/* The Tycho docs: a night ground with a faint pixel grid, hard-edged panels
   that cast a pixel's shadow, amber eyebrows, cyan headings and links, and
   Silkscreen, a pixel face, for the titles. Dark only, like the games. */
:root {
  color-scheme: dark;
  --bg: #0b0d1a;
  --panel: #121528;
  --panel-raised: #181c34;
  --text: #e3e6f0;
  --muted: #8f97b2;
  --line: #242a48;
  --line-strong: #39416a;
  --cyan: #5fd8f0;
  --cyan-bright: #9ae9f8;
  --amber: #ffb000;
  --violet: #9d8cff;
  --shadow: #04050b;
  --grid-line: rgba(95, 216, 240, .045);
  --font-pixel: "Silkscreen", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 16px; }
body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 16px 16px;
  color: var(--text);
  font: 16px/1.65 var(--font-body);
}
a { color: var(--cyan); text-decoration-color: color-mix(in srgb, var(--cyan) 45%, transparent); text-underline-offset: 3px; }
a:hover, a:focus-visible { color: var(--cyan-bright); text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 16px; top: 16px; z-index: 10; padding: 8px 12px; background: var(--panel); }

/* Header: the pixel wordmark, the eyebrow, and the ways out. */
.site-header { display: flex; align-items: center; gap: 24px; max-width: 1180px; margin: 0 auto; padding: 24px 24px 20px; border-bottom: 2px solid var(--line-strong); }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { display: block; image-rendering: pixelated; }
.brand .mark { width: 64px; height: 64px; }
.brand .word { width: 114px; height: 27px; }
.brand-text { flex: 1; min-width: 0; }
.eyebrow { margin: 0; color: var(--amber); font: 12px var(--font-pixel); letter-spacing: .08em; text-transform: uppercase; }
.tagline { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.site-links { display: flex; flex-wrap: wrap; gap: 8px 18px; font: 13px var(--font-pixel); }
.site-links a { color: var(--text); text-decoration: none; border-bottom: 2px solid transparent; }
.site-links a:hover, .site-links a:focus-visible { color: var(--amber); border-bottom-color: var(--amber); }

/* The pages down the side, the page beside them. */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 40px; max-width: 1180px; margin: 0 auto; padding: 28px 24px 56px; }
.toc { position: sticky; top: 20px; align-self: start; max-height: calc(100vh - 40px); overflow-y: auto; padding: 14px; border: 2px solid var(--line-strong); background: var(--panel); box-shadow: 4px 4px 0 var(--shadow); font-size: 14px; }
.toc ul { margin: 0 0 6px; padding: 0; list-style: none; }
.toc a { display: block; padding: 4px 8px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; }
.toc a:hover, .toc a:focus-visible { border-left-color: var(--amber); background: var(--panel-raised); color: var(--text); }
.toc a.is-current { border-left-color: var(--amber); color: var(--text); background: var(--panel-raised); }
.toc-group { margin: 14px 0 4px; color: var(--violet); font: 11px var(--font-pixel); letter-spacing: .06em; text-transform: uppercase; }
.toc-group:first-child { margin-top: 0; }

/* The page. */
.content { min-width: 0; max-width: 820px; }
.content h1 { margin: 0 0 20px; font: 28px/1.25 var(--font-pixel); letter-spacing: .02em; }
.content h2, .content h3, .content h4 { font-family: var(--font-mono); line-height: 1.3; scroll-margin-top: 16px; }
.content h2 { margin: 40px 0 12px; padding-bottom: 8px; border-bottom: 2px solid var(--line); color: var(--cyan); font-size: 20px; }
.content h3 { margin: 28px 0 8px; font-size: 16px; color: var(--text); }
.content h4 { margin: 20px 0 6px; color: var(--muted); font-size: 14px; }
.content p, .content ul, .content ol { margin: 0 0 14px; }
.content li + li { margin-top: 4px; }
.content strong { color: #f7f8fc; }
.content hr { margin: 36px 0 16px; border: 0; border-top: 2px solid var(--line); }
.content img { max-width: 100%; height: auto; }
.content blockquote { margin: 0 0 14px; padding: 8px 14px; border-left: 4px solid var(--amber); background: var(--panel-raised); }
code { padding: 1px 5px; border: 1px solid var(--line); background: var(--panel-raised); font: .88em var(--font-mono); overflow-wrap: anywhere; }
pre { margin: 0 0 16px; padding: 14px 16px; overflow-x: auto; border: 2px solid var(--line-strong); background: var(--panel); box-shadow: 4px 4px 0 var(--shadow); line-height: 1.5; }
pre code { padding: 0; border: 0; background: none; font-size: 13px; overflow-wrap: normal; }
.highlight { background: none; }
table { display: block; width: 100%; margin: 0 0 18px; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--amber); font: 11px var(--font-pixel); letter-spacing: .04em; text-transform: uppercase; }
tbody tr:hover { background: var(--panel); }

.site-footer { max-width: 1180px; margin: 0 auto; padding: 18px 24px 36px; border-top: 2px solid var(--line); color: var(--muted); font-size: 13px; }

/* Syntax colors for Rouge's highlighted blocks, in the palette. */
.highlight .c, .highlight .c1, .highlight .cm { color: #6b7394; font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr { color: var(--violet); }
.highlight .s, .highlight .s1, .highlight .s2, .highlight .sb { color: #b7e07a; }
.highlight .m, .highlight .mi, .highlight .mf { color: var(--amber); }
.highlight .nf, .highlight .nx { color: var(--cyan-bright); }
.highlight .o, .highlight .p { color: #c4c9dc; }

/* The study's live demos (docs/study): a dark stage panel with the pixel art
   scaled by whole numbers, its controls, and a caption with a chip saying how
   the technique would run in Tycho (per frame, pre-bake, shader). */
figure.demo { margin: 22px 0; border: 2px solid var(--line-strong); background: var(--panel); box-shadow: 4px 4px 0 var(--shadow); }
figure.demo .stage { padding: 12px; background: #07080f; color: var(--text); }
figure.demo figcaption { padding: 10px 14px 12px; border-top: 2px solid var(--line); font-size: 14.5px; }
figure.demo figcaption b { color: #f7f8fc; }
figure.demo figcaption ul { margin: 6px 0; }
.fit { display: inline-block; margin-left: 6px; padding: 0 6px; border: 1px solid currentColor; font: 10px/1.7 var(--font-pixel); letter-spacing: .04em; text-transform: uppercase; vertical-align: 2px; white-space: nowrap; }
.fit.per-frame { color: #8be07a; }
.fit.prebake { color: var(--cyan); }
.fit.shader { color: #ff7a8a; }
canvas.px { display: block; max-width: 100%; margin: 0 auto; image-rendering: pixelated; image-rendering: crisp-edges; }
.stage .ctl { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; font-size: 13px; }
.stage .tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.stage button { min-height: 32px; padding: 5px 11px; border: 2px solid var(--line-strong); background: var(--panel-raised); color: var(--text); font: 13px var(--font-body); cursor: pointer; }
.stage button:hover { border-color: var(--amber); }
.stage button[aria-pressed="true"] { border-color: var(--amber); background: var(--amber); color: #0b0d1a; }
.stage label { display: inline-flex; align-items: center; gap: 4px; }
.stage input[type="range"] { width: 110px; accent-color: var(--amber); }
.stage input[type="checkbox"] { accent-color: var(--amber); }
.stage code { background: var(--panel-raised); color: var(--text); }
.stage .note { flex-basis: 100%; color: var(--muted); font-size: 12.5px; }
.content .finding { margin: 18px 0; padding: 12px 16px; border-left: 4px solid var(--amber); background: var(--panel-raised); }

@media (max-width: 860px) {
  .site-header { flex-wrap: wrap; padding: 18px 16px 14px; }
  .layout { grid-template-columns: 1fr; gap: 20px; padding: 18px 16px 40px; }
  .toc { position: static; max-height: none; }
  .content h1 { font-size: 22px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
