/* Site chrome for the standalone pages (landing, playgrounds, transcript).
   Shares the deck's palette; theme.css is loaded first for the widget styles. */

:root { --maxw: 1080px; }  /* palette lives in tokens.css */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 18px; line-height: 1.62;
}
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }

h1, h2, h3, h4 {
  font-family: var(--display); letter-spacing: -0.02em; line-height: 1.12;
  margin: 0 0 0.5em; font-weight: 800;
}
h1 { font-size: clamp(2.4rem, 6vw, 4.1rem); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2.3rem); }
h3 { font-size: 1.14rem; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--accent-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }

.eyebrow {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--ink-faint); display: block;
  margin-bottom: 1.1em;
}
.eyebrow b { color: var(--accent-text); font-weight: 600; }

/* --- top bar ---------------------------------------------------------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--glass); backdrop-filter: blur(12px) saturate(1.4);
  border-bottom: 1px solid var(--rule);
}
.nav .wrap { display: flex; align-items: center; gap: 1.4em; height: 60px; }
.nav .brand {
  font-family: var(--display); font-weight: 800; font-size: 1.05rem;
  color: var(--ink); text-decoration: none; letter-spacing: -0.02em;
  margin-right: auto;
}
.nav .brand span { color: var(--accent-text); }
.nav a.link {
  font-family: var(--mono); font-size: 0.78rem; letter-spacing: 0.06em;
  color: var(--ink-soft); text-decoration: none; text-transform: uppercase;
}
.nav a.link:hover { color: var(--accent-text); }
@media (max-width: 640px) { .nav a.link.hide-s { display: none; } }

/* --- hero -------------------------------------------------------------- */
.hero { padding: clamp(3rem, 9vw, 6.5rem) 0 3rem; }
.hero .lede {
  font-size: clamp(1.05rem, 2.1vw, 1.32rem); color: var(--ink-soft);
  max-width: 30ch; margin-bottom: 1.6em;
}
.hero .lede b { color: var(--ink); font-weight: 600; }

.cta { display: flex; flex-wrap: wrap; gap: 0.7em; margin-bottom: 2.6em; }
.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  font-family: var(--mono); font-size: 0.82rem; letter-spacing: 0.04em;
  padding: 0.85em 1.4em; border-radius: 5px; text-decoration: none;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 20px var(--shadow); }
.btn.primary { background: var(--accent-text); border-color: var(--accent-text); color: var(--on-accent); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent-text); }

.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1.4em; border-top: 1px solid var(--rule); padding-top: 1.6em;
}
.fact .n {
  font-family: var(--mono); font-size: 1.7rem; color: var(--accent);
  line-height: 1; font-weight: 500;
}
.fact .l {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-faint); margin-top: 0.5em;
}

/* --- sections ---------------------------------------------------------- */
section.band { padding: clamp(2.6rem, 6vw, 4.6rem) 0; border-top: 1px solid var(--rule); }
section.band.tint { background: var(--card); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4em; align-items: start; }
/* grid and flex children default to min-width:auto, so one long <pre> line can
   push the whole page sideways. This is the fix. */
.grid2 > *, .cards > *, .two > * { min-width: 0; }
@media (max-width: 820px) { .grid2 { grid-template-columns: 1fr; gap: 1.6em; } }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1em; }
.card {
  background: var(--card); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.3em 1.35em; text-decoration: none; color: inherit; display: block;
  transition: border-color .12s, transform .12s;
}
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .k {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent-text); font-weight: 700;
  display: block; margin-bottom: 0.6em;
}
.card h3 { margin-bottom: 0.35em; }
.card p { font-size: 0.93rem; color: var(--ink-soft); margin: 0; line-height: 1.5; }

ul.checks { list-style: none; padding: 0; margin: 0; }
ul.checks li {
  padding-left: 1.7em; position: relative; margin-bottom: 0.65em; line-height: 1.5;
}
ul.checks li::before {
  content: "→"; position: absolute; left: 0; top: 0;
  color: var(--accent-text); font-family: var(--mono);
}

code {
  font-family: var(--mono); font-size: 0.86em; background: var(--accent-soft);
  color: var(--accent-ink); padding: 0.1em 0.36em; border-radius: 3px;
}
pre {
  background: var(--term-bg); color: var(--term-fg); border-radius: 7px; overflow-x: auto;
  padding: 1.1em 1.3em; font-family: var(--mono); font-size: 0.8rem;
  line-height: 1.6; font-variant-ligatures: none;
}
pre code { background: none; color: inherit; padding: 0; font-size: inherit; }
pre .c { color: var(--term-dim); }

/* --- footer ------------------------------------------------------------ */
footer {
  border-top: 1px solid var(--rule); padding: 2.6em 0 3.4em;
  font-size: 0.88rem; color: var(--ink-faint);
}
footer a { color: var(--ink-soft); }
footer .row { display: flex; flex-wrap: wrap; gap: 1.4em; align-items: baseline; }
footer .row .sp { margin-left: auto; }

/* --- playground page ---------------------------------------------------- */
.pg { padding: 2.4em 0 1em; }
.pg-item { padding: 2.2em 0; border-top: 1px solid var(--rule); }
.pg-item:first-of-type { border-top: none; }
.pg-item .ix { font-size: 15px; }
.pg-item > p.after { font-size: 0.92rem; color: var(--ink-soft); margin-top: 1em; }
.pg-num {
  font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em;
  color: var(--accent-text); text-transform: uppercase; font-weight: 700;
}

/* --- reading view -------------------------------------------------------
   The deck's CSS sizes everything in em against .reveal's 30px canvas. In a
   document that context is gone, so the pieces we reuse get explicit sizes.
   ---------------------------------------------------------------------- */
.read { max-width: 760px; padding: 2.6em 0 5em; }

.read-head { margin-bottom: 3.4em; }
.read-lede { font-size: 1.12rem; color: var(--ink-soft); max-width: 34ch; }
.read-toc {
  display: grid; gap: 0.1em; margin: 2em 0 1.4em;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  padding: 1.1em 0;
}
.read-toc a {
  color: var(--ink-soft); text-decoration: none; font-size: 0.96rem;
  padding: 0.22em 0; display: flex; gap: 0.9em;
}
.read-toc a:hover { color: var(--accent-text); }
.read-toc a b { font-family: var(--mono); font-size: 0.8em; color: var(--ink-faint); font-weight: 500; }
.read-alt { font-size: 0.92rem; color: var(--ink-faint); }

/* chapters ------------------------------------------------------------- */
.read-chapter { margin: 4.4em 0 2.4em; padding-top: 2.2em; border-top: 3px solid var(--accent); }
.read-chapter-k {
  font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--accent-text); font-weight: 700;
}
.read-chapter h2 { font-size: clamp(1.8rem, 4.4vw, 2.5rem); margin: 0.3em 0 0.5em; }
.read-chapter .muted { font-size: 1.02rem; color: var(--ink-soft); }

/* slides --------------------------------------------------------------- */
.read-slide { margin: 3em 0; scroll-margin-top: 76px; }
.read-meta {
  font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-faint);
  display: flex; align-items: center; gap: 0.8em; margin-bottom: 0.6em;
}
.read-meta .n {
  color: var(--accent-text); font-weight: 700;
  border: 1px solid var(--rule); border-radius: 3px; padding: 0.15em 0.5em;
}
.read-slide h3 { font-size: clamp(1.28rem, 3vw, 1.66rem); font-weight: 800; margin-bottom: 0.7em; }
.read-visual { margin-bottom: 1.5em; }

.read-narration {
  border-left: 2px solid var(--rule); padding-left: 1.3em; margin-top: 1.4em;
}
.read-narration p { line-height: 1.72; margin: 0 0 0.85em; }
.read-narration p.read-stage {
  font-family: var(--mono); font-size: 0.8rem; color: var(--teal);
  background: var(--teal-soft); border-radius: 4px;
  padding: 0.5em 0.85em; display: inline-block;
}
.read-end { margin-top: 4em; }

/* deck pieces, resized for a document ---------------------------------- */
.read .term { font-size: 12px; line-height: 1.6; padding: 1em 1.15em; overflow-x: auto; }
.read .cue { font-size: 13px; padding: 0.7em 1em; }
.read .cue .label { font-size: 0.86em; }
.read .callout, .read .definition { font-size: 0.97rem; padding: 1em 1.15em; }
.read .callout .label { font-size: 0.68rem; }
.read table { font-size: 0.9rem; }
.read table th { font-size: 0.68rem; }
.read .ix { font-size: 15px; }
.read p { font-size: 1rem; line-height: 1.65; }
.read .tight { font-size: 1rem; }
.read .muted { color: var(--ink-soft); }
.read .pipe { overflow-x: auto; }
.read .pipe .row { min-width: 640px; }
.read .pipe .box { font-size: 11px; }
.read .pipe .tag { font-size: 9px; }
.read .two { grid-template-columns: 1fr 1fr; gap: 1.4em; }
.read .big-num { font-size: 2rem; }
.read ul, .read ol { margin-left: 1.1em; }
.read li { line-height: 1.6; margin-bottom: 0.45em; font-size: 1rem; }

@media (max-width: 700px) {
  .read .two { grid-template-columns: 1fr; }
  .read .term { font-size: 10.5px; }
  .read-narration { padding-left: 1em; }
}

/* --- narrow screens ----------------------------------------------------- */
@media (max-width: 760px) {
  body { font-size: 17px; }
  /* the pipeline diagram is wide by nature: let it scroll inside itself
     rather than pushing the page sideways */
  .pipe { overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 0.4em; }
  .pipe .row { min-width: 660px; }
  .grid2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .hero { padding-top: 2.4rem; }
}

/* widgets: keep every wide child inside its own scroller */
.ix-list, .ix-prompt, .ix-stats { max-width: 100%; }
.ix-stats { overflow-x: auto; }
.two { max-width: 100%; }
@media (max-width: 700px) {
  .two { grid-template-columns: 1fr !important; }
  .ix-controls.two-up { grid-template-columns: 1fr; }
  .ix-stats { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
}

/* --- present page -------------------------------------------------------- */
kbd {
  font-family: var(--mono); font-size: 0.8em; border: 1px solid var(--rule);
  border-bottom-width: 2px; border-radius: 4px; padding: 0.15em 0.45em;
  background: var(--card); color: var(--ink);
}
ol.steps { padding-left: 1.3em; }
ol.steps li { margin-bottom: 0.9em; line-height: 1.6; }
ol.steps li::marker { font-family: var(--mono); color: var(--accent-text); font-weight: 700; }
table.keys, table.cues { width: 100%; border-collapse: collapse; margin-top: 0.8em; }
table.keys td, table.cues td, table.cues th {
  padding: 0.5em 0.7em; border-bottom: 1px solid var(--rule);
  text-align: left; vertical-align: top; font-size: 0.94rem;
}
table.cues th {
  font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-faint); font-weight: 500;
  border-bottom: 2px solid var(--rule);
}
table.keys td:first-child { width: 8em; white-space: nowrap; }
table.cues td.n {
  font-family: var(--mono); color: var(--accent-text); font-weight: 700; width: 4em;
}
table.cues code { font-size: 0.82em; }

/* the cue sheet's command column can outrun a narrow screen */
table.cues { table-layout: fixed; }
table.cues td, table.cues th { overflow-wrap: anywhere; }
table.cues td:nth-child(2) { width: 40%; }

/* --- hero ---------------------------------------------------------------- */
.hero {
  position: relative;
  padding: clamp(3.6rem, 11vw, 8rem) 0 clamp(2.6rem, 6vw, 4rem);
  min-height: min(88vh, 820px);
  display: flex; align-items: center;
  overflow: hidden;
  isolation: isolate;
}
#hero-canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: -2; display: block;
}
/* keeps the type readable over the point cloud without hiding it */
.hero-veil {
  position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(95deg, var(--paper) 0%, var(--paper) 33%, transparent 58%),
    linear-gradient(to bottom, var(--paper) 0%, transparent 15%, transparent 58%, var(--paper) 90%);
}
.hero-inner { position: relative; width: 100%; }
.hero h1 { margin-bottom: 0.32em; }
.hero-caption {
  margin-top: 2.4em; font-size: 0.82rem; color: var(--ink-faint);
  max-width: 46ch; line-height: 1.55;
}
@media (max-width: 760px) {
  .hero-veil {
    background:
      radial-gradient(150% 60% at 50% 30%, var(--paper) 44%, transparent 88%),
      linear-gradient(to bottom, var(--paper) 0%, transparent 34%, transparent 64%, var(--paper) 100%);
  }
  .hero-caption { display: none; }
}

/* --- theme toggle --------------------------------------------------------- */
.theme-btn {
  width: 32px; height: 32px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--rule); background: var(--card); color: var(--ink-soft);
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  transition: border-color .12s, color .12s;
}
.theme-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.theme-btn svg { fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme-btn .moon { display: none; fill: currentColor; stroke: none; }
:root[data-theme="dark"] .theme-btn .sun,
:root[data-theme="dark"] .theme-btn .rays { display: none; }
:root[data-theme="dark"] .theme-btn .moon { display: block; }

/* --- dark-mode adjustments ------------------------------------------------ */
:root[data-theme="dark"] .card,
:root[data-theme="dark"] section.band.tint { background: var(--card); }
:root[data-theme="dark"] .btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
:root[data-theme="dark"] .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
:root[data-theme="dark"] .btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .btn { background: var(--ink); color: var(--paper); border-color: var(--ink); }
  :root:not([data-theme="light"]) .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
  :root:not([data-theme="light"]) .btn.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
}

/* --- keyboard access ------------------------------------------------------ */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--term-bg); color: var(--term-fg); padding: 0.7em 1.1em;
  font-family: var(--mono); font-size: 0.82rem; border-radius: 0 0 5px 0;
  text-decoration: none;
}
.skip:focus { left: 0; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}
