/* ── Tokens ────────────────────────────────────────────────────────────────── */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/font/IBMPlexMono-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/font/IBMPlexMono-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: dark;

  /* matches the Monocurl desktop app palette */
  --bg:       #121212;
  --surface:  #1b1b1b;
  --surface2: #252629;
  --fg:       #ececf0;
  --muted:    #b7b8be;
  --dim:      #7c8391;
  --accent:   #4697d9;
  --accent-hover: #6bc9cf;
  --accent-bg: rgba(85, 183, 189, 0.10);
  --download-blue: oklch(48% .23 264);
  --download-blue-hover: oklch(56% .22 264);
  --cyan:     #63cdcf;
  --cyan-bg:  rgba(99, 205, 207, 0.10);
  --gold:     #dbbc7f;
  --rose:     #f07a7a;
  --purple:   #bb9af7;
  --border:   #2f2f2f;
  --border2:  #3a3a3a;

  --mono: "IBM Plex Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --sans: Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "IBM Plex Serif", Georgia, serif;
}

/* ── Reset ─────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 16px;
  scroll-padding-top: 76px;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background: var(--bg);
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

code, pre, kbd { font-family: var(--mono); }

code {
  color: var(--gold);
  padding: 0.07rem 0.3rem;
  border: 1px solid rgba(219, 188, 127, 0.18);
  border-radius: 3px;
  background: rgba(219, 188, 127, 0.08);
  font-size: 0.88em;
}

pre {
  overflow-x: hidden;
  overflow-y: auto;
  color: #cdced2;
  background: #192330;
  border: 1px solid var(--border);
}

pre code {
  display: block;
  min-width: 0;
  padding: 0.85rem 4.2rem 0.85rem 1rem;
  color: inherit;
  border: none;
  background: transparent;
  font-size: 0.875rem;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.code-shell {
  position: relative;
  min-width: 0;
  background: #192330;
  border: 1px solid var(--border);
}

.code-shell pre {
  margin: 0;
  border: none;
  background: transparent;
}

.code-copy {
  position: absolute;
  z-index: 1;
  top: 0.45rem;
  right: 0.45rem;
  min-width: 3.1rem;
  padding: 0.18rem 0.45rem;
  color: var(--dim);
  background: rgba(18, 18, 18, 0.72);
  border: 1px solid var(--border2);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.72rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s, color 0.1s, border-color 0.1s;
}

.code-shell:hover .code-copy,
.code-shell:focus-within .code-copy {
  opacity: 1;
  pointer-events: auto;
}

.code-copy:hover {
  color: var(--fg);
  border-color: var(--accent);
}

.code-block code,
.scene-block code,
.workbench code,
.doc-entry pre code {
  color: #cdced2;
  font-family: var(--mono);
  font-size: 0.875rem;
  line-height: 1.48;
  white-space: pre-wrap;
}

.mc-comment { color: #6e7481; }
.mc-text-literal { color: #81b29a; }
.mc-numeric-literal { color: #e0af68; }
.mc-argument-label { color: #c790a9; }
.mc-identifier { color: #cdced2; }
.mc-operator { color: #63cdcf; }
.mc-punctuation { color: #cdced2; }
.mc-control-flow { color: #bb9af7; }
.mc-non-control-flow-keyword { color: #e08dcd; }
.mc-unknown { color: #cdced2; }
.mc-function-invocation { color: #8ea8ba; font-weight: 400; }
.mc-operator-invocation { color: #a99ac6; font-weight: 400; }

img, video { max-width: 100%; display: block; }

/* ── Topbar ────────────────────────────────────────────────────────────────── */
.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 20;
  opacity: 0.018;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 120px;
  mix-blend-mode: overlay;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  height: 56px;
  padding: 0 1.25rem;
  background: rgba(18, 18, 18, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.01em;
  text-decoration: none;
}

.brand:hover { color: var(--fg); }

.brand img {
  width: 26px;
  height: 26px;
  background: #050505;
  border: 1px solid var(--border2);
  border-radius: 5px;
  object-fit: cover;
}

.top-links {
  display: flex;
  align-items: center;
  gap: 0.2rem;
}

.top-links a {
  padding: 0.3rem 0.65rem;
  border-radius: 4px;
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}

.top-links a:hover,
.top-links .active {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.top-actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.social-link {
  padding: 0.36rem 0.6rem;
  color: var(--muted);
  border-radius: 4px;
  font-size: 0.84rem;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}

.social-link:hover {
  color: var(--fg);
  background: rgba(255, 255, 255, 0.06);
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 1.1rem;
  background: var(--download-blue);
  border: 1px solid color-mix(in oklch, var(--download-blue), white 24%);
  border-radius: 5px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.1s;
}

.download-button.active,
.download-button:hover {
  background: var(--download-blue-hover);
  color: #fff;
}

/* ── Home ──────────────────────────────────────────────────────────────────── */
.home {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2.5rem 5rem;
}

.download-content,
.gallery-content {
  width: min(100%, 1180px);
}

.download-page {
  display: grid;
  gap: 1.25rem;
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 4.5rem 0 5rem;
}

.download-hero {
  max-width: 680px;
  padding: 1rem 0 1.25rem;
}

.download-hero h1 {
  color: var(--fg);
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

.download-hero p:not(.eyebrow) {
  margin-top: 0.85rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.download-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.os-download-button {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 0.5rem;
  min-height: 152px;
  padding: 1.2rem;
  color: var(--fg);
  border: 1px solid color-mix(in srgb, var(--download-blue), var(--border) 68%);
  background: linear-gradient(180deg, rgba(70, 151, 217, 0.14), var(--surface) 66%);
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
}

.os-download-button:hover {
  background: linear-gradient(180deg, rgba(70, 151, 217, 0.2), rgba(255, 255, 255, 0.035) 72%);
  border-color: color-mix(in srgb, var(--download-blue), white 18%);
  color: var(--fg);
  transform: translateY(-1px);
}

.os-mark {
  width: fit-content;
  padding: 0.18rem 0.45rem;
  color: #dcecff;
  border: 1px solid color-mix(in srgb, var(--download-blue), white 18%);
  background: rgba(70, 151, 217, 0.24);
  font-family: var(--mono);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.os-download-button strong {
  color: var(--fg);
  font-size: 1.15rem;
  line-height: 1.25;
}

.os-download-button small {
  align-self: end;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.download-note {
  color: var(--dim);
  font-size: 0.9rem;
}

.hero-field {
  position: relative;
  min-height: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-inline: 1px dashed var(--border);
  padding: 3rem 2rem;
}

.announcement,
.eyebrow {
  margin-bottom: 0.7rem;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hero-field h1 {
  margin: 0;
  color: var(--fg);
  font-family: var(--serif);
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 400;
  line-height: 1.08;
  letter-spacing: -0.01em;
}

.hero-copy {
  max-width: 580px;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.65rem;
  margin-top: 1.6rem;
}

.hero-product {
  width: min(100%, 700px);
  margin-top: 2rem;
  padding: 0 1rem;
}

.hero-product img {
  width: 100%;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.55rem 1.5rem;
  border-radius: 5px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: 1px solid rgba(99, 205, 207, 0.35);
  text-decoration: none;
  transition: background 0.1s;
}

.primary-action:hover {
  background: var(--accent-hover);
  color: #fff;
}

.download-action {
  background: var(--download-blue);
  border-color: color-mix(in oklch, var(--download-blue), white 24%);
}

.download-action:hover {
  background: var(--download-blue-hover);
}

.ghost-action {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  border-radius: 5px;
  font-size: 0.85rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border2);
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
}

.ghost-action:hover {
  color: var(--fg);
  border-color: var(--dim);
}

/* ── Gallery grid (home preview + gallery page) ────────────────────────────── */
.gallery-section {
  padding: 2.5rem 0 0;
  border-top: 1px solid var(--border);
}

.gallery-section > p.eyebrow { padding-top: 0; }

.gallery-section h2 {
  margin: 0 0 1.2rem;
  color: var(--fg);
  font-size: 1rem;
  font-weight: 600;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  overflow: hidden;
}

.gallery-item {
  position: relative;
  background: #0e0e10;
  overflow: hidden;
  aspect-ratio: 16 / 9;
}

.gallery-item img,
.gallery-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.25s;
}

.gallery-item:hover img,
.gallery-item:hover video {
  transform: scale(1.02);
}

.gallery-caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 0.7rem;
  background: linear-gradient(transparent, rgba(0,0,0,0.75));
  color: var(--muted);
  font-size: 0.75rem;
  opacity: 0;
  transition: opacity 0.18s;
}

.gallery-item:hover .gallery-caption { opacity: 1; }

.gallery-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(90deg, rgba(99,205,207,0.06) 1px, transparent 1px),
    linear-gradient(0deg,  rgba(99,205,207,0.06) 1px, transparent 1px),
    radial-gradient(circle at center, rgba(77,142,255,0.15), transparent 60%),
    #0e0e12;
  background-size: 24px 24px, 24px 24px, auto, auto;
  font-size: 0.75rem;
  color: var(--dim);
}

/* full gallery page */
.gallery-page-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.gallery-page-item {
  border: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}

.gallery-page-media {
  aspect-ratio: 16 / 9;
  background: #0e0e10;
  overflow: hidden;
}

.gallery-page-media img,
.gallery-page-media video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gallery-page-media .gallery-placeholder {
  height: 100%;
}

.gallery-source-preview {
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.gallery-page-body {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border);
}

.gallery-page-body h3 {
  margin-bottom: 0.25rem;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
}

.gallery-page-body p {
  margin: 0 0 0.7rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.55;
}

.gallery-code-toggle {
  display: block;
  color: var(--dim);
  font-size: 0.78rem;
  cursor: pointer;
  list-style: none;
  padding: 0.3rem 0;
  border-top: 1px solid var(--border);
}

.gallery-code-toggle:hover { color: var(--muted); }

.gallery-code-toggle + .code-shell {
  margin: 0;
  border-top: none;
  border-left: none;
  border-right: none;
  border-bottom: none;
  max-height: 260px;
  overflow: auto;
}

/* ── Three-up / Feature cards ──────────────────────────────────────────────── */
.three-up,
.home-lists {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--border);
}

.three-up {
  width: min(100%, 1120px);
  margin: clamp(16rem, 32vh, 24rem) auto clamp(14rem, 28vh, 22rem);
  align-content: center;
  gap: 0.9rem;
  border: none;
  background: transparent;
}

.three-up article,
.home-lists > div {
  padding: 1.25rem 1.5rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.three-up article {
  border: 1px solid var(--border);
  border-left: 2px solid color-mix(in srgb, var(--accent), var(--border) 35%);
  background: var(--surface);
}

.home-lists > div:last-child { border-right: none; }

.three-up h2,
.home-lists h2 {
  margin: 0.4rem 0 0.55rem;
  color: var(--fg);
  font-size: 0.95rem;
  font-weight: 600;
}

.three-up p:not(.eyebrow) {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.6;
}

.feature-demo {
  margin: 1rem 0 0;
  border: 1px solid var(--border2);
  background: #050505;
  overflow: hidden;
}

.feature-demo video {
  display: block;
  width: 100%;
  max-height: 150px;
  object-fit: cover;
}

/* ── Workbench ─────────────────────────────────────────────────────────────── */
.workbench {
  width: min(100%, 920px);
  margin: 2rem auto 4.5rem;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #192330;
}

.workbench-top {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0.85rem;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.workbench-body {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(420px, 1fr);
}

.workbench pre {
  margin: 0;
  border: none;
  background: transparent;
}

.workbench code {
  font-size: 0.78rem;
  line-height: 1.42;
}

.workbench .code-shell {
  border: none;
  background: transparent;
  padding: 1.15rem 0;
}

.workbench-media,
.proof-preview,
.scene-preview {
  position: relative;
  min-height: 260px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(99,205,207,0.07) 1px, transparent 1px),
    linear-gradient(0deg, rgba(99,205,207,0.07) 1px, transparent 1px),
    radial-gradient(circle at 50% 50%, rgba(77,142,255,0.15), transparent 58%),
    #0e0e12;
  background-size: 28px 28px, 28px 28px, auto, auto;
  border-left: 1px solid var(--border);
}

.workbench-media {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0e0e10;
}

.workbench-media video {
  width: 100%;
  height: 100%;
  max-height: 380px;
  object-fit: cover;
}

.axis { position: absolute; background: rgba(220,220,230,0.14); }
.axis.x { left: 9%; right: 9%; top: 50%; height: 1px; }
.axis.y { top: 12%; bottom: 12%; left: 50%; width: 1px; }

.curve {
  position: absolute;
  left: 18%; right: 18%; top: 30%; height: 38%;
  border: 2.5px solid var(--cyan);
  border-color: transparent transparent var(--cyan) transparent;
  border-radius: 50%;
  transform: rotate(-7deg);
  filter: drop-shadow(0 0 14px rgba(99,205,207,0.3));
}

.dot {
  position: absolute;
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--gold);
}
.dot.a { left: 28%; top: 55%; }
.dot.b { right: 30%; top: 38%; background: var(--rose); }

.plane-label {
  position: absolute;
  right: 0.75rem;
  bottom: 0.75rem;
  color: var(--dim);
  font-family: var(--serif);
  font-size: 0.85rem;
}

/* ── Home lists ────────────────────────────────────────────────────────────── */
.home-lists { grid-template-columns: 1fr 1fr; }

.link-stack {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.link-stack a {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  padding: 0.35rem 0;
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
  border-bottom: 1px dashed var(--border);
  transition: color 0.1s;
}

.link-stack a:hover { color: var(--fg); }

.link-stack span {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* ── App frame (docs + learn pages) ───────────────────────────────────────── */
.app-frame {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 200px;
  min-height: calc(100vh - 56px);
}

.standalone-frame {
  min-height: calc(100vh - 56px);
}

.sidebar {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg);
}

.side-nav {
  display: grid;
  gap: 0.2rem;
  padding: 1rem 0.85rem 2rem;
}

.side-nav p {
  margin: 1rem 0 0.2rem;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.side-nav p:first-child { margin-top: 0; }

.side-nav a {
  display: block;
  padding: 0.22rem 0.4rem;
  color: var(--muted);
  border-radius: 3px;
  font-size: 0.875rem;
  line-height: 1.4;
  text-decoration: none;
  transition: color 0.1s, background 0.1s;
}

.side-nav a:hover,
.side-nav a.active {
  color: var(--fg);
  background: var(--accent-bg);
}

.side-subnav {
  display: grid;
  gap: 0.05rem;
  margin: 0.1rem 0 0.3rem 0.55rem;
  padding-left: 0.65rem;
  border-left: 1px solid var(--border);
}

.side-subnav a {
  color: var(--dim);
  font-size: 0.82rem;
}

.page { min-width: 0; }

.content {
  width: min(100%, 740px);
  margin: 0 auto;
  padding: 2.75rem 1.75rem 5rem;
}

.content.download-content,
.content.gallery-content {
  width: min(100%, 1180px);
}

.toc-panel {
  position: sticky;
  top: 56px;
  align-self: start;
  height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 4rem 1.25rem 2rem 0.5rem;
}

.toc-title {
  margin-bottom: 0.6rem;
  color: var(--dim);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.toc-panel a {
  display: block;
  width: fit-content;
  margin: 0.22rem 0;
  color: var(--dim);
  font-size: 0.82rem;
  text-decoration: none;
  transition: color 0.1s;
}

.toc-panel a:hover { color: var(--muted); }
.toc-panel a.active {
  color: var(--fg);
}
.toc-h3 { margin-left: 1rem !important; }
.toc-h4 { margin-left: 2rem !important; }

/* ── Page head ─────────────────────────────────────────────────────────────── */
.page-head { margin-bottom: 2rem; }

.prose h2,
.prose h3,
.content section > h2,
.module-index,
.doc-group,
.doc-entry {
  scroll-margin-top: 76px;
}

.page-head h1,
.prose h1 {
  margin: 0;
  color: var(--fg);
  font-family: var(--sans);
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-head p:not(.eyebrow),
.prose > p {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* ── Prose ─────────────────────────────────────────────────────────────────── */
.prose h2,
.content section > h2 {
  margin: 2rem 0 0.85rem;
  padding-bottom: 0.5rem;
  color: var(--fg);
  border-bottom: 1px solid var(--border);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.prose h3,
.doc-entry h3 {
  margin: 1.4rem 0 0.65rem;
  padding-bottom: 0.4rem;
  color: var(--fg);
  border-bottom: 1px dashed var(--border2);
  font-size: 1rem;
  font-weight: 600;
}

.prose .header,
.content h2 .header,
.doc-entry h3 .header {
  color: inherit;
  text-decoration: none;
}

.prose .header:hover { color: var(--accent); }

.prose ul,
.prose ol { line-height: 1.75; padding-left: 1.25rem; }

.prose > .code-shell {
  margin: 0.25rem 0;
}

/* ── Callout ───────────────────────────────────────────────────────────────── */
.callout {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border: 1px solid rgba(99, 205, 207, 0.2);
  background: rgba(99, 205, 207, 0.06);
  border-left: 3px solid var(--cyan);
}

.callout span {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--cyan);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: lowercase;
  letter-spacing: 0.05em;
}

.callout p {
  margin: 0;
  color: var(--fg);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ── Scene blocks (lesson code + rendered media) ───────────────────────────── */
.scene-block {
  margin: 1.25rem 0;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #192330;
}

.scene-block figcaption {
  display: flex;
  justify-content: space-between;
  padding: 0.45rem 0.75rem;
  color: var(--dim);
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.75rem;
}

.scene-block figcaption span { color: var(--cyan); }

.scene-block-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.scene-block .code-shell { margin: 0; border: none; background: transparent; }
.scene-block pre { margin: 0; border: none; background: transparent; }

.scene-block .scene-preview { min-height: 320px; }

.scene-block .scene-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
  padding: 1rem;
  background: #0e0e10;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.scene-block .scene-media img,
.scene-block .scene-media video {
  max-width: 100%;
  max-height: 520px;
  display: block;
}

/* ── Standalone media embed ────────────────────────────────────────────────── */
.media-embed {
  margin: 1.25rem 0;
  border: 1px solid var(--border);
  background: #0e0e10;
  overflow: hidden;
}

.media-embed img,
.media-embed video { display: block; width: 100%; }

.media-embed figcaption {
  padding: 0.45rem 0.75rem;
  color: var(--muted);
  font-size: 0.8rem;
  border-top: 1px solid var(--border);
}

/* ── Index lists ───────────────────────────────────────────────────────────── */
.index-list { display: grid; gap: 0.5rem; }
.index-list.compact { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.index-row {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  color: var(--fg);
  border: 1px solid var(--border);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.1s;
}

.index-row:hover { border-color: var(--accent); }

.index-row strong {
  color: var(--fg);
  font-size: 1rem;
  font-weight: 600;
}

.index-row span { color: var(--muted); font-size: 0.85rem; line-height: 1.4; }

.row-kicker {
  color: var(--accent) !important;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

/* ── Lesson footer buttons ─────────────────────────────────────────────────── */
.footer-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.footer-button {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.6rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
}

.footer-button:hover { color: var(--fg); border-color: var(--border2); }

/* ── Stdlib metrics ────────────────────────────────────────────────────────── */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 1.25rem 0 2rem;
  border: 1px solid var(--border);
}

.metric-strip div {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--border);
}
.metric-strip div:last-child { border-right: none; }

.metric-strip strong {
  display: block;
  color: var(--fg);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.metric-strip span { color: var(--muted); font-size: 0.85rem; }

/* ── Symbol search ─────────────────────────────────────────────────────────── */
.docs-search-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.docs-search-row h2 { margin: 0; border: none; padding: 0; }

.search-input {
  width: min(100%, 300px);
  padding: 0.45rem 0.65rem;
  color: var(--fg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.1s;
}

.search-input:focus { border-color: var(--accent); }

.symbol-list { display: grid; gap: 0.35rem; margin-top: 0.85rem; }

.symbol-row {
  display: grid;
  grid-template-columns: 88px minmax(120px, 1fr) 80px minmax(0, 1.6fr);
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.45rem 0.65rem;
  color: var(--fg);
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.85rem;
  text-decoration: none;
  transition: border-color 0.1s;
}

.symbol-row:hover { border-color: var(--border2); }
.symbol-row strong { color: var(--fg); font-family: var(--mono); font-size: 0.875rem; }
.symbol-row span, .symbol-row small { color: var(--muted); font-size: 0.8rem; line-height: 1.35; }
.symbol-kind { font-family: var(--mono); font-size: 0.72rem; }
.important-marker {
  margin-left: 0.45rem;
  color: var(--accent);
  font-family: var(--sans);
  font-size: 0.68rem;
  font-style: normal;
  font-weight: 600;
  text-transform: uppercase;
}

.kind-function { color: #8ea8ba !important; }
.kind-constant { color: var(--gold) !important; }
.kind-operator { color: #a99ac6 !important; }
.kind-constructor { color: #81b29a !important; }
.kind-unknown { color: var(--muted) !important; }

.module-index-group { margin-top: 1rem; }

.module-index-group h3 {
  margin: 0.6rem 0 0.45rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.module-symbol-row {
  grid-template-columns: 88px minmax(120px, 1fr) minmax(0, 1.7fr);
}

/* ── Doc entries ───────────────────────────────────────────────────────────── */
.doc-group { margin-top: 1.75rem; }
.doc-entry-list { display: grid; gap: 0.75rem; }

.doc-entry {
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  background: var(--surface);
}

.doc-entry.important {
  border-color: color-mix(in srgb, var(--accent), var(--border) 55%);
}

.doc-entry header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.65rem;
}

.doc-entry h3 { margin: 0 0 0.3rem; border: none; }
.doc-entry > p { margin: 0 0 0.65rem; color: var(--muted); font-size: 0.88rem; line-height: 1.55; }
.doc-entry > .doc-description { color: var(--fg); }

.doc-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.doc-important {
  flex: none;
  height: fit-content;
  padding: 0.15rem 0.4rem;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: var(--accent-bg);
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
}

.doc-kind {
  flex: none;
  height: fit-content;
  padding: 0.15rem 0.4rem;
  border: 1px solid currentColor;
  background: rgba(255, 255, 255, 0.035);
  font-family: var(--mono);
  font-size: 0.72rem;
  border-radius: 2px;
  opacity: 0.9;
}

.doc-entry pre { margin-bottom: 0; }

/* ── Param table ───────────────────────────────────────────────────────────── */
.param-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 0.5rem;
  font-size: 0.85rem;
}

.param-table td {
  padding: 0.4rem 0.6rem;
  border-top: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--muted);
}

.param-table td:first-child {
  width: 18%;
  min-width: 72px;
  color: var(--fg);
  font-family: var(--mono);
  font-size: 0.8rem;
  white-space: nowrap;
  padding-right: 0.9rem;
}

/* ── Hidden ────────────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .app-frame { grid-template-columns: 220px minmax(0, 1fr); }
  .toc-panel { display: none; }
}

@media (max-width: 860px) {
  .topbar { grid-template-columns: 1fr auto; }
  .top-links { display: none; }

  .app-frame { display: block; }
  .sidebar { position: static; height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .side-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .side-nav p, .side-subnav { display: none; }

  .content { padding: 1.75rem 1rem 4rem; }
  .home { padding: 0 1rem 4rem; }
  .hero-field { min-height: 380px; border-inline: none; }

  .three-up, .home-lists, .workbench-body, .scene-block-grid, .index-list.compact, .metric-strip, .download-options {
    grid-template-columns: 1fr;
  }
  .three-up article, .home-lists > div, .metric-strip div, .os-download-button {
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .gallery-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-page-grid { grid-template-columns: 1fr; }
  .symbol-row { grid-template-columns: 1fr; gap: 0.15rem; }
  .docs-search-row { display: block; }
  .search-input { width: 100%; }
  .footer-buttons { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
  .gallery-grid { grid-template-columns: 1fr; }
  .hero-field h1 { font-size: 2rem; }
}
