@import url("https://fonts.googleapis.com/css2?family=Catamaran:wght@400;500;600;700;800&display=swap");

:root {
  --navy: #0e1422;
  --navy-soft: #182033;
  --orange: #ef7d23;
  --orange-dark: #c95f10;
  --paper: #f4f5f7;
  --white: #ffffff;
  --ink: #172033;
  --muted: #697184;
  --line: #dce0e7;
  --good: #19764a;
  --bad: #b33a3a;
  --warning: #9a5b0b;
  --radius: 6px;
  --shadow: 0 20px 55px rgba(14, 20, 34, 0.12);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Catamaran", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
}

a { color: inherit; }

button, input, textarea, select { font: inherit; }

button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  background: rgba(14, 20, 34, 0.97);
  color: var(--white);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-wrap {
  width: min(1180px, calc(100% - 40px));
  min-height: 74px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.11em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--orange);
  display: grid;
  place-items: center;
  transform: rotate(45deg);
}

.brand-mark::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--orange);
}

.nav-links { display: flex; align-items: center; gap: 26px; }

.nav-links a {
  color: #e8ebf1;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
}

.nav-links a:hover, .nav-links a[aria-current="page"] { color: var(--orange); }

.menu-toggle {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  background: transparent;
  padding: 8px 12px;
  border-radius: var(--radius);
}

.hero {
  color: white;
  background: var(--navy);
  min-height: 440px;
  display: grid;
  align-items: center;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  width: 530px;
  height: 530px;
  right: -120px;
  top: -210px;
  border: 1px solid rgba(239, 125, 35, 0.32);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(239, 125, 35, 0.035), 0 0 0 140px rgba(239, 125, 35, 0.02);
}

.hero-inner {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 40px));
  margin: auto;
  padding: 76px 0 92px;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 80px;
  align-items: end;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--orange);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
  max-width: 780px;
  margin-bottom: 22px;
  font-size: clamp(46px, 6vw, 76px);
  line-height: 0.98;
  letter-spacing: -0.035em;
}

.hero-copy {
  max-width: 690px;
  color: #bdc4d1;
  font-size: 20px;
}

.hero-facts {
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  padding-left: 28px;
}

.hero-facts div { padding: 13px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
.hero-facts strong { display: block; color: white; font-size: 24px; }
.hero-facts span { color: #9ea7b7; font-size: 14px; }

.page-shell {
  width: min(1180px, calc(100% - 40px));
  margin: -42px auto 0;
  position: relative;
  z-index: 2;
  padding-bottom: 100px;
}

.tool-panel {
  background: var(--white);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.panel-head {
  padding: 30px 34px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 { margin-bottom: 4px; font-size: 29px; }
.panel-head p { margin-bottom: 0; color: var(--muted); }

.panel-body { padding: 34px; }

.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.button {
  min-height: 46px;
  padding: 11px 20px;
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  color: white;
  background: var(--navy);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease;
}

.button:hover { transform: translateY(-1px); background: var(--navy-soft); }
.button.primary { border-color: var(--orange); background: var(--orange); }
.button.primary:hover { background: var(--orange-dark); }
.button.secondary { color: var(--ink); background: white; border-color: var(--line); }
.button:disabled { opacity: 0.55; cursor: wait; transform: none; }

.field label, .field-label {
  display: block;
  margin-bottom: 7px;
  color: #343c4d;
  font-size: 14px;
  font-weight: 800;
}

input, textarea, select {
  width: 100%;
  border: 1px solid #cbd1db;
  border-radius: var(--radius);
  background: white;
  color: var(--ink);
  padding: 11px 13px;
  outline: none;
}

input:focus, textarea:focus, select:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(239, 125, 35, 0.14);
}

textarea { min-height: 86px; resize: vertical; }

.help { margin: 7px 0 0; color: var(--muted); font-size: 13px; }

.molecule-list { display: grid; gap: 12px; margin-bottom: 18px; }

.molecule-row {
  display: grid;
  grid-template-columns: 42px minmax(130px, 0.34fr) minmax(300px, 1fr) 42px;
  gap: 10px;
  align-items: end;
}

.row-number {
  height: 46px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
}

.icon-button {
  width: 42px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  background: white;
  cursor: pointer;
  font-size: 20px;
}

.icon-button:hover { color: var(--bad); border-color: #e2baba; }

.form-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 18px; }
.span-12 { grid-column: span 12; }
.span-8 { grid-column: span 8; }
.span-6 { grid-column: span 6; }
.span-4 { grid-column: span 4; }
.span-3 { grid-column: span 3; }

.advanced {
  grid-column: span 12;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.advanced summary { cursor: pointer; font-weight: 800; }
.advanced .form-grid { margin-top: 18px; }

.status {
  margin-top: 22px;
  padding: 16px 18px;
  border-left: 4px solid var(--orange);
  background: #fff8f2;
}

.status[hidden], .results[hidden], .viewer-area[hidden] { display: none; }
.status.error { border-color: var(--bad); color: var(--bad); background: #fff5f5; }
.status.success { border-color: var(--good); color: var(--good); background: #f2faf5; }

.results { margin-top: 36px; }
.results h2 { font-size: 30px; margin-bottom: 14px; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); background: white; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #f7f8fa; color: #555f70; font-size: 13px; letter-spacing: 0.04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.rank { font-weight: 800; color: var(--orange-dark); }
.score strong { display: block; font-size: 19px; }
.meter { width: 110px; height: 4px; background: #e6e8ed; margin-top: 7px; }
.meter span { display: block; height: 100%; background: var(--orange); }
.smiles-cell { max-width: 360px; overflow-wrap: anywhere; color: #495164; font-family: Consolas, monospace; font-size: 13px; }
.invalid { color: var(--bad); }

.notice {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  border-top: 1px solid var(--line);
  padding-top: 16px;
}

.viewer-layout {
  margin-top: 34px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 22px;
}

.viewer-frame {
  height: 570px;
  position: relative;
  overflow: hidden;
  background: #080d16;
  border: 1px solid #273044;
}

#docking-viewer { width: 100%; height: 100%; position: relative; }

.viewer-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 40px;
  color: #9ea7b7;
  text-align: center;
}

.viewer-placeholder[hidden] { display: none; }

.result-aside { background: white; border: 1px solid var(--line); padding: 22px; }
.result-aside h3 { font-size: 20px; margin-bottom: 14px; }
.metric { padding: 14px 0; border-bottom: 1px solid var(--line); }
.metric span { display: block; color: var(--muted); font-size: 13px; }
.metric strong { display: block; font-size: 23px; }
.result-aside .action-row { margin-top: 20px; }
.result-aside .button { width: 100%; }

.pose-table { margin-top: 22px; }

.pymol-output {
  margin-top: 22px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  background: var(--white);
  border: 1px solid var(--line);
}

.pymol-output[hidden] { display: none; }
.pymol-output figure { margin: 0; min-height: 360px; background: #eef0f3; }
.pymol-output img { display: block; width: 100%; height: 100%; object-fit: cover; }
.pymol-output > div { padding: 32px; align-self: center; }
.pymol-output h3 { font-size: 27px; line-height: 1.1; }
.pymol-output p { color: var(--muted); }

.method {
  margin-top: 60px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  gap: 70px;
  align-items: start;
}

.method h2 { font-size: 38px; line-height: 1.08; }
.method p { color: var(--muted); }
.method ol { margin: 0; padding: 0; list-style: none; counter-reset: steps; }
.method li { counter-increment: steps; padding: 18px 0 18px 56px; border-top: 1px solid var(--line); position: relative; }
.method li::before { content: "0" counter(steps); position: absolute; left: 0; color: var(--orange-dark); font-weight: 800; }

.site-footer { background: var(--navy); color: #aeb6c5; padding: 42px 0; }
.footer-inner { width: min(1180px, calc(100% - 40px)); margin: auto; display: flex; justify-content: space-between; gap: 30px; }
.site-footer a { color: white; }

@media (max-width: 900px) {
  .menu-toggle { display: block; }
  .nav-links { display: none; position: absolute; inset: 74px 0 auto; padding: 20px; background: var(--navy); flex-direction: column; align-items: flex-start; }
  .nav-links.open { display: flex; }
  .hero-inner, .method, .viewer-layout, .pymol-output { grid-template-columns: 1fr; gap: 34px; }
  .hero-facts { border-left: 0; border-top: 1px solid rgba(255,255,255,.18); padding: 16px 0 0; display: grid; grid-template-columns: repeat(3, 1fr); }
  .hero-facts div { border-bottom: 0; }
  .viewer-frame { height: 480px; }
}

@media (max-width: 680px) {
  body { font-size: 16px; }
  .nav-wrap, .hero-inner, .page-shell, .footer-inner { width: min(100% - 28px, 1180px); }
  .hero { min-height: 0; }
  .hero-inner { padding: 56px 0 78px; }
  h1 { font-size: 44px; }
  .hero-facts { grid-template-columns: 1fr; }
  .panel-head, .panel-body { padding: 24px 18px; }
  .panel-head { align-items: flex-start; flex-direction: column; }
  .molecule-row { grid-template-columns: 32px 1fr 42px; }
  .molecule-row .smiles-field { grid-column: 2 / 4; }
  .form-grid { gap: 14px; }
  .span-8, .span-6, .span-4, .span-3 { grid-column: span 12; }
  .viewer-frame { height: 400px; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; }
}
