/* CohortLoom site. System fonts only; no external assets. Light and dark via tokens. */
:root {
  --bg: #f7f6f2; --surface: #ffffff; --surface-2: #efede6; --text: #1a1a18; --muted: #55534d; --line: #d9d6cc;
  --accent: #1f5f7a; --accent-ink: #ffffff; --accent-soft: #e2eef3; --thread: #b8642a; --thread-soft: #f6e6d8;
  --good: #2b7a4b; --good-bg: #e2f1e6; --warn: #8a5d00; --warn-bg: #faefd2;
  --mark: #fde7b0; --focus: #c2410c;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131413; --surface: #1d1e1c; --surface-2: #272825; --text: #ecebe5; --muted: #aaa79d; --line: #3a3a35;
    --accent: #7fc0da; --accent-ink: #0d1a20; --accent-soft: #1a2c34; --thread: #e8a26b; --thread-soft: #3a2a1d;
    --good: #80d1a1; --good-bg: #1d3226; --warn: #f0c25a; --warn-bg: #392e13;
    --mark: #5a4614; --focus: #fdba74;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #131413; --surface: #1d1e1c; --surface-2: #272825; --text: #ecebe5; --muted: #aaa79d; --line: #3a3a35;
  --accent: #7fc0da; --accent-ink: #0d1a20; --accent-soft: #1a2c34; --thread: #e8a26b; --thread-soft: #3a2a1d;
  --good: #80d1a1; --good-bg: #1d3226; --warn: #f0c25a; --warn-bg: #392e13;
  --mark: #5a4614; --focus: #fdba74;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }
img, svg { max-width: 100%; }
code, pre, .mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
code { font-size: .88em; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -9999px; top: 8px; background: var(--surface); color: var(--text); padding: 8px 12px; border: 2px solid var(--focus); z-index: 10; }
.skip:focus { left: 8px; }

/* header */
.site-head { border-bottom: 1px solid var(--line); background: var(--surface); }
.site-head .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-top: 12px; padding-bottom: 12px; }
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 1.12rem; color: var(--text); text-decoration: none; letter-spacing: -.01em; }
.brand svg { width: 26px; height: 26px; flex: none; }
.nav { margin-left: auto; }
.nav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 0; padding: 0; }
.nav a { color: var(--text); text-decoration: none; font-size: .95rem; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--line); }
.nav a[aria-current="page"] { border-bottom-color: var(--thread); }
.theme-toggle { background: none; border: 1px solid var(--line); color: var(--text); border-radius: 999px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.theme-toggle[hidden] { display: none; }

.notice { background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: .9rem; }
.notice .wrap { padding-top: 8px; padding-bottom: 8px; }

main { display: block; padding-bottom: 64px; }
h1 { font-size: clamp(1.8rem, 4.2vw, 2.7rem); line-height: 1.15; letter-spacing: -.02em; margin: 0 0 14px; }
h2 { font-size: 1.45rem; line-height: 1.25; margin: 48px 0 14px; letter-spacing: -.01em; }
h3 { font-size: 1.08rem; margin: 0 0 6px; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 22px; margin: 0 0 14px; }
li { margin: 4px 0; }
.lede { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.prose { max-width: 46em; }

/* hero with a woven-thread motif (pure CSS) */
.hero { position: relative; padding: 56px 0 44px; border-bottom: 1px solid var(--line); overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 46px, color-mix(in srgb, var(--accent) 10%, transparent) 46px 48px),
    repeating-linear-gradient(0deg, transparent 0 46px, color-mix(in srgb, var(--thread) 12%, transparent) 46px 48px),
    var(--bg); }
.hero .wrap > * { position: relative; }
.hero .eyebrow { font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--thread); margin-bottom: 10px; }
.page-head { padding: 40px 0 8px; }

.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); border: 2px solid var(--accent); border-radius: 8px; padding: 9px 18px; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: transparent; color: var(--accent); }
.btn[disabled] { opacity: .6; cursor: progress; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0 6px; }

.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.card p:last-child, .card ul:last-child { margin-bottom: 0; }
.card.accent { border-top: 4px solid var(--thread); }

.steps { list-style: none; padding: 0; counter-reset: s; display: grid; gap: 12px; }
.steps > li { counter-increment: s; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px 16px 62px; margin: 0; }
.steps > li::before { content: counter(s); position: absolute; left: 16px; top: 15px; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; }

.callout { border-left: 4px solid var(--thread); background: var(--thread-soft); border-radius: 8px; padding: 12px 16px; margin: 18px 0; }
.callout p:last-child { margin-bottom: 0; }
.draft-banner { background: var(--warn-bg); color: var(--warn); border: 1px solid currentColor; border-radius: 8px; padding: 10px 14px; font-weight: 700; margin: 0 0 20px; }

/* pricing */
.tiers { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 18px; }
.tier { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.tier h3 { font-size: 1.1rem; }
.tier .price { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 4px 0 0; }
.tier .unit { color: var(--muted); font-size: .9rem; margin-bottom: 10px; }
.tier .founding { font-size: .9rem; background: var(--good-bg); color: var(--good); border-radius: 6px; padding: 4px 8px; margin-bottom: 10px; }
.tier ul { font-size: .95rem; flex: 1; }
.tier form { margin: 0; }
.tier .btn { width: 100%; text-align: center; }
.slots { font-weight: 600; }
.form-status { min-height: 1.6em; font-size: .92rem; }
.form-status.error { color: var(--focus); }

/* answer-key example (also the typing demo). Overflow-safe: grid tracks are minmax(0, ...) so long
   lines can never widen the page; the note wraps; the JSON scrolls sideways inside its own panel only. */
.example { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; max-width: 100%; }
@media (min-width: 900px) { .example { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); } }
.example figure { margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; min-width: 0; max-width: 100%; overflow: hidden; }
.example figcaption { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; font-size: .82rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.example pre { margin: 0; max-width: 100%; font-size: .84rem; line-height: 1.5; }
.example .note { font-size: .86rem; white-space: pre-wrap; overflow-wrap: anywhere; overflow-x: auto; }
.example .json { white-space: pre; overflow-x: auto; max-height: 28em; overflow-y: auto; background: var(--surface-2); border-radius: 8px; padding: 10px 12px; font-size: .78rem; }
.example .json code { background: none; padding: 0; font-size: inherit; }
mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 1px; }
.hl-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-weight: 600; text-transform: none; letter-spacing: 0; font-size: .85rem; color: var(--text); cursor: pointer; }
.example:has(.hl-toggle input:not(:checked)) mark.ev { background: transparent; box-shadow: none; }

/* forms */
form.stack { display: grid; gap: 14px; max-width: 34em; }
label { font-weight: 600; display: block; margin-bottom: 4px; }
.hint { font-weight: 400; color: var(--muted); font-size: .88rem; }
input[type=text], input[type=email], textarea, form.stack select { width: 100%; font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--muted); border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 8em; resize: vertical; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* wait-list (request 139): consent checkbox beside its label; visually hidden text for repeated CTAs */
.consent { display: flex; align-items: flex-start; gap: 10px; }
.consent input { width: 1.15em; height: 1.15em; margin: 3px 0 0; flex: none; accent-color: var(--accent); }
.consent label { font-weight: 400; margin: 0; }
.waitlist-inline { margin-top: 28px; scroll-margin-top: 16px; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tablewrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
th { font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }

/* footer */
.site-foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .9rem; padding: 28px 0 36px; }
.site-foot .cols { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.site-foot ul { list-style: none; padding: 0; margin: 0; }
.site-foot a { color: var(--text); }
.site-foot h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; border: 0; padding: 0; }
address { font-style: normal; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav { margin-left: 0; width: 100%; }
  .hero { padding: 36px 0 30px; }
  .steps > li { padding-left: 56px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }

/* labelled spans, key list, typing demo (request 138) */
:root { --c1: #1a6e9e; --c2: #b8642a; --c1-soft: #dbeaf3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --c1: #3d9acb; --c2: #c97a3c; --c1-soft: #17303d; } }
:root[data-theme="dark"] { --c1: #3d9acb; --c2: #c97a3c; --c1-soft: #17303d; }
mark.ev { --box: var(--c1); -webkit-box-decoration-break: clone; box-decoration-break: clone; }
mark.ev.t-medication { --box: var(--c2); }
mark.ev.t-lab { --box: var(--good); }
mark.ev.t-time_point, mark.ev.t-visit_level { --box: var(--muted); }
mark.ev.boxed { box-shadow: 0 0 0 1.5px var(--box); }
mark.ev.typing { background: transparent; }
mark.ev.linked, mark.ev:focus-visible { box-shadow: 0 0 0 3px var(--box); background: var(--c1-soft); outline: none; }
mark.ev.pop { animation: box-pop .45s ease-out; }
@keyframes box-pop { from { box-shadow: 0 0 0 6px transparent; } to { box-shadow: 0 0 0 1.5px var(--box); } }
.keylist { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; font-size: .88rem; }
.keylist li { margin: 0; min-width: 0; border-left: 3px solid var(--c1); border-radius: 6px; background: var(--bg); }
.keylist li.t-medication { border-left-color: var(--c2); }
.keylist li.t-lab { border-left-color: var(--good); }
.keylist li.t-time_point, .keylist li.t-visit_level { border-left-color: var(--muted); }
.keylist li.pending { visibility: hidden; }
.keylist li.fresh { animation: key-in .4s ease-out; }
@keyframes key-in { from { opacity: 0; transform: translateX(6px); } to { opacity: 1; transform: none; } }
.kentry { display: block; padding: 5px 9px; color: var(--text); text-decoration: none; overflow-wrap: anywhere; border-radius: 0 6px 6px 0; }
.kentry:hover, .keylist li.linked .kentry, .kentry.linked { background: var(--c1-soft); }
.ktype { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); min-width: 7.5em; }
.koff { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .8rem; color: var(--muted); white-space: nowrap; }
.rawkey summary { cursor: pointer; font-size: .88rem; font-weight: 600; margin-bottom: 6px; }
.typing-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 12px; }
.typing-controls[hidden] { display: none; }
.small-btn { padding: 5px 12px; font-size: .9rem; }
.speed { display: inline-flex; align-items: center; gap: 6px; margin: 0; font-size: .9rem; }
.speed select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--muted); border-radius: 6px; padding: 3px 6px; }

/* pipeline strip */
.pipeline { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); counter-reset: p; }
.pipeline li { counter-increment: p; margin: 0; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-top: 3px solid var(--thread); border-radius: 10px; padding: 10px 12px; font-size: .9rem; }
.pipeline li strong { display: block; }
.pipeline li strong::before { content: counter(p) ". "; color: var(--thread); }
.pipeline li span { color: var(--muted); }

/* tuning dashboard: inline SVG drawn at build time */
.illus-banner { background: var(--warn-bg); color: var(--warn); border: 2px solid currentColor; border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; }
.dash-grid, .dist-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
.dist-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.chart-fig { margin: 0; min-width: 0; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.chart-fig figcaption { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.chart-fig details { font-size: .85rem; margin-top: 6px; }
.chart-fig summary { cursor: pointer; }
svg.chart { display: block; width: 100%; height: auto; max-width: 100%; }
svg.chart text { font: 13px system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
svg.chart .axis { fill: var(--muted); font-size: 11px; }
svg.chart .label { fill: var(--text); }
svg.chart .strong { font-weight: 700; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .baseline { stroke: var(--muted); stroke-width: 1; }
svg.chart .bar-line { stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 5 4; }
svg.chart .s1-line { fill: none; stroke: var(--c1); stroke-width: 2; stroke-linejoin: round; }
svg.chart .s1-dot { fill: var(--c1); stroke: var(--surface); stroke-width: 2; }
svg.chart .hit { fill: transparent; }
svg.chart .track { fill: var(--surface-2); }
svg.chart .s1-fill { fill: var(--c1); }
svg.chart .s2-fill { fill: var(--c2); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .9rem; color: var(--muted); }
.legend .key { display: inline-block; width: 12px; height: 12px; border-radius: 3px; }
.legend .key.s1 { background: var(--c1); }
.legend .key.s2 { background: var(--c2); margin-left: 8px; }
.heatmap td { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.heatmap th[scope="col"] { min-width: 6.5em; }
.heat-0 { background: color-mix(in srgb, var(--c1) 4%, transparent); }
.heat-1 { background: color-mix(in srgb, var(--c1) 12%, transparent); }
.heat-2 { background: color-mix(in srgb, var(--c1) 20%, transparent); }
.heat-3 { background: color-mix(in srgb, var(--c1) 30%, transparent); }
.heat-4 { background: color-mix(in srgb, var(--c1) 42%, transparent); }
@media (prefers-reduced-motion: reduce) { mark.ev.pop, .keylist li.fresh { animation: none; } }
