/* =====================================================================
   London Genomics - v3 "Instrument"
   Cool near-black substrate, editorial display type, one electric accent.
   Motion is load-bearing, not decorative.
   ===================================================================== */

:root {
  /* Substrate */
  --bg:           oklch(0.155 0.012 250);
  --bg-deep:      oklch(0.12 0.012 250);
  --bg-rise:      oklch(0.185 0.012 250);
  --bg-rise-2:    oklch(0.21 0.012 250);
  --hair:         oklch(0.32 0.012 250);
  --hair-soft:    oklch(0.26 0.012 250);
  --hair-lit:     oklch(0.42 0.012 250);

  /* Ink */
  --ink:          oklch(0.965 0.005 90);
  --ink-2:        oklch(0.86 0.008 250);
  --ink-3:        oklch(0.68 0.01 250);
  --ink-4:        oklch(0.52 0.012 250);
  --ink-5:        oklch(0.4 0.012 250);

  /* Accent - electric clay */
  --acc:          oklch(0.74 0.18 35);
  --acc-deep:     oklch(0.62 0.19 32);
  --acc-soft:     oklch(0.84 0.12 38);
  --acc-glow:     oklch(0.74 0.18 35 / 0.35);

  /* Status */
  --good:         oklch(0.78 0.14 145);
  --warn:         oklch(0.82 0.15 85);

  /* Type */
  --f-display:    "Newsreader", ui-serif, Georgia, serif;
  --f-sans:       "Inter Tight", ui-sans-serif, system-ui, sans-serif;
  --f-mono:       "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Motion */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft:    cubic-bezier(0.2, 0, 0, 1);
  --ease-snap:    cubic-bezier(0.6, 0, 0.2, 1);

  /* Layout */
  --maxw:         1320px;
  --gutter:       clamp(20px, 4vw, 56px);
}

[data-palette="moss"] {
  --acc:       oklch(0.72 0.13 145);
  --acc-deep:  oklch(0.6 0.14 145);
  --acc-soft:  oklch(0.82 0.1 145);
  --acc-glow:  oklch(0.72 0.13 145 / 0.35);
}
[data-palette="oxblood"] {
  --acc:       oklch(0.58 0.18 18);
  --acc-deep:  oklch(0.48 0.18 18);
  --acc-soft:  oklch(0.7 0.14 20);
  --acc-glow:  oklch(0.58 0.18 18 / 0.4);
}
[data-palette="cobalt"] {
  --acc:       oklch(0.68 0.18 248);
  --acc-deep:  oklch(0.56 0.2 250);
  --acc-soft:  oklch(0.78 0.14 248);
  --acc-glow:  oklch(0.68 0.18 248 / 0.4);
}

[data-density="compact"] {
  --pad-section: clamp(64px, 8vw, 120px);
}
[data-density="editorial"] {
  --pad-section: clamp(96px, 12vw, 200px);
}

[data-display="newsreader"] { --f-display: "Newsreader", ui-serif, Georgia, serif; }
[data-display="instrument"] { --f-display: "Instrument Serif", ui-serif, Georgia, serif; }
[data-display="fraunces"]   { --f-display: "Fraunces", ui-serif, Georgia, serif; }
[data-display="sans"]       { --f-display: "Inter Tight", ui-sans-serif, system-ui, sans-serif; }

* { box-sizing: border-box; }

/* Accessibility - visible keyboard focus on every interactive element.
   Mouse users (via :focus-visible heuristic) do not see the outline. */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 3px;
  border-radius: 2px;
}

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-size: 16px;
  line-height: 1.55;
  font-feature-settings: "ss01", "cv11", "calt";
}
body {
  min-height: 100dvh;
  overflow-x: hidden;
}

/* Subtle film grain + vignette so black isn't dead */
body::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.5 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  opacity: 0.04;
  mix-blend-mode: screen;
}
body::after {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background:
    radial-gradient(120% 80% at 50% 0%, transparent 40%, oklch(0.1 0.01 250 / 0.5) 100%),
    radial-gradient(60% 40% at 80% 100%, oklch(0.74 0.18 35 / 0.04), transparent 60%);
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--acc); color: var(--bg); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--hair); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--acc); }

/* Type primitives */
.display {
  font-family: var(--f-display);
  font-weight: 400;
  letter-spacing: -0.022em;
  line-height: 0.98;
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
}
.display em {
  font-style: italic;
  color: var(--ink-3);
  font-variation-settings: "opsz" 144, "ital" 1;
}
.mono {
  font-family: var(--f-mono);
  font-feature-settings: "ss01", "calt", "zero";
  letter-spacing: 0;
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.eyebrow .acc { color: var(--acc); }
.lede {
  font-family: var(--f-display);
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.45;
  color: var(--ink-2);
  letter-spacing: -0.012em;
  font-weight: 350;
  font-variation-settings: "opsz" 36;
  text-wrap: pretty;
}

/* Layout primitives */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 5;
}
.section {
  padding-block: var(--pad-section, 120px);
  position: relative;
}
.hair { height: 1px; background: var(--hair-soft); width: 100%; }
.hair-acc {
  height: 1px;
  background: linear-gradient(90deg, var(--acc) 0 96px, var(--hair-soft) 96px 100%);
}

/* Section header (editorial) */
.section-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  margin-bottom: 64px;
  align-items: end;
}
@media (min-width: 900px) {
  .section-head {
    grid-template-columns: 240px minmax(0, 1fr);
    grid-auto-flow: row;
    gap: 32px 48px;
  }
  .section-head .meta {
    grid-column: 2;
    justify-self: end;
    margin-top: -8px;
  }
}
@media (min-width: 1200px) {
  .section-head {
    grid-template-columns: 240px minmax(0, 1fr) max-content;
    gap: 48px;
  }
  .section-head .meta { grid-column: auto; margin-top: 0; }
}
.section-head .num {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--ink-4);
  text-transform: uppercase;
  border-top: 1px solid var(--hair);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.section-head .num .dot {
  width: 6px; height: 6px; border-radius: 999px; background: var(--acc);
  align-self: center;
  box-shadow: 0 0 12px var(--acc-glow);
}
.section-head h2 {
  font-family: var(--f-display);
  font-size: clamp(32px, 4.6vw, 64px);
  line-height: 1.0;
  letter-spacing: -0.028em;
  font-weight: 400;
  margin: 0;
  font-variation-settings: "opsz" 144;
  text-wrap: balance;
}
.section-head h2 em {
  color: var(--ink-4);
  font-style: italic;
}
.section-head .meta {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-4);
  text-transform: uppercase;
  text-align: right;
  align-self: end;
}

/* Reveal on enter */
.reveal {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 1s var(--ease-out), transform 1s var(--ease-out);
  will-change: opacity, transform;
}
.reveal.in {
  opacity: 1;
  transform: none;
}
.reveal[data-d="1"] { transition-delay: 0.06s; }
.reveal[data-d="2"] { transition-delay: 0.12s; }
.reveal[data-d="3"] { transition-delay: 0.18s; }
.reveal[data-d="4"] { transition-delay: 0.24s; }
.reveal[data-d="5"] { transition-delay: 0.3s; }
.reveal[data-d="6"] { transition-delay: 0.36s; }

/* Letter reveal for headlines (per-word) */
.word-reveal {
  display: inline-block;
  overflow: hidden;
  vertical-align: top;
}
.word-reveal > span {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 1.2s var(--ease-out);
}
.word-reveal.in > span { transform: none; }

/* Buttons / links */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font-family: var(--f-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.4s var(--ease-out), border-color 0.4s var(--ease-out), color 0.4s var(--ease-out), transform 0.4s var(--ease-out);
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: "";
  position: absolute; inset: 0;
  background: var(--acc);
  transform: translateY(101%);
  transition: transform 0.5s var(--ease-out);
  z-index: 0;
}
.btn:hover::after { transform: none; }
.btn > * { position: relative; z-index: 1; }
.btn:hover { color: var(--bg); }
.btn-ghost {
  background: transparent;
  border: 1px solid var(--hair-lit);
  color: var(--ink-2);
}
.btn-ghost::after { background: var(--ink); }
.btn-ghost:hover { color: var(--bg); }

.link {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--hair-lit);
  padding-bottom: 2px;
  transition: border-color 0.3s var(--ease-out), color 0.3s var(--ease-out);
}
.link:hover { color: var(--acc); border-color: var(--acc); }

/* Marquee ticker */
.ticker {
  border-block: 1px solid var(--hair-soft);
  overflow: hidden;
  position: relative;
  background: var(--bg-deep);
}
.ticker-track {
  display: flex;
  gap: 64px;
  white-space: nowrap;
  animation: ticker 60s linear infinite;
  padding-block: 14px;
}
.ticker-item {
  font-family: var(--f-mono);
  font-size: 11.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex;
  align-items: center;
  gap: 14px;
}
.ticker-item .dot {
  width: 5px; height: 5px; border-radius: 999px;
  background: var(--acc);
  box-shadow: 0 0 8px var(--acc-glow);
}
@keyframes ticker {
  to { transform: translateX(-50%); }
}

/* Cards */
.card {
  background: var(--bg-rise);
  border: 1px solid var(--hair);
  padding: 28px;
  position: relative;
  transition: border-color 0.4s var(--ease-out), background 0.4s var(--ease-out);
}
.card:hover { border-color: var(--hair-lit); }

/* Number tile (animated counter) */
.figure-tile {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 32px;
  background: var(--bg-rise);
  border: 1px solid var(--hair);
  position: relative;
  overflow: hidden;
  min-height: 240px;
  justify-content: space-between;
  container-type: inline-size;
}
.figure-tile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--acc-glow), transparent 50%);
  opacity: 0;
  transition: opacity 0.6s var(--ease-out);
  pointer-events: none;
}
.figure-tile:hover::before { opacity: 0.5; }
.figure-tile .val {
  font-family: var(--f-display);
  /* Size to the tile's own width via container query, so long values like
     "237,000" or "£2.2B" never spill regardless of grid breakpoint. */
  font-size: clamp(34px, 18cqw, 72px);
  line-height: 0.96;
  letter-spacing: -0.04em;
  font-weight: 400;
  font-variation-settings: "opsz" 144;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  font-variant-numeric: tabular-nums;
}
.figure-tile .val span { display: inline-block; }
.figure-tile .val.acc { color: var(--acc); }
.figure-tile .lbl {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.figure-tile .det {
  font-size: 13.5px;
  color: var(--ink-2);
  line-height: 1.55;
  max-width: 44ch;
}
.figure-tile .src-tag {
  margin-top: 14px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
  border-top: 1px dashed var(--hair-soft);
  padding-top: 10px;
}

/* Pipeline stages */
.pipeline {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  background: var(--hair-soft);
  border: 1px solid var(--hair-soft);
}
@media (min-width: 700px) { .pipeline { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .pipeline { grid-template-columns: repeat(4, 1fr); } }
.stage {
  background: var(--bg);
  padding: 22px;
  position: relative;
  transition: background 0.5s var(--ease-out);
}
.stage.lit { background: var(--bg-rise-2); }
.stage.lit .stage-num { color: var(--acc); }
.stage .stage-num {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--ink-4);
  display: flex;
  justify-content: space-between;
  transition: color 0.5s var(--ease-out);
}
.stage .stage-name {
  font-family: var(--f-display);
  font-size: 19px;
  margin-top: 12px;
  letter-spacing: -0.014em;
  font-variation-settings: "opsz" 36;
}
.stage .stage-io {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  margin-top: 14px;
  line-height: 1.6;
}
.stage .stage-io b { color: var(--ink-3); font-weight: 500; }

/* Benchmark wedges */
.bench-row {
  display: grid;
  grid-template-columns: 200px 1fr 64px;
  gap: 24px;
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--hair-soft);
}
@media (max-width: 700px) {
  .bench-row { grid-template-columns: 1fr; gap: 8px; }
}
.bench-cat {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
}
.bench-cat .unit {
  display: block;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  color: var(--ink-4);
  text-transform: uppercase;
  margin-top: 2px;
}
.bench-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.bench-bar {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 12px;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--ink-3);
}
.bench-bar .name { text-align: right; }
.bench-bar .name.ours { color: var(--acc); }
.bench-bar .track {
  height: 6px;
  background: var(--hair-soft);
  position: relative;
  overflow: hidden;
}
.bench-bar .fill {
  position: absolute;
  inset: 0 100% 0 0;
  background: var(--ink-4);
  transition: right 1.4s var(--ease-out);
}
.bench-bar.ours .fill { background: var(--acc); }
.bench-bar.absent .fill {
  background: repeating-linear-gradient(90deg, var(--hair-soft) 0 4px, transparent 4px 8px);
}
.bench-bar .val {
  font-size: 11px;
  color: var(--ink-3);
  white-space: nowrap;
}
.bench-bar.ours .val { color: var(--acc); }
.bench-win {
  font-family: var(--f-mono);
  font-size: 12px;
  text-align: right;
  color: var(--ink-4);
}
.bench-win.win { color: var(--acc); }

/* Hash ticker */
.hash-tape {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 16px;
}
.hash-tape .lbl { color: var(--ink-3); }
.hash-tape .hash {
  color: var(--acc);
  display: inline-block;
  min-width: 64ch;
}

/* Report mock */
.report {
  background: var(--bg-rise);
  border: 1px solid var(--hair);
  padding: 0;
  font-family: var(--f-mono);
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--ink-2);
  overflow: hidden;
  position: relative;
}
.report-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 18px 22px;
  border-bottom: 1px solid var(--hair-soft);
  background: var(--bg-rise-2);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.report-head .right { text-align: right; }
.report-body { padding: 22px; }
.report-row {
  display: grid;
  grid-template-columns: 14px 90px 1fr auto;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hair-soft);
  align-items: baseline;
}
.report-row:last-child { border-bottom: 0; }
.report-row .light {
  width: 8px; height: 8px;
  border-radius: 999px;
  background: var(--good);
  align-self: center;
}
.report-row .light.warn { background: var(--warn); }
.report-row .light.bad { background: var(--acc-deep); }
.report-row .gene { color: var(--ink); font-weight: 500; }
.report-row .desc { color: var(--ink-3); }
.report-row .tier {
  font-size: 10px; letter-spacing: 0.14em;
  color: var(--ink-4);
}
.report-foot {
  padding: 14px 22px;
  border-top: 1px solid var(--hair-soft);
  background: var(--bg-rise-2);
  font-size: 10.5px;
  color: var(--ink-4);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

/* Module grid */
.mods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1px;
  background: var(--hair-soft);
  border: 1px solid var(--hair-soft);
}
.mod {
  background: var(--bg);
  padding: 18px;
  transition: background 0.5s var(--ease-out);
}
.mod:hover { background: var(--bg-rise-2); }
.mod .nm {
  font-family: var(--f-display);
  font-size: 17px;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.012em;
  margin-bottom: 8px;
}
.mod .sm {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.5;
}
.mod .stat {
  margin-top: 10px;
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--acc);
}

/* Roadmap timeline */
.timeline {
  position: relative;
  display: grid;
  gap: 0;
}
.tl-row {
  display: grid;
  grid-template-columns: 200px 1fr auto;
  gap: 24px;
  padding: 20px 0;
  border-bottom: 1px solid var(--hair-soft);
  align-items: baseline;
}
@media (max-width: 800px) { .tl-row { grid-template-columns: 1fr; gap: 6px; } }
.tl-row .when {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-4);
}
.tl-row .what {
  font-family: var(--f-display);
  font-size: 22px;
  letter-spacing: -0.014em;
  font-variation-settings: "opsz" 36;
}
.tl-row .what em { color: var(--ink-3); font-style: italic; }
.tl-row .why { font-size: 13.5px; color: var(--ink-3); margin-top: 4px; max-width: 64ch; line-height: 1.55; }
.tl-row .badge {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border: 1px solid var(--hair-lit);
  padding: 5px 9px;
  color: var(--ink-3);
  white-space: nowrap;
}
.tl-row .badge.acc { color: var(--acc); border-color: var(--acc-deep); }
.tl-row .badge.good { color: var(--good); border-color: oklch(0.5 0.1 145); }
.tl-row .badge.warn { color: var(--warn); border-color: oklch(0.5 0.1 85); }

/* Grant list */
.grant-row {
  display: grid;
  grid-template-columns: 56px minmax(0,1fr) auto auto;
  gap: 28px;
  align-items: center;
  padding: 22px 0;
  border-top: 1px solid var(--hair-soft);
  transition: background 0.4s var(--ease-out), padding 0.4s var(--ease-out);
}
.grant-row:hover { padding-inline: 12px; background: var(--bg-rise); }
.grant-row .idx { font-family: var(--f-mono); font-size: 11px; color: var(--ink-4); letter-spacing: 0.18em; }
.grant-row .nm { font-family: var(--f-display); font-size: 22px; letter-spacing: -0.014em; font-variation-settings: "opsz" 36; }
.grant-row .funder { font-family: var(--f-mono); font-size: 11px; color: var(--ink-4); letter-spacing: 0.16em; text-transform: uppercase; margin-top: 4px; }
.grant-row .amt {
  font-family: var(--f-display);
  font-size: 20px;
  color: var(--acc);
  font-variation-settings: "opsz" 36;
  white-space: nowrap;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.grant-row .stat-tag {
  font-family: var(--f-mono);
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: right;
  color: var(--ink-3);
  white-space: nowrap;
}
@media (max-width: 800px) {
  .grant-row { grid-template-columns: 32px 1fr; gap: 12px; }
  .grant-row .amt, .grant-row .stat-tag { grid-column: 2; text-align: left; white-space: normal; }
}

/* Footer */
.footer {
  border-top: 1px solid var(--hair-soft);
  padding-block: 80px;
  margin-top: 120px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr 1fr; gap: 56px; }
}
.footer h4 {
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-4);
  margin: 0 0 14px;
}
.footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.footer a { color: var(--ink-2); text-decoration: none; font-size: 14px; transition: color 0.3s var(--ease-out); }
.footer a:hover { color: var(--acc); }

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