/* ==== 00-tokens.css ==== */
/* 00-tokens.css: design tokens (BUILD-SPEC v3 addendum C). Change colours HERE only.
   DARK IS THE DEFAULT for every visitor (owner choice, v3): :root holds the dark palette, and the toggle sets
   data-theme="light" on <html> (remembered in localStorage) to switch to the light palette below.
   prefers-color-scheme is deliberately NOT consulted.
   Every text/background pair is contrast-checked by scripts/contrast.mjs; run it after any change. */

:root {
  color-scheme: dark;

  /* palette, dark (the default) */
  --bg: #10231A;
  --surface: #173225;
  --mint: #1C3B2B;
  --mint-2: #234A35;
  --line: #2C5540;
  --green-600: #7FD8A4;   /* actions, links (dark text on solid fills) */
  --green-800: #D9F0E0;   /* headings */
  --leaf-400: #4FA875;    /* decoration only, never text */
  --sage-300: #3E7357;    /* decoration only, never text */
  --sun: #F7C948;         /* accent; always with --on-sun text */
  --peach: #F5B48C;       /* decoration only */
  --sky: #C4E4F2;         /* decoration only */
  --cream: #FFF6E0;       /* illustration grounds */
  --sakura: #F2A7C3;      /* decoration only, never text */
  --sakura-deep: #D9779F; /* decoration only, never text */
  --ink: #E8F1EA;
  --muted: #A9BFB0;

  /* roles */
  --link: var(--green-600);
  --link-hover: #B5EBCB;
  --on-accent: #10231A;          /* text on a solid --green-600 fill (buttons) */
  --on-sun: #14261C;             /* text on --sun, both themes */
  --band-bg: #1F7A4D;            /* the one solid green band, both themes */
  --band-ink: #FFFFFF;
  --band-btn-bg: #FFFFFF;        /* inverted button on the band, both themes */
  --band-btn-ink: #17543A;
  --link-strong: var(--green-800); /* links on --mint-2 panels (--link is 4.17:1 there in light) */
  --focus: #7FD8A4;
  --header-bg: rgb(16 35 26 / 0.86);
  --shadow-soft: 0 1px 2px rgb(0 0 0 / 0.2), 0 8px 24px -12px rgb(0 0 0 / 0.5);
  --shadow-lift: 0 2px 4px rgb(0 0 0 / 0.25), 0 18px 40px -18px rgb(0 0 0 / 0.6);

  /* type */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-body: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-pixel: 'Silkscreen', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; /* tiny eyebrow labels only */
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --step--1: clamp(0.8125rem, 0.79rem + 0.1vw, 0.875rem);
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.07rem + 0.3vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.25rem + 0.6vw, 1.75rem);
  --step-3: clamp(1.75rem, 1.5rem + 1.3vw, 2.5rem);
  --step-4: clamp(2.125rem, 1.7rem + 2.2vw, 3.5rem);
  --step-display: clamp(2.75rem, 7vw, 6rem);

  /* space and shape */
  --space-section: clamp(4rem, 10vw, 9rem);
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --max: 72rem;
  --max-text: 40rem;
  --radius: 1.5rem;
  --radius-sm: 0.875rem;
  --pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* light values: only when the visitor has chosen light with the toggle (data-theme="light" on <html>) */
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #F6FAF3;
  --surface: #FFFFFF;
  --mint: #E6F4E4;
  --mint-2: #CFEBD2;
  --line: #D4E6D5;
  --green-600: #1F7A4D;
  --green-800: #17543A;
  --leaf-400: #5BBF84;
  --sage-300: #A8D5B5;
  --ink: #14261C;
  --muted: #4C6155;
  --on-accent: #FFFFFF;
  --focus: #1F7A4D;
  --link-hover: var(--green-800);
  --header-bg: rgb(246 250 243 / 0.86);
  --shadow-soft: 0 1px 2px rgb(20 38 28 / 0.04), 0 8px 24px -12px rgb(20 38 28 / 0.12);
  --shadow-lift: 0 2px 4px rgb(20 38 28 / 0.05), 0 18px 40px -18px rgb(20 38 28 / 0.22);
}

/* ==== 10-base.css ==== */
/* 10-base.css: reset, element defaults, typography, focus, motion preferences. */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.02em;
  color: var(--green-800);
  margin: 0 0 0.5em;
  text-wrap: balance;
}
h1 { font-size: var(--step-4); font-weight: 700; }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }

p, ul, ol, dl, blockquote, pre, figure { margin: 0 0 1rem; }
p { text-wrap: pretty; }

img, svg, video, iframe { display: block; max-width: 100%; }
img { height: auto; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}
a:hover { color: var(--link-hover); text-decoration-thickness: 2px; }

strong { font-weight: 600; }
small { font-size: var(--step--1); }
code, pre { font-family: var(--font-mono); font-size: 0.9em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2.5rem 0; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

::selection { background: var(--sun); color: var(--on-sun); }

/* focus: always visible for keyboard users */
:focus { outline: none; }
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}
main:focus { outline: none; }

.skip-link {
  position: absolute;
  left: 1rem;
  top: 0.75rem;
  z-index: 100;
  padding: 0.6rem 1rem;
  border-radius: var(--pill);
  background: var(--green-600);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-200%);
  transition: transform 0.2s var(--ease);
}
.skip-link:focus { transform: none; color: var(--on-accent); }

/* .js-only: shown only once site.js is running (e.g. text about the theme button) */
.js-only { display: none !important; }
.site-js .js-only { display: block !important; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* page transitions: progressive enhancement, same-origin navigations only */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vt-out 0.18s ease both; }
  ::view-transition-new(root) { animation: vt-in 0.28s var(--ease) both; }
  @keyframes vt-out { to { opacity: 0; } }
  @keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ==== 20-components.css ==== */
/* 20-components.css: shared components. Reuse these; do not restyle them from page CSS files.
   ---------------------------------------------------------------------------------------------
   LAYOUT
   .container            centred column, max 72rem, side gutters. Add .container--text for a 40rem text column.
   .section              full-width block with big vertical padding. Modifiers: .section--mint (soft panel bg),
                         .section--tight (half padding), .section--flush-top (no top padding).
   .section-head         heading group: .eyebrow + h2 + optional .lead. Add .section-head--center to centre.
   .split                two columns (text + media) from 860px, stacked below. .split--reverse puts media first
                         on wide screens. Children: .split__text, .split__media.
   .band                 THE one solid green full-width block (white text). Use once per page at most.
                         Use .btn--on-band inside it.
   TYPE
   .eyebrow              tiny pixel label above a heading (Silkscreen, var(--font-pixel), green). Silkscreen is for
                         these tiny labels only, never headings or body text (v3 addendum C).
   .display              the biggest heading size (hero h1).
   .lead                 larger intro paragraph, muted colour.
   .muted                secondary text colour.
   .prose                wrapper for markdownToHtml output: headings, lists, quotes, code, rules.
   ACTIONS
   .btn                  pill button/link. Variants: .btn--primary (solid green), .btn--ghost (outlined),
                         .btn--sm (small outlined action, e.g. project rows), .btn--on-band (white on the band).
   .btn-row              horizontal wrap of buttons with gaps.
   .text-link            inline link with a trailing arrow (add <span aria-hidden="true">&rarr;</span>).
                         Min 24px tall, 44px on touch widths. Use it for standalone links (downloads etc).
   .js-only              hidden unless site.js is running (block element). For text about JS-only controls.
   LABELS
   .chip                 small rounded tag (category, theme). .chip-list wraps several.
   .sample-chip          yellow "sample" marker for placeholder content (BUILD-SPEC section 2). Every item
                         with sample: true must render one: <span class="sample-chip">Sample</span>
   CARDS AND LISTS
   .card                 rounded surface with border and padding. .card--link adds hover lift (put the <a> on
                         .card__title a; the ::after stretches it over the card). Parts: .card__media,
                         .card__body, .card__title, .card__text.
   .row-list             simple rows: <ul class="row-list"><li class="row"> .row__title (a) + .row__meta
                         (<time>, chips, reading time). Title left, meta right on wide screens.
   .year-list            grouped by year: .year-list__group > .year-list__year (left column) + .year-list__rows
                         (a .row-list or any content). Used by Home timeline and Projects.
   .empty-state          friendly placeholder: optional <img> (pixel/empty-sapling.svg) + heading + text, centred.
   .ill                  illustration frame: rounded, painted --mint-2 ground, keeps aspect ratio. Give the <img>
                         width and height attributes (no inline styles: the CSP blocks them).
   .pixel                any pixel-art <img> (src/img/pixel/): crisp scaling (image-rendering: pixelated).
   .divider              quiet full-width treeline (pixel/divider-treeline.svg repeated horizontally, 480x24).
   MOTION
   .reveal               fades/lifts in on scroll (site.js). Content stays visible without JS, if the observer
                         fails (2.5s failsafe), and under prefers-reduced-motion.
   CHROME
   .site-header, .site-nav, .nav-toggle, .theme-toggle, .wordmark, .site-footer: header, nav, footer partials.
   ---------------------------------------------------------------------------------------------
   Rules: colours only via tokens in 00-tokens.css. Links on --mint-2 use var(--link-strong).
   No inline style="" attributes and no inline scripts anywhere (CSP).                                    */

/* ---------------------------------------------------------------- layout */

.container {
  width: 100%;
  max-width: calc(var(--max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--text { max-width: calc(var(--max-text) + 2 * var(--gutter)); }

.section { padding-block: var(--space-section); }
.section--mint { background: var(--mint); }
.section--tight { padding-block: calc(var(--space-section) / 2); }
.section--flush-top { padding-top: 0; }

.section-head { max-width: var(--max-text); margin-bottom: clamp(2rem, 5vw, 3.5rem); }
.section-head > :last-child { margin-bottom: 0; }
.section-head--center { margin-inline: auto; text-align: center; }

.split {
  display: grid;
  gap: clamp(2.5rem, 6vw, 6rem);
  align-items: center;
}
.split__text { max-width: var(--max-text); }
@media (min-width: 860px) {
  .split { grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr); }
  .split--reverse { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); }
  .split--reverse .split__media { order: -1; }
}

.band {
  background: var(--band-bg);
  color: var(--band-ink);
  padding-block: var(--space-section);
  --focus: var(--band-ink);
}
.band h2, .band h3, .band p, .band a:not(.btn) { color: var(--band-ink); }

/* ---------------------------------------------------------------- type */

.eyebrow {
  display: inline-block;
  margin: 0 0 0.9rem;
  font-family: var(--font-pixel);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--link);
}
.display {
  font-size: var(--step-display);
  font-weight: 700;
  line-height: 0.98;
  letter-spacing: -0.035em;
}
.lead { font-size: var(--step-1); color: var(--muted); line-height: 1.55; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- actions */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.875rem;
  padding: 0.7rem 1.4rem;
  border: 1.5px solid transparent;
  border-radius: var(--pill);
  font-family: var(--font-body);
  font-size: var(--step-0);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  transition: transform 0.25s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.25s var(--ease);
}
.btn:hover { transform: translateY(-2px); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--green-600); color: var(--on-accent); box-shadow: var(--shadow-soft); }
.btn--primary:hover { background: var(--green-800); color: var(--surface); box-shadow: var(--shadow-lift); }
.btn--ghost { border-color: currentColor; color: var(--link); }
.btn--ghost:hover { background: var(--surface); color: var(--link-hover); }
.btn--sm {
  min-height: 2.75rem; /* 44px tap target */
  padding: 0.35rem 1rem;
  font-size: var(--step--1);
  border-color: var(--line);
  color: var(--link);
  background: var(--surface);
}
.btn--sm:hover { border-color: currentColor; color: var(--link-hover); }
.btn--on-band { background: var(--band-btn-bg); color: var(--band-btn-ink); }
.btn--on-band:hover { background: var(--band-btn-bg); color: var(--band-btn-ink); box-shadow: 0 12px 30px -12px rgb(0 0 0 / 0.35); }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  min-height: 2.75rem; /* 44px tap target at every width (see TAP TARGETS) */
  font-weight: 600;
  text-decoration: none;
  color: var(--link);
}
.text-link span[aria-hidden] { transition: transform 0.25s var(--ease); }
.text-link:hover { text-decoration: underline; }
.text-link:hover span[aria-hidden] { transform: translateX(4px); }

/* ---------------------------------------------------------------- labels */

.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0; padding: 0; list-style: none; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: var(--pill);
  background: var(--mint);
  color: var(--green-800);
  font-size: var(--step--1);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}
.section--mint .chip { background: var(--surface); }
.sample-chip {
  display: inline-flex;
  align-items: center;
  vertical-align: 0.15em;
  padding: 0.05rem 0.5rem;
  border-radius: var(--pill);
  background: var(--sun);
  color: var(--on-sun);
  font-family: var(--font-body);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.5;
  text-transform: uppercase;
  white-space: nowrap;
}

/* ---------------------------------------------------------------- cards */

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s var(--ease);
}
.card__media { background: var(--mint-2); }
.card__media img { width: 100%; height: auto; }
.card__body { display: flex; flex-direction: column; gap: 0.5rem; padding: 1.5rem; flex: 1; }
.card__body > * { margin: 0; }
.card__title { font-size: var(--step-1); }
.card__title a { display: inline-flex; align-items: center; min-height: 2.75rem; color: inherit; text-decoration: none; }
.card__text { color: var(--muted); }
.card--link .card__title a::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
.card--link:hover { transform: translateY(-4px); box-shadow: var(--shadow-lift); border-color: var(--sage-300); }
.card--link:focus-within { box-shadow: 0 0 0 3px var(--focus); }
.card--link .card__title a:focus-visible { outline: none; }

/* ---------------------------------------------------------------- lists */

.row-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.row {
  display: grid;
  gap: 0.35rem 1.5rem;
  padding: 1.15rem 0;
  border-bottom: 1px solid var(--line);
}
.row__title {
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
  color: var(--green-800);
  text-decoration: none;
}
a.row__title { display: flex; align-items: center; min-height: 2.75rem; }
a.row__title:hover { color: var(--link); text-decoration: underline; }
.row__text { margin: 0; color: var(--muted); }
.row__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.75rem;
  color: var(--muted);
  font-size: var(--step--1);
}
@media (min-width: 720px) {
  .row { grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; }
  .row__meta { justify-content: flex-end; }
  .row__text { grid-column: 1; }
}

.year-list { display: grid; gap: 0; border-top: 1px solid var(--line); }
.year-list__group {
  display: grid;
  gap: 0.5rem 2rem;
  padding: 1.75rem 0;
  border-bottom: 1px solid var(--line);
}
.year-list__year {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--muted);
  letter-spacing: -0.01em;
}
.year-list__rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 1.5rem; }
.year-list__rows > li > :last-child { margin-bottom: 0; }
@media (min-width: 720px) {
  .year-list__group { grid-template-columns: 10rem minmax(0, 1fr); }
}

/* ---------------------------------------------------------------- empty state, illustration frame */

.empty-state {
  display: grid;
  justify-items: center;
  gap: 0.75rem;
  max-width: 28rem;
  margin-inline: auto;
  padding: 2.5rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.empty-state img { width: 9rem; height: auto; aspect-ratio: 1; }
.empty-state > * { margin: 0; }
.empty-state h3 { font-size: var(--step-1); }
.empty-state p { color: var(--muted); }

.ill {
  margin: 0;
  border-radius: var(--radius);
  background: var(--mint-2);
  overflow: hidden;
}
.ill img { width: 100%; height: auto; }

/* pixel art: keep hard pixel edges at any scale (all files in src/img/pixel/ are drawn on an integer grid) */
.pixel, .ill img, .empty-state img { image-rendering: pixelated; }

/* divider: a 480x24 treeline tile repeated across the full width (decorative; aria-hidden in the markup) */
.divider {
  display: block;
  height: clamp(2.25rem, 4.5vw, 3rem);
  background-image: url('/assets/img/pixel/divider-treeline.svg');
  background-repeat: repeat-x;
  background-position: left bottom;
  background-size: auto 100%;
  image-rendering: pixelated;
}

/* ---------------------------------------------------------------- prose (markdown) */

.prose { max-width: var(--max-text); }
.prose > * + * { margin-top: 1.1em; }
.prose > * { margin-bottom: 0; }
.prose h2 { margin-top: 2.2em; font-size: var(--step-2); }
.prose h3 { margin-top: 1.8em; font-size: var(--step-1); }
.prose h2 + *, .prose h3 + * { margin-top: 0.6em; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--green-600); }
.prose blockquote {
  margin-inline: 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  border-left: 3px solid var(--sage-300);
  color: var(--muted);
}
.prose code {
  padding: 0.1em 0.35em;
  border-radius: 0.35em;
  background: var(--mint);
  color: var(--ink);
}
.prose pre {
  padding: 1.1rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--mint);
  overflow-x: auto;
  line-height: 1.5;
}
.prose pre code { padding: 0; background: none; }
.prose img { border-radius: var(--radius-sm); }

/* ---------------------------------------------------------------- reveal (site.js adds .reveal-ready to <html>) */

@media (prefers-reduced-motion: no-preference) {
  .reveal-ready .reveal:not(.is-visible) { opacity: 0; transform: translateY(24px); }
  .reveal-ready .reveal { transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
}

/* ---------------------------------------------------------------- header and nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
  backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s var(--ease);
}
.site-header.is-scrolled, .site-header.is-open { border-bottom-color: var(--line); }
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  gap: 0.55rem;
  margin-right: auto;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--green-800);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--green-800); }
.wordmark__mark { color: var(--green-600); flex: none; transition: transform 0.4s var(--ease); }
.wordmark__vein { stroke: var(--bg); }
.site-footer .wordmark__vein { stroke: var(--mint); }
.wordmark:hover .wordmark__mark { transform: rotate(-12deg); }

.site-nav__list { display: flex; gap: 0.25rem; margin: 0; padding: 0; list-style: none; }
.site-nav a {
  display: flex;
  align-items: center;
  min-height: 2.75rem; /* 44px */
  padding: 0.5rem 0.85rem;
  border-radius: var(--pill);
  color: var(--ink);
  font-size: 0.9375rem;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.site-nav a:hover { background: var(--mint); color: var(--green-800); }
.site-nav a[aria-current='page'] { background: var(--mint-2); color: var(--green-800); font-weight: 600; }

.theme-toggle, .nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-width: 2.75rem;
  height: 2.75rem;
  padding: 0 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--green-800);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.theme-toggle:hover, .nav-toggle:hover { border-color: var(--green-600); }
.theme-toggle[hidden] { display: none; }
.theme-toggle__moon { display: none; }
/* the icon shows the theme that is on: moon for dark (the default), sun for light */
:root:not([data-theme='light']) .theme-toggle__sun { display: none; }
:root:not([data-theme='light']) .theme-toggle__moon { display: block; }

.nav-toggle { display: none; padding: 0 0.95rem 0 0.8rem; font-size: 0.9375rem; font-weight: 600; }
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block;
  width: 1.05rem;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 899.98px) {
  /* without JS: the nav simply wraps onto its own row under the wordmark */
  .no-js .site-header__inner { flex-wrap: wrap; padding-block: 0.6rem; }
  .no-js .site-nav { order: 3; width: 100%; }
  .no-js .site-nav__list { flex-wrap: wrap; }

  /* with JS: a menu button opens a full-width panel */
  .js .nav-toggle { display: inline-flex; }
  .js .site-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    display: none;
    max-height: calc(100vh - 4.25rem);
    overflow-y: auto;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: var(--shadow-lift);
  }
  .js .site-header.is-open .site-nav { display: block; animation: nav-in 0.25s var(--ease); }
  .js .site-nav__list {
    flex-direction: column;
    gap: 0.25rem;
    max-width: calc(var(--max) + 2 * var(--gutter));
    margin-inline: auto;
    padding: 0.75rem var(--gutter) 1.25rem;
  }
  .js .site-nav a { padding: 0.85rem 1rem; border-radius: var(--radius-sm); font-size: var(--step-1); }
}
@keyframes nav-in { from { opacity: 0; transform: translateY(-6px); } }
@media (max-width: 380px) {
  .nav-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .js .nav-toggle { padding: 0 0.8rem; }
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  background: var(--mint);
  color: var(--ink);
  padding-top: clamp(3rem, 7vw, 5rem);
}
.site-footer__inner {
  display: grid;
  gap: 2.5rem;
  padding-bottom: 2.5rem;
}
@media (min-width: 720px) {
  .site-footer__inner { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
}
.site-footer__note { margin: 1rem 0 0; max-width: 22rem; color: var(--muted); }
.site-footer__heading {
  margin: 0 0 0.9rem;
  font-family: var(--font-body);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.site-footer__col a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem; /* 44px */
  color: var(--ink);
  text-decoration: none;
}
.site-footer__col a:hover { color: var(--link); text-decoration: underline; }
.site-footer__base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  position: relative;
  padding-block: 1.5rem 2rem;
  color: var(--muted);
  font-size: var(--step--1);
}
.site-footer__base::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--line);
}
.site-footer__base p { margin: 0; }

/* ---------------------------------------------------------------- tap targets
   At every width: header nav links, .text-link, linked row titles and footer links are at least 44px tall (min-height
   with inline-flex or flex; the text size is unchanged). Links inside running prose paragraphs are exempt. */

/* ==== about.css ==== */
/* about.css: About page only (build/60-about.mjs). Shared pieces live in 20-components.css. */

/* story: big heading and narrow text beside the grove picture (pixel art, 4:5) */
.about-story__title { margin-bottom: 1.5rem; max-width: 12ch; }
.about-story__lead { color: var(--ink); max-width: 34rem; }
.about-story .split__text > p:not(.eyebrow):not(.lead) { max-width: 36rem; }
.about-story__actions { margin-top: 2rem; }
.about-story__ill { width: 100%; max-width: 28rem; justify-self: center; aspect-ratio: 4 / 5; }
.about-story__ill img { height: 100%; object-fit: cover; }
@media (max-width: 859.98px) {
  .about-story__ill { max-width: 20rem; justify-self: start; }
}

/* outside work: five short items, no cards (a quiet grid with a top rule each) */
.about-outside { scroll-margin-top: 4.25rem; }
.about-outside:focus { outline: none; }
.outside-list {
  display: grid;
  gap: 1.75rem clamp(1.5rem, 4vw, 3rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 600px) { .outside-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .outside-list { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.outside-list__item { padding-top: 1.1rem; border-top: 2px solid var(--sage-300); }
.outside-list__item > * { margin: 0 0 0.4rem; }
.outside-list__item p { color: var(--muted); }
.outside-list__name { font-size: var(--step-1); }

/* what I'm building: three cards, one column on phones */
.build-list {
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 860px) {
  .build-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.build-list__item .card__body { padding: clamp(1.5rem, 3vw, 2rem); gap: 0.75rem; }
.build-list__more { margin-top: auto; padding-top: 0.5rem; color: var(--link); font-weight: 600; font-size: var(--step--1); }

/* writing: heading left, narrow text right on wide screens */
.about-writing { display: grid; gap: 0 clamp(2rem, 6vw, 6rem); }
@media (min-width: 860px) {
  .about-writing { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr); align-items: start; }
}
.about-writing__body { max-width: var(--max-text); }
.about-writing__body > p { font-size: var(--step-1); line-height: 1.6; }

/* not advice: a quiet bordered note */
.not-advice {
  margin-top: 2.5rem;
  padding: 1.5rem 1.75rem;
  border: 1px solid var(--line);
  border-left: 4px solid var(--sun);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.not-advice__title { margin: 0 0 0.5rem; font-size: var(--step-1); }
.not-advice p { margin: 0; color: var(--muted); }

/* contact: the page's one solid green band */
.contact { scroll-margin-top: 4.25rem; }
.contact:focus { outline: none; }
.contact__inner > * { max-width: 48rem; }
.contact__eyebrow {
  margin: 0 0 0.9rem;
  font-family: var(--font-pixel);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.contact__title { font-size: var(--step-4); margin-bottom: 1rem; }
.contact__text { max-width: 36rem; font-size: var(--step-1); }
.contact__email {
  margin: 1.75rem 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 5.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.band .contact__email a { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; }
.contact__links { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; margin: 0; padding: 0; list-style: none; }
.contact__linkedin { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.contact__linkedin a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.contact__linkedin .sample-chip { vertical-align: 0; }

/* ==== edits.css ==== */
/* edits.css: Edits page only (build/50-edits.mjs). Shared pieces live in 20-components.css. */

/* intro: big heading beside the pixel camera-on-a-hill picture (src/img/pixel/interest-video.svg, 3:4) */
.edits-intro__title { margin-bottom: 1.5rem; }
.edits-intro__note { max-width: 34rem; font-size: var(--step--1); }
.edits-intro__ill { width: 100%; max-width: 22rem; justify-self: center; aspect-ratio: 3 / 4; }
.edits-intro__ill img { height: 100%; object-fit: cover; image-rendering: pixelated; }
@media (max-width: 859.98px) {
  .edits-intro__ill { max-width: 16rem; justify-self: start; }
}

/* reel grid: reels are portrait (9:16). One column on phones (capped so a card is not a whole screen tall),
   two from 600px, three in a row from 820px. */
.reel-grid {
  display: grid;
  gap: clamp(1.5rem, 3vw, 2.5rem);
  max-width: 22rem;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
@media (min-width: 600px) {
  .reel-grid { max-width: none; grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 820px) {
  .reel-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.reel__card { height: 100%; }
.reel__card .card__title { font-size: var(--step-1); }
.reel__year { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: var(--step--1); font-weight: 500; }
.reel__year .sample-chip { vertical-align: 0; }
.reel__credit {
  display: inline-flex;
  align-items: center;
  padding: 0.1rem 0.6rem;
  border: 1.5px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--green-800);
  font-weight: 600;
}
.reel__external { margin-top: auto; padding-top: 0.25rem; font-size: var(--step--1); font-weight: 600; }

/* 9:16 poster area: pixel placeholder or local poster, plus the native video or the "coming soon" label */
.reel__media {
  position: relative;
  aspect-ratio: 9 / 16;
  background: var(--mint-2);
  overflow: hidden;
}
.reel__media > .reel__art,
.reel__media > .reel__poster-img,
.reel__cover,
.reel__cover > .reel__art,
.reel__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.reel__poster-img { object-fit: cover; }
.reel__art { image-rendering: pixelated; }
.reel__cover { display: none; }
.reel__video { background: transparent; object-fit: cover; }
.reel__media--video:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }

/* pixel placeholder: a quiet night lake. Theme tokens only. Dark (the default) draws the trees as dark
   silhouettes; light swaps to a soft daytime version. */
.px-sky1 { fill: var(--bg); }
.px-sky2 { fill: var(--surface); }
.px-sky3 { fill: var(--mint); }
.px-star { fill: var(--muted); opacity: 0.5; }
.px-star-hi { fill: var(--ink); opacity: 0.85; }
.px-halo { fill: var(--sun); opacity: 0.14; }
.px-moon { fill: var(--sun); }
.px-moon-shade { fill: var(--on-sun); opacity: 0.15; }
.px-hill-back { fill: var(--line); }
.px-snow { fill: var(--muted); opacity: 0.6; }
.px-hill-front { fill: var(--mint-2); }
.px-tree { fill: var(--bg); }
.px-shore { fill: var(--bg); }
.px-water { fill: var(--surface); }
.px-glint { fill: var(--sun); opacity: 0.55; }
.px-ripple { fill: var(--line); }
.px-petal { fill: var(--sakura, var(--peach)); }
:root[data-theme='light'] .px-star,
:root[data-theme='light'] .px-star-hi { fill: var(--surface); opacity: 0.9; }
:root[data-theme='light'] .px-hill-back { fill: var(--sage-300); }
:root[data-theme='light'] .px-snow { fill: var(--surface); opacity: 1; }
:root[data-theme='light'] .px-hill-front { fill: var(--leaf-400); }
:root[data-theme='light'] .px-tree,
:root[data-theme='light'] .px-shore { fill: var(--green-600); }
:root[data-theme='light'] .px-water { fill: var(--mint-2); }
:root[data-theme='light'] .px-ripple { fill: var(--surface); }

/* reel with a video but no poster image: edits.js adds .reel--enhanced, which puts the pixel picture and a real
   Play button over the video until the button is pressed. Without JS the plain video controls stay usable. */
.reel--enhanced .reel__cover { display: block; }
.reel--enhanced .reel__video { visibility: hidden; }
.reel--enhanced.is-playing .reel__cover { display: none; }
.reel--enhanced.is-playing .reel__video { visibility: visible; }
.reel__start {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  min-width: 7rem;
  min-height: 3rem;
  padding: 0.5rem 1.4rem;
  border: 2px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--green-800);
  font: inherit;
  font-size: var(--step-0);
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
}
.reel__start:hover { border-color: var(--green-800); }
.reel__start:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.reel__start-icon {
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 0.5rem 0 0.5rem 0.85rem;
  border-color: transparent transparent transparent currentColor;
}

/* video not added yet: a quiet label, no button */
.reel__soon {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  padding: 0.45rem 1rem;
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--green-800);
  font-size: var(--step--1);
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
}

/* closing line */
.edits-closing__inner { text-align: center; }
.edits-closing__inner .lead { margin-inline: auto; }
.edits-closing__inner > :last-child { margin-bottom: 0; }

/* ==== home.css ==== */
/* home.css: Home page only (build/10-home.mjs). Shared pieces live in 20-components.css. */

/* hero: tall, text on top, the hills band full-bleed along the bottom */
.hero {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: calc(100svh - 4.25rem);
  padding-top: clamp(3rem, 9vw, 7.5rem);
  overflow: hidden;
}
.hero__content { position: relative; z-index: 1; }
.hero__title { margin-bottom: 1.5rem; max-width: 12ch; }
.hero__line { max-width: 34rem; margin-bottom: 2rem; }
.hero__band {
  /* the valley is painted darker at the top so it melts into the dark page; no frame, no ground colour */
  margin: clamp(2.5rem, 6vw, 4rem) 0 0;
  aspect-ratio: 3 / 1;
}
.hero__band img { width: 100%; height: 100%; object-fit: cover; object-position: center bottom; }
@media (max-width: 899.98px), (orientation: portrait) {
  /* phones and portrait tablets: no forced full-height hero (it left a big empty gap) */
  .hero { min-height: 0; }
}

/* about split */
.about-split__ill { max-width: 28rem; justify-self: center; width: 100%; aspect-ratio: 4 / 5; }
.about-split__ill img { height: 100%; object-fit: cover; }

/* treeline divider before Now: sits on the page background, touching the mint panel below */
.divider--home { margin-top: calc(var(--space-section) * -0.5); }

/* timeline: dated rows on a vertical line */
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  max-width: 52rem;
  position: relative;
}
.timeline::before {
  content: '';
  position: absolute;
  top: 0.6rem;
  bottom: 0.6rem;
  left: 0.4rem;
  width: 2px;
  border-radius: 2px;
  background: var(--sage-300);
}
.timeline__row {
  position: relative;
  display: grid;
  gap: 0.15rem 2rem;
  padding: 0 0 2rem 2rem;
}
.timeline__row:last-child { padding-bottom: 0; }
.timeline__row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45rem;
  width: 0.9rem;
  height: 0.9rem;
  border-radius: 50%;
  background: var(--surface);
  border: 3px solid var(--green-600);
}
.timeline__when .sample-chip { vertical-align: 0; }
.timeline__when {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  align-self: start;
  gap: 0.25rem 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--green-800);
}
.timeline__body p { margin: 0 0 0.35rem; }
.timeline__body .text-link { font-size: var(--step--1); }
@media (min-width: 720px) {
  .timeline::before { left: 10.4rem; }
  .timeline__row { grid-template-columns: 8.5rem minmax(0, 1fr); padding-left: 0; }
  .timeline__row::before { left: 10rem; }
  .timeline__body { padding-left: 1.6rem; }
}

/* interests: six tall portrait cards (3x2 desktop, 2x3 tablet, one column on phones) */
.interest-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 600px) { .interest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1040px) { .interest-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.interest-card .card__media { aspect-ratio: 3 / 4; }
.interest-card .card__media img { height: 100%; object-fit: cover; }
@media (max-width: 599.98px) {
  /* phones: picture beside the text, still 3:4, so six cards do not make a very long scroll */
  .interest-card { flex-direction: row; }
  .interest-card .card__media { flex: none; width: 34%; align-self: flex-start; }
  .interest-card .card__body { padding: 1rem 1.1rem; }
}
.interest-card__more { margin-top: auto; padding-top: 0.5rem; font-weight: 600; color: var(--link); font-size: var(--step--1); }
.interest-card:hover .interest-card__more { text-decoration: underline; }

/* now: centred narrow column */
.now__inner { text-align: center; }
.now__ill {
  width: clamp(9rem, 22vw, 12rem);
  aspect-ratio: 1;
  margin: 0 auto 1.75rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.now__ill img { width: 100%; height: 100%; object-fit: cover; }
.now__list {
  list-style: none;
  margin: 1.5rem auto;
  padding: 0;
  display: grid;
  gap: 0.75rem;
  max-width: 30rem;
  font-size: var(--step-1);
}
.now__list li {
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line);
}
.now__updated { margin: 0; font-size: var(--step--1); }

/* latest writing header: heading left, "All notes" right */
.writing__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: clamp(2rem, 5vw, 3.5rem);
}
.writing__head .section-head { margin-bottom: 0; }

/* projects */
.project__name { margin: 0 0 0.25rem; font-size: var(--step-1); }
.project__line { margin: 0 0 0.75rem; }

/* statement band */
.statement__inner { text-align: center; max-width: 52rem; }
.statement__title { font-size: var(--step-4); font-weight: 700; margin-bottom: 1rem; }
.statement__line { font-size: var(--step-1); margin: 0 auto 2rem; max-width: 34rem; }

/* ==== journal.css ==== */
/* journal.css: public /journal/ page and reflection pages. Pager and back-link styles live in notes.css. */

.journal-how {
  margin-bottom: clamp(3rem, 7vw, 5rem);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border-radius: var(--radius);
  background: var(--mint);
}
.journal-how__title { margin: 0 0 1.5rem; font-size: var(--step-2); }
.journal-how__steps { display: grid; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 860px) { .journal-how__steps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2rem; } }
.journal-how__steps li { display: flex; gap: 0.9rem; align-items: flex-start; }
.journal-how__steps p { margin: 0; }
.journal-how__steps strong { display: block; margin-bottom: 0.25rem; color: var(--green-800); font-family: var(--font-display); }
.journal-how__step {
  flex: none;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--surface);
  color: var(--green-800);
  font-family: var(--font-display);
  font-weight: 700;
}

.journal-list-title { margin: 0 0 1.5rem; font-size: var(--step-2); }
.reflection-list { display: grid; gap: 1.5rem; margin: 0; padding: 0; list-style: none; }
@media (min-width: 860px) { .reflection-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.reflection-card .card__body { gap: 0.85rem; padding: clamp(1.5rem, 3vw, 2rem); }
.reflection-card__when { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; color: var(--muted); font-size: var(--step--1); font-weight: 600; }
.reflection-card__label {
  margin-top: 0.5rem !important;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.reflection-card__takeaways { display: grid; gap: 0.4rem; padding-left: 1.3em; }
.reflection-card__takeaways li::marker { color: var(--green-600); font-weight: 600; }
.reflection-card__more { margin-top: auto !important; padding-top: 0.5rem; color: var(--link); font-weight: 600; }

/* reflection page */
.reflection__header { margin-bottom: clamp(2rem, 5vw, 3rem); }
.reflection__header .chip-list { margin-top: 0.25rem; }
.reflection__note { margin: 2.5rem 0 0; color: var(--muted); font-size: var(--step--1); }

/* ==== notes.css ==== */
/* notes.css: /notes/ index, note pages. Shared by journal reflection pages: .pager.
   Uses shared .row-list, .chip, .prose, .empty-state from 20-components.css. */

/* filter chips: real links; JS (notes.js) filters in place and sets aria-current */
.notes-filter { margin-bottom: 1rem; }
.notes-filter__list { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0; padding: 0; list-style: none; }
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.45rem 1rem;
  border: 1.5px solid var(--line);
  border-radius: var(--pill);
  background: var(--surface);
  color: var(--green-800);
  font-size: var(--step--1);
  font-weight: 600;
  text-decoration: none;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease), color 0.2s var(--ease);
}
.filter-chip:hover { border-color: var(--green-600); color: var(--green-800); text-decoration: none; }
.filter-chip[aria-current='true'] { background: var(--green-600); border-color: var(--green-600); color: var(--on-accent); }
.filter-chip__count {
  display: inline-grid;
  place-items: center;
  min-width: 1.5rem;
  padding: 0 0.35rem;
  border-radius: var(--pill);
  background: var(--mint);
  color: var(--green-800);
  font-size: 0.75rem;
  line-height: 1.5rem;
}
.filter-chip[aria-current='true'] .filter-chip__count { background: var(--surface); color: var(--green-800); }
/* without JS the chips cannot filter, so hide them and the count line: the full list is all there is */
.no-js .notes-filter,
.no-js .notes-count { display: none; }

.notes-count { margin: 0 0 1.25rem; font-size: var(--step--1); }

.note-row[hidden], .notes-filter-empty[hidden] { display: none; }
.note-row__main { display: grid; gap: 0.35rem; }
.note-list .row__text { max-width: 44rem; }
.notes-filter-empty { margin-top: 2rem; }
.notes-filter-empty h2 { font-size: var(--step-1); }
.notes-rss { margin: 2.5rem 0 0; }

/* note page */
.note__header { margin-bottom: clamp(2rem, 5vw, 3rem); }
.note__back, .reflection__back { margin: 0 0 2rem; }
.note__header .eyebrow a { color: inherit; text-decoration: none; }
.note__header .eyebrow a:hover { text-decoration: underline; }
.note__title, .reflection__title { font-size: var(--step-4); letter-spacing: -0.025em; margin: 0 0 1rem; }
.note__meta, .reflection__meta { justify-content: flex-start; margin: 0 0 1rem; }
.note__disclaimer {
  display: inline-block;
  margin: 0;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius-sm);
  background: var(--mint);
  color: var(--muted);
  font-size: var(--step--1);
}
.note__footer, .reflection__footer {
  display: grid;
  gap: 2rem;
  margin-top: clamp(3rem, 7vw, 4.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}
.note__footer > p, .reflection__footer > p { margin: 0; }

/* previous / next */
.pager { display: grid; gap: 1rem; }
@media (min-width: 640px) { .pager { grid-template-columns: 1fr 1fr; } }
.pager__link {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  text-decoration: none;
  transition: border-color 0.2s var(--ease), transform 0.25s var(--ease);
}
.pager__link:hover { border-color: var(--green-600); transform: translateY(-2px); text-decoration: none; }
.pager__link--next { text-align: right; grid-column: -2; }
.pager__label { color: var(--muted); font-size: var(--step--1); }
.pager__title { font-family: var(--font-display); font-weight: 600; color: var(--green-800); line-height: 1.3; }
@media (max-width: 639.98px) { .pager__link--next { grid-column: auto; } }

/* ==== ratrace.css ==== */
/* ratrace.css: the Rat Race tab only (build/20-ratrace.mjs, src/js/ratrace.js).
   This is the ONLY page allowed pixel art and the Silkscreen font (.rr-label).
   Uses shared tokens and components; every selector here is rr- prefixed or scoped to .page-ratrace.
   Colour pairs used for text: --green-800 on --bg/--surface/--mint/--mint-2, --ink/--muted on the same,
   --on-sun on --sun. All are already checked by scripts/contrast.mjs; no new colours are introduced. */

/* ---------------------------------------------------------------- pixel bits */

.rr-pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* tiny pixel label (Silkscreen). Use instead of .eyebrow on this tab only. */
.rr-label {
  display: inline-flex;
  align-items: center;
  gap: 0.55em;
  margin: 0 0 0.9rem;
  font-family: 'Silkscreen', var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--green-800);
}
.rr-label::before {
  content: '';
  flex: none;
  width: 0.5em;
  height: 0.5em;
  background: var(--sun);
  box-shadow: 0.5em 0.5em 0 var(--leaf-400);
  margin-bottom: 0.5em;
}
.rr-label--inline { margin: 0; }

/* ---------------------------------------------------------------- hero */

.rr-hero { padding-top: clamp(3rem, 8vw, 6.5rem); }
.rr-hero__title { margin-bottom: 1.25rem; }
.rr-hero .lead { max-width: 34rem; margin-bottom: 1.5rem; }
.rr-licence {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.9rem;
  max-width: 34rem;
  margin-bottom: 2rem;
  padding: 0.85rem 1.1rem;
  border: 2px dashed var(--sage-300);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 500;
}
.rr-meta { margin: 1rem 0 0; color: var(--muted); font-size: var(--step--1); }

/* the Rat King on a pixel-grid stage */
.rr-stage {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  max-width: 26rem;
  aspect-ratio: 1;
  justify-self: center;
  margin: 0;
  border-radius: var(--radius);
  background-color: var(--mint-2);
  background-image:
    linear-gradient(var(--sage-300) 1px, transparent 1px),
    linear-gradient(90deg, var(--sage-300) 1px, transparent 1px);
  background-size: 1.25rem 1.25rem;
  background-position: center;
  box-shadow: inset 0 0 0 6px var(--mint-2);
  overflow: hidden;
}
.rr-stage::after {
  /* stepped pixel ground */
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 16%;
  background:
    linear-gradient(var(--leaf-400), var(--leaf-400)) 0 0 / 100% 0.625rem no-repeat,
    var(--sage-300);
}
.rr-stage__king { position: relative; z-index: 1; width: 72%; margin-top: 4%; }

@media (prefers-reduced-motion: no-preference) {
  .rr-stage__king { animation: rr-bob 2.4s steps(2, jump-none) infinite; }
  @keyframes rr-bob { 50% { transform: translateY(-2.5%); } }
}

/* ---------------------------------------------------------------- sheet cards */

.rr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 21rem), 1fr));
  gap: clamp(1.25rem, 3vw, 2rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.rr-card { border-width: 2px; }
.rr-card__media {
  aspect-ratio: 4 / 3;
  border-bottom: 2px dashed var(--line);
}
.rr-card__media img { width: 100%; height: 100%; object-fit: cover; }
.rr-card .card__title { font-size: var(--step-2); }
.rr-card .rr-label { margin-bottom: 0; }
.rr-actions { gap: 0.5rem; margin-top: 0.75rem; align-items: center; }
.rr-actions .btn { white-space: normal; text-align: center; }
.rr-dl__meta { font-weight: 500; color: var(--muted); }
.rr-soon {
  margin: 0;
  padding: 0.3rem 0.85rem;
  border: 1.5px dotted var(--sage-300);
  border-radius: var(--pill);
  color: var(--muted);
  font-size: var(--step--1);
}

/* one sheet only: a wide card, image beside the text */
@media (min-width: 760px) {
  .rr-grid--single { grid-template-columns: minmax(0, 1fr); max-width: 60rem; }
  .rr-grid--single .rr-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rr-grid--single .rr-card__media { border-bottom: 0; border-right: 2px dashed var(--line); aspect-ratio: auto; min-height: 100%; }
  .rr-grid--single .card__body { justify-content: center; padding: clamp(1.5rem, 3vw, 2.5rem); }
}

/* no-JS preview links; hidden once ratrace.js has the dialog working */
.rr-shots {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  font-size: var(--step--1);
}
.rr-enhanced .rr-shots { display: none; }

/* ---------------------------------------------------------------- extras */

.rr-extras__group + .rr-extras__group { margin-top: clamp(2.5rem, 6vw, 4rem); }
.rr-extras__heading { margin: 0 0 1.25rem; font-size: inherit; }
.rr-extras {
  display: grid;
  gap: clamp(1rem, 3vw, 1.75rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.rr-extras--wallpaper { grid-template-columns: minmax(0, 3.2fr) minmax(0, 1fr); align-items: end; }
.rr-extras--sticker { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rr-extra { display: grid; gap: 0.6rem; align-content: start; }
.rr-extra__media {
  margin: 0;
  padding: clamp(0.75rem, 2vw, 1.25rem);
  border: 2px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--mint);
}
.rr-extra--sticker .rr-extra__media {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  background-image: radial-gradient(var(--sage-300) 1.5px, transparent 1.5px);
  background-size: 1rem 1rem;
}
.rr-extra--sticker .rr-extra__media img { width: 78%; }
.rr-extra--wallpaper .rr-extra__media img { width: 100%; border-radius: 0.375rem; }
.rr-extra__title { margin: 0; font-size: var(--step-0); line-height: 1.35; }
.rr-extra .text-link { font-size: var(--step--1); }

@media (max-width: 599.98px) {
  .rr-extras--wallpaper { grid-template-columns: minmax(0, 1fr); }
  .rr-extra--wallpaper:nth-child(2) { max-width: 13rem; }
  .rr-extras--sticker { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- gallery dialog */

.rr-dialog-open { overflow: hidden; }
.rr-gallery {
  width: min(64rem, calc(100vw - 1.5rem));
  max-width: none;
  max-height: calc(100dvh - 1.5rem);
  padding: 0;
  border: 2px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-lift);
}
.rr-gallery::backdrop { background: rgb(16 35 26 / 0.62); }
.rr-gallery__inner { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; padding: clamp(1rem, 3vw, 1.75rem); }
.rr-gallery__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
}
.rr-gallery__title { margin: 0; margin-right: auto; font-size: var(--step-2); }
.rr-gallery__count { margin: 0; }
.rr-gallery__count:empty { display: none; }
.rr-gallery__figure { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.6rem; }
.rr-gallery__img {
  width: 100%;
  max-height: calc(100dvh - 17rem);
  min-height: 8rem;
  object-fit: contain;
  border-radius: var(--radius-sm);
  background: var(--mint);
}
.rr-gallery__caption { color: var(--muted); font-size: var(--step--1); }
.rr-gallery__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}
.rr-gallery__nav [hidden] { display: none; }
.rr-gallery__view { font-size: var(--step--1); }

@media (prefers-reduced-motion: no-preference) {
  .rr-gallery[open] { animation: rr-pop 0.22s steps(4, jump-end); }
  @keyframes rr-pop { from { opacity: 0; transform: scale(0.96); } }
}

/* ---------------------------------------------------------------- coming-soon slots
   Manifest entries with "status": "coming-soon": quiet dashed cards, no image, no actions. */

.rr-slots { margin-top: clamp(2.5rem, 6vw, 4rem); }
.rr-slots__heading { margin: 0 0 1.25rem; font-size: inherit; }
.rr-slots__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.5rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
.rr-slot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1.25rem 1.25rem 1.1rem;
  border: 2px dashed var(--sage-300);
  border-radius: var(--radius-sm);
  background: transparent;
}
.rr-slot > * { margin: 0; }
.rr-slot__title { font-size: var(--step-1); color: var(--green-800); }
.rr-slot__text { color: var(--muted); font-size: var(--step--1); }
.rr-slot__tag { align-self: flex-start; margin-top: auto; }
