/*
 * BasedBioHacker, prototype five
 *
 * The accepted Compress opening returns. Prototype four's decision engine stays
 * intact beneath it. White space and type carry hierarchy; cobalt marks state.
 */

:root {
  --header-height: 116px;
  --conversion: #eaf0fd;
  --conversion-deep: #dfe8fb;
  --surface-raised: #ffffff;
  --surface-inverse: #111316;
  --ink-inverse: #ffffff;
}

html[data-theme='dark'] {
  --paper: #111316;
  --canvas: #171a1e;
  --canvas-cool: #181d27;
  --ink: #f4f5f6;
  --body: #c8cbd0;
  --quiet: #a2a7af;
  --muted: #858c96;
  --rule: #30353d;
  --rule-soft: #252a31;
  --rule-strong: #59616c;
  --panel: #1a1d22;
  --powder: #1a2744;
  --powder-soft: #182035;
  --blue: #7fa2ff;
  --blue-dark: #9bb6ff;
  --conversion: #17213a;
  --conversion-deep: #1d2a48;
  --surface-raised: #171a1e;
  --surface-inverse: #f4f5f6;
  --ink-inverse: #111316;
  --navigator-canvas: #15181c;
  --navigator-panel: #1b1e23;
  --navigator-hover: #20242b;
  --navigator-soft-blue: #1a2744;
  color-scheme: dark;
}

body,
.site-header,
.site-nav,
dialog.modal {
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

/* Header: a taller, explicit product index with a quiet research boundary. */

.site-header {
  display: block;
  min-height: var(--header-height);
  padding: 0;
  background: color-mix(in srgb, var(--paper) 95%, transparent);
}

.site-header__row {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 84px;
  padding-inline: var(--pad);
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
}

.wordmark {
  font-size: 0.92rem;
}

.wordmark::before {
  width: 34px;
  height: 34px;
}

.site-nav__link {
  padding-block: 31px 28px;
  font-size: 0.78rem;
}

.theme-toggle {
  display: inline-flex;
  min-width: 68px;
  min-height: 40px;
  padding: 0;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  background: transparent;
  color: var(--ink);
  border: 0;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.theme-toggle i {
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid currentColor;
  border-radius: 50%;
  box-shadow: inset -6px 0 0 currentColor;
}

html[data-theme='dark'] .theme-toggle i {
  box-shadow: inset 6px 0 0 currentColor;
}

.site-disclaimer {
  display: flex;
  min-height: 31px;
  padding: 6px var(--pad);
  justify-content: center;
  gap: 18px;
  align-items: center;
  background: var(--surface-inverse);
  color: var(--ink-inverse);
  font-size: 0.68rem;
  letter-spacing: 0.01em;
}

.site-disclaimer p { color: inherit; }
.site-disclaimer a { font-weight: 700; }

/* Compress-style opening: one centered promise, one question field. */

.home-hero {
  min-height: min(800px, calc(100dvh - var(--header-height)));
  background: var(--paper);
  border-bottom: 1px solid var(--rule-soft);
}

.home-hero::before {
  z-index: -1;
  background: linear-gradient(90deg, color-mix(in srgb, var(--paper) 78%, transparent), color-mix(in srgb, var(--paper) 30%, transparent), color-mix(in srgb, var(--paper) 78%, transparent));
}

.home-hero::after { display: none; }

.home-hero__art {
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.8;
  filter: none;
}

html[data-theme='dark'] .home-hero__art {
  opacity: 0.42;
  filter: invert(0.9) hue-rotate(180deg);
}

.home-hero__content {
  align-items: center;
  padding-block: clamp(92px, 13vw, 158px);
  text-align: center;
}

.home-hero__kicker { color: var(--blue); }

.home-hero h1 {
  max-width: 15ch;
  color: var(--ink);
  font-size: clamp(3.8rem, 6.7vw, 6.55rem);
  line-height: 0.88;
}

.home-hero__content > p {
  max-width: 43rem;
  margin: 28px auto 34px;
  color: var(--quiet);
}

.home-hero .ai-composer {
  width: min(100%, 760px);
  padding: 5px;
  background: var(--surface-inverse);
  border-color: var(--surface-inverse);
  box-shadow: 0 18px 46px rgba(15, 18, 23, 0.12);
}

.home-hero .ai-composer input {
  color: var(--ink-inverse);
}

.home-hero .ai-composer input::placeholder {
  color: color-mix(in srgb, var(--ink-inverse) 72%, transparent);
}

.home-hero .ai-composer button {
  min-width: 145px;
  background: transparent;
  color: var(--ink-inverse);
  border-left: 1px solid color-mix(in srgb, var(--ink-inverse) 35%, transparent);
}

.home-hero__proof {
  display: flex;
  margin-top: 24px;
  gap: 24px;
  color: color-mix(in srgb, var(--quiet) 80%, transparent);
  font-size: 0.68rem;
  font-weight: 600;
}

.home-hero__proof span + span::before {
  margin-right: 24px;
  color: var(--blue);
  content: "·";
}

/* Top five and one persistent region choice. */

.ranking-section { background: var(--paper); }

.ranking-heading {
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 56px !important;
}

.ranking-heading > div .section-kicker {
  margin-bottom: 18px;
}

.ranking-heading > div > p {
  max-width: 42rem;
  margin-top: 22px;
}

.region-picker {
  display: flex;
  margin: 0;
  padding: 0;
  gap: 0;
  align-items: center;
  border: 0;
}

.region-picker legend {
  float: left;
  margin-right: 16px;
  color: var(--quiet);
  font-size: 0.7rem;
  font-weight: 700;
}

.region-picker label { position: relative; }
.region-picker input { position: absolute; opacity: 0; pointer-events: none; }

.region-picker span {
  display: grid;
  min-width: 52px;
  min-height: 40px;
  place-items: center;
  color: var(--quiet);
  border: 1px solid var(--rule);
  border-right: 0;
  font-size: 0.7rem;
  font-weight: 700;
}

.region-picker label:last-child span { border-right: 1px solid var(--rule); }
.region-picker input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.region-picker input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 3px; }

#directory .region-picker { margin-top: 28px; }

/* The peptide finder begins with a decision, never an empty results panel. */

.directory-start {
  min-width: 0;
  padding: clamp(42px, 5vw, 68px);
  background: var(--paper);
  border: 1px solid var(--rule);
}

.directory-start h3 {
  max-width: 9ch;
  margin-top: 18px;
  font-size: clamp(2.4rem, 4.2vw, 4.4rem);
  line-height: 0.94;
  letter-spacing: -0.055em;
}

.directory-start > p {
  max-width: 34rem;
  margin-top: 22px;
  color: var(--quiet);
}

.directory-start__paths {
  display: grid;
  margin-top: clamp(38px, 5vw, 66px);
  border-top: 1px solid var(--rule-strong);
}

.directory-start__paths > * {
  display: grid;
  width: 100%;
  min-height: 104px;
  padding: 22px 0;
  grid-template-columns: 38px minmax(0, 0.62fr) minmax(180px, 1fr) 20px;
  gap: 16px;
  align-items: center;
  background: transparent;
  color: var(--ink);
  border: 0;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}

.directory-start__paths span {
  color: var(--blue);
  font-size: 0.68rem;
  font-weight: 700;
}

.directory-start__paths strong {
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.directory-start__paths small {
  color: var(--quiet);
  font-size: 0.78rem;
  line-height: 1.45;
}

.directory-start__paths i {
  color: var(--blue);
  font-style: normal;
  text-align: right;
}

.ranking-layout {
  box-shadow: none;
}

.ranking-feature__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.ranking-boundary {
  margin-top: 18px;
  color: var(--muted);
  font-size: 0.7rem;
}

/* First email capture: one powder-blue conversion zone, not another card. */

.newsletter-band {
  padding-block: clamp(76px, 9vw, 118px);
  background: var(--conversion);
  border-block: 1px solid var(--rule-soft);
}

.newsletter-band__inner {
  display: grid;
  width: min(100%, 1060px);
  margin-inline: auto;
  grid-template-columns: minmax(0, 0.92fr) minmax(380px, 1.08fr);
  gap: clamp(54px, 7vw, 88px);
  align-items: center;
}

.newsletter-band h2 { max-width: 16ch; }
.newsletter-band__inner > div > p { max-width: 40rem; margin-top: 24px; }

.newsletter-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 700;
}

.newsletter-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.newsletter-form input { min-height: 50px; background: var(--paper); }
.newsletter-form small { display: block; margin-top: 10px; color: var(--muted); font-size: 0.65rem; }
.newsletter-success { margin-top: 18px; color: var(--ink); font-weight: 700; }

/* Guided quiz: the database stays behind a plain-language first choice. */

.quiz-intro { background: var(--paper); }

.navigator-stage-list { grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); }

.quiz-intro__layout {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(460px, 1.1fr);
  gap: clamp(72px, 11vw, 148px);
  align-items: start;
}

.quiz-intro h2 { max-width: 11ch; }
.quiz-intro__layout > div:first-child > p { max-width: 38rem; margin: 28px 0 34px; }

.quiz-goal-preview {
  border-top: 1px solid var(--rule-strong);
}

.quiz-goal-preview > span {
  display: block;
  padding: 0 0 18px;
  color: var(--blue);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.quiz-goal-preview a {
  display: flex;
  min-height: 72px;
  padding: 18px 0;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  font-size: clamp(1.02rem, 1.6vw, 1.34rem);
  font-weight: 700;
  text-decoration: none;
}

.quiz-goal-preview i { color: var(--blue); font-style: normal; }

/* Curated compounds and peptide functionality teaser. */

.compound-intro { background: var(--canvas); }

.compound-intro__heading {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 72px;
  align-items: end;
}

.compound-intro__heading > p { margin: 0; }

.compound-name-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule-strong);
  border-left: 1px solid var(--rule);
}

.compound-name-grid article {
  display: flex;
  min-height: 205px;
  padding: 28px;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.compound-name-grid article > span { color: var(--blue); font-size: 0.68rem; font-weight: 700; }
.compound-name-grid h3 { margin-top: 18px; font-size: 1.65rem; }

.compound-name-grid article > div {
  display: flex;
  margin-top: auto;
  padding-top: 30px;
  gap: 18px;
  align-items: center;
}

.compound-name-grid a,
.compound-name-grid button {
  padding: 0;
  background: transparent;
  color: var(--ink);
  border: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.peptide-intro { background: var(--paper); }

.peptide-intro__layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(0, 0.92fr);
  gap: clamp(64px, 10vw, 132px);
  align-items: center;
}

.peptide-intro__visual { margin: 0; }
.peptide-intro__visual img { width: 100%; border: 1px solid var(--rule); }
.peptide-intro__visual figcaption { margin-top: 12px; color: var(--muted); font-size: 0.68rem; }
.peptide-intro h2 { max-width: 12ch; }
.peptide-intro__layout > div > p { margin: 26px 0 34px; }

.peptide-intro ul {
  margin: 0 0 34px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule-strong);
}

.peptide-intro li {
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 22px;
  padding: 15px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.8rem;
}

.depth-section { background: var(--canvas); }
.depth-section .section-heading h2 { max-width: 18ch; }

.depth-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule-strong);
}

.depth-grid article {
  display: flex;
  min-height: 330px;
  padding: 30px 32px 0 0;
  flex-direction: column;
  border-right: 1px solid var(--rule);
}

.depth-grid article + article { padding-left: 32px; }
.depth-grid article:last-child { border-right: 0; }
.depth-grid article > span { color: var(--blue); font-size: 0.7rem; font-weight: 700; }
.depth-grid h3 { margin-top: 36px; }
.depth-grid p { margin-top: 20px; color: var(--quiet); }
.depth-grid a { margin-top: auto; color: var(--ink); font-size: 0.78rem; font-weight: 700; }

.ai-return { background: var(--surface-inverse); }
.ai-return__inner { display: grid; grid-template-columns: minmax(0, 1fr) minmax(440px, 0.9fr); gap: 70px; align-items: end; }
.ai-return h2 { max-width: 12ch; color: var(--ink-inverse); }
.ai-return .section-kicker { color: #9bb6ff; }
.ai-composer--light { background: var(--paper); border-color: var(--paper); box-shadow: none; }

/* New standalone content surfaces. */

.compounds-page #directory > .page-shell:first-child,
.research-map-page [aria-labelledby='research-map-visual-title'] > .page-shell,
.research-map-page [aria-labelledby='research-map-records-title'] > .page-shell {
  max-width: var(--max);
}

.compounds-page #directory > .page-shell:first-child > p,
.research-map-page [aria-labelledby='research-map-records-title'] > .page-shell > p {
  max-width: 50rem;
  margin-top: 18px;
}

.compounds-page #directory > ol,
.research-map-page [aria-labelledby='research-map-records-title'] ol {
  margin-top: 64px;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule-strong);
}

.compounds-page #directory > ol > li > article,
.research-map-page [aria-labelledby='research-map-records-title'] ol > li > article {
  display: grid;
  grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1.1fr) minmax(320px, 1.2fr) minmax(170px, 0.6fr);
  gap: 36px;
  align-items: start;
  padding: 34px 0;
  border-bottom: 1px solid var(--rule);
}

.compounds-page #directory article h2,
.research-map-page [aria-labelledby='research-map-records-title'] article h2 { font-size: clamp(1.65rem, 2.4vw, 2.35rem); }

.compounds-page #directory article > p,
.research-map-page [aria-labelledby='research-map-records-title'] article > p { color: var(--quiet); font-size: 0.88rem; }

.compounds-page #directory article dl,
.research-map-page [aria-labelledby='research-map-records-title'] article dl { margin: 0; }

.compounds-page #directory article dl div,
.research-map-page [aria-labelledby='research-map-records-title'] article dl div { display: grid; grid-template-columns: 110px 1fr; padding: 6px 0; border-bottom: 1px solid var(--rule-soft); }

.compounds-page #directory article dt,
.research-map-page [aria-labelledby='research-map-records-title'] article dt { color: var(--muted); font-size: 0.64rem; font-weight: 700; text-transform: uppercase; }

.compounds-page #directory article dd,
.research-map-page [aria-labelledby='research-map-records-title'] article dd { color: var(--body); font-size: 0.75rem; }

.research-map-page [aria-labelledby='research-map-visual-title'] figure { margin: 48px 0 24px; border: 1px solid var(--rule); }
.research-map-page [aria-labelledby='research-map-visual-title'] figure figcaption { padding: 12px 16px; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.68rem; }
.research-map-page [aria-labelledby='research-map-visual-title'] nav ol { display: grid; grid-template-columns: repeat(3, 1fr); margin: 42px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--rule-strong); }
.research-map-page [aria-labelledby='research-map-visual-title'] nav a { display: flex; min-height: 76px; padding: 16px; justify-content: space-between; gap: 16px; border-right: 1px solid var(--rule); border-bottom: 1px solid var(--rule); text-decoration: none; }
.research-map-page [aria-labelledby='research-map-visual-title'] nav small { color: var(--muted); }

/* Dialog hierarchy and honest prototype states. */

.acknowledgment-dialog { max-width: min(650px, calc(100vw - 32px)) !important; }
.acknowledgment-dialog h2 { max-width: 14ch; }
.acknowledgment-dialog > p { margin-top: 22px; }
.acknowledgment-dialog__detail { margin: 28px 0; padding: 18px 0; border-block: 1px solid var(--rule); }
.acknowledgment-dialog__detail span { color: var(--blue); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; }
.acknowledgment-dialog__detail p { margin-top: 8px; color: var(--quiet); font-size: 0.78rem; }

.newsletter-dialog h2 { max-width: 13ch; }
.newsletter-dialog > p { margin-top: 22px; }
.newsletter-form--dialog { margin-top: 30px; }

html[data-theme='dark'] .compound-illustration,
html[data-theme='dark'] .peptide-intro__visual img,
html[data-theme='dark'] .research-map-page figure img {
  filter: invert(0.9) hue-rotate(180deg);
}

html[data-theme='dark'] .guided-path-section,
html[data-theme='dark'] .navigator-workspace,
html[data-theme='dark'] .directory-shell,
html[data-theme='dark'] .tool-hero,
html[data-theme='dark'] .page-hero {
  background: var(--canvas);
}

@media (hover: hover) and (pointer: fine) {
  .quiz-goal-preview a:hover,
  .compound-name-grid a:hover,
  .compound-name-grid button:hover,
  .depth-grid a:hover { color: var(--blue); }
  .region-picker label:hover span { background: var(--powder-soft); }
  .region-picker input:checked + span:hover { background: var(--ink); }
  .directory-start__paths > *:hover strong { text-decoration: underline; text-underline-offset: 4px; }
}

/*
 * Navigation owns its breakpoint here. Earlier prototype sheets used different
 * cutoffs, so every layout-affecting property is resolved in the final layer.
 */

@media (min-width: 821px) {
  .site-nav {
    position: static;
    display: flex;
    width: auto;
    padding: 0;
    flex-direction: row;
    justify-content: center;
    gap: clamp(22px, 3vw, 42px);
    background: transparent;
    border: 0;
  }

  .nav-toggle { display: none; }
}

@media (max-width: 980px) {
  .newsletter-band__inner,
  .quiz-intro__layout,
  .peptide-intro__layout,
  .ai-return__inner { grid-template-columns: 1fr; gap: 48px; }

  .compound-name-grid { grid-template-columns: repeat(2, 1fr); }
  .depth-grid { grid-template-columns: 1fr; }
  .depth-grid article,
  .depth-grid article + article { min-height: 230px; padding: 28px 0; border-right: 0; border-bottom: 1px solid var(--rule); }

  .compounds-page #directory > ol > li > article,
  .research-map-page [aria-labelledby='research-map-records-title'] ol > li > article { grid-template-columns: 0.75fr 1.25fr; }
}

@media (max-width: 820px) {
  :root { --header-height: 104px; }

  .site-header__row {
    min-height: 72px;
    grid-template-columns: auto 1fr auto auto;
    gap: 8px;
  }

  .wordmark::before { display: grid; width: 30px; height: 30px; }
  .wordmark > span:last-child { display: inline; }

  .theme-toggle {
    grid-column: 3;
    grid-row: 1;
    min-width: 38px;
    justify-content: center;
  }

  .theme-toggle span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

  .nav-toggle {
    display: inline-flex;
    grid-column: 4;
    grid-row: 1;
    min-height: 40px;
    align-items: center;
    justify-content: center;
  }

  .site-nav {
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    z-index: 2;
    display: none;
    width: auto;
    padding: 10px var(--pad) 20px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0;
    background: var(--paper);
    border-bottom: 1px solid var(--rule-strong);
  }

  .site-nav[data-open='true'] { display: flex; }

  .site-nav__link {
    padding: 16px 0;
    border-bottom: 1px solid var(--rule-soft);
  }

  .site-disclaimer { min-height: 32px; justify-content: flex-start; }
  .site-disclaimer a { margin-left: auto; white-space: nowrap; }

  .home-hero { min-height: min(720px, calc(100dvh - var(--header-height))); }
  .home-hero__art { right: auto; width: 100%; opacity: 0.64; }
  .home-hero h1 { max-width: 14ch; font-size: clamp(3.35rem, 11.2vw, 5.4rem); }

  .ranking-heading,
  .compound-intro__heading { grid-template-columns: 1fr !important; gap: 32px !important; }

  .region-picker { justify-self: start; }

  .research-map-page [aria-labelledby='research-map-visual-title'] nav ol { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  :root { --pad: 20px; --section: clamp(64px, 16vw, 88px); }

  .site-disclaimer { font-size: 0.66rem; gap: 8px; }

  .home-hero__content { padding-block: 76px 86px; }
  .home-hero h1 { max-width: 13.5ch; font-size: clamp(2.85rem, 12.2vw, 3.95rem); }
  .home-hero__content > p { margin-block: 22px 28px; }
  .home-hero .ai-composer button { border-top: 1px solid color-mix(in srgb, var(--ink-inverse) 35%, transparent); border-left: 0; }
  .home-hero__proof { display: grid; gap: 6px; }
  .home-hero__proof span + span::before { margin-right: 8px; }

  .region-picker { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; }
  .region-picker legend { grid-column: 1 / -1; margin: 0 0 10px; }
  .region-picker span { min-width: 0; }
  .directory-start { padding: 32px 24px; }
  .directory-start__paths > * {
    grid-template-columns: 30px minmax(0, 1fr) 18px;
    gap: 10px;
  }
  .directory-start__paths small { grid-column: 2; }
  .directory-start__paths i { grid-column: 3; grid-row: 1 / span 2; }

  .ranking-feature__actions,
  .newsletter-form > div { grid-template-columns: 1fr; width: 100%; }
  .ranking-feature__actions { display: grid; }

  .newsletter-band__inner { gap: 36px; }
  .newsletter-band h2 { font-size: clamp(2.4rem, 12vw, 3.45rem); }

  .compound-name-grid { grid-template-columns: 1fr; }
  .compound-name-grid article { min-height: 150px; padding: 22px; }

  .peptide-intro__layout { grid-template-columns: minmax(0, 1fr); }
  .peptide-intro li { grid-template-columns: 1fr; gap: 4px; }

  .compounds-page #directory > ol > li > article,
  .research-map-page [aria-labelledby='research-map-records-title'] ol > li > article { grid-template-columns: 1fr; gap: 22px; }

  .research-map-page [aria-labelledby='research-map-visual-title'] nav ol { grid-template-columns: 1fr; }

  .newsletter-form--dialog > div { grid-template-columns: 1fr; }
}

@media (max-width: 350px) {
  .wordmark > span:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body,
  .site-header,
  .site-nav,
  dialog.modal { transition: none; }
}
