/* Layout: one calm document column. Real screenshots of the app carry the page:
   the note first, the cells and the graph as further views of the same model. */
:root {
  --paper: #fbfcf9;
  --panel: #f2f5ed;
  --raised: #ffffff;
  --ink: #20231f;
  --muted: #5d6459;
  --line: #dde2d6;
  --lime: #c9f26c;
  --lime-ink: #1a2504;
  --live: #6247cf;
  --live-bg: #efecfc;
  --k-input: #6247cf;
  --k-formula: #41700f;
  --k-resource: #3f55b5;
  --k-effect: #a8540f;
  --k-note: #1f7265;
  --shadow: 0 1px 2px rgb(32 35 31 / 6%), 0 18px 44px rgb(32 35 31 / 9%);
  --display: 'Bricolage Grotesque', 'Avenir Next', 'Segoe UI', sans-serif;
  --body: 'Hanken Grotesk', 'Segoe UI', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0f110e; --panel: #171a15; --raised: #1b1e18; --ink: #e3e6de; --muted: #9da397;
    --line: #2b2f27; --lime: #c9f26c; --lime-ink: #1a2504; --live: #ab9bf6; --live-bg: #24203a;
    --k-input: #ab9bf6; --k-formula: #a5d163; --k-resource: #93a3ee; --k-effect: #e3a064; --k-note: #6fc7b8;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 18px 44px rgb(0 0 0 / 45%);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --paper: #0f110e; --panel: #171a15; --raised: #1b1e18; --ink: #e3e6de; --muted: #9da397;
  --line: #2b2f27; --lime: #c9f26c; --lime-ink: #1a2504; --live: #ab9bf6; --live-bg: #24203a;
  --k-input: #ab9bf6; --k-formula: #a5d163; --k-resource: #93a3ee; --k-effect: #e3a064; --k-note: #6fc7b8;
  --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 18px 44px rgb(0 0 0 / 45%);
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  padding-inline: clamp(16px, 4vw, 40px);
  color: var(--ink);
  background: var(--paper);
  font: 400 17px/1.6 var(--body);
}
.wrap { max-width: 1120px; margin-inline: auto; }
a { color: inherit; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 2px solid var(--live); outline-offset: 3px; }
code, .mono { font-family: var(--mono); font-size: 0.86em; }
h1, h2, h3 { margin: 0; font-family: var(--display); line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); font-weight: 700; letter-spacing: -0.035em; }
h2 { font-size: clamp(1.75rem, 3.4vw, 2.6rem); font-weight: 700; letter-spacing: -0.025em; }
h3 { font-size: 1.15rem; font-weight: 700; letter-spacing: -0.01em; }
p { margin: 0; }
.lede { max-width: 62ch; color: var(--muted); font-size: 1.12rem; }
.eyebrow {
  color: var(--muted);
  font: 600 0.74rem/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

/* Header */
.top { display: flex; align-items: center; gap: 20px; padding-block: 22px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 700 1.05rem var(--display); text-decoration: none; }
.mark {
  display: grid; width: 30px; height: 30px; place-items: center; border-radius: 8px;
  color: var(--lime-ink); background: var(--lime); font: 700 0.95rem var(--display);
}
.top nav { display: flex; gap: 22px; margin-left: auto; flex-wrap: wrap; font-size: 0.95rem; }
.top nav a { color: var(--muted); text-decoration: none; }
.top nav a:hover { color: var(--ink); }

/* Hero */
.hero { display: grid; gap: 22px; padding-block: clamp(28px, 6vw, 70px) 34px; }
.hero h1 { max-width: 13ch; }
.hero h1 em { font-style: normal; background: linear-gradient(transparent 62%, var(--lime) 62%); color: var(--ink); }
:root[data-theme='dark'] .hero h1 em { background: linear-gradient(transparent 80%, var(--lime) 80%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .hero h1 em { background: linear-gradient(transparent 80%, var(--lime) 80%); } }
.actions { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.button {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 20px;
  border: 1px solid var(--ink); border-radius: 10px; color: var(--paper); background: var(--ink);
  font: 650 1rem var(--body); text-decoration: none;
}
.button:hover { transform: translateY(-1px); }
.button.ghost { color: var(--ink); background: transparent; border-color: var(--line); }

/* Sections */
section { padding-block: clamp(44px, 8vw, 96px); border-top: 1px solid var(--line); }
.head { display: grid; gap: 14px; margin-bottom: 30px; }

pre { margin: 0; overflow-x: auto; font-variant-ligatures: none; padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font: 400 0.82rem/1.6 var(--mono); }
pre .c { color: var(--muted); } pre .d { color: var(--k-input); } pre .s { color: var(--k-note); } pre .o { color: var(--k-formula); } pre .n { color: var(--k-effect); }
footer { display: flex; gap: 12px 24px; flex-wrap: wrap; padding-block: 28px 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.88rem; }
footer span:first-child { margin-right: auto; }

@media (prefers-reduced-motion: reduce) { .button:hover { transform: none; } }

/* Shared by every page */
.kind { display: inline-block; width: 1.2em; font-weight: 700; }
.k-input .kind { color: var(--k-input); } .k-formula .kind { color: var(--k-formula); }
.k-resource .kind { color: var(--k-resource); } .k-effect .kind { color: var(--k-effect); } .k-note .kind { color: var(--k-note); }
.live { padding: 1px 6px; border-radius: 5px; color: var(--live); background: var(--live-bg); font-weight: 650; white-space: nowrap; }
.top nav a[aria-current='page'] { color: var(--ink); font-weight: 650; }

/* Screenshots of the real app, framed like a window */
.shot { overflow: hidden; margin: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--raised); box-shadow: var(--shadow); }
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption { padding: 10px 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.86rem; }
/* Landing page: hero, the notebook-user points, the example gallery, the command line */
.home .hero { gap: 20px; padding-block: clamp(36px, 8vw, 92px) 36px; }
.home .hero h1 { max-width: 16ch; }
.home .hero .lede { max-width: 58ch; }
.install { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; color: var(--muted); font-size: 0.9rem; }
.install code { padding: 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--ink); }
.trust { color: var(--muted); font-size: 0.86rem; }
.trust a { color: inherit; }
.hero-shot { margin-bottom: 14px; }
.stack { margin-bottom: clamp(20px, 4vw, 40px); color: var(--muted); font-size: 0.9rem; text-align: center; }
.faq details { max-width: 76ch; border-bottom: 1px solid var(--line); }
.faq details:first-of-type { border-top: 1px solid var(--line); }
.faq summary { padding: 16px 0; cursor: pointer; font-weight: 650; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; float: right; color: var(--muted); font: 500 1.1rem var(--mono); }
.faq details[open] summary::after { content: '−'; }
.faq details p { padding-bottom: 18px; color: var(--muted); }
.home section { padding-block: clamp(48px, 8vw, 88px); }
.model-views { display: grid; gap: 18px; margin-top: clamp(32px, 5vw, 52px); }
.model-views .shot { box-shadow: none; }
.model-views figcaption b { margin-right: 6px; color: var(--ink); }
.points-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 30px 34px; }
.points-grid h3 { margin-bottom: 6px; font-size: 1.05rem; }
.points-grid p { color: var(--muted); font-size: 0.94rem; line-height: 1.55; }
.gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px 22px; }
.example { display: flex; min-width: 0; flex-direction: column; gap: 6px; color: inherit; text-decoration: none; }
.example img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; margin-bottom: 8px; object-fit: cover; object-position: top left;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); transition: border-color 120ms, transform 120ms; }
.example:hover img { border-color: var(--ink); transform: translateY(-2px); }
.example h3 { font-size: 1.08rem; }
.example p { color: var(--muted); font-size: 0.93rem; line-height: 1.5; }
.example .tags { color: var(--muted); font: 500 0.72rem var(--mono); letter-spacing: 0.02em; }
.more { margin-top: 34px; }
.more a { color: var(--live); font-weight: 650; text-decoration: none; }
.more a:hover { text-decoration: underline; }
.core-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 44px); align-items: start; }
.principles { display: grid; gap: 14px; margin: 0; padding-left: 22px; }
.principles li { padding-left: 4px; color: var(--muted); font-size: 0.95rem; line-height: 1.55; }
.principles li::marker { color: var(--live); font: 600 0.85rem var(--mono); }
.principles b { color: var(--ink); }
.primitives { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: clamp(28px, 4vw, 40px); }
.primitives > div { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.primitives h3 { display: inline; font-size: 1rem; }
.primitives small { margin-left: 8px; color: var(--live); font: 500 0.74rem var(--mono); }
.primitives p { margin-top: 6px; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.code-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 960px) { .points-grid, .primitives { grid-template-columns: repeat(2, minmax(0, 1fr)); } .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } .core-split { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .points-grid, .gallery, .code-pair, .primitives { grid-template-columns: minmax(0, 1fr); } }
@media (prefers-reduced-motion: reduce) { .example:hover img { transform: none; } }

/* Simple page header (404) */
.page-head { display: grid; gap: 14px; padding-block: clamp(24px, 5vw, 56px) 26px; }
.page-head h1 { font-size: clamp(2.1rem, 5vw, 3.4rem); }
/* Static note pages (scripts/build_pages.py): one readable article per note */
.article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 240px; gap: clamp(24px, 4vw, 56px); align-items: start; padding-block: 18px 48px; }
.article { min-width: 0; max-width: 76ch; }
.article > * + * { margin-top: 16px; }
.article h1 { font-size: clamp(2rem, 4.6vw, 3rem); }
.article h2 { margin-top: 36px; font-size: clamp(1.4rem, 2.6vw, 1.8rem); }
.article h3 { margin-top: 24px; }
.article p, .article li { line-height: 1.65; }
.article ul, .article ol { padding-left: 22px; }
.article li + li { margin-top: 4px; }
.article a { color: var(--live); }
.article blockquote { margin: 0; padding: 4px 16px; border-left: 3px solid var(--line); color: var(--muted); }
.article table { width: 100%; border-collapse: collapse; background: var(--raised); font-size: 0.93rem; display: block; overflow-x: auto; }
.article th, .article td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.article thead th { background: var(--panel); font-family: var(--display); }
.article hr { border: 0; border-top: 1px solid var(--line); margin-block: 28px; }
.article code { padding: 1px 5px; border-radius: 5px; background: var(--panel); }
.article pre, .article code { white-space: pre-wrap; overflow-wrap: anywhere; } /* as in the app's notes */
.article pre code { padding: 0; background: none; }
.crumbs { color: var(--muted); font-size: 0.9rem; }
.crumbs a { color: var(--muted); }
.control { padding: 3px 9px; border: 1px solid var(--line); border-radius: 999px; background: var(--live-bg); color: var(--live); font-weight: 650; white-space: nowrap; }
.output { margin: 18px 0; }
/* Wide and full-width values: they may use the whole article width and scroll. */
.layout-wide, .layout-full { max-width: none; overflow-x: auto; }
.output img { max-width: 100%; height: auto; border-radius: 10px; }
.chart { min-height: 120px; padding: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.chart figcaption { padding: 30px 12px; color: var(--muted); text-align: center; }
.math[data-display='true'] { overflow-x: auto; padding-block: 6px; text-align: center; }
pre.mermaid { background: var(--raised); text-align: center; }
.interactive { display: flex; gap: 10px 16px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--panel); }
.interactive span { color: var(--muted); }
.cta { display: flex; gap: 12px 20px; flex-wrap: wrap; align-items: center; margin-top: 40px !important; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--live-bg); }
.cta p { flex: 1 1 100%; }
.article .cta .button { color: var(--paper); }
.pager { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 36px !important; padding-top: 18px; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; font-weight: 650; }
.chapter-list { position: sticky; top: 16px; display: grid; gap: 10px; }
.chapter-list ol { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; font-size: 0.92rem; }
.chapter-list a { display: block; padding: 5px 10px; border-left: 2px solid var(--line); color: var(--muted); text-decoration: none; }
.chapter-list a:hover { color: var(--ink); }
.chapter-list a[aria-current] { border-left-color: var(--live); color: var(--ink); font-weight: 650; }
.overview { padding-block: 18px 48px; }
.facts { color: var(--muted); font: 500 0.85rem var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.chapter-cards { display: grid; gap: 10px; padding: 0 !important; list-style: none; counter-reset: chapter; }
.chapter-cards li { display: grid; gap: 4px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
.chapter-cards li span { color: var(--muted); font-size: 0.95rem; }
.chapter-cards a { color: var(--ink) !important; text-decoration: none; }
@media (max-width: 860px) {
  .article-layout { grid-template-columns: minmax(0, 1fr); }
  .chapter-list { position: static; order: -1; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--raised); }
}
