/* The advent section: four looks over one layout (docs/decisions/0008); riso
   is the one in use, the others wait for a rework (0010). Each look only sets the tokens below plus a few
   decorations; layout rules use tokens and never a look's own colours.
   Palettes are deliberate Christmas palettes, a stated exception to
   house-style's "no invented palette"; the readability floor still applies
   (16px body, nothing read under 14px, text pairs >= 4.5:1, measured). */

/* Display fonts, self-hosted (latin subsets from Google Fonts, SIL OFL 1.1;
   licences beside them in fonts/). A browser only downloads the ones the
   current look uses. */
@font-face { font-family: "Pixelify Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/pixelify-sans-700-latin.woff2") format("woff2"); }
@font-face { font-family: "VT323"; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/vt323-400-latin.woff2") format("woff2"); }
@font-face { font-family: "Fraunces"; font-weight: 600; font-style: italic; font-display: swap; src: url("fonts/fraunces-600-italic-latin.woff2") format("woff2"); }
@font-face { font-family: "Bricolage Grotesque"; font-weight: 800; font-style: normal; font-display: swap; src: url("fonts/bricolage-grotesque-800-latin.woff2") format("woff2"); }

:root {
  /* knit tokens; riso, the look in use (0010), overrides them below */
  --bg: #faf5ec;
  --fg: #1e2a44;
  --muted: #55607a;
  --accent: #b8312f;
  --link: #a12b29;
  --line: #e3d7c3;
  --code: #f1e9dc;
  --snow: #b9c8d8;
  --display: "Pixelify Sans", ui-monospace, monospace;
  --display-color: var(--accent);
  --body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

[data-skin="printout"] {
  --bg: #fbfaf3;
  --fg: #1f1f1f;
  --muted: #5f5d56;
  --accent: #b3261e;
  --link: #b3261e;
  --line: #c9c6ba;
  --code: #eef3ea;
  --snow: transparent;
  --display: "VT323", ui-monospace, monospace;
  --display-color: var(--accent);
  --body: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

[data-skin="village"] {
  --bg: #13233a;
  --fg: #e8eef5;
  --muted: #a9b8cc;
  --accent: #ffc56b;
  --link: #ffd48a;
  --line: #2c4260;
  --code: #1b2f4a;
  --snow: #f3f6fa;
  --display: "Fraunces", Georgia, serif;
  --display-color: #ffd48a;
  color-scheme: dark;
}

[data-skin="riso"] {
  --bg: #f2ede3;
  --fg: #2a2522;
  --muted: #62574f;
  --accent: #e0443e;
  --link: #00704f;
  --line: #d9cfbf;
  --code: #e9e2d4;
  --snow: #c9b9a6;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --display-color: #00795c;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--fg); font: 16px/1.65 var(--body); -webkit-text-size-adjust: 100%; }
body { margin: 0; }
a { color: var(--link); text-underline-offset: 0.2em; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }

.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 0; }
.sheet { position: relative; z-index: 1; min-height: 100vh; }
.wrap { max-width: 46rem; margin: 0 auto; padding-left: 1.25rem; padding-right: 1.25rem; }

/* Printout: continuous-feed paper with tractor holes down both edges. */
[data-skin="printout"] .sheet {
  max-width: 52rem; margin: 0 auto;
  background: repeating-linear-gradient(#fbfaf3 0 2.4rem, #e4efe0 2.4rem 4.8rem);
  border-left: 22px solid #efede4; border-right: 22px solid #efede4;
}
[data-skin="printout"] .sheet::before, [data-skin="printout"] .sheet::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 22px;
  background: radial-gradient(circle, #d3d0c4 0 4.5px, transparent 5.5px) 0 0 / 22px 1.2rem;
}
[data-skin="printout"] .sheet::before { left: -22px; }
[data-skin="printout"] .sheet::after { right: -22px; }

/* ---- header ---- */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding-top: 1rem; padding-bottom: 0.75rem; font-size: 0.875rem; }
.back { color: var(--muted); text-decoration: none; }
.back:hover { color: var(--fg); }
.skins { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.skins-label { color: var(--muted); }
.skins button {
  font: inherit; font-size: 0.875rem; color: var(--fg); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.7rem; cursor: pointer;
}
.skins button:hover { border-color: var(--fg); }
.skins button[aria-pressed="true"] { background: var(--fg); color: var(--bg); border-color: var(--fg); }

.hero { display: block; width: 100%; height: 120px; }
[data-skin="printout"] .hero { height: 96px; }
[data-skin="village"] .hero { height: 170px; }

main { padding-top: 1.5rem; padding-bottom: 3rem; }

/* ---- type ---- */
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
.display { font-family: var(--display); color: var(--display-color); font-weight: 700; font-size: 2.3rem; margin: 0 0 0.5rem; letter-spacing: 0.01em; }
.display.small { font-size: 1.5rem; margin-top: 2.5rem; }
[data-skin="printout"] .display { font-weight: 400; font-size: 2.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
[data-skin="printout"] .display.small { font-size: 2rem; }
[data-skin="village"] .display { font-style: italic; font-weight: 600; }
[data-skin="riso"] .display { font-weight: 800; letter-spacing: -0.02em; text-shadow: 3px 2px 0 rgba(224, 68, 62, 0.55); }
.lede { color: var(--muted); margin: 0 0 1.5rem; max-width: 36rem; }
.eyebrow { margin: 0 0 0.4rem; font-size: 0.875rem; color: var(--muted); }
.eyebrow a { color: var(--muted); }

/* ---- calendar ---- */
.cal { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.6rem; }
@media (max-width: 34rem) { .cal { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.day {
  position: relative; display: block; aspect-ratio: 1 / 1.1; border-radius: 6px; overflow: hidden;
  text-decoration: none; color: var(--fg); border: 1px solid var(--line);
}
.day[href]:hover { transform: translateY(-2px); }
.day canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.day .num, .day .parts {
  position: absolute; font-size: 0.875rem; font-weight: 700; line-height: 1;
  padding: 0.25rem 0.35rem; border-radius: 4px; background: var(--bg); color: var(--fg);
}
.day .num { left: 0.3rem; top: 0.3rem; }
.day .parts { right: 0.3rem; bottom: 0.3rem; letter-spacing: 0.1em; color: var(--accent); }
.day[data-parts="0"] .parts { color: var(--muted); }
[data-skin="village"] .day .parts { color: var(--accent); }
[data-skin="printout"] .day { border: 1px dashed var(--fg); border-radius: 0; }
[data-skin="printout"] .day .num, [data-skin="printout"] .day .parts { font-family: "VT323", var(--mono); font-size: 1.15rem; font-weight: 400; }
[data-skin="village"] .day { border-color: transparent; }

.days { list-style: none; padding: 0; margin: 0; }
.days li { display: flex; gap: 1rem; padding: 0.4rem 0; border-bottom: 1px dashed var(--line); }
.days .d { color: var(--muted); font-family: var(--mono); font-size: 0.875rem; padding-top: 0.15em; }

/* ---- post ---- */
.post-head { margin-bottom: 1.25rem; }
.meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; margin: 0; font-size: 0.875rem; color: var(--muted); }
.meta a { color: var(--muted); }
.scene { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; margin: 0 0 1.75rem; }
.prose { overflow-wrap: break-word; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose table { margin: 0 0 1rem; }
.prose h2 { font-family: var(--display); color: var(--display-color); font-size: 1.35rem; margin: 2.25rem 0 0.75rem; }
[data-skin="printout"] .prose h2 { font-weight: 400; font-size: 1.7rem; text-transform: uppercase; letter-spacing: 0.05em; }
[data-skin="village"] .prose h2 { font-style: italic; }
.prose h3 { font-size: 1.05rem; margin: 1.75rem 0 0.5rem; }
/* A part of the puzzle (## Part 1 ... {.part}): a level above its steps,
   with a rule across the page so the two parts read as separate halves. */
.prose .part {
  font-family: var(--display); color: var(--display-color); font-size: 1.7rem;
  margin: 3.5rem 0 1rem; padding-top: 1.25rem; border-top: 3px solid var(--accent);
}
[data-skin="riso"] .prose .part { box-shadow: 0 -5px 0 -2px rgba(0, 121, 92, 0.35); }
.prose ul, .prose ol { padding-left: 1.5rem; }
.prose blockquote { margin-left: 0; padding-left: 1rem; border-left: 3px solid var(--line); color: var(--muted); }
.prose img { max-width: 100%; height: auto; }
.prose table { border-collapse: collapse; display: block; overflow-x: auto; font-size: 0.875rem; }
.prose th, .prose td { border: 1px solid var(--line); padding: 0.35rem 0.6rem; text-align: left; }
code { font-family: var(--mono); font-size: 0.9em; }
:not(pre) > code { background: var(--code); padding: 0.1em 0.35em; border-radius: 3px; }
pre, .chroma, .dark .chroma { background: var(--code) !important; }
pre { padding: 0.9rem 1rem; overflow-x: auto; line-height: 1.5; border: 1px solid var(--line); border-radius: 6px; margin: 0 0 1.25rem; }
pre code { font-size: 0.875rem; }
.dark .chroma span { color: inherit; font-weight: inherit; font-style: inherit; }
.chroma .bp { color: #57606a; }
.dark .chroma .bp { color: #ffa657; }

.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 3rem; padding-top: 1rem; border-top: 1px dashed var(--line); font-size: 0.875rem; }
.notice { padding: 0.75rem 1rem; border: 1px dashed var(--accent); border-radius: 6px; font-size: 0.875rem; margin: 0 0 1.5rem; }

.foot { padding-bottom: 2rem; color: var(--muted); font-size: 0.875rem; }
.foot p { margin: 0; padding-top: 1rem; border-top: 1px solid var(--line); }
.foot a { color: var(--muted); }

@media (prefers-reduced-motion: reduce) { .day[href]:hover { transform: none; } }

/* Measured on these looks' code backgrounds (2026-12-02): github's keyword red
   is 4.16–4.44:1 on the riso and knit code surfaces, and github-dark's comment
   grey 4.4:1 on the village one. */
.chroma .k, .chroma .kc, .chroma .kd, .chroma .kn, .chroma .kp, .chroma .kr, .chroma .kt { color: #b0141f; }
.dark .chroma .k, .dark .chroma .kc, .dark .chroma .kd, .dark .chroma .kn, .dark .chroma .kp, .dark .chroma .kr, .dark .chroma .kt { color: #ff7b72; }
.dark .chroma .c, .dark .chroma .ch, .dark .chroma .cm, .dark .chroma .c1, .dark .chroma .cs, .dark .chroma .cp, .dark .chroma .cpf, .dark .chroma .go, .dark .chroma .gp { color: #a3adb9; }

/* Videos from the loop shortcode. */
.loop { margin: 0 0 1.75rem; }
.loop video { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--code); }
.loop figcaption { margin-top: 0.5rem; font-size: 0.875rem; color: var(--muted); }
.loop video { cursor: pointer; }
.loop-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-top: 0.5rem; font-size: 0.85rem; }
.loop-controls button {
  font: inherit; color: var(--fg); background: var(--code); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.15rem 0.5rem; cursor: pointer;
}
.loop-controls button:hover { border-color: var(--muted); }
.loop-play { min-width: 5.5rem; text-align: left; }
.loop-scrub { flex: 1 1 10rem; min-width: 8rem; accent-color: var(--accent); }
.loop-speed { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--muted); }
.loop-speed span { margin-right: 0.15rem; }
.loop-speed button[aria-pressed="true"] { color: var(--bg); background: var(--accent); border-color: var(--accent); }

/* ---- tabs (layouts/_shortcodes/tabs.html) --------------------------------
   Without JS the sections follow each other with their own headings; the
   script adds .tabs-on, builds the bar and hides the inactive sections. */
.tabs { margin: 2rem 0; }
.tab-bar { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 1.5rem; padding: 0; border-bottom: 2px solid var(--line); }
.tab-bar button {
  font: inherit; font-weight: 700; font-size: 0.95rem; color: var(--muted); background: none;
  border: 2px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0;
  padding: 0.45rem 0.9rem; margin-bottom: -2px; cursor: pointer;
}
.tab-bar button:hover { color: var(--fg); }
.tab-bar button[aria-selected="true"] { color: var(--display-color); background: var(--bg); border-color: var(--line); }
.tabs-on .tab-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tabs-on .tab[hidden] { display: none; }
.tab-title { font-family: var(--display); color: var(--display-color); font-size: 1.6rem; margin: 2.5rem 0 1rem; }
.prose .tab h3 { font-family: var(--display); color: var(--display-color); font-size: 1.25rem; margin: 2.25rem 0 0.75rem; }
/* Inside a language tab the parts are ### {.part} and their steps ####
   (decision 0014): steps keep the look tab headings had before. */
.prose h4 { font-size: 1rem; margin: 1.5rem 0 0.5rem; }
.prose .tab h4 { font-family: var(--display); color: var(--display-color); font-size: 1.15rem; margin: 2rem 0 0.6rem; }
.prose .tab .part { font-size: 1.5rem; }
[data-skin="riso"] .tab-bar button[aria-selected="true"] { box-shadow: 2px -1px 0 rgba(224, 68, 62, 0.45); }

/* ---- notes (layouts/_shortcodes/note.html) ------------------------------- */
.note {
  margin: 1.5rem 0; padding: 0.9rem 1.1rem 0.2rem; border: 2px solid var(--display-color);
  border-radius: 6px; background: var(--code);
}
[data-skin="riso"] .note { box-shadow: 4px 3px 0 rgba(224, 68, 62, 0.5); } /* an ink layer out of register */
.note-label { margin: 0 0 0.5rem !important; font-family: var(--display); font-weight: 700; color: var(--display-color); font-size: 0.95rem; letter-spacing: 0.02em; }
.note-did-you-know { border-color: #00795c; }
.note-complexity { border-style: dashed; }
.note pre { background: var(--bg) !important; }
.note table { font-size: 0.875rem; }
.series-intro { max-width: 40rem; margin-bottom: 1.5rem; }
.series-intro ul { padding-left: 1.25rem; }

/* Tabs inside a tab (one per language) are pills that wrap, since there are
   twenty-odd of them. */
.tab .tabs { margin-top: 1rem; }
.tab .tabs > .tab-bar { border-bottom: none; gap: 0.35rem; margin-bottom: 1.25rem; }
.tab .tabs > .tab-bar button {
  font-weight: 600; font-size: 0.875rem; padding: 0.2rem 0.75rem; margin: 0;
  border: 1px solid var(--line); border-radius: 999px;
}
.tab .tabs > .tab-bar button[aria-selected="true"] { background: var(--display-color); color: var(--bg); border-color: var(--display-color); box-shadow: none; }

/* Narrow screens (decision 0015): a shorter hero band so its sprites are
   smaller and more of them fit, and tighter tab buttons so the three
   top tabs share one row. */
@media (max-width: 640px) {
  .hero { height: 84px; }
  .tab-bar { gap: 0.25rem; }
  .tab-bar button { padding: 0.4rem 0.55rem; font-size: 0.875rem; }
}

/* Charts from the figure shortcode: on a phone a chart keeps a readable
   width and scrolls sideways; tapping it opens the SVG full size. */
.chart-scroll { overflow-x: auto; }
.chart-scroll img { display: block; width: 100%; height: auto; }
.chart-hint { display: none; font-size: 0.8rem; color: var(--muted); margin: 0.25rem 0 0; }
@media (max-width: 640px) {
  .chart-scroll img { width: 640px; max-width: none; }
  .chart-hint { display: block; }
}
