/* Generated by tools/build-docs.mjs — do not edit by hand. */
:root {
  --crt-bg: #070a1c;
  --ui-bg: #0b0e24;
  --panel-bg: #11142e;
  --border: #2c2f63;
  --accent: #7471ec;
  --green: #8fe985;
  --amber: #e6dd6b;
  --red: #d76b70;
  --text: #ccd0ec;
  --dim: #8e8eb7;
  --text-bright: #ffffff;
  --on-accent: #070a1c;
  --accent-hover: #908df0;
  --page-glow: #10143a;
  --topbar-bg: rgba(11, 14, 36, 0.82);
  --zebra: rgba(255, 255, 255, 0.02);
  --logo-c64: #dff4ff;
  --logo-edge: var(--accent);
  --logo-glow: rgba(112, 109, 235, 0.7);
  --logo-shadow: #07071a;
  --ramp-4: #9b98ff;
  --ramp-2: #5a57b8;
  --ramp-1: #43407c;
  --maxw: 820px;
}
/* Light: Classic's light mode, chosen with the same setting as the emulator
   (c64emu.appearance, set by the header button here or there). */
:root[data-mode="light"] {
  --crt-bg: #e8e9f3;
  --ui-bg: #f4f5fb;
  --panel-bg: #ffffff;
  --border: #cfd2e7;
  --accent: #4c49c0;
  --green: #2a7337;
  --amber: #7a5d00;
  --red: #b8323b;
  --text: #23264d;
  --dim: #53567d;
  --text-bright: #12143a;
  --on-accent: #ffffff;
  --accent-hover: #3b3998;
  --page-glow: #d8d9f2;
  --topbar-bg: rgba(244, 245, 251, 0.88);
  --zebra: rgba(35, 38, 77, 0.035);
  --logo-c64: #16183a;
  --logo-edge: transparent;
  --logo-glow: transparent;
  --logo-shadow: transparent;
  --ramp-4: #3e3c9f;
  --ramp-2: #9d9bdc;
  --ramp-1: #c9c8ec;
}
:root[data-mode="light"] .logo-text::after { display: none; }   /* scanlines are for the dark tube */
:root:root {
  --topbar-bg: color-mix(in srgb, var(--ui-bg) 88%, transparent);
  --accent-hover: color-mix(in srgb, var(--accent) 80%, var(--text-bright));
  --zebra: color-mix(in srgb, var(--text) 3%, transparent);
  --logo-c64: var(--text-bright);
  --logo-glow: color-mix(in srgb, var(--accent) 65%, transparent);
  --logo-shadow: var(--crt-bg);
  --ramp-4: var(--logo-ramp-4, var(--accent));
  --ramp-2: var(--logo-ramp-2, var(--accent));
  --ramp-1: var(--logo-ramp-1, var(--border));
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; }
body {
  margin: 0;
  background:
    var(--page-pattern, none),
    radial-gradient(1200px 600px at 50% -10%, var(--page-glow) 0%, transparent 60%),
    var(--crt-bg);
  background-size: var(--page-pattern-size, auto), auto;
  color: var(--text);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, .brand, kbd { font-family: 'Share Tech Mono', ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ── top bar ─────────────────────────────────────────────── */
.doc-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 12px 24px;
  background: var(--topbar-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand:hover .logo-text { filter: brightness(1.12); }

/* ── C64 READY. logo (mirrors the app header) ────────────── */
.logo-text {
  display: inline-flex; align-items: center; gap: 2px;
  font-family: 'PetMe64', 'Share Tech Mono', monospace;
  font-size: clamp(0.62rem, 3vw, 1.26rem);   /* same size as the emulator's header logo */
  line-height: 1; white-space: nowrap; letter-spacing: 1px;
  position: relative;
}
.lt-main { position: relative; }
.lt-c64 {
  color: var(--logo-c64);
  text-shadow: 0 0 2px var(--logo-edge), 0 0 10px var(--logo-glow), 2px 2px 0 var(--logo-shadow);
}
.lt-ready {
  color: var(--accent); margin-left: calc(-0.333em - 3px);
  text-shadow: 0 0 2px var(--logo-edge), 0 0 12px var(--logo-glow), 2px 2px 0 var(--logo-shadow);
}
.lt-blocks {
  font-family: 'Share Tech Mono', monospace; font-size: 0.85em;
  text-shadow: 0 0 8px var(--logo-glow); margin-right: 6px;
}
.lt-blocks .b4 { color: var(--ramp-4); }
.lt-blocks .b3 { color: var(--accent); }
.lt-blocks .b2 { color: var(--ramp-2); }
.lt-blocks .b1 { color: var(--ramp-1); }
.logo-text::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: repeating-linear-gradient(0deg,
      rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px, rgba(0,0,0,0.28) 3px, rgba(0,0,0,0) 4px);
}
.top-nav { display: flex; align-items: center; gap: 18px; }
.nav-links { display: flex; align-items: center; gap: 10px; }
.top-nav a { color: var(--dim); font-size: 0.92rem; letter-spacing: 0.5px; }
.top-nav a:hover { color: var(--text); text-decoration: none; }

/* ABOUT + the GitHub / YouTube / Facebook icons, matching the emulator's own header
   buttons (.credits-link in src/styles/styles-header.css) so the two bars read alike. */
.nav-btn, .doc-top .cta {
  display: inline-flex; align-items: center; justify-content: center;
  height: 34px; line-height: 1;
}
.nav-btn {
  font-family: 'Share Tech Mono', monospace;
  font-size: 0.9rem;
  letter-spacing: 2px;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 7px 16px;
  text-decoration: none;
  transition: all 0.15s;
}
button.nav-btn { background: transparent; cursor: pointer; line-height: 1; }
.top-nav .nav-btn:hover {
  color: var(--text-bright);
  border-color: var(--accent);
  box-shadow: 0 0 12px color-mix(in srgb, var(--accent) 45%, transparent);
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; padding: 7px 11px; }
/* Launch emulator: filled in Classic's accent, labelled in its on-accent ink
   (dark on the light violet, white on the deep one), like the app's primary
   buttons. */
.doc-top .cta {
  color: var(--on-accent);
  font-weight: 700;
  border: 1px solid var(--accent); border-radius: 7px;
  padding: 7px 14px; background: var(--accent);
  white-space: nowrap;
}
.doc-top .cta:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--on-accent); text-decoration: none; }

/* ── layout ──────────────────────────────────────────────── */
.doc-main { max-width: 1160px; margin: 0 auto; padding: 34px 24px 80px; }
.doc-main.has-toc {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 42px; align-items: start;
}
.doc-content { max-width: var(--maxw); min-width: 0; }
.doc-main.has-toc .doc-content { max-width: none; }

.crumbs { color: var(--dim); font-size: 0.85rem; margin: 0 0 22px; }
.crumbs span { opacity: 0.5; margin: 0 4px; }
.guide-pager { display: flex; justify-content: space-between; gap: 16px; margin: 40px 0 0; padding-top: 18px; border-top: 1px solid var(--border); }
.guide-pager a { display: inline-block; padding: 4px 0; }
.guide-pager-next { margin-left: auto; text-align: right; }

/* ── on-this-page TOC ────────────────────────────────────── */
.doc-toc {
  position: sticky; top: 78px;
  font-size: 0.86rem; line-height: 1.5;
  border-left: 1px solid var(--border); padding-left: 16px;
  max-height: calc(100vh - 110px); overflow: auto;
}
.toc-title {
  color: var(--dim); text-transform: uppercase; letter-spacing: 2px;
  font-size: 0.7rem; margin-bottom: 10px;
}
.doc-toc ul { list-style: none; margin: 0; padding: 0; }
.doc-toc li { margin: 3px 0; }
.doc-toc a { display: inline-block; padding: 2px 0; }   /* 24 px touch targets */
.doc-toc a { color: var(--dim); }
.doc-toc a:hover { color: var(--text); text-decoration: none; }
.toc-l3 { padding-left: 14px; font-size: 0.82rem; }
.toc-title a { color: inherit; }
.guide-nav .guide-doc > a { color: var(--text); }
.guide-nav .guide-doc.current > a { color: var(--accent); font-weight: 600; }
.guide-nav .guide-doc > ul { margin: 2px 0 8px 10px; padding-left: 8px; border-left: 1px solid var(--border); }

/* ── prose ───────────────────────────────────────────────── */
.doc-content h1, .doc-content h2, .doc-content h3,
.doc-content h4, .doc-content h5, .doc-content h6 {
  font-family: 'Share Tech Mono', ui-monospace, monospace;
  color: var(--text); line-height: 1.25; scroll-margin-top: 84px;
}
.doc-content h1 { font-size: 2rem; margin: 0 0 18px; letter-spacing: 0.5px; }
.doc-content h2 {
  font-size: 1.4rem; margin: 60px 0 14px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border); color: var(--accent);
  text-shadow: 0 0 8px color-mix(in srgb, var(--accent) 30%, transparent);
}
.doc-content h3 { font-size: 1.12rem; margin: 30px 0 10px; color: var(--green); }
.doc-content h4 { font-size: 1rem; margin: 24px 0 8px; color: var(--amber); }
.doc-content p, .doc-content li { color: var(--text); }
.doc-content strong { color: var(--text-bright); }
.doc-content em { color: var(--green); }
.doc-content ul, .doc-content ol { padding-left: 24px; }
.doc-content li { margin: 4px 0; }
.doc-content li::marker { color: var(--accent); }
/* Section breaks: no rule — the --- before each heading renders nothing; the
   heading's own top margin carries the separation as padding instead. */
.doc-content hr { display: none; }
/* Exception: a doc's closing footer note (the --- + paragraph that ends the
   article) gets a visible rule + breathing room above it. hr is display:none,
   so the following paragraph draws the line via border-top. Scoped with
   :last-child so only the final footer matches, never a mid-doc --- + text. */
.doc-content hr + p:last-child {
  border-top: 1px solid var(--border);
  margin-top: 48px;
  padding-top: 28px;
}
/* No frame by default: the panel/modal control screenshots already carry the
   card's own rounded border, so a wrapper border would double up in the
   corners. The full-window shots (overviews, header, 3D scene) have no frame of
   their own and sit on a near-identical page background, so they get one back. */
.doc-content img { max-width: 100%; height: auto; display: block; margin: 22px 0; border-radius: 8px; }
.mobile-views { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2.15fr); align-items: center; gap: clamp(8px, 2vw, 24px); margin: 24px 0; }
.mobile-views figure { min-width: 0; margin: 0; text-align: center; }
.mobile-views img { width: 100%; margin: 0 0 8px; }
.mobile-views figcaption { color: var(--dim); font-size: 0.85rem; }
.doc-content img[src*="overview"],
.doc-content img[src*="/guide/header"],
.doc-content img[src*="retro-vibes"],
.doc-content img[src*="/guide/theme-"] { border: 1px solid var(--border); }

/* Galleries (renderGalleries): one slide at a time, picked by a hidden radio
   button; Previous / Next are labels for the neighbouring slides. */
.gallery { margin: 40px 0; }
.gallery-pick { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.gallery-slide { display: none; margin: 0; }
.gallery-pick:checked + .gallery-slide { display: block; }
.gallery-nav { display: flex; align-items: center; gap: 12px; border-radius: 8px; }
.gallery-pick:focus-visible + .gallery-slide .gallery-nav { outline: 2px solid var(--accent); outline-offset: 4px; }
.gallery-step {
  flex: none; cursor: pointer; user-select: none; padding: 6px 12px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--panel-bg);
  color: var(--text); font-family: 'Share Tech Mono', monospace; letter-spacing: 0.06em;
}
.gallery-step:hover { border-color: var(--accent); }
.gallery-title { flex: 1; text-align: center; font-weight: 600; }
.gallery-count { margin-left: 10px; font-weight: 400; color: var(--dim); font-family: 'Share Tech Mono', monospace; }
.gallery-slide img { margin: 12px 0; }
.gallery-slide figcaption { color: var(--text); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* One line where there is room; a phone would cut it off, so there it wraps. */
@media (max-width: 700px) { .gallery-slide figcaption { white-space: normal; } }

/* underline inline prose links only — not the block-level doc cards */
.doc-content p a, .doc-content li a, .doc-content td a, .doc-content blockquote a {
  text-decoration: underline; text-underline-offset: 2px; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
}
h1 .anchor, h2 .anchor, h3 .anchor, h4 .anchor, h5 .anchor, h6 .anchor {
  margin-left: 10px; color: var(--dim); opacity: 0; text-decoration: none;
  font-weight: normal; transition: opacity 0.12s;
}
h1:hover .anchor, h2:hover .anchor, h3:hover .anchor,
h4:hover .anchor, h5:hover .anchor, h6:hover .anchor { opacity: 0.6; }

/* code */
.doc-content :not(pre) > code {
  font-size: 0.88em; background: var(--panel-bg);
  border: 1px solid var(--border); border-radius: 4px;
  padding: 1px 5px; color: var(--green);
}
.doc-content pre {
  background: var(--panel-bg); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 18px; overflow-x: auto;
  font-size: 0.86rem; line-height: 1.5;
  /* A real system monospace, NOT Share Tech Mono: that webfont has no
     box-drawing (─│┌┐) or block (█▓▒░) glyphs, so in the ASCII schematics those
     chars fall back to a different-width font and the columns drift. These
     system fonts carry those glyphs at a consistent cell width, so diagrams
     line up. Inline code keeps Share Tech Mono (it never uses box glyphs). */
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, 'Liberation Mono', 'DejaVu Sans Mono', monospace;
}
.doc-content pre code { color: var(--text); background: none; border: 0; padding: 0; font-family: inherit; }

/* blockquote */
.doc-content blockquote {
  margin: 18px 0; padding: 2px 18px; color: var(--dim);
  border-left: 3px solid var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, transparent); border-radius: 0 8px 8px 0;
}

/* tables */
.doc-content table {
  border-collapse: collapse; width: 100%; margin: 20px 0;
  font-size: 0.9rem; display: block; overflow-x: auto;
}
.doc-content th, .doc-content td {
  border: 1px solid var(--border); padding: 7px 12px; text-align: left;
}
.doc-content thead th {
  background: var(--panel-bg); color: var(--accent);
  font-family: 'Share Tech Mono', monospace; font-weight: normal;
}
.doc-content tbody tr:nth-child(even) { background: var(--zebra); }

/* ── index / landing ─────────────────────────────────────── */
.docs-hero { margin-bottom: 8px; }
.docs-hero h1 {
  font-size: 1.5rem; margin: 0 0 12px; color: var(--dim);
  text-transform: uppercase; letter-spacing: 6px;
}
.lede { font-size: 1.15rem; color: var(--dim); max-width: 60ch; }
.overview p { color: var(--text); }
/* The landing page's grouped list: scoped under .doc-content so it wins over
   the article's own h2 / ul / li / link rules. */
.doc-content .docs-group-heading {
  font-family: 'Share Tech Mono', monospace; color: var(--dim);
  text-transform: uppercase; letter-spacing: 3px; font-size: 1.05rem;
  margin: 40px 0 10px; padding: 0; border: 0; text-shadow: none;
}
.doc-content .doc-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.doc-content .doc-list li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 16px;
  margin: 0; padding: 9px 2px; border-bottom: 1px solid var(--border);
}
.doc-content .doc-list a {
  font-family: 'Share Tech Mono', monospace; color: var(--accent); min-width: 15rem;
  text-decoration: none;
}
.doc-content .doc-list a:hover { text-decoration: underline; }
.doc-list-note { color: var(--dim); font-size: 0.92rem; }

/* ── footer ──────────────────────────────────────────────── */
.doc-foot {
  border-top: 1px solid var(--border); color: var(--dim); font-size: 0.82rem;
  max-width: 1160px; margin: 0 auto; padding: 22px 24px 40px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.doc-foot code { color: var(--dim); }
/* The version links to what changed in that release. Dim like the rest of the
   line, with the underline carrying the affordance: the accent colour every
   other link gets would shout from a footer. Matches the emulator's own About
   footer (.credits-footer in src/styles/styles-header.css). */
.doc-foot a {
  color: inherit; text-decoration: underline; text-underline-offset: 2px;
  text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent);
}
.doc-foot a:hover { color: var(--text); text-decoration-color: var(--accent); }

/* The User Guide's jump menu: only where the left menu has no room. */
.guide-jump { display: none; }

@media (max-width: 860px) {
  .doc-main.has-toc { grid-template-columns: 1fr; gap: 0; }
  .doc-toc { display: none; }
  .docs-hero h1 { font-size: 1.9rem; }
  .doc-top:has(.guide-jump) { flex-wrap: wrap; row-gap: 10px; }
  .guide-jump { display: block; flex: 1 0 100%; }
  .guide-jump select {
    width: 100%; padding: 8px 10px;
    font: inherit; font-size: 0.92rem;
    color: var(--text); background: var(--panel-bg);
    border: 1px solid var(--border); border-radius: 6px;
  }
  /* The menu takes the place of the About and icon buttons, so the bar is two
     rows at most. */
  .doc-top:has(.guide-jump) .nav-links { display: none; }
  /* The bar is a row taller here: anchors land just below it, with one offset
     (the page's padding) rather than padding and margin added together, so
     the menu's "chapter at the top" line matches where a jump lands. */
  html:has(.guide-jump) { scroll-padding-top: 120px; }
  html:has(.guide-jump) .doc-content :is(h1, h2, h3, h4, h5, h6) { scroll-margin-top: 0; }
}

/* A phone on its side has little height: the menu sits in the logo's row, so
   the bar stays one row. */
@media (max-width: 860px) and (max-height: 500px) {
  .doc-top:has(.guide-jump) { flex-wrap: nowrap; }
  .guide-jump { flex: 1 1 auto; min-width: 0; order: 1; }
  .doc-top:has(.guide-jump) .top-nav { order: 2; }
  html:has(.guide-jump) { scroll-padding-top: 84px; }
}

/* ABOUT and the two icons are desktop-only. They need more room than the plain
   text link they replaced, and below this they push the bar past the viewport;
   the emulator drops its own header icons at the same width. The About page is
   still one tap away through the emulator's About dialog and the docs index. */
@media (max-width: 680px) {
  .nav-links { display: none; }
}

/* Phones: the logo and the CTA share the bar. With a single row the base 84px
   anchor clearance is enough again. */
@media (max-width: 560px) {
  .doc-top { padding: 10px 14px; gap: 10px; }
  /* Scale the pill with the viewport (as the logo does) so the two keep sharing
     the line down to ~300px. */
  .top-nav .cta { font-size: clamp(0.76rem, 3.1vw, 0.92rem); padding: 6px 11px; }
}
