/* biohacking · $bioLLM — the instrument.
   Light clinical theme: white ground, medical blue, bioluminescent green.
   Every colour is defined once, here. #00C805 is reserved for on-chain surfaces only. */

:root {
  /* grounds */
  --ground: #FFFFFF;
  --panel: #F6F9FB;
  --panel-2: #EDF3F7;
  --line: #E2EAF0;
  --line-2: #C9D6E0;

  /* ink */
  --ink: #0B1620;
  --ink-dim: #55697A;
  --ink-faint: #8CA0AF;

  /* the neon green — bright for fills and marks, deep for text (contrast on white) */
  --signal: #00E5A0;
  --signal-ink: #00795C;
  --signal-wash: #E4FBF3;

  /* medical blue — the structural colour */
  --blue: #1565C0;
  --blue-ink: #0D47A1;
  --blue-wash: #EAF2FC;

  --amber: #B26A00;
  --alert: #C62828;
  --chain: #00A004;        /* on-chain events ONLY */

  --ui: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --r: 4px;
  --maxw: 1240px;
  --shadow: 0 1px 2px rgba(11,22,32,.05), 0 4px 16px rgba(11,22,32,.05);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.6;
  font-feature-settings: 'tnum' 1;
  overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; border-bottom: 1px solid var(--line-2); }
a:hover { border-bottom-color: var(--signal-ink); color: var(--signal-ink); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 2px solid var(--blue); outline-offset: 2px;
}

h1, h2, h3 { font-weight: 600; letter-spacing: -.018em; line-height: 1.15; margin: 0 0 .6rem; }
h1 { font-size: clamp(2rem, 4.6vw, 3.3rem); }
h2 { font-size: clamp(1.2rem, 2.2vw, 1.6rem); }
h3 { font-size: 1rem; }
p { margin: 0 0 1rem; max-width: 68ch; }

.skip { position: absolute; left: -9999px; top: 0; background: var(--signal); color: var(--ink); padding: .6rem 1rem; z-index: 99; }
.skip:focus { left: 0; }

/* ── chrome ─────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1.1rem;
  padding: .66rem clamp(.9rem, 3vw, 1.6rem);
  background: rgba(255,255,255,.9);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: .8rem;
}
.brand { display: flex; align-items: baseline; gap: .5rem; border: 0; flex: none; color: var(--ink); }
.brand b { font-weight: 600; letter-spacing: -.02em; font-size: .98rem; }
.brand .tick { font-family: var(--mono); font-size: .72rem; color: var(--signal-ink); letter-spacing: .04em; }
.top nav { display: flex; gap: .9rem; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.top nav::-webkit-scrollbar { display: none; }
.top nav a { border: 0; color: var(--ink-dim); white-space: nowrap; }
.top nav a:hover, .top nav a[aria-current] { color: var(--ink); }
.top nav a[aria-current] { text-decoration: underline; text-underline-offset: 5px; text-decoration-thickness: 2px; text-decoration-color: var(--signal); }
.top .spacer { flex: 1; }
.ca { font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); border: 1px solid var(--line); padding: .22rem .5rem; border-radius: var(--r); white-space: nowrap; }

main { max-width: var(--maxw); margin: 0 auto; padding: clamp(1.6rem, 4vw, 3rem) clamp(.9rem, 3vw, 1.6rem) 5rem; }

.eyebrow { font-family: var(--mono); font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-faint); margin: 0 0 .7rem; }

/* ── hero ───────────────────────────────────────────────── */
.hero { padding: clamp(1rem, 5vw, 3rem) 0 2rem; border-bottom: 1px solid var(--line); }
.hero h1 { max-width: 20ch; }
.hero .claim { font-size: clamp(1rem, 1.7vw, 1.16rem); color: var(--ink-dim); max-width: 58ch; }
.hero .tag { font-family: var(--mono); color: var(--signal-ink); font-size: .84rem; }

.counters { display: flex; flex-wrap: wrap; gap: clamp(1.2rem, 4vw, 3rem); margin: 1.8rem 0 .4rem; }
.counter b { display: block; font-family: var(--mono); font-size: clamp(1.6rem, 3.6vw, 2.4rem); color: var(--blue); font-weight: 500; line-height: 1.1; }
.counter span { font-size: .74rem; color: var(--ink-faint); font-family: var(--mono); letter-spacing: .05em; }

.chainline { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); border-top: 1px solid var(--line); margin-top: 2rem; padding-top: .8rem; }
.chainline b { color: var(--chain); font-weight: 500; }

section { padding: 2.6rem 0; border-bottom: 1px solid var(--line); }
section:last-of-type { border-bottom: 0; }

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 1.1rem 1.2rem; }
.card h3 { margin-bottom: .35rem; }
.card p { font-size: .88rem; color: var(--ink-dim); margin: 0; }

.note { border-left: 3px solid var(--amber); background: #FFF8EC; padding: .8rem 1rem; font-size: .85rem; color: var(--ink-dim); border-radius: 0 var(--r) var(--r) 0; }
.note.hard { border-left-color: var(--alert); background: #FDECEC; }
.note b { color: var(--ink); }

/* ── data tables ────────────────────────────────────────── */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--ground); }
table { border-collapse: collapse; width: 100%; font-size: .84rem; min-width: 720px; }
caption { text-align: left; font-size: .78rem; color: var(--ink-faint); padding: .7rem .9rem; font-family: var(--mono); }
th, td { text-align: left; padding: .56rem .8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--mono); font-size: .68rem; text-transform: uppercase; letter-spacing: .09em; color: var(--ink-dim); font-weight: 500; position: sticky; top: 0; background: var(--panel-2); z-index: 1; white-space: nowrap; }
th[data-sort] { cursor: pointer; user-select: none; }
th[data-sort]:hover { color: var(--ink); }
th[aria-sort] { color: var(--blue); }
tbody tr:hover { background: var(--blue-wash); }
td.num { font-family: var(--mono); text-align: right; }
.nil { color: var(--ink-faint); font-style: italic; font-size: .8rem; }

/* ── sequences ──────────────────────────────────────────── */
.seq { font-family: var(--mono); letter-spacing: .13em; word-break: break-all; font-size: .9rem; line-height: 1.9; }
.seq b { font-weight: 500; }
.seq-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1rem; position: relative; }
.seq3 { font-family: var(--mono); font-size: .76rem; color: var(--ink-dim); word-break: break-word; }
.copy { position: absolute; top: .55rem; right: .55rem; background: var(--ground); border: 1px solid var(--line-2); color: var(--ink-dim); font-family: var(--mono); font-size: .64rem; padding: .2rem .45rem; border-radius: var(--r); cursor: pointer; }
.copy:hover { color: var(--signal-ink); border-color: var(--signal-ink); }

/* ── molecular structures ───────────────────────────────── */
.molhero { border-bottom: 1px solid var(--line); padding-bottom: 2rem; }
.molstage {
  margin: 0; background: linear-gradient(170deg, #FBFDFE 0%, var(--panel) 100%);
  border: 1px solid var(--line); border-radius: 8px; padding: 1rem;
  position: relative; overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; align-items: center;
  touch-action: none;
}
.molstage svg { max-width: 100%; height: auto; cursor: grab; transition: none; }
.molstage.dragging svg { cursor: grabbing; }
.molstage figcaption { display: flex; flex-wrap: wrap; gap: .6rem 1.4rem; justify-content: space-between; align-items: center;
  width: 100%; margin-top: .8rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.molmeta { font-family: var(--mono); font-size: .7rem; color: var(--ink-faint); letter-spacing: .03em; }
.molels { display: flex; flex-wrap: wrap; gap: .55rem; font-family: var(--mono); font-size: .72rem; color: var(--ink-dim); }
.molels i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: .3rem; vertical-align: 0; }
.molels b { font-weight: 500; color: var(--ink-faint); margin-left: .15rem; }

.viz-mol line { vector-effect: non-scaling-stroke; }

/* the structure wall */
.molgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: .9rem; }
.molcard {
  border: 1px solid var(--line); border-radius: 8px; background: var(--ground); padding: .7rem;
  display: flex; flex-direction: column; gap: .5rem; text-decoration: none; color: inherit;
  transition: border-color .18s linear, box-shadow .18s linear;
}
.molcard:hover { border-color: var(--signal); box-shadow: var(--shadow); }
.molcard-fig { background: var(--panel); border-radius: var(--r); aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: .5rem; overflow: hidden; }
.molcard-fig svg { max-width: 100%; max-height: 100%; height: auto; }
.molcard-meta { display: flex; flex-direction: column; gap: .18rem; }
.molcard-meta b { font-size: .84rem; letter-spacing: -.01em; }
.molcard-meta span { font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); }
.molcard-meta .chip { align-self: flex-start; margin-top: .15rem; }

/* ── residue explorer ───────────────────────────────────── */
.resgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.rescard { border: 1px solid var(--line); border-top: 3px solid var(--c); border-radius: var(--r); padding: .85rem .95rem; background: var(--ground); }
.rescard-top { display: flex; align-items: baseline; gap: .5rem; }
.resletter { font-family: var(--mono); font-size: 2rem; font-weight: 500; color: var(--c); line-height: 1; }
.resthree { font-family: var(--mono); font-size: .78rem; color: var(--ink-faint); }
.rescard b { display: block; margin: .3rem 0 .35rem; font-size: .9rem; }
.resdata { margin: .6rem 0 .5rem; display: grid; gap: .15rem; }
.resdata div { display: flex; justify-content: space-between; font-family: var(--mono); font-size: .7rem; }
.resdata dt { color: var(--ink-faint); margin: 0; }
.resdata dd { margin: 0; color: var(--ink); }
.resbar { height: 4px; background: var(--panel-2); border-radius: 2px; overflow: hidden; }
.resbar i { display: block; height: 100%; background: var(--c); }
.rescount { font-family: var(--mono); font-size: .64rem; color: var(--ink-faint); margin-top: .35rem; display: block; }

/* ── viz (residue chains, wheels, traces) ───────────────── */
.vizwrap { overflow-x: auto; padding: .4rem 0 .2rem; }
.viz { max-width: 100%; height: auto; display: block; }
.viz .bond { stroke: var(--line-2); stroke-width: 1.4; }
.viz .bond-wrap { stroke-dasharray: 2 3; }
.viz .res-l { font-family: var(--mono); font-size: 11px; font-weight: 500; }
.viz .res-n { font-family: var(--mono); font-size: 8px; fill: var(--ink-faint); }
.viz .wheel-ring { stroke: var(--line); stroke-width: 1; }

.legend { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem .95rem; padding: 0; margin: .7rem 0 0; font-family: var(--mono); font-size: .67rem; color: var(--ink-faint); }
.legend li { display: flex; align-items: center; gap: .32rem; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }

.align-seq { font-family: var(--mono); font-size: .76rem; letter-spacing: .08em; white-space: pre-wrap; word-break: break-all; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: .8rem .9rem; margin: .4rem 0 0; }
.align-seq .dim { color: var(--ink-faint); }
.align-seq mark { background: var(--signal-wash); color: var(--signal-ink); border-bottom: 1px solid var(--signal-ink); }
.align-meta { font-size: .8rem; color: var(--ink-dim); margin: 0; }

/* ── chips / status ─────────────────────────────────────── */
.chip { display: inline-block; font-family: var(--mono); font-size: .66rem; letter-spacing: .04em; padding: .16rem .46rem; border: 1px solid var(--line-2); border-radius: var(--r); color: var(--ink-dim); white-space: nowrap; background: var(--ground); }
.chip.ok { color: var(--signal-ink); border-color: #9AE8D2; background: var(--signal-wash); }
.chip.warn { color: var(--amber); border-color: #EBCF9B; background: #FFF8EC; }
.chip.bad { color: var(--alert); border-color: #EFB4B4; background: #FDECEC; }
.chip.chain { color: var(--chain); border-color: #9FE0A1; background: #EAF9EB; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; margin: .5rem 0; }

/* ── controls ───────────────────────────────────────────── */
.controls { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: 0 0 1rem; }
input[type="search"], input[type="text"], select {
  background: var(--ground); border: 1px solid var(--line-2); color: var(--ink);
  font-family: var(--mono); font-size: .82rem; padding: .48rem .65rem; border-radius: var(--r);
}
input[type="search"] { min-width: min(320px, 100%); }
label.lbl { font-family: var(--mono); font-size: .68rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .08em; }
.count { font-family: var(--mono); font-size: .74rem; color: var(--ink-faint); margin-left: auto; }

.outcomes { display: flex; flex-wrap: wrap; gap: .45rem; margin: 0 0 1.4rem; padding: 0; list-style: none; }
.outcomes button, .obtn { background: var(--ground); border: 1px solid var(--line-2); color: var(--ink-dim); font-family: var(--mono); font-size: .76rem; padding: .38rem .7rem; border-radius: var(--r); cursor: pointer; }
.outcomes button:hover, .obtn:hover { color: var(--signal-ink); border-color: var(--signal); background: var(--signal-wash); }

/* ── results / lab / registry ───────────────────────────── */
.result { border: 1px solid var(--line); border-radius: var(--r); padding: .9rem 1.05rem; background: var(--ground); }
.result h3 { margin-bottom: .2rem; }
.result h3 a { border: 0; }
.why { font-size: .85rem; color: var(--ink-dim); margin: .2rem 0 .5rem; }
.cite { font-family: var(--mono); font-size: .71rem; color: var(--ink-faint); }
.rank { font-family: var(--mono); color: var(--signal-ink); font-size: .74rem; }

.hazard { display: block; font-family: var(--mono); font-size: .66rem; letter-spacing: .05em; line-height: 1.5; color: var(--alert); border: 1px solid #EFB4B4; background: #FDECEC; padding: .45rem .6rem; border-radius: var(--r); margin: 0 0 .8rem; }

.phase { font-family: var(--mono); font-size: .76rem; color: var(--amber); }
.log { font-family: var(--mono); font-size: .76rem; color: var(--ink-dim); }
.log li { margin-bottom: .3rem; }
.hash { font-family: var(--mono); font-size: .7rem; color: var(--ink-dim); word-break: break-all; }

details { border: 1px solid var(--line); border-radius: var(--r); padding: .6rem .85rem; background: var(--ground); margin-bottom: .55rem; }
details summary { cursor: pointer; font-size: .88rem; }
details[open] summary { color: var(--blue); margin-bottom: .5rem; }
details p { font-size: .85rem; color: var(--ink-dim); margin: .4rem 0 0; }

footer { border-top: 1px solid var(--line); padding: 1.8rem clamp(.9rem, 3vw, 1.6rem) 3rem; font-size: .76rem; color: var(--ink-faint); max-width: var(--maxw); margin: 0 auto; }
footer p { max-width: 78ch; margin: 0 0 .5rem; }
footer a { color: var(--ink-dim); }
.disclaim { font-family: var(--mono); font-size: .69rem; line-height: 1.7; }

/* ── motion: data resolves, nothing bounces ─────────────── */
@keyframes resolve { from { opacity: 0; } to { opacity: 1; } }
.resolve { animation: resolve .42s linear both; }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .resolve { opacity: 1 !important; }
  .viz-mol line { stroke-dashoffset: 0 !important; }
}

@media (max-width: 640px) {
  .top { gap: .7rem; }
  .top .ca { display: none; }
  section { padding: 2rem 0; }
  .molgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* ── visual-first home ──────────────────────────────────── */
.hero-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: clamp(1.5rem, 4vw, 3.4rem); align-items: center; }
.hero-copy h1 { margin-bottom: .8rem; }
.hero-mol { margin: 0; }
.hero-mol svg { max-height: 460px; }
.herocta { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.6rem; }
.btn { display: inline-block; font-family: var(--mono); font-size: .8rem; padding: .58rem 1rem; border-radius: var(--r);
  border: 1px solid var(--line-2); color: var(--ink); background: var(--ground); }
.btn:hover { border-color: var(--signal); background: var(--signal-wash); color: var(--signal-ink); }
.btn-primary { background: var(--signal); border-color: var(--signal); color: #04241B; font-weight: 500; }
.btn-primary:hover { background: var(--signal-ink); border-color: var(--signal-ink); color: #fff; }

.statband { padding-top: 1.8rem; }
.molstrip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .8rem; margin-bottom: 1rem; }

.scalebars { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .42rem; }
.scalebars li { display: grid; grid-template-columns: minmax(120px, 190px) 1fr auto; align-items: center; gap: .8rem; font-size: .82rem; }
.scalebars li a { border: 0; color: var(--ink); }
.scalebars li a:hover { color: var(--signal-ink); }
.scalebars li i { display: block; height: 10px; border-radius: 2px; background: linear-gradient(90deg, var(--blue), var(--signal)); min-width: 2px; }
.scalebars li b { font-family: var(--mono); font-size: .72rem; color: var(--ink-faint); font-weight: 400; }

@media (max-width: 860px) {
  .hero-split { grid-template-columns: 1fr; }
  .hero-mol svg { max-height: 320px; }
  .scalebars li { grid-template-columns: minmax(90px, 130px) 1fr auto; font-size: .76rem; }
}
