/* ivive.app — a generative identity drawn from the model itself.
   Every line in the mark and the field is the well-stirred curve EH = x / (1 + x); the spectrum
   along it is extraction ratio, violet (low clearance) through solar (high). Text stays on ink,
   never on the spectrum, so contrast holds: ink on mist ≈ 17:1, secondary ink ≈ 8:1. */

@font-face {
  font-family: "Sora";
  src: url("/fonts/sora-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --mist: #eeecf7;
  --paper: #f8f7fc;
  --night: #0e1024;
  --ink-2: #3d4160;
  --ink-3: #5b5f7d;
  --line: #d9d6ea;
  --iris: #6a32e0;
  --spectrum: linear-gradient(90deg, #7a3fee 0%, #4a7cff 30%, #00b3a4 50%, #8fd14a 70%, #f2c230 100%);
  --seed: #4a7cff;
  --radius: 22px;
  --shadow: 0 1px 2px rgb(14 16 36 / 0.05), 0 18px 40px -18px rgb(76 60 160 / 0.28);
  --wide: 74rem;
  --measure: 40rem;
  font-family: "Sora", system-ui, sans-serif;
  font-size: 106.25%;
  line-height: 1.6;
  color: var(--night);
  background: var(--mist);
  font-variant-numeric: tabular-nums;
}

* { box-sizing: border-box; }
body { margin: 0; overflow-x: clip; }
a { color: var(--iris); text-underline-offset: 0.18em; }
a:hover { color: var(--night); }
:focus-visible { outline: 2px solid var(--iris); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; font-weight: 600; text-wrap: balance; }
p { text-wrap: pretty; }
code, pre { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 0.85em; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Seed tint: the page's accent follows the chosen worked example where :has is supported */
body:has(#seed-midazolam:checked) { --seed: #3f8fe6; }
body:has(#seed-verapamil:checked) { --seed: #3fbf7f; }
body:has(#seed-diltiazem:checked) { --seed: #5a5cf2; }
body:has(#seed-warfarin:checked) { --seed: #7a3fee; }

/* Header and footer, shared by every page */
.site-header {
  max-width: var(--wide); margin: 0 auto; padding: 1.4rem 1.5rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  position: relative; z-index: 2;
}
.wordmark { display: inline-flex; align-items: center; gap: 0.7rem; color: var(--night); text-decoration: none; }
.wordmark img { width: 2.6rem; height: 2.6rem; }
.wordmark span { font-size: 1.3rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.wordmark span b { font-weight: 300; letter-spacing: 0.06em; }
.header-nav { display: flex; align-items: center; gap: 1.4rem; }
.header-nav > a:not(.pill) { color: var(--ink-2); text-decoration: none; font-size: 0.92rem; }
.header-nav > a:not(.pill):hover { color: var(--night); }

.site-footer {
  max-width: var(--wide); margin: 5rem auto 0; padding: 2rem 1.5rem 3rem;
  color: var(--ink-2); font-size: 0.9rem; position: relative;
}
.site-footer::before { content: ""; display: block; height: 2px; background: var(--spectrum); border-radius: 2px; margin-bottom: 1.6rem; opacity: 0.8; }
.site-footer nav, .site-footer p { margin: 0 0 0.5rem; }
.small { font-size: 0.8rem; color: var(--ink-3); }

/* Pills: the one control shape. Primary carries a spectrum disc, like the mark */
.pill {
  display: inline-flex; align-items: center; gap: 0.85rem;
  border-radius: 999px; text-decoration: none; font-weight: 500; line-height: 1;
  transition: transform 160ms cubic-bezier(0.16, 1, 0.3, 1), box-shadow 160ms;
}
.pill-primary { background: var(--night); color: #fff; padding: 0.42rem 0.42rem 0.42rem 1.25rem; box-shadow: var(--shadow); }
.pill-primary::after {
  content: ""; width: 2.1rem; height: 2.1rem; border-radius: 50%; flex: none;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230e1024' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h13M13 6l6 6-6 6'/%3E%3C/svg%3E") center / 1.05rem no-repeat,
    conic-gradient(from 200deg, #7a3fee, #4a7cff, #00b3a4, #8fd14a, #f2c230, #7a3fee);
}
.pill-primary:hover { color: #fff; transform: translateY(-1px); }
.pill-large { font-size: 1.08rem; padding-left: 1.6rem; }
.pill-large::after { width: 2.6rem; height: 2.6rem; }
.pill-quiet { color: var(--night); border: 1.5px solid var(--line); background: var(--paper); padding: 0.95rem 1.4rem; }
.pill-quiet:hover { border-color: var(--iris); color: var(--night); }

/* Hero: thesis left, the model at work right, its own curve family as the ground */
main { position: relative; overflow-x: clip; }
.hero {
  position: relative; max-width: var(--wide); margin: 0 auto; padding: 2.5rem 1.5rem 4rem;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 3rem; align-items: start;
}
.hero::before {
  content: ""; position: absolute; inset: 0 -40vw 0 32%; z-index: -1;
  background: url("/field.svg") right center / cover no-repeat;
  mask-image: linear-gradient(90deg, transparent, #000 30%);
}
.hero h1 { font-size: clamp(2.5rem, 5.6vw, 4.7rem); margin: 2.5rem 0 1.4rem; }
.hero h1 span { display: block; font-weight: 300; }
.lede { font-size: 1.15rem; color: var(--ink-2); max-width: 32rem; margin: 0 0 2rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: center; }
.note { margin: 1.1rem 0 0; color: var(--ink-3); font-size: 0.92rem; display: flex; align-items: center; gap: 0.5rem; }
.note::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #00a596; }

/* The worked example: a real calculation, reseeded by choosing a drug (radio inputs, no script) */
.example {
  position: relative; background: rgb(248 247 252 / 0.92); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.4rem 1.5rem 1.2rem; box-shadow: var(--shadow);
}
.example-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem; margin-bottom: 1rem; }
.example-title { margin: 0; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; display: flex; align-items: center; gap: 0.55rem; }
.example-title::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--seed); transition: background 400ms; }
.seeds { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.seeds label {
  cursor: pointer; font-size: 0.82rem; padding: 0.38rem 0.8rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--ink-2); background: #fff;
}
.seeds label:hover { border-color: var(--iris); color: var(--night); }
.example > input { position: absolute; opacity: 0; pointer-events: none; }
#seed-midazolam:checked ~ .example-head label[for="seed-midazolam"],
#seed-verapamil:checked ~ .example-head label[for="seed-verapamil"],
#seed-diltiazem:checked ~ .example-head label[for="seed-diltiazem"],
#seed-warfarin:checked ~ .example-head label[for="seed-warfarin"] { background: var(--night); border-color: var(--night); color: #fff; }
#seed-midazolam:focus-visible ~ .example-head label[for="seed-midazolam"],
#seed-verapamil:focus-visible ~ .example-head label[for="seed-verapamil"],
#seed-diltiazem:focus-visible ~ .example-head label[for="seed-diltiazem"],
#seed-warfarin:focus-visible ~ .example-head label[for="seed-warfarin"] { outline: 2px solid var(--iris); outline-offset: 2px; }

.panel { display: none; }
#seed-midazolam:checked ~ .panel-midazolam,
#seed-verapamil:checked ~ .panel-verapamil,
#seed-diltiazem:checked ~ .panel-diltiazem,
#seed-warfarin:checked ~ .panel-warfarin { display: block; animation: reseed 700ms cubic-bezier(0.16, 1, 0.3, 1); }
.panel .plot path { stroke-dasharray: 700; animation: draw 900ms cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes reseed { from { opacity: 0.25; filter: blur(3px); } to { opacity: 1; filter: none; } }
@keyframes draw { from { stroke-dashoffset: 700; } to { stroke-dashoffset: 0; } }

.inputs { margin: 0 0 0.6rem; font-size: 0.82rem; color: var(--ink-3); }
.plot { width: 100%; height: auto; display: block; margin: 0 0 0.6rem; }
.plot .grid { stroke: var(--line); stroke-width: 1; }
.plot .tick { fill: var(--ink-3); font-size: 12px; font-family: inherit; }
.result { display: grid; grid-template-columns: auto auto 1fr; gap: 0.2rem 1.5rem; align-items: baseline; margin: 0 0 0.9rem; }
.result dt { font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); grid-row: 1; }
.result dd { margin: 0; font-size: 1.45rem; font-weight: 600; letter-spacing: -0.02em; grid-row: 2; }
.result dd small { font-size: 0.72rem; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }

/* The band bar: plasma CL on a log axis, 0.01 to 100 mL/min/kg */
.bandbar { position: relative; height: 2.6rem; margin: 0.4rem 0 0.2rem; }
.axis-title { margin: 0 0 0.9rem; font-size: 0.68rem; color: var(--ink-3); text-align: right; }
.bandbar::before { content: ""; position: absolute; left: 0; right: 0; top: 1.15rem; height: 2px; background: var(--line); }
.bandbar .band { position: absolute; top: 0.8rem; height: 0.9rem; border-radius: 999px; background: color-mix(in srgb, var(--seed) 45%, transparent); outline: 1px solid var(--night); outline-offset: -1px; }
.bandbar .pred, .bandbar .obs { position: absolute; top: 0.62rem; transform: translateX(-50%); }
.bandbar .pred { width: 1.25rem; height: 1.25rem; border-radius: 50%; background: var(--night); border: 3px solid #fff; box-shadow: 0 2px 6px rgb(14 16 36 / 0.3); }
.bandbar .obs { width: 3px; height: 1.6rem; top: 0.45rem; background: var(--night); border-radius: 2px; }
.bandbar .axis { position: absolute; top: 2.05rem; font-size: 0.66rem; color: var(--ink-3); transform: translateX(-50%); }
.bandbar .axis.at-0 { transform: none; }
.bandbar .axis.at-4 { transform: translateX(-100%); }
.legend { display: flex; flex-wrap: wrap; gap: 0.3rem 1.2rem; margin: 0; padding: 0; list-style: none; font-size: 0.8rem; color: var(--ink-2); }
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend i { display: inline-block; flex: none; }
.legend .k-pred { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--night); }
.legend .k-band { width: 1.4rem; height: 0.55rem; border-radius: 999px; background: color-mix(in srgb, var(--seed) 45%, transparent); outline: 1px solid var(--night); outline-offset: -1px; }
.legend .k-obs { width: 3px; height: 0.9rem; background: var(--night); }
.flag { margin: 0.4rem 0 1rem; padding: 0.8rem 1rem; border-radius: 14px; background: #fff; border: 1px dashed #b9b3da; font-size: 0.88rem; color: var(--ink-2); }
.example-foot { margin: 0.9rem 0 0; font-size: 0.75rem; color: var(--ink-3); }

/* Positions on the log axis, computed as (log10 v + 2) / 4 */
.panel-midazolam .band { left: 65.9%; right: 13.9%; } .panel-midazolam .pred { left: 66.9%; } .panel-midazolam .obs { left: 68.1%; }
.panel-verapamil .band { left: 73.9%; right: 5.9%; } .panel-verapamil .pred { left: 74.9%; } .panel-verapamil .obs { left: 81.4%; }
.panel-diltiazem .band { left: 62.1%; right: 17.7%; } .panel-diltiazem .pred { left: 63.1%; }
.panel-warfarin .pred { left: 0.6%; } .panel-warfarin .obs { left: 19.5%; }
.bandbar .at-0 { left: 0; } .bandbar .at-1 { left: 25%; } .bandbar .at-2 { left: 50%; } .bandbar .at-3 { left: 75%; } .bandbar .at-4 { left: 100%; }

/* Sections below the fold: one rhythm, quiet then dense */
.section { max-width: var(--wide); margin: 0 auto; padding: 4.5rem 1.5rem 0; }
.section > h2 { font-size: clamp(1.8rem, 3.2vw, 2.6rem); margin: 0 0 1.4rem; max-width: 22ch; }
.section > p { max-width: var(--measure); color: var(--ink-2); }

.anatomy { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 3.5rem; margin: 0; }
.anatomy div { padding: 1.3rem 0 1.4rem; border-top: 1px solid var(--line); }
.anatomy dt { font-weight: 600; font-size: 1.08rem; display: flex; align-items: center; gap: 0.7rem; margin-bottom: 0.35rem; }
.anatomy dt::before { content: ""; width: 1.6rem; height: 3px; border-radius: 2px; background: var(--spectrum); flex: none; }
.anatomy dd { margin: 0; color: var(--ink-2); max-width: 32rem; }

#validation { position: relative; }
/* The curve family frames the coverage figure only; body text never sits on it */
#validation::before { content: ""; position: absolute; left: 52%; right: -20vw; top: 3rem; height: 22rem; z-index: -1; background: url("/strip.svg") left center / cover no-repeat; opacity: 0.6; }
@media (max-width: 860px) { #validation::before { display: none; } }
.evidence { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 3rem; align-items: start; }
.evidence ul { padding-left: 1.1rem; color: var(--ink-2); }
.evidence li { margin-bottom: 0.7rem; }
.coverage { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem 1.5rem; box-shadow: var(--shadow); }
.coverage h3 { margin: 0 0 1rem; font-size: 1rem; }
.meter { position: relative; height: 0.9rem; border-radius: 999px; background: #e3e0f0; margin: 0.4rem 0 0.3rem; }
.meter .held { position: absolute; top: 0; bottom: 0; left: 58%; right: 32%; border-radius: 999px; background: var(--iris); }
.meter .nominal { position: absolute; top: -0.3rem; bottom: -0.3rem; left: 50%; width: 2px; background: var(--night); }
.meter-scale { display: flex; justify-content: space-between; font-size: 0.7rem; color: var(--ink-3); }
.coverage p { font-size: 0.88rem; color: var(--ink-2); margin: 0.9rem 0 0; }
.sources { font-size: 0.85rem; color: var(--ink-3); }

.llm { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; }
.tools { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0; margin: 0 0 1rem; list-style: none; }
.tools li code { display: inline-block; padding: 0.3rem 0.7rem; border-radius: 999px; background: #fff; border: 1px solid var(--line); font-size: 0.8rem; }
pre {
  margin: 0.4rem 0 1.2rem; padding: 1rem 1.2rem; border-radius: 16px; overflow-x: auto;
  background: var(--night); color: #e9e6ff; line-height: 1.5;
}
.caution { font-size: 0.92rem; color: var(--ink-2); padding: 1rem 1.2rem; border-radius: 16px; background: #fff; border: 1px solid var(--line); }

table { border-collapse: separate; border-spacing: 0; width: 100%; max-width: 56rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
th, td { text-align: left; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
thead th { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); font-weight: 600; }
tbody th { font-weight: 500; }
td { color: var(--ink-2); }

/* Legal pages: one readable column in the same world */
.legal { max-width: 44rem; margin: 0 auto; padding: 1.5rem 1.5rem 0; }
.legal h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0.5rem 0 1rem; }
.legal h2 { font-size: 1.15rem; margin: 2.2rem 0 0.4rem; }
.legal p { color: var(--ink-2); }

@media (max-width: 860px) {
  .hero, .evidence, .llm { grid-template-columns: minmax(0, 1fr); gap: 2.2rem; }
  .hero { padding-top: 1rem; }
  .hero::before { inset: -4rem -30vw 45% -10%; opacity: 0.55; }
  .anatomy { grid-template-columns: minmax(0, 1fr); }
  .header-nav > a:not(.pill) { display: none; }
  .result dd { font-size: 1.2rem; }
  .result { gap: 0.2rem 1rem; }
  .site-header { padding: 1rem; }
  .wordmark span { font-size: 1.05rem; }
  .header-nav .pill-primary { font-size: 0.85rem; padding-left: 0.95rem; white-space: nowrap; }
  .header-nav .pill-primary::after { width: 1.7rem; height: 1.7rem; }
  th, td { padding: 0.7rem 0.75rem; font-size: 0.88rem; }
}

/* Phones: the hero's own button is one thumb below, so the header keeps only the wordmark */
@media (max-width: 520px) {
  .header-nav { display: none; }
  .plot .tick { font-size: 15px; }
  .bandbar .at-3 { display: none; }
  table, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr { padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  th, td { border-bottom: 0; padding: 0.25rem 1rem; }
  tbody th { font-weight: 600; padding-top: 0.5rem; }
  td::before { content: attr(data-col) ": "; color: var(--ink-3); font-size: 0.78rem; }
  td.empty { display: none; }
}

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