:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #f0efe9;
  --ink: #0e1a2b;
  --ink-2: #3a4658;
  --muted: #6b7482;
  --line: #e2e0d8;
  --accent: #0b7a75;
  --accent-ink: #ffffff;
  --accent-soft: #dff1ef;
  --coral: #d9573c;
  --gold: #b7862d;
  --ok: #1d7f4e;
  --warn: #a8641a;
  --bad: #b3372b;
  --shadow: 0 1px 2px rgba(14, 26, 43, .06), 0 8px 24px rgba(14, 26, 43, .06);
  --radius: 14px;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c131d; --surface: #111b28; --surface-2: #162233; --ink: #e8edf3; --ink-2: #c3ccd8;
    --muted: #8a96a6; --line: #22324a; --accent: #38b2a9; --accent-ink: #06201e; --accent-soft: #123532;
    --coral: #f07a5f; --gold: #d9a94e; --ok: #4cc38a; --warn: #e0a458; --bad: #f07a6a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c131d; --surface: #111b28; --surface-2: #162233; --ink: #e8edf3; --ink-2: #c3ccd8;
  --muted: #8a96a6; --line: #22324a; --accent: #38b2a9; --accent-ink: #06201e; --accent-soft: #123532;
  --coral: #f07a5f; --gold: #d9a94e; --ok: #4cc38a; --warn: #e0a458; --bad: #f07a6a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
code, pre { font-family: var(--mono); font-size: .88em; }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 820px; }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.2) blur(10px); border-bottom: 1px solid var(--line); }
.nav .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--ink); letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand svg { width: 28px; height: 28px; }
.nav-links { display: flex; gap: 20px; margin-left: auto; align-items: center; }
.nav-links a { color: var(--ink-2); font-size: 15px; }
.nav-links a.btn { color: var(--accent-ink); }
@media (max-width: 760px) { .nav-links a:not(.btn) { display: none; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; padding: 10px 18px; border-radius: 10px;
  font-size: 15px; cursor: pointer; transition: transform .08s ease, background .2s; font-family: inherit; }
.btn:hover { text-decoration: none; filter: brightness(1.05); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.small { padding: 7px 12px; font-size: 14px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* hero */
.hero { padding: 72px 0 40px; }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .hero-grid { grid-template-columns: 1fr; } .hero { padding-top: 40px; } }
.eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 5px 10px; border-radius: 999px; letter-spacing: .01em; }
h1, h2, h3 { font-family: var(--serif); letter-spacing: -.015em; line-height: 1.15; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: clamp(36px, 5.2vw, 58px); margin-top: 18px; }
h2 { font-size: clamp(28px, 3.4vw, 40px); }
h3 { font-size: 21px; }
.lede { font-size: 19px; color: var(--ink-2); max-width: 36em; }
.hero-cta { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }
.hero-note { margin-top: 14px; color: var(--muted); font-size: 14px; }
.hero-art { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 18px; box-shadow: var(--shadow); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; margin: 36px 0 8px; }
.stat { background: var(--surface); padding: 20px 22px; }
.stat b { display: block; font-family: var(--serif); font-size: 32px; font-weight: 600; letter-spacing: -.02em; }
.stat span { color: var(--muted); font-size: 14px; }
@media (max-width: 800px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.fine { color: var(--muted); font-size: 13px; }

section { padding: 64px 0; }
section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-head { max-width: 760px; margin-bottom: 32px; }
.section-head p { color: var(--ink-2); font-size: 18px; }

/* demo */
.demo { display: grid; grid-template-columns: 300px 1fr; gap: 24px; }
@media (max-width: 900px) { .demo { grid-template-columns: 1fr; } }
.samples { display: grid; gap: 12px; }
.sample { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; color: var(--ink);
  font: inherit; }
.sample img { border-radius: 8px; border: 1px solid var(--line); background: #fff; aspect-ratio: 1.1; object-fit: cover; }
.sample b { font-size: 14px; display: block; }
.sample span { font-size: 13px; color: var(--muted); line-height: 1.35; display: block; }
.sample[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.drop { border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted);
  background: var(--surface); cursor: pointer; font-size: 14px; }
.drop.hover { border-color: var(--accent); color: var(--accent); }
.drop input { display: none; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-body { padding: 18px; }
.result-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
@media (max-width: 1000px) { .result-grid { grid-template-columns: 1fr; } }
.figure-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; border-radius: 999px; padding: 3px 10px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 35%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.muted { color: var(--muted); }
.error { color: var(--bad); }
.checks li { margin: 4px 0; }
.hide { display: none !important; }

/* steps & cards */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; counter-reset: step; }
@media (max-width: 900px) { .steps { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .steps { grid-template-columns: 1fr; } }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.step::before { counter-increment: step; content: counter(step); display: inline-grid; place-items: center; width: 28px; height: 28px;
  border-radius: 8px; background: var(--accent-soft); color: var(--accent); font-weight: 700; margin-bottom: 10px; }
.step h3 { font-family: var(--sans); font-size: 17px; font-weight: 650; letter-spacing: 0; }
.step p { margin: 0; color: var(--ink-2); font-size: 15px; }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
section.alt .card, section.alt .step { background: var(--bg); }
.card h3 { font-family: var(--sans); font-size: 17px; font-weight: 650; letter-spacing: 0; }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
ul.ticks { list-style: none; padding: 0; margin: 0; }
ul.ticks li { padding-left: 28px; position: relative; margin: 10px 0; color: var(--ink-2); }
ul.ticks li::before { content: ""; position: absolute; left: 0; top: 6px; width: 16px; height: 16px; border-radius: 5px;
  background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='%230b7a75' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }

/* code */
.code { background: #0f1b2a; color: #dce6f2; border-radius: 12px; overflow: hidden; border: 1px solid #1f2f45; }
.code-tabs { display: flex; gap: 2px; padding: 6px; background: #0b1522; border-bottom: 1px solid #1f2f45; }
.code-tabs button { background: transparent; border: 0; color: #9fb0c5; font: 600 13px var(--sans); padding: 6px 12px; border-radius: 8px; cursor: pointer; }
.code-tabs button[aria-selected="true"] { background: #1a2a40; color: #fff; }
.code pre { margin: 0; padding: 18px; overflow-x: auto; line-height: 1.55; }
.code .c { color: #7f93ab; }
.code .s { color: #9fe0b0; }
.code .k { color: #f5b971; }
pre.block { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px; overflow-x: auto; }

/* pricing */
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 960px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 26px; display: flex; flex-direction: column; }
.plan.featured { border: 2px solid var(--accent); box-shadow: var(--shadow); }
.plan h3 { font-family: var(--sans); font-size: 18px; font-weight: 700; letter-spacing: 0; margin-bottom: 4px; }
.plan .price { font-family: var(--serif); font-size: 42px; font-weight: 600; letter-spacing: -.02em; margin: 10px 0 0; }
.plan .price small { font-family: var(--sans); font-size: 15px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
.plan .sub { color: var(--muted); font-size: 14px; margin-bottom: 16px; }
.plan ul { flex: 1; }
.plan .btn { margin-top: 18px; width: 100%; }
.currency { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 22px; }
.currency button { background: var(--surface); border: 0; padding: 7px 14px; font: 600 13px var(--sans); color: var(--ink-2); cursor: pointer; }
.currency button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }

/* faq */
details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; margin: 10px 0; }
details summary { cursor: pointer; font-weight: 600; }
details p { color: var(--ink-2); margin: 10px 0 0; }

footer { padding: 40px 0 60px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
footer .wrap { display: flex; gap: 20px; flex-wrap: wrap; justify-content: space-between; }
footer a { color: var(--ink-2); }

/* docs */
.docs { display: grid; grid-template-columns: 220px 1fr; gap: 40px; padding-top: 40px; padding-bottom: 80px; }
@media (max-width: 860px) { .docs { grid-template-columns: 1fr; } .docs nav { position: static !important; } }
.docs nav { position: sticky; top: 84px; align-self: start; font-size: 14px; }
.docs nav a { display: block; color: var(--ink-2); padding: 5px 0; }
.docs h2 { margin-top: 48px; padding-top: 8px; }
.docs h2:first-child { margin-top: 0; }
.docs h3 { margin-top: 28px; font-family: var(--sans); font-size: 18px; letter-spacing: 0; font-weight: 650; }
.docs p, .docs li { color: var(--ink-2); }
.callout { border-left: 3px solid var(--accent); background: var(--accent-soft); padding: 12px 16px; border-radius: 0 10px 10px 0; color: var(--ink); }
.keybox { font-family: var(--mono); font-size: 15px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 14px; word-break: break-all; }

/* forms (contact, academic access, admin) */
.form { display: grid; gap: 16px; margin-top: 24px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: 14px; color: var(--ink); }
.field .hint { font-size: 13px; color: var(--muted); }
.field input, .field textarea, .field select {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; width: 100%; }
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; border-color: var(--accent); }
.form .row2 { display: grid; gap: 16px; grid-template-columns: 1fr 1fr; }
@media (max-width: 640px) { .form .row2 { grid-template-columns: 1fr; } }
.notice { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent);
  padding: 14px 18px; border-radius: 0 10px 10px 0; color: var(--ink); margin: 18px 0; }
.notice.bad { border-left-color: var(--bad); background: color-mix(in srgb, var(--bad) 8%, transparent); }
.inbox-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; margin: 12px 0; background: var(--surface); }
.inbox-item .meta { font-size: 13px; color: var(--muted); }
.inbox-item .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.inbox-item .actions input { width: 90px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); }

/* clickable cards (trial library teasers) */
.card.link-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s, transform .15s; }
.card.link-card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card.link-card h3 { color: var(--accent); }

/* site footer (every page) */
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 20px 28px; width: 100%; }
.footer-grid h4 { margin: 0 0 8px; font-size: 13px; color: var(--ink); text-transform: uppercase; letter-spacing: .05em; }
.footer-grid a { display: block; margin: 4px 0; }

/* API docs on small screens: code and tables scroll inside their own box */
.docs > * { min-width: 0; }
pre.block { overflow-x: auto; max-width: 100%; }
@media (max-width: 860px) { .docs table { display: block; overflow-x: auto; } }

/* by hand vs TrialCurve */
.vs-table { width: 100%; max-width: 860px; }
.vs-table th .fine { display: block; font-weight: 400; text-transform: none; letter-spacing: 0; }
.vs-table td:nth-child(3), .vs-table th:nth-child(3) { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.vs-table td:nth-child(3) b { color: var(--ink); }
.vs-table td:nth-child(2) { color: var(--muted); }

/* demo results on small screens: nothing may be wider than the panel */
.demo > *, .result-grid > * { min-width: 0; }
.figure-box img, .figure-box svg { display: block; max-width: 100%; height: auto; }
.kv dd { min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- phones */
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 10px; width: 42px; height: 38px;
  align-items: center; justify-content: center; flex-direction: column; gap: 4px; cursor: pointer; padding: 0; }
.menu-btn span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .15s, opacity .15s; }
@media (max-width: 760px) {
  .nav .wrap { gap: 10px; }
  .menu-btn { display: inline-flex; order: 3; }
  .nav-links { gap: 10px; }
  .nav-links a.btn { padding: 8px 12px; font-size: 14px; }
  .nav.open .nav-links { position: absolute; top: 64px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line); padding: 6px 20px 16px; box-shadow: var(--shadow); }
  .nav.open .nav-links a:not(.btn) { display: block; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 16px; color: var(--ink); }
  .nav.open .nav-links a.btn { margin-top: 12px; text-align: center; }
  .nav.open .menu-btn span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .nav.open .menu-btn span:nth-child(2) { opacity: 0; }
  .nav.open .menu-btn span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
}
@media (max-width: 600px) {
  table { font-size: 13.5px; }
  th, td { padding: 7px 6px; overflow-wrap: anywhere; }
  th { font-size: 11px; letter-spacing: .02em; }
  pre, pre.block, .code pre { font-size: 12px; }
  /* wide tables: one card per row, each value labelled with its column */
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack thead { display: none; }
  table.stack tr { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; margin: 0 0 10px; background: var(--surface); }
  table.stack td { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; border: 0; padding: 5px 0; text-align: right; }
  table.stack td::before { content: attr(data-label); color: var(--muted); font-size: 12.5px; text-align: left; flex: 0 0 auto; max-width: 55%; }
  table.stack td:first-child { display: block; text-align: left; font-weight: 650; color: var(--ink); padding-bottom: 6px;
    border-bottom: 1px solid var(--line); margin-bottom: 4px; }
  table.stack td:first-child::before { content: none; }
  table.stack td:empty { display: none; }
}
@media (max-width: 600px) {
  th { overflow-wrap: normal; word-break: normal; hyphens: auto; }
  td.num, th.num { overflow-wrap: normal; white-space: nowrap; }
  table.no-stack td:first-child { white-space: nowrap; }
  td { overflow-wrap: break-word; }
  td a { overflow-wrap: anywhere; }
  /* long secondary text inside table cells (e.g. paper titles in the trial index): two lines */
  td .fine { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
}
@media (max-width: 600px) {
  th.num { white-space: normal; }
  /* card rows: label on the left, the whole value (text + units) kept together on the right */
  table.stack td { display: block; position: relative; padding: 5px 0 5px 46%; text-align: right; min-height: 1.6em; }
  table.stack td::before { position: absolute; left: 0; top: 5px; max-width: 44%; }
  table.stack td:first-child { padding-left: 0; }
}
@media (max-width: 600px) {
  th, td { padding-left: 5px; padding-right: 5px; }
  td:not(.num) { overflow-wrap: anywhere; }            /* long DOIs, citations, gene names */
  table.no-stack thead th { overflow-wrap: anywhere; } /* arm names in landmark-table headers */
}
