/* Elpis Biosciences — content page design system
 *
 * Loaded only by generated content pages (see build.mjs + templates/).
 * base.css keeps the shell (nav, footer) and the interactive app pages.
 *
 * Three typographic voices, applied by meaning rather than by position:
 *   serif  — human register: prose, story, argument
 *   mono   — measured register: counts, identifiers, coverage, labels
 *   sans   — interface register: buttons, nav, form controls
 *
 * Colour is inherited from tokens.css and never introduced here. --terra is
 * reserved for risk and exclusion per CLAUDE.md §8.3; it is never decorative.
 */

:root {
  --rail-w:   168px;
  --gutter:   40px;
  --page-max: 1220px;
}

/* ═══ Grid ═════════════════════════════════════════════════════════════════
   Two columns throughout: a label column the trace runs through, and the
   content column. No rules between bands — the trace carries the structure,
   and rhythm comes from varied spacing rather than from hairlines. */

#main { position: relative; }

.section,
.hero {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  column-gap: var(--gutter);
  padding: 54px max(var(--pad), calc((100% - var(--page-max)) / 2));
}

/* Uneven vertical rhythm. Bands that carry an argument get more room than
   bands that carry a list. */
.section + .section { padding-top: 46px; }
.section:has(.cards),
.section:has(.steps) { padding-top: 68px; padding-bottom: 68px; }
.section:has(.cta) { padding-top: 30px; padding-bottom: 88px; }

.hero {
  padding-top: 78px;
  padding-bottom: 34px;
}

.rail {
  align-self: start;
  /* Clears the trace: spine sits at x≈16–25, the branch node ends at ≈61. */
  padding-left: 78px;
  padding-top: 1px;
  min-height: 1px;
}

.rail-index,
.rail-meta {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.7;
}
.rail-index { color: var(--teal); }
.rail-meta  { color: var(--muted); margin-top: 10px; }

/* ═══ Type ═════════════════════════════════════════════════════════════════ */

.eyebrow {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 26px;
}

.display {
  font-family: var(--serif);
  font-size: clamp(2.3rem, 5.2vw, 3.05rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.035em;
  color: var(--ink);
  margin-bottom: 24px;
  text-wrap: balance;
}
.display em {
  font-style: italic;
  font-weight: 400;
  color: var(--forest);
}

.lede {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--muted);
  max-width: 30em;
  margin-bottom: 34px;
}

.section-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 14px;
  text-wrap: balance;
}
.section-lede {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.78rem;
  line-height: 1.75;
  color: var(--muted);
  max-width: 34em;
  margin-bottom: 34px;
}

/* Prose is capped near 70 characters. The content column is wider than that
   on desktop; the rail, not the paragraph, is what fills the space. */
.section-body .prose-p,
.section-body .pullquote { max-width: 34em; }

.section-body > .prose-p:last-child,
.section-body > .section-lede:last-child { margin-bottom: 0; }

.prose-h3 {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--ink);
  margin: 32px 0 8px;
}
.prose-list {
  margin: 0 0 18px 1.1em;
  font-family: var(--serif);
  font-size: 0.9rem;
  line-height: 1.85;
  color: var(--muted);
}
.prose-list li { margin-bottom: 6px; }
.prose-hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 36px 0;
}
.prose .prose-h2:first-child { margin-top: 0; }
.prose code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--teal);
}

/* ═══ Links and buttons ════════════════════════════════════════════════════ */

.link {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--forest);
  border-bottom: 1px solid var(--forest);
  padding-bottom: 2px;
  margin-top: 8px;
}
.link:hover { color: var(--teal-mid); border-color: var(--teal-mid); }

.prose-p a,
.card-text a,
.row-body a {
  color: var(--forest);
  border-bottom: 1px solid rgba(13,74,58,0.35);
}
.prose-p a:hover,
.card-text a:hover,
.row-body a:hover { border-bottom-color: var(--forest); }

.actions { display: flex; gap: 12px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--forest);
  color: var(--bg);
  border: 1.5px solid var(--forest);
  border-radius: 4px;
  padding: 13px 26px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--teal); border-color: var(--teal); }

.btn-quiet {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  font-weight: 400;
}
.btn-quiet:hover { background: transparent; color: var(--forest); border-color: var(--forest); }

.btn-invert {
  background: var(--bg);
  color: var(--forest);
  border-color: var(--bg);
}
.btn-invert:hover { background: var(--warm); border-color: var(--warm); color: var(--forest); }

/* ═══ Measures ═════════════════════════════════════════════════════════════
   Counts render in mono at display size. These are instrument readings, not
   marketing numbers, and the typeface should say so. */

.measure-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 32px 24px;
}
.measure { padding-left: 14px; border-left: 2px solid var(--teal-mid); }
.measure-value {
  font-family: var(--mono);
  font-size: 1.75rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.measure-label {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.6;
}

/* ═══ Cards ════════════════════════════════════════════════════════════════ */

.cards { display: grid; gap: 14px; }
.cards.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cards.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cards.cols-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 24px 22px 26px;
  display: block;
  text-decoration: none;
  position: relative;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(.2,.7,.3,1), box-shadow 0.22s, border-color 0.22s;
}
a.card:hover {
  transform: translateY(-3px);
  border-color: var(--border);
  box-shadow: 0 10px 26px rgba(44,34,24,0.07);
}

.card-kicker {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 14px;
}
.card-title {
  font-family: var(--serif);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 9px;
  line-height: 1.25;
}
.card-text {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.68rem;
  line-height: 1.75;
  color: var(--muted);
}
.card-meta {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 16px;
  line-height: 1.7;
}

/* Module tones. A hairline at the card's top edge, not a filled block. */
.card[data-tone]::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--tone, var(--forest));
}
.card[data-tone="cycle"]   { --tone: var(--cycle); }
.card[data-tone="vitalis"] { --tone: var(--vitalis); }
.card[data-tone="age"]     { --tone: var(--age); }
.card[data-tone="athlete"] { --tone: var(--athlete); }
.card[data-tone="risk"]    { --tone: var(--terra); }
.card[data-tone="teal"]    { --tone: var(--teal); }
.card[data-tone="gold"]    { --tone: var(--gold); }
/* One tone signal per card. The hairline carries it; the kicker stays teal so
   it holds contrast at label size regardless of which module it belongs to. */

/* ═══ Rows ═════════════════════════════════════════════════════════════════ */

.rows { display: grid; gap: 10px; }
.row {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 28px;
  padding: 20px 24px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
}
.row-title {
  font-family: var(--serif);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}
.row-tags {
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  color: var(--teal);
  margin-top: 8px;
  line-height: 1.7;
}
/* --terra reaches AA only at the title's larger size; the tag line under it
   stays muted rather than tinting small text below the contrast floor. */
.row[data-tone="risk"] .row-title { color: var(--terra); }
.row[data-tone="risk"] .row-tags  { color: var(--muted); }
.row-body {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.75rem;
  line-height: 1.8;
  color: var(--muted);
  max-width: 40em;
}

/* ═══ Steps ════════════════════════════════════════════════════════════════
   Numbered because the engagement genuinely runs in this order. Numbering is
   not used anywhere the content is merely a list. */

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  list-style: none;
}
.step {
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 20px 20px 22px;
}
.step-num {
  font-family: var(--mono);
  font-size: 0.62rem;
  color: var(--forest);
  letter-spacing: 0.1em;
  margin-bottom: 12px;
  font-variant-numeric: tabular-nums;
}
.step-title {
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 7px;
}
.step-text {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.68rem;
  line-height: 1.75;
  color: var(--muted);
}

/* ═══ CTA ══════════════════════════════════════════════════════════════════ */

.cta {
  background: var(--forest);
  border-radius: 6px;
  padding: 40px 42px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 36px;
  flex-wrap: wrap;
}
.cta-title {
  font-family: var(--serif);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #E8DDD0;
  margin-bottom: 10px;
}
.cta-text {
  font-family: var(--sans);
  font-weight: 300;
  font-size: 0.75rem;
  line-height: 1.75;
  color: rgba(232,221,208,0.72);
  max-width: 40em;
}

/* ═══ Signature: the file, resolving ═══════════════════════════════════════
   Raw genotype lines that read out into plain language. The tagline is
   "Your data. Seen clearly." — this is that sentence, performed. */

.hero-figure {
  grid-column: 2;
  margin-top: 44px;
  max-width: 620px;
}

.filestrip {
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  overflow: hidden;
}
.filestrip-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.filestrip-status { color: var(--teal); }

.fileline {
  display: grid;
  grid-template-columns: 1fr;
  padding: 7px 18px;
  font-family: var(--mono);
  font-size: 0.58rem;
  line-height: 1.5;
  border-bottom: 1px solid rgba(221,213,196,0.5);
  white-space: nowrap;
  overflow: hidden;
}
.fileline:last-child { border-bottom: none; }

.fileline > span { grid-area: 1 / 1; transition: opacity 0.45s ease; }
/* Unresolved lines stay on the page permanently, so they hold AA contrast
   rather than sitting at --faint. The read/unread distinction is muted vs ink. */
.fileline .raw  { color: var(--muted); }
.fileline .read { color: var(--ink); opacity: 0; }
/* The full result colour mapping (CLAUDE.md §8.3) lives in the report, where
   type is large enough to carry it. At this size only --sage clears AA, so the
   figure distinguishes findings by weight rather than tinting below the floor. */
.fileline .read b { font-weight: 500; color: var(--sage); }
.fileline .read i { font-style: normal; font-weight: 500; color: var(--muted); }

.fileline.is-read .raw  { opacity: 0; }
.fileline.is-read .read { opacity: 1; }

.filestrip-note {
  font-family: var(--mono);
  font-size: 0.54rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 11px 18px;
  border-top: 1px solid var(--rule);
  line-height: 1.7;
}

/* ═══ The trace ════════════════════════════════════════════════════════════
   One line down the page, forking once per band — a cladogram, not a ruler.
   Geometry is computed in js/motion.js from real section positions. */

.trace {
  position: absolute;
  top: 0;
  left: max(var(--pad), calc((100% - var(--page-max)) / 2));
  pointer-events: none;
  overflow: visible;
  z-index: 0;
}
.section > *,
.hero > * { position: relative; z-index: 1; }

.trace-spine,
.trace-branch {
  fill: none;
  stroke: var(--border);
  stroke-width: 1.5;
  stroke-linecap: round;
}
.trace-spine { transition: stroke-dashoffset 0.1s linear; }
.trace-branch { transition: stroke-dashoffset 0.7s cubic-bezier(.2,.7,.3,1); }

.trace-node {
  fill: var(--bg);
  stroke: var(--teal-mid);
  stroke-width: 1.5;
  opacity: 0;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.5s ease 0.25s, transform 0.5s cubic-bezier(.2,1.5,.4,1) 0.25s;
  transform: scale(0.4);
}
.trace-node.is-on { opacity: 1; transform: scale(1); }

.trace.is-static .trace-node { opacity: 1; transform: none; }

/* ═══ Reveals ══════════════════════════════════════════════════════════════
   Each band lifts once as it enters view, then holds. Nothing loops. */

.will-reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.2,.7,.3,1);
}
.will-reveal.is-in { opacity: 1; transform: none; }
.hero-figure.will-reveal { transition-delay: 0.12s; }

/* ═══ Quality floor ════════════════════════════════════════════════════════ */

:where(a, button, input, select, textarea):focus-visible {
  outline: 2px solid var(--teal-mid);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .fileline > span,
  .trace-spine,
  .trace-branch,
  .trace-node,
  .will-reveal { transition: none !important; }
  .will-reveal { opacity: 1; transform: none; }
  a.card:hover { transform: none; }
  html { scroll-behavior: auto; }
}

/* ═══ Responsive ═══════════════════════════════════════════════════════════ */

@media (max-width: 1140px) {
  .cards.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  :root { --rail-w: 0px; --gutter: 0px; }

  /* The trace needs a column of its own to live in; below this width there
     isn't one, so the rail metadata goes inline and the trace is dropped. */
  .trace { display: none; }

  .section, .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 40px var(--pad);
  }
  .section + .section { padding-top: 34px; }
  .section:has(.cards),
  .section:has(.steps) { padding-top: 46px; padding-bottom: 46px; }
  .section:has(.cta) { padding-top: 24px; padding-bottom: 56px; }
  .hero { padding-top: 48px; }

  .rail {
    padding-left: 0;
    margin-bottom: 18px;
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
  }
  .rail:empty { display: none; }
  .rail-meta { margin-top: 0; }
  .hero-figure { grid-column: 1; margin-top: 32px; }

  .cards.cols-2,
  .cards.cols-3,
  .cards.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .steps { grid-template-columns: minmax(0, 1fr); }
  .row { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .cta { padding: 28px 24px; }
  .measure-list { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 24px 18px; }
  /* Genotype lines must not wrap — the columns are the point. If the viewport
     is narrower than a line, the strip scrolls rather than reflowing. */
  .fileline { font-size: 0.56rem; overflow-x: auto; }
}

/* ═══ Home atmosphere ══════════════════════════════════════════════════════
   Homepage only (body.home). A warm, slow-moving field behind the hero band:
   a gold-forward wash of brand hues that gently "breathes", a soft light
   sweep that crosses once, and a shimmer on the tagline. Colour is drawn
   from the tokens (gold / sage / teal / forest) via color-mix — no new
   hues, and --terra stays out of it. Everything stops for reduced-motion.
   The field is a fixed-height band from the top; the rest of the page is
   untouched --bg. */

@keyframes atmo-breathe {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes atmo-sweep {
  0%   { transform: translateX(-120%) skewX(-16deg); opacity: 0; }
  10%  { opacity: 0.55; }
  26%  { opacity: 0; }
  100% { transform: translateX(360%) skewX(-16deg); opacity: 0; }
}
@keyframes atmo-shimmer {
  from { background-position: 0% 50%; }
  to   { background-position: 200% 50%; }
}

body.home { position: relative; overflow-x: clip; }

/* Keep the shell and content above the field. */
body.home > .dev-banner,
body.home > .nav,
body.home > #main,
body.home > .footer { position: relative; z-index: 1; }

body.home::before,
body.home::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 0;
  pointer-events: none;
}

/* The breathing wash. */
body.home::before {
  height: 920px;
  transform-origin: 50% 30%;
  background:
    linear-gradient(180deg,
      transparent 0px,
      color-mix(in srgb, var(--bg) 55%, transparent) 400px,
      var(--bg) 820px),
    radial-gradient(640px 540px at 12% 240px, color-mix(in srgb, var(--gold) 33%, transparent), transparent 70%),
    radial-gradient(520px 440px at 90% 120px, color-mix(in srgb, var(--gold) 18%, transparent), transparent 72%),
    radial-gradient(580px 520px at 72% 520px, color-mix(in srgb, var(--sage) 18%, transparent), transparent 74%),
    radial-gradient(400px 420px at 99% 320px, color-mix(in srgb, var(--teal) 14%, transparent), transparent 78%);
  animation: atmo-breathe 13s ease-in-out infinite;
}

/* The light sweep — one pass, then a long wait. */
body.home::after {
  width: 26%;
  height: min(760px, 88vh);
  background: linear-gradient(90deg,
    transparent,
    color-mix(in srgb, white 55%, transparent),
    transparent);
  animation: atmo-sweep 15s ease-in-out infinite;
  animation-delay: 2s;
}

/* The tagline, shimmering. Falls back to the solid --forest already set on
   .display em if background-clip:text is unavailable. */
body.home .hero .display em {
  background-image: linear-gradient(90deg,
    var(--forest), var(--sage) 26%, var(--teal-mid) 50%, var(--sage) 74%, var(--forest));
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: atmo-shimmer 7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  body.home::before,
  body.home::after { animation: none !important; }
  body.home .hero .display em {
    animation: none !important;
    background-image: none;
    -webkit-text-fill-color: var(--forest);
  }
}

@media (max-width: 900px) {
  body.home::before { height: 680px; }
  body.home::after { width: 44%; }
}
