/* CourseBend site v3.
   Dark theme = Brand Spec v2 exactly (Midnight, Gold, Orange, Sage, grain + glow).
   Light theme "Homeroom" = David's Nov 3 2026 direction: more colourful, high school, friendly.
   Nov 5 2026: light-theme accent is green (David's call, departs from Spec 3.6 pending his and Bobby's decision):
   #0E9468 large type, #0B7A5A small text, #45C79B fills. Header and footer always use the dark tokens, on every page and in both themes.
   The subject colours are derived from spec tokens where one exists (Social Studies from Gold,
   English from Orange, Science from Sage) and added where none does. Type stays Newsreader + Hanken.
   Every text pairing below was computed at AA or better. */

:root {
  --cb-midnight: #131722; --cb-midnight-raised: #232630;
  --cb-gold: #D9A441; --cb-gold-deep: #7A5210;
  --cb-orange: #E8722C; --cb-sage: #6FB8A8;
  --cb-paper: #F5F3EE; --cb-white: #FFFFFF;
  --cb-muted: #929294; --cb-muted-light: #5B5750; --cb-rule: #DDD8CE;
  --cb-glow: rgba(217,164,65,.07);
  --cb-font-display: "Newsreader", Georgia, serif;
  --cb-font-ui: "Hanken Grotesk", system-ui, Arial, sans-serif;

  /* Binder colours: fill / deep text on light */
  --math: #6C9BFF;    --math-d: #1F4FBF;
  --science: #45C79B; --science-d: #0B6B50;
  --english: #FF8A5C; --english-d: #B23A10;
  --social: #FFC93C;  --social-d: #7A5210;
  --arts: #B48CFF;    --arts-d: #5A2FC2;
  --phe: #FF8FB8;     --phe-d: #AD1F5C;

  --gutter: clamp(16px, 4vw, 40px);
  --max: 1160px;
  --radius: 18px;
  --ease-out: cubic-bezier(.16,1,.3,1);
  --z-nav: 30;
}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #FBF8F1; --surface: #FFFFFF; --surface-2: #F3EEE3;
  --text: #131722; --text-2: #5B5750;
  --line: rgba(19,23,34,.14); --line-2: rgba(19,23,34,.9);
  --accent: #0B7A5A; --mark: #131722; --bend: #0E9468;
  --hl: transparent; --wash: #45C79B; --comm: #45C79B;
  --btn-bg: #45C79B; --btn-fg: #131722; --btn-line: #131722; --btn-hover: #62D3AC;
  --shadow: 5px 5px 0 #131722; --shadow-s: 3px 3px 0 #131722;
  --card-line: 1.5px solid #131722;
  --nav-bg: rgba(251,248,241,.88);
  --tint: 20%;
  --ground-img: none;
}

[data-theme="dark"] { --wash: var(--social); --comm: var(--cb-gold); }
[data-theme="dark"], .nav, footer, .comm {
  color-scheme: dark;
  --bg: var(--cb-midnight); --surface: var(--cb-midnight-raised); --surface-2: #1B1F2A;
  --text: var(--cb-paper); --text-2: var(--cb-muted);
  --line: rgba(245,243,238,.09); --line-2: rgba(245,243,238,.28);
  --accent: var(--cb-gold); --mark: var(--cb-gold); --bend: var(--cb-gold);
  --hl: transparent;
  --btn-bg: var(--cb-gold); --btn-fg: var(--cb-midnight); --btn-line: var(--cb-gold); --btn-hover: #E3B45A;
  --shadow: none; --shadow-s: none;
  --card-line: 1px solid rgba(245,243,238,.09);
  --nav-bg: rgba(19,23,34,.97);
  --tint: 12%;
  --ground-img: url("/cb-grain.svg"), radial-gradient(ellipse 80% 70% at 18% 0%, var(--cb-glow), transparent 70%);
  /* On dark, deep text swaps to the fill value (all at least 5.5:1 on Raised) */
  --math-d: var(--math); --science-d: var(--science); --english-d: var(--english);
  --social-d: var(--social); --arts-d: var(--arts); --phe-d: var(--phe);
}

.s-math { --c: var(--math); --d: var(--math-d); }
.s-science { --c: var(--science); --d: var(--science-d); }
.s-english { --c: var(--english); --d: var(--english-d); }
.s-social { --c: var(--social); --d: var(--social-d); }
.s-arts { --c: var(--arts); --d: var(--arts-d); }
.s-phe { --c: var(--phe); --d: var(--phe-d); }
.s-brand { --c: var(--wash); --d: var(--accent); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0; color: var(--text); background-color: var(--bg);
  background-image: var(--ground-img); background-size: 180px 180px, 100% 100vh; background-repeat: repeat, no-repeat;
  font: 400 16px/1.5 var(--cb-font-ui); overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--wash); color: var(--cb-midnight); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 16px; top: -60px; z-index: 60; background: var(--btn-bg); color: var(--btn-fg); padding: 10px 14px; border-radius: 8px; font-weight: 500; text-decoration: none; }
.skip:focus { top: 16px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.wrap.narrow { max-width: 760px; }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Type ---------- */
h1, h2, h3, h4 { font-family: var(--cb-font-display); font-weight: 500; margin: 0; text-wrap: balance; }
h1 { font-size: clamp(44px, 7.4vw, 88px); line-height: 1.02; letter-spacing: -.015em; }
h1.page { font-size: clamp(40px, 5.8vw, 68px); }
h2 { font-size: clamp(32px, 4.2vw, 48px); line-height: 1.06; letter-spacing: -.015em; }
h3 { font-size: 22px; line-height: 1.2; }
h1 em, h2 em {
  font-style: italic; padding: 0 .08em; margin: 0 -.04em; color: var(--bend);
  background: linear-gradient(transparent 58%, var(--hl) 58%, var(--hl) 92%, transparent 92%);
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}
.bn { font-style: italic; color: var(--accent); }
.nm { font-family: var(--cb-font-display); font-weight: 500; }
.flag .bn { color: inherit; }
.eyebrow { font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.lede { font: 400 clamp(19px, 2vw, 22px)/1.45 var(--cb-font-display); color: var(--text); margin: 0; max-width: 40em; }
.sub { color: var(--text-2); margin: 0; max-width: 42em; }
.prose p, .prose li { font: 400 17px/1.6 var(--cb-font-display); }
.prose p { margin: 0 0 1em; max-width: 65ch; }
.fine { font-size: 13px; line-height: 1.5; color: var(--text-2); margin: 0; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px; border-radius: 999px; cursor: pointer;
  font: 500 14px/1 var(--cb-font-ui); text-decoration: none;
  border: 1.5px solid var(--btn-line); box-shadow: var(--shadow-s);
  transition: transform .15s var(--ease-out), box-shadow .15s var(--ease-out), background-color .2s;
}
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); }
.btn-primary:hover { background: var(--btn-hover); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--line-2); }
[data-theme="light"] .btn:hover { transform: translate(-1px,-1px); box-shadow: 4px 4px 0 #131722; }
[data-theme="light"] .btn:active { transform: translate(2px,2px); box-shadow: 1px 1px 0 #131722; }
.btn[disabled] { opacity: .7; cursor: progress; }
.btn svg { width: 16px; height: 16px; }
.tlink { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; min-height: 44px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ---------- Nav ---------- */
.nav, footer { color: var(--text); }
[data-theme="light"] .nav .btn:hover, [data-theme="light"] .nav .btn:active { transform: none; box-shadow: none; }
.nav { position: sticky; top: 0; z-index: var(--z-nav); background: var(--nav-bg); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid var(--line); }
.nav-in { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: block; flex: none; border-radius: 6px; padding: 4px 0; }
.lockup { height: 28px; width: auto; }
.lockup .ls { stroke: var(--mark); }
.lockup .lw { fill: var(--text); }
.lockup .lb { fill: var(--accent); }
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a:not(.btn) { font: 500 14px/1 var(--cb-font-ui); color: var(--text-2); text-decoration: none; padding: 0 10px; min-height: 44px; display: inline-flex; align-items: center; border-radius: 8px; transition: color .2s; white-space: nowrap; }
.nav-links a:not(.btn):hover { color: var(--text); }
.nav-links a[aria-current="page"]:not(.btn) { color: var(--text); text-decoration: underline; text-decoration-thickness: 3px; text-decoration-color: var(--cb-gold); text-underline-offset: 6px; }
.nav-end { display: flex; align-items: center; gap: 8px; flex: none; }
.nav-end .btn { min-height: 44px; padding: 0 18px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--text); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
[data-theme="light"] .i-sun, [data-theme="dark"] .i-moon { display: none; }
@media (max-width: 1080px) {
  .menu-btn { display: inline-grid; }
  .nav-links { display: none; position: absolute; left: 0; right: 0; top: 100%; flex-direction: column; align-items: stretch; gap: 0; background: var(--bg); border-bottom: 1px solid var(--line); padding: 8px var(--gutter) 16px; }
  .nav-links.open { display: flex; }
  .nav-links a:not(.btn) { min-height: 48px; font-size: 16px; padding: 0 4px; border-bottom: 1px solid var(--line); }
}
@media (max-width: 520px) { .nav-end .btn { display: none; } .lockup { height: 24px; } }

/* ---------- Layout ---------- */
.sec { padding: clamp(56px, 8vw, 104px) 0; }
.sec.tight { padding-top: 0; }
.band { background: var(--surface-2); border-block: 1px solid var(--line); }
.head { display: grid; gap: 14px; margin-bottom: clamp(28px, 4vw, 48px); max-width: 780px; }
.page-head { padding-block: clamp(48px, 7vw, 88px) clamp(24px, 4vw, 40px); display: grid; gap: 18px; }
.grid { display: grid; gap: 20px; }
.g2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 900px) { .g3, .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 640px) { .g2, .g3, .g4 { grid-template-columns: minmax(0,1fr); } }

/* ---------- Cards and binder tabs ---------- */
.card { position: relative; background: var(--surface); border: var(--card-line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card h3 { margin-bottom: 2px; }
.card p { margin: 0; color: var(--text-2); }
.card.flat { box-shadow: none; }
.card.fill { background: color-mix(in srgb, var(--c, var(--wash)) var(--tint), var(--surface)); }
.card.solid { background: var(--c); color: var(--cb-midnight); border-color: var(--cb-midnight); }
.card.solid p { color: var(--cb-midnight); }
.tabbed { margin-top: 22px; border-top-left-radius: 0; }
.tab {
  position: absolute; left: -1.5px; bottom: 100%; padding: 6px 14px 5px; background: var(--c, var(--wash)); color: var(--cb-midnight);
  border: 1.5px solid var(--cb-midnight); border-bottom: 0; border-radius: 10px 10px 0 0;
  font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .04em; white-space: nowrap;
}
[data-theme="dark"] .tab { border-color: transparent; left: -1px; }
.stamp { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; justify-self: start; padding: 3px 10px; border: 1.5px solid currentColor; border-radius: 999px; font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .02em; color: var(--d, var(--accent)); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); flex: none; border: 1.5px solid var(--cb-midnight); }
[data-theme="dark"] .dot { border-color: transparent; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--line); }
.hero canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero .wrap { position: relative; padding-block: clamp(48px, 8vw, 104px) clamp(48px, 7vw, 88px); display: grid; gap: 22px; }
.hero h1 { max-width: 11em; }
.hero .lede { max-width: 30em; }
@media (max-width: 899px) { .hero .wrap { padding-top: 158px; } .hero h1 { max-width: none; } }
.bends { position: relative; }
.bend-bar { display: grid; gap: 8px; max-width: 620px; margin-top: 6px; }
.bend-bar label { font-weight: 500; }
.bend-in { display: flex; gap: 8px; padding: 6px; background: var(--surface); border: var(--card-line); border-radius: 999px; box-shadow: var(--shadow-s); }
.bend-in input { flex: 1; min-width: 0; min-height: 44px; padding: 0 14px; border: 0; background: transparent; outline: none; font-size: 16px; }
.bend-in input::placeholder { color: var(--text-2); }
.bend-in:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }
.bend-in .btn { box-shadow: none; flex: none; }
.status { min-height: 1.5em; font-size: 14px; color: var(--text-2); margin: 0; }
.status.bad { color: #B42A2A; }
[data-theme="dark"] .status.bad { color: #F26D6D; }
.bends { margin-top: 8px; }
.bends[hidden] { display: none; }
.bend-card a.cite { font-size: 13px; color: var(--d); text-decoration: underline; text-underline-offset: 3px; overflow-wrap: anywhere; }
.bend-card p { color: var(--text); font: 400 17px/1.45 var(--cb-font-display); }

/* ---------- Student Model network ---------- */
.net { position: relative; background: var(--surface); border: var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.net canvas { background: #131722; display: block; width: 100%; height: clamp(500px, min(62vw, 76vh), 760px); touch-action: pan-y; }
.net-ui { display: flex; flex-direction: column; gap: 14px; align-items: stretch; padding: 14px 18px 18px; border-top: 1px solid var(--line); }
.scrub { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.scrub input { flex: 1; min-width: 80px; accent-color: var(--accent); }
.scrub button { min-height: 36px; padding: 0 14px; border-radius: 999px; background: transparent; border: 1px solid var(--line-2); cursor: pointer; font-size: 13px; }
.net-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 190px)); gap: 12px; justify-content: center; width: 100%; }
.net-chip { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 64px; padding: 10px 14px 11px; border-radius: 18px; border: 1.5px solid #131722; background: var(--pc); color: #131722; cursor: pointer; text-align: center; box-shadow: var(--shadow-s); transition: transform .15s var(--ease-out); }
[data-theme="dark"] .net-chip { border-color: transparent; }
.net-chip:hover { transform: translateY(-1px); }
.net-chip b { display: block; font: italic 500 21px/1.1 var(--cb-font-display); letter-spacing: -.005em; }
.net-chip span { display: block; font: 600 11px/1.2 var(--cb-font-ui); letter-spacing: .08em; text-transform: uppercase; }
.net-chip[aria-pressed="true"] { outline: 3px solid var(--pc); outline-offset: 3px; }
@media (max-width: 520px) { .net-chips { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .net-chip { padding: 9px 4px 10px; } .net-chip b { font-size: 15px; } .net-chip span { font-size: 10px; letter-spacing: .05em; } }
.tip { position: absolute; z-index: 2; max-width: 240px; padding: 10px 12px; border-radius: 10px; background: var(--cb-paper); color: var(--cb-midnight); font-size: 13px; line-height: 1.4; pointer-events: none; opacity: 0; transform: translate(-50%, calc(-100% - 12px)); transition: opacity .15s; }
.tip.on { opacity: 1; }
.tip b { display: block; font-weight: 600; }
.tip small { color: #5B5750; font-size: 12px; }
.stats { margin-top: 20px; }
.stat b { display: block; font: 500 34px/1.1 var(--cb-font-display); font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Community AI: an always-dark panel, like the network ---------- */
.comm { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 48px); align-items: center; padding: clamp(20px, 3.4vw, 40px); background: var(--cb-midnight); color: var(--text); border: var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); }
[data-theme="light"] .comm { border-color: #131722; box-shadow: 5px 5px 0 #131722; }
.comm svg { width: 100%; height: auto; }
.comm .eyebrow, .comm .bn { color: var(--comm); }
.comm h2 em { color: var(--comm); }
.comm .sub { color: #C9C6BF; }
.comm .tlink { color: var(--comm); }
.comm .stamp { color: var(--comm); }
.comm-text { display: grid; gap: 14px; justify-items: start; }
@media (max-width: 820px) { .comm { grid-template-columns: minmax(0,1fr); } }

/* ---------- Pennants: the road ahead ---------- */
.pennants { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; }
@media (max-width: 820px) { .pennants { grid-template-columns: minmax(0,1fr); } }
.pennant { --w: 100%; display: flex; flex-direction: column; gap: 12px; }
.flag { position: relative; display: flex; align-items: center; min-height: 92px; padding: 0 56px 0 22px; background: var(--c); color: var(--cb-midnight); clip-path: polygon(0 0, 100% 50%, 0 100%); font: 500 clamp(21px, 2.4vw, 27px)/1.05 var(--cb-font-display); }
.flag span { display: block; }
.flag i { font-style: italic; }
.pennant .when { font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--d); }
.pennant p { margin: 0; color: var(--text-2); }

/* ---------- Loop strip ---------- */
.loop { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 12px; counter-reset: l; }
@media (max-width: 900px) { .loop { grid-template-columns: minmax(0,1fr); } }
.loop li { list-style: none; counter-increment: l; }
.loop .card { height: 100%; }
.loop .card::before { content: counter(l); display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--c); color: var(--cb-midnight); font: 600 14px/1 var(--cb-font-ui); font-variant-numeric: tabular-nums lining-nums; }
ol.loop { margin: 0; padding: 0; }

/* ---------- Layers diagram ---------- */
.layers { display: grid; gap: 10px; }
.layer { display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 14px; align-items: start; padding: 14px 16px; background: var(--surface); border: var(--card-line); border-radius: 12px; }
.layer b { font: 500 19px/1.2 var(--cb-font-display); display: block; }
.layer span.d { color: var(--text-2); font-size: 15px; }
.layer .n { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--c); color: var(--cb-midnight); font: 600 14px/1 var(--cb-font-ui); }
.layer.core { background: color-mix(in srgb, var(--c) var(--tint), var(--surface)); }
.foundation { padding: 14px 18px; border-radius: 12px; background: var(--cb-midnight); color: var(--cb-paper); }
[data-theme="dark"] .foundation { background: var(--surface-2); }

/* ---------- Compare table ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); }
.tbl-wrap { overflow-x: auto; background: var(--surface); border: var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- Mock UI ---------- */
.device { background: var(--surface); border: var(--card-line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; display: grid; gap: 12px; min-width: 0; }
.mock-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-bottom: 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.mock-bar b { color: var(--text); font-weight: 600; }
.mock-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; font-size: 14px; }
.track { height: 10px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.track i { display: block; height: 100%; background: var(--c); border-radius: 6px; }
.bubble { padding: 10px 14px; border-radius: 14px; font-size: 14px; max-width: 92%; }
.bubble.me { background: var(--surface-2); justify-self: end; }
.bubble.ai { background: color-mix(in srgb, var(--wash) var(--tint), var(--surface)); border: 1px solid var(--line); }
.locked-row { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; border: 1px dashed var(--line-2); font-size: 14px; color: var(--text-2); }
.dial { display: grid; grid-template-columns: repeat(3,1fr); border: var(--card-line); border-radius: 999px; overflow: hidden; background: var(--surface); }
.dial button { min-height: 44px; border: 0; background: transparent; cursor: pointer; font-weight: 500; }
.dial button[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); }
.seen-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.seen-list li { display: grid; grid-template-columns: 22px minmax(0,1fr); gap: 8px; font-size: 14px; }
.seen-list svg { width: 18px; height: 18px; margin-top: 2px; }
.yes { color: #1E7A4C; } .no { color: #B42A2A; }
[data-theme="dark"] .yes { color: #5CC98F; } [data-theme="dark"] .no { color: #F26D6D; }

/* Surfaces */
.surface-art { aspect-ratio: 16/10; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) var(--tint), var(--surface-2)); overflow: hidden; }
.surface-art svg { width: 62%; height: 78%; }

/* ---------- Team ---------- */
.person { padding: 0; overflow: hidden; }
.photo { aspect-ratio: 1/1; background: var(--c); display: grid; place-items: center; color: var(--cb-midnight); font: italic 500 72px/1 var(--cb-font-display); border-bottom: var(--card-line); }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.person .body { padding: 18px 20px 22px; display: grid; gap: 8px; }
.person .role { font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .04em; color: var(--d); }

/* ---------- Forms ---------- */
.form-card { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label, legend { font-size: 14px; font-weight: 500; }
.field input { min-height: 48px; padding: 0 14px; border-radius: 10px; background: var(--surface); border: 1.5px solid var(--line-2); width: 100%; }
fieldset { border: 0; margin: 0; padding: 0; display: grid; gap: 6px; }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line-2); cursor: pointer; font-size: 14px; }
.seg input:checked + label { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-line); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 3px; }
.err { display: none; font-size: 13px; color: #B42A2A; }
[data-theme="dark"] .err { color: #F26D6D; }
.bad .err, .failed .send-err { display: block; }
.bad input { border-color: currentColor; }
.hp { position: absolute; left: -9999px; }
.ok { display: none; }
.sent form { display: none; }
.sent .ok { display: grid; gap: 6px; }
.ok b { font: 500 22px/1.2 var(--cb-font-display); }

/* ---------- Status note ---------- */
.note { border-left: 4px solid var(--c, var(--wash)); padding: 12px 16px; background: var(--surface); border-radius: 0 10px 10px 0; font-size: 15px; color: var(--text); }
.note b { font-weight: 600; }

/* ---------- News ---------- */
.news-item { display: grid; grid-template-columns: 120px minmax(0,1fr); gap: 16px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.news-item time { font: 600 13px/1.5 var(--cb-font-ui); color: var(--text-2); font-variant-numeric: tabular-nums lining-nums; }
.news-item p { margin: 6px 0 0; color: var(--text-2); }
@media (max-width: 560px) { .news-item { grid-template-columns: minmax(0,1fr); gap: 4px; } }

/* ---------- Paper ---------- */
.paper { padding-bottom: 80px; }
.paper .byline { color: var(--text-2); font-size: 15px; }
.paper h2 { font-size: 30px; line-height: 1.1; letter-spacing: -.01em; margin: 44px 0 14px; scroll-margin-top: 88px; }
.paper h3 { margin: 26px 0 8px; }
.paper p, .paper li { font: 400 17px/1.6 var(--cb-font-display); }
.paper p { margin: 0 0 1em; }
.paper ul, .paper ol { padding-left: 1.2em; margin: 0 0 1em; }
.paper li { margin-bottom: .4em; }
.paper .abstract { padding: 18px 20px; background: var(--surface); border: var(--card-line); border-radius: 14px; box-shadow: var(--shadow-s); }
.paper .abstract p:last-child { margin: 0; }
.paper .toc { list-style: none; padding: 0; columns: 2; font: 400 15px/1.8 var(--cb-font-ui); }
@media (max-width: 560px) { .paper .toc { columns: 1; } }
.paper .refs li { font-size: 15px; line-height: 1.5; font-family: var(--cb-font-ui); overflow-wrap: anywhere; }
.paper sup { font: 500 11px var(--cb-font-ui); }
.paper figure { margin: 24px 0; }
.paper figcaption { font: 400 13px/1.45 var(--cb-font-ui); color: var(--text-2); margin-top: 8px; }

/* ---------- Day of positive interruptions ---------- */
.day-bar { display: flex; flex-wrap: wrap; gap: 8px; }
.day-btn { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 14px; }
.day-btn[aria-pressed="true"] { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-line); }
.card p.day-line { font: 400 clamp(20px, 2.4vw, 26px)/1.35 var(--cb-font-display); color: var(--text); }

/* ---------- Demo ---------- */
[hidden] { display: none !important; }
.demo-stage { position: relative; overflow: hidden; min-height: calc(100vh - 69px); min-height: calc(100svh - 69px); display: flex; align-items: center; border-bottom: 1px solid var(--line); }
#map { position: absolute; top: 0; left: 0; pointer-events: none; }
.demo-wrap { position: relative; padding-block: clamp(32px, 6vw, 72px); }
.demo-panel { width: 100%; max-width: 560px; display: grid; gap: 14px; }
.demo-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; }
.demo-dots { display: flex; gap: 6px; }
.demo-dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--line); transition: background .3s; }
.demo-dots i.on { background: var(--c); }
.screen { display: none; flex-direction: column; gap: 16px; animation: demo-in .5s var(--ease-out) both; }
.screen.on { display: flex; }
.screen h1:focus, .screen h2:focus { outline: none; }
@keyframes demo-in { from { opacity: 0; transform: translateY(12px); } }
h2.demo-q { font-size: clamp(24px, 3vw, 30px); line-height: 1.15; letter-spacing: -.01em; }
.screen textarea { width: 100%; min-height: 132px; padding: 14px 16px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); font-size: 17px; line-height: 1.45; resize: none; }
.screen textarea::placeholder { color: var(--text-2); }
.demo-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.demo-link { background: none; border: 0; padding: 10px 4px; min-height: 44px; display: inline-flex; align-items: center; color: var(--text-2); font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.demo-link:hover { color: var(--text); }
.screen .btn[disabled] { opacity: .45; cursor: not-allowed; }
.screen .btn-ghost.on { background: var(--btn-bg); color: var(--btn-fg); border-color: var(--btn-line); }
.card p.demo-said { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); color: var(--text-2); font-size: 14px; }
.demo-said b { display: block; margin-bottom: 4px; }
.demo-think { display: flex; align-items: center; gap: 12px; color: var(--text-2); font-size: 15px; }
.sweep { width: 64px; height: 3px; border-radius: 2px; background: var(--line); overflow: hidden; position: relative; flex: none; }
.sweep::after { content: ""; position: absolute; inset: 0; width: 40%; background: var(--accent); border-radius: 2px; animation: sweep 1.1s ease-in-out infinite; }
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
.spine-draw { width: 72px; height: 72px; }
.spine-draw path { fill: none; stroke: var(--mark); stroke-width: 13; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 240; animation: draw 2.4s ease-in-out infinite; }
@keyframes draw { 0% { stroke-dashoffset: 240; } 50%, 70% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -240; } }
.card p.demo-quote { font: 400 clamp(24px, 3vw, 30px)/1.3 var(--cb-font-display); color: var(--text); }
.demo-quote::before { content: "\201C"; color: var(--accent); }
.demo-quote::after { content: "\201D"; color: var(--accent); }
.card p.demo-reading { font: 400 18px/1.6 var(--cb-font-display); color: var(--text); }
.card p.demo-turn { padding: 16px 18px; border-radius: 14px; background: color-mix(in srgb, var(--wash) var(--tint), var(--surface)); font: 400 18px/1.6 var(--cb-font-display); color: var(--text); }
.card p.demo-closer { font: italic 400 18px/1.5 var(--cb-font-display); color: var(--text); }
.demo-closer b { font-weight: 500; }
.card p.demo-err, .demo-err { margin: 0; color: #B42A2A; font-size: 14px; }
[data-theme="dark"] .card p.demo-err, [data-theme="dark"] .demo-err { color: #F26D6D; }
@media (max-width: 899px) { .demo-stage { align-items: flex-start; } .demo-wrap { padding-top: calc(24vh + 12px); } .demo-panel { max-width: none; } }
@media (prefers-reduced-motion: reduce) { .screen, .sweep::after, .spine-draw path { animation: none; } }

/* ---------- Footer ---------- */
footer { background: var(--cb-midnight) url("/cb-grain.svg") 0 0 / 180px 180px; padding: 48px 0 32px; font-size: 14px; }
.foot { display: grid; grid-template-columns: 1.4fr repeat(4, 1fr); gap: 28px; }
@media (max-width: 860px) { .foot { grid-template-columns: repeat(2, minmax(0,1fr)); } .foot > :first-child { grid-column: 1/-1; } }
.foot h4 { font: 600 12px/1.3 var(--cb-font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-2); margin-bottom: 10px; }
.foot ul { list-style: none; margin: 0; padding: 0; }
.foot li a { display: inline-flex; align-items: center; min-height: 32px; text-decoration: none; }
.foot li a:hover { text-decoration: underline; }
.foot .tag { font: italic 400 20px/1.3 var(--cb-font-display); margin: 12px 0 0; }
.colophon { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--text-2); font-size: 13px; display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }

/* ---------- Motion ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--ease-out), transform .6s var(--ease-out); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn { transition: none; }
}
@media print {
  .nav, footer, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .paper .abstract { box-shadow: none; }
}
