/* ==========================================================================
   site.css — design-system foundation (P6 · B1, re-themed C1.1)
   Dark game-developer identity: near-black charcoal with dark-green tonal
   surfaces and a restrained neon-green accent (restored from the original
   site in C1.1, replacing the B1 warm-paper palette). Space Grotesk for
   display, Archivo for text, JetBrains Mono for metadata.

   STYLESHEET ARCHITECTURE (load order on every public page)
     1. base.css   LEGACY COMPATIBILITY. Element defaults kept from Bootstrap
                   4.6 Reboot when it was removed (A2). Retire when the
                   legacy styles are gone.
     2. index.css  LEGACY VISUAL SYSTEM. The current dark "Development Build
                   HQ" design, replaced section by section, deleted last.
     3. site.css   THIS FILE. The new design system. It loads last, so at
                   equal specificity its rules win over the legacy files.

   THIS FILE
     §1 Tokens       :root custom properties. Global, safe on every page.
     §2 Fonts        @font-face, self-hosted. A face downloads only when
                     text actually uses it.
     §3 Foundations  Element styles. OPT-IN: they apply only inside the
                     design-system scope `.ds`.
     §4 Layout       Layout primitives (`.ds-container`, `.ds-grid`…). Opt-in.
     §5 Typography   Role classes (`.ds-text-*`) that decouple look from tag.
     §6 Accessibility & motion
     §7 Components   B2 controls, B3 media, C1 site shell and section head.
     Page compositions live in their own files (assets/css/home.css), are
     built only from these tokens and components, and add no tokens.

   THE `.ds` SCOPE
     Today's pages are the legacy dark design. Applying the new foundation
     to every element would restyle the whole site at once, so it is opt-in:
       - a migrated region:     <section class="ds"> … </section>
       - a fully migrated page: <html class="ds">
     Foundation selectors are written `:where(.ds) h2`, specificity (0,0,1):
     they beat the legacy element rules (by load order) but any component
     class beats them. Inside a `.ds` region on a legacy page, index.css
     still forces body background/colour/font and h1–h6 colour with
     !important. Resolving that is C1 work, with the first migrated region.

   TOKEN NAMES
     New tokens are named so they cannot collide with index.css (--bg,
     --text, --accent, --font-mono, --radius-sm, …). Exception: the 4px
     spacing scale --space-1…10 is now defined only here and shared by
     both systems. Its values did not change.

   Breakpoints (mobile first; custom properties cannot be used inside
   @media, so these are literal values throughout):
     mobile < 768px · tablet ≥ 768px · desktop ≥ 1024px · large ≥ 1440px
   ========================================================================== */


/* ==========================================================================
   §1 TOKENS
   ========================================================================== */
:root {
  /* ---- Colour (C1.1: the original site's dark identity; do not add
     colours casually). Ratios below are against --color-background. ---- */
  /* Core surfaces: near-black charcoal with a faint green cast, then three
     steps of raised dark panels. */
  --color-background:        #0C0E0D;
  --color-surface:           #131614;  /* cards, panels, header/footer */
  --color-surface-secondary: #191D1A;  /* hover / nested panels */
  --color-surface-raised:    #212622;  /* pressed / top-most panels */
  /* Media surfaces ("viewport" plates behind gameplay media and title
     plates): a dark-green tone that reads as its own surface. */
  --color-viewport:          #0F1712;
  --color-viewport-text:     #E7EAE5;
  --color-viewport-muted:    #9AA39C;
  /* Text. Every text colour meets WCAG AA (≥ 4.5:1) on every surface above,
     including --color-surface-raised (tertiary 4.8:1 there). */
  --color-text-primary:      #E7EAE5;  /* 16.0:1 */
  --color-text-secondary:    #A9AFA7;  /*  8.7:1 */
  --color-text-tertiary:     #8C928B;  /*  6.1:1; also control borders (≥ 3:1) */
  /* Accent: the signature neon green. An accent, never a background fill
     for large areas: links, focus, the primary action, small markers. */
  --color-accent:            #4ADE80;  /* 11.1:1 */
  --color-accent-hover:      #86EFAC;  /* 13.8:1 */
  --color-accent-tint:       #14291C;  /* selection, tinted panels (text on it ≥ 4.8:1) */
  --color-panel-accent:      #4ADE80;  /* accent on viewport plates (10.5:1) */
  --color-on-accent:         #0C0E0D;  /* text on an accent fill (11.1:1) */
  /* Errors must never be signalled in the accent green. */
  --color-danger:            #FF6B6B;  /*  7.0:1 */
  /* Structure. Decorative hairlines only (1.4:1): never the sole boundary of
     an input or control. */
  --color-divider:           #272C28;

  /* ---- Typography ---- */
  --font-family-display: "Space Grotesk Variable", "Archivo Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-family-sans: "Archivo Variable", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-family-mono: "JetBrains Mono Variable", ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --font-weight-regular:  400;
  --font-weight-medium:   500;
  --font-weight-semibold: 600;
  --font-weight-bold:     700;

  /* Archivo width axis (font-stretch). Semi-condensed is for display type only. */
  --font-width-normal:    100%;
  --font-width-condensed: 87.5%;

  /* Size roles. Fluid sizes interpolate linearly between a 390px and a
     1440px viewport and are rem-based, so they still follow user zoom. */
  --font-size-display: clamp(2.75rem, 1.9143rem + 3.4286vw, 5rem);       /* 44 → 80px */
  --font-size-h1:      clamp(2.125rem, 1.7071rem + 1.7143vw, 3.25rem);   /* 34 → 52px */
  --font-size-h2:      clamp(1.625rem, 1.3929rem + 0.9524vw, 2.25rem);   /* 26 → 36px */
  --font-size-h3:      clamp(1.25rem, 1.1571rem + 0.381vw, 1.5rem);      /* 20 → 24px */
  --font-size-lead:    clamp(1.125rem, 1.0786rem + 0.1905vw, 1.25rem);   /* 18 → 20px */
  --font-size-body:    clamp(1rem, 0.9768rem + 0.0952vw, 1.0625rem);     /* 16 → 17px */
  --font-size-small:   clamp(0.875rem, 0.8518rem + 0.0952vw, 0.9375rem); /* 14 → 15px */
  --font-size-caption: 0.8125rem;                                         /* 13px */
  --font-size-meta:    0.75rem;                                           /* 12px, mono */

  --line-height-tight:   1.05;  /* display */
  --line-height-heading: 1.15;  /* h1, h2 */
  --line-height-snug:    1.3;   /* h3–h6, lead */
  --line-height-body:    1.6;   /* running text */
  --line-height-meta:    1.45;  /* captions, metadata */

  --letter-spacing-tight:  -0.025em; /* display */
  --letter-spacing-snug:   -0.015em; /* headings */
  --letter-spacing-normal: 0;
  --letter-spacing-wide:   0.04em;   /* mono metadata and labels */
  --letter-spacing-caps:   0.18em;   /* uppercase mono eyebrows */

  --paragraph-spacing: 1em;
  --measure: 66ch;                    /* comfortable line length for prose */

  /* ---- Spacing: 4px unit. Shared with the legacy index.css. ---- */
  --space-1: 4px;   --space-2: 8px;   --space-3: 12px;  --space-4: 16px;
  --space-5: 24px;  --space-6: 32px;  --space-7: 48px;  --space-8: 64px;
  --space-9: 96px;  --space-10: 128px;
  /* Section padding, applied above AND below each section: 48 → 96px, so
     adjacent sections sit 96 → 192px apart. --space-9 and --space-10 are
     available for larger compositions. */
  --space-section: clamp(3rem, 1.8857rem + 4.5714vw, 6rem);

  /* ---- Layout ---- */
  --container-max:      1280px;   /* standard content */
  --container-wide-max: 1440px;   /* media */
  /* Responsive values: mobile defaults, overridden per breakpoint below */
  --gutter:       var(--space-5); /* page side padding: 24 / 32 / 48 / 48 */
  --grid-columns: 4;              /* 4 / 8 / 12 / 12 */
  --grid-gap:     var(--space-4); /* column gap: 16 / 24 / 24 / 32 */

  /* ---- Borders and radius: hairlines, no shadows. Corners: 2px for small
     marks, 6px for controls and media, 12px for panels and cards (the
     original site's shape language). ---- */
  --border-width-hairline: 1px;
  --border-width-strong:   2px;   /* error state on controls: a non-colour cue */
  --border-hairline: var(--border-width-hairline) solid var(--color-divider);
  --radius-xs: 2px;
  --radius-control: 6px;
  --radius-panel: 12px;

  /* ---- Focus ---- */
  --focus-ring-width:  2px;
  --focus-ring-offset: 2px;
  --focus-ring-color:  var(--color-accent); /* ≥ 8.8:1 on every surface */

  /* ---- Control sizes (B2) ---- */
  --size-target: 2.75rem;  /* 44px minimum height for buttons and fields */
  --size-choice: 1.25rem;  /* 20px checkbox / radio box */

  /* ---- Motion: interaction feedback only. Both collapse to 0ms under
     prefers-reduced-motion (§6). ---- */
  --duration-fast:     120ms;
  --duration-standard: 200ms;
  --easing-standard:   cubic-bezier(0.2, 0, 0, 1);
}

@media (min-width: 768px) {
  :root {
    --grid-columns: 8;
    --grid-gap: var(--space-5);
    --gutter:   var(--space-6);
  }
}

@media (min-width: 1024px) {
  :root {
    --grid-columns: 12;
    --gutter: var(--space-7);
  }
}

@media (min-width: 1440px) {
  :root {
    --grid-gap: var(--space-6);
  }
}


/* ==========================================================================
   §2 FONTS — self-hosted variable fonts (SIL OFL 1.1, licences in
   assets/fonts/*). Family names carry "Variable" so they never collide with
   the Google-hosted "JetBrains Mono" the legacy pages still load.
   ========================================================================== */
/* Archivo: weight 100–900, width 62–125% */
@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo/archivo-variable-roman-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo/archivo-variable-roman-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo/archivo-variable-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo Variable";
  font-style: italic;
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  src: url("../fonts/archivo/archivo-variable-italic-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* Space Grotesk: weight 300–700 (display type: headings, names, figures). */
@font-face {
  font-family: "Space Grotesk Variable";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk/space-grotesk-variable-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Space Grotesk Variable";
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("../fonts/space-grotesk/space-grotesk-variable-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
/* JetBrains Mono: weight 100–800. Metadata, dates, technical labels, code only. */
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono/jetbrains-mono-variable-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-weight: 100 800;
  font-display: swap;
  src: url("../fonts/jetbrains-mono/jetbrains-mono-variable-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}


/* ==========================================================================
   §3 FOUNDATIONS — opt-in inside `.ds`. Element selectors are written
   `:where(.ds) <el>`, specificity (0,0,1).
   ========================================================================== */

/* The scope root carries the base surface and type.
   On a region (`<section class="ds">`) it is the element itself. On a full
   page (`<html class="ds">`) it is <body>: base.css sets body font and
   colour directly, so body must be styled rather than left to inherit, and
   <html> keeps the user's default font size so `rem` stays stable. */
html.ds {
  color-scheme: dark;
  background-color: var(--color-background);
}
.ds:where(:not(html)),
:where(html.ds) > body {
  color-scheme: dark;
  background-color: var(--color-background);
  color: var(--color-text-primary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  font-stretch: var(--font-width-normal);
  line-height: var(--line-height-body);
  letter-spacing: var(--letter-spacing-normal);
  font-kerning: normal;
  font-optical-sizing: auto;
}

/* ---- Headings ---- */
:where(.ds) h1,
:where(.ds) h2,
:where(.ds) h3,
:where(.ds) h4,
:where(.ds) h5,
:where(.ds) h6 {
  margin-block: 0;
  color: var(--color-text-primary);
  font-family: var(--font-family-display);
  font-weight: var(--font-weight-semibold);
  font-stretch: var(--font-width-normal);
  text-wrap: balance;
}
:where(.ds) h1 {
  font-size: var(--font-size-h1);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-snug);
}
:where(.ds) h2 {
  font-size: var(--font-size-h2);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-snug);
}
:where(.ds) h3 {
  font-size: var(--font-size-h3);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
}
:where(.ds) h4 {
  font-size: var(--font-size-lead);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
}
:where(.ds) h5,
:where(.ds) h6 {
  font-size: var(--font-size-body);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
}

/* ---- Paragraphs ----
   SPACING MODEL: foundation elements carry no vertical margins. Space
   between blocks belongs to the layout primitives (`.ds-stack` gap,
   `.ds-section` padding, `.ds-grid` gap), so margins never add to gaps.
   Running prose: <div class="ds-stack" style="--stack-gap: var(--paragraph-spacing)">,
   or a component that sets --stack-gap. */
:where(.ds) p {
  margin-block: 0;
  text-wrap: pretty;
}
/* The remaining block margins base.css (Bootstrap Reboot) adds, removed
   inside the scope for the same reason. */
:where(.ds) :is(address, blockquote, dl, dd, pre, label, legend) {
  margin-block: 0;
}

/* ---- Inline text ---- */
:where(.ds) b,
:where(.ds) strong {
  font-weight: var(--font-weight-semibold);
}
:where(.ds) code,
:where(.ds) kbd,
:where(.ds) samp,
:where(.ds) pre {
  font-family: var(--font-family-mono);
  font-size: 0.875em;
}
:where(.ds) code {
  color: inherit;
}

/* ---- Links: always underlined (colour is never the only cue) ---- */
:where(.ds) a {
  color: var(--color-accent);
  text-decoration-line: underline;
  text-decoration-thickness: var(--border-width-hairline);
  text-underline-offset: 0.2em;
  transition: color var(--duration-fast) var(--easing-standard);
}
:where(.ds) a:hover {
  color: var(--color-accent-hover);
  text-decoration-line: underline;
}

/* ---- Media ---- */
:where(.ds) img,
:where(.ds) picture,
:where(.ds) video,
:where(.ds) canvas {
  display: block;
  max-width: 100%;
}
:where(.ds) img,
:where(.ds) video {
  height: auto;
}
:where(.ds) figure {
  margin: 0;
}
:where(.ds) figcaption {
  margin-block-start: var(--space-2);
  color: var(--color-text-tertiary);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-meta);
}

/* ---- Lists ---- */
:where(.ds) ul,
:where(.ds) ol {
  margin-block: 0;
  padding-inline-start: 1.25em;
}
:where(.ds) li::marker {
  color: var(--color-text-tertiary);
}

/* ---- Hairline divider ---- */
:where(.ds) hr {
  height: 0;
  margin-block: 0;
  border: 0;
  border-block-start: var(--border-hairline);
}

/* ---- Selection ---- */
:where(.ds)::selection,
:where(.ds) ::selection {
  background-color: var(--color-accent-tint);
  color: var(--color-text-primary);
}

/* ---- Buttons and form elements: inherit type. Appearance is B2 work. ---- */
:where(.ds) button,
:where(.ds) input,
:where(.ds) select,
:where(.ds) textarea {
  font: inherit;
  letter-spacing: inherit;
}
/* Text fields inherit the text colour. A bare <button> keeps the native
   ButtonText colour: with color-scheme: dark the native button face is
   #6B6B6B, which inherited light text would fail (4.4:1); ButtonText passes.
   Component classes (.ds-button…) set their own colours either way. */
:where(.ds) input,
:where(.ds) select,
:where(.ds) textarea {
  color: inherit;
}
:where(.ds) input::placeholder,
:where(.ds) textarea::placeholder {
  color: var(--color-text-tertiary);
  opacity: 1;
}


/* ==========================================================================
   §4 LAYOUT PRIMITIVES — page structure only, no visual styling.
   Full-width region = `.ds-section` (backgrounds go here) containing a
   `.ds-container`, which centres and constrains the content.
   ========================================================================== */

/* Layout hooks (--stack-gap, --cluster-*, --grid-row-gap) are registered as
   NON-inheriting: a value set on one primitive must not leak into a nested
   one (a stack inside a 64px stack would otherwise also get 64px). Unset, each
   falls back to its token default in the var() below. */
@property --stack-gap      { syntax: "*"; inherits: false; }
@property --cluster-gap    { syntax: "*"; inherits: false; }
@property --cluster-align  { syntax: "*"; inherits: false; }
@property --cluster-justify { syntax: "*"; inherits: false; }
@property --grid-row-gap   { syntax: "*"; inherits: false; }

/* Vertical rhythm for a full-width page section */
.ds-section {
  padding-block: var(--space-section);
}

/* Centred content column: 1280px max, responsive side gutters */
.ds-container {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--container-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
/* Media width: 1440px max */
.ds-container--wide {
  max-width: calc(var(--container-wide-max) + 2 * var(--gutter));
}

/* Column grid: 4 / 8 / 12 columns. Children span the full row by default;
   components place them with `grid-column`, e.g. `grid-column: span 6`. */
.ds-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), minmax(0, 1fr));
  column-gap: var(--grid-gap);
  row-gap: var(--grid-row-gap, var(--grid-gap));
}
:where(.ds-grid) > * {
  grid-column: 1 / -1;
  min-width: 0;
}

/* Vertical flow: even spacing between stacked children. This is where
   block spacing comes from; set --stack-gap to tune it (e.g. prose:
   --stack-gap: var(--paragraph-spacing)). */
.ds-stack {
  display: flex;
  flex-direction: column;
  gap: var(--stack-gap, var(--space-4));
}

/* Inline group that wraps: tags, metadata rows, button pairs */
.ds-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: var(--cluster-align, center);
  justify-content: var(--cluster-justify, flex-start);
  gap: var(--cluster-gap, var(--space-3));
}


/* ==========================================================================
   §5 TYPOGRAPHY ROLES — when the visual role differs from the HTML element
   (e.g. a section title that must be an h2 but reads as page-level).
   ========================================================================== */
.ds-text-display {
  font-family: var(--font-family-display);
  font-size: var(--font-size-display);
  font-weight: var(--font-weight-semibold);
  font-stretch: var(--font-width-condensed);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
}
.ds-text-h1 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-snug);
}
.ds-text-h2 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-h2);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-snug);
}
.ds-text-h3 {
  font-family: var(--font-family-display);
  font-size: var(--font-size-h3);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}
.ds-text-lead {
  font-size: var(--font-size-lead);
  line-height: var(--line-height-snug);
  color: var(--color-text-secondary);
}
.ds-text-small {
  font-size: var(--font-size-small);
  line-height: var(--line-height-body);
}
.ds-text-caption {
  font-size: var(--font-size-caption);
  line-height: var(--line-height-meta);
  color: var(--color-text-tertiary);
}
/* The only sanctioned monospace role: short metadata, dates, technical
   labels, small numbers. Never headings or running text. */
.ds-text-meta {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-meta);
  letter-spacing: var(--letter-spacing-wide);
  font-variant-numeric: tabular-nums;
  color: var(--color-text-secondary);
}


/* ==========================================================================
   §6 ACCESSIBILITY AND MOTION
   ========================================================================== */

/* Keyboard focus: always visible and always an outline. Outlines survive
   forced-colours mode and are not clipped like box-shadows. */
:where(.ds) :focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* Hidden visually but still read by screen readers */
.ds-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion. Components take durations from the motion tokens, which
   collapse to 0ms here. The scoped block below is the safety net for any
   motion inside `.ds` that bypasses the tokens. Its !important is deliberate
   and the only one in this file: an accessibility guarantee must beat
   component specificity. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --duration-fast: 0ms;
    --duration-standard: 0ms;
  }
  :where(html.ds) {
    scroll-behavior: auto;
  }
  :where(.ds),
  :where(.ds) *,
  :where(.ds) *::before,
  :where(.ds) *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ==========================================================================
   §7 COMPONENTS — built only from §1 tokens. Single-class selectors
   (`.ds-<component>`, BEM elements `__`, modifiers `--`); no !important, no
   IDs. Each component reads private custom properties (`--button-bg`,
   `--input-border`, …): variants and states change only those values, so
   selectors stay flat. Every interactive component sets its own focus ring,
   so it also works outside a `.ds` scope.
   Media (7.7) adds behaviour from assets/js/media.js.
   Demo of every component and state: tools/qa/fixtures/foundation.html.
   Checks: node tools/qa/a11y-components.mjs
   ========================================================================== */

/* ---- 7.1 Buttons ------------------------------------------------------
   <button class="ds-button">            primary: ink, the one main action
   <a class="ds-button ds-button--secondary" href>   outlined
   <button class="ds-button ds-button--text">        minimal, text-only
   Disabled: the `disabled` attribute on <button>; aria-disabled="true" on <a>
   (and drop the href). The 44px minimum height is a touch target. */
.ds-button {
  /* Primary: the green action (the original site's "View Résumé"). */
  --button-bg: var(--color-accent);
  --button-fg: var(--color-on-accent);
  --button-border: var(--color-accent);
  --button-bg-hover: var(--color-accent-hover);
  --button-fg-hover: var(--color-on-accent);
  --button-border-hover: var(--color-accent-hover);
  --button-bg-active: var(--color-accent);
  --button-fg-active: var(--color-on-accent);
  --button-border-active: var(--color-accent);
  --button-decoration: none;
  --button-decoration-color: currentColor;
  --button-press: 1px;

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-block-size: var(--size-target);
  margin: 0;
  padding-block: var(--space-2);
  padding-inline: var(--space-5);
  border: var(--border-width-hairline) solid var(--button-border);
  border-radius: var(--radius-control);
  background-color: var(--button-bg);
  color: var(--button-fg);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  font-stretch: var(--font-width-normal);
  line-height: var(--line-height-snug);
  letter-spacing: var(--letter-spacing-normal);
  text-align: center;
  text-decoration-line: var(--button-decoration);
  text-decoration-thickness: var(--border-width-hairline);
  text-decoration-color: var(--button-decoration-color);
  text-underline-offset: 0.25em;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    border-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard);
}
.ds-button:hover {
  background-color: var(--button-bg-hover);
  border-color: var(--button-border-hover);
  color: var(--button-fg-hover);
  text-decoration-line: var(--button-decoration);
  text-decoration-color: var(--button-decoration-color-hover, var(--button-decoration-color));
}
.ds-button:active {
  background-color: var(--button-bg-active);
  border-color: var(--button-border-active);
  color: var(--button-fg-active);
  translate: 0 var(--button-press);
}
/* Secondary: a dark panel button with a visible (≥ 3:1) outline. */
.ds-button--secondary {
  --button-bg: var(--color-surface);
  --button-fg: var(--color-text-primary);
  --button-border: var(--color-text-tertiary);
  --button-bg-hover: var(--color-surface-secondary);
  --button-fg-hover: var(--color-text-primary);
  --button-border-hover: var(--color-accent);
  --button-bg-active: var(--color-surface-raised);
  --button-fg-active: var(--color-text-primary);
  --button-border-active: var(--color-accent);
}
.ds-button--text {
  --button-bg: transparent;
  --button-fg: var(--color-text-primary);
  --button-border: transparent;
  --button-bg-hover: transparent;
  --button-fg-hover: var(--color-accent);
  --button-border-hover: transparent;
  --button-bg-active: transparent;
  --button-fg-active: var(--color-accent-hover);
  --button-border-active: transparent;
  --button-decoration: underline;
  --button-decoration-color: var(--color-text-tertiary);
  --button-decoration-color-hover: currentColor;
  --button-press: 0px;
  padding-inline: 0;
}
.ds-button:disabled,
.ds-button[aria-disabled="true"] {
  --button-bg: var(--color-surface-secondary);
  --button-fg: var(--color-text-tertiary);
  --button-border: var(--color-surface-raised);
  --button-bg-hover: var(--button-bg);
  --button-fg-hover: var(--button-fg);
  --button-border-hover: var(--button-border);
  --button-bg-active: var(--button-bg);
  --button-fg-active: var(--button-fg);
  --button-border-active: var(--button-border);
  --button-decoration-color-hover: var(--button-decoration-color);
  --button-press: 0px;
  cursor: not-allowed;
}
.ds-button--text:disabled,
.ds-button--text[aria-disabled="true"] {
  --button-bg: transparent;
  --button-border: transparent;
}

/* ---- 7.2 Links ---------------------------------------------------------
   Inline links in running text need no class: the §3 foundation styles
   them (accent, always underlined). Pressed state added here.
   `.ds-link-quiet`: ink link for metadata rows and secondary navigation
   inside components; the underline is still there, just lighter. */
:where(.ds) a:active {
  color: var(--color-accent-hover);
}
.ds-link-quiet {
  color: var(--color-text-primary);
  text-decoration-line: underline;
  text-decoration-thickness: var(--border-width-hairline);
  text-decoration-color: var(--color-text-tertiary);
  text-underline-offset: 0.25em;
  transition: color var(--duration-fast) var(--easing-standard);
}
.ds-link-quiet:hover {
  color: var(--color-accent);
  text-decoration-line: underline;
  text-decoration-color: currentColor;
}
.ds-link-quiet:active {
  color: var(--color-accent-hover);
}

/* ---- 7.3 Form fields ---------------------------------------------------
   <div class="ds-field">
     <label class="ds-label" for="x">Email <span class="ds-label__optional">(optional)</span></label>
     <input class="ds-input" id="x" aria-describedby="x-hint">
     <p class="ds-hint" id="x-hint">…</p>
   </div>
   Error: aria-invalid="true" on the control, and an error message
   (<p class="ds-error" id="x-error">) referenced by aria-describedby.
   The 2px border and the message text mean colour is never the only cue. */
.ds-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-inline-size: 0;
}
.ds-label {
  display: block;
  margin: 0;
  color: var(--color-text-primary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}
.ds-label__optional {
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-regular);
}
.ds-hint,
.ds-error {
  margin: 0;
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  line-height: var(--line-height-meta);
}
.ds-hint {
  color: var(--color-text-secondary);
}
.ds-error {
  color: var(--color-danger);
  font-weight: var(--font-weight-medium);
}

/* Text input, textarea and select share one control style. */
.ds-input {
  --input-border: var(--color-text-tertiary);
  --input-border-width: var(--border-width-hairline);

  display: block;
  box-sizing: border-box;
  inline-size: 100%;
  min-block-size: var(--size-target);
  margin: 0;
  /* Padding shrinks by the extra border width, so the error state does not
     shift the text. */
  padding-block: calc(var(--space-2) + var(--border-width-strong) - var(--input-border-width));
  padding-inline: calc(var(--space-3) + var(--border-width-strong) - var(--input-border-width));
  border: var(--input-border-width) solid var(--input-border);
  border-radius: var(--radius-control);
  background-color: var(--color-surface);
  color: var(--color-text-primary);
  font-family: var(--font-family-sans);
  /* Body size (≥16px) also stops iOS from zooming the page on focus. */
  font-size: var(--font-size-body);
  font-weight: var(--font-weight-regular);
  line-height: var(--line-height-snug);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color var(--duration-fast) var(--easing-standard);
}
.ds-input::placeholder {
  color: var(--color-text-tertiary);
  opacity: 1;
}
.ds-input:hover,
.ds-input:focus {
  --input-border: var(--color-text-primary);
}
.ds-input[aria-invalid="true"] {
  --input-border: var(--color-danger);
  --input-border-width: var(--border-width-strong);
}
.ds-input:disabled {
  --input-border: var(--color-divider);
  background-color: var(--color-surface-secondary);
  color: var(--color-text-tertiary);
  cursor: not-allowed;
}
.ds-input:read-only:not(select) {
  background-color: var(--color-surface-secondary);
}
textarea.ds-input {
  min-block-size: var(--space-10);
  resize: vertical;
}

/* Select: the native control, with a drawn chevron. Wrap it:
   <div class="ds-select"><select class="ds-input">…</select></div> */
.ds-select {
  position: relative;
  display: block;
}
.ds-select > .ds-input {
  padding-inline-end: calc(var(--space-3) + var(--space-6));
  cursor: pointer;
}
.ds-select > .ds-input:disabled {
  cursor: not-allowed;
}
.ds-select::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-end: var(--space-4);
  inline-size: var(--space-2);
  block-size: var(--space-2);
  border-block-end: var(--border-width-strong) solid var(--color-text-primary);
  border-inline-end: var(--border-width-strong) solid var(--color-text-primary);
  translate: 0 -75%;
  rotate: 45deg;
  pointer-events: none;
}
.ds-select:has(> .ds-input:disabled)::after {
  border-color: var(--color-text-tertiary);
}

/* ---- 7.4 Checkbox and radio --------------------------------------------
   <label class="ds-choice"><input type="checkbox" class="ds-check"> Text</label>
   Groups: <fieldset class="ds-fieldset"><legend class="ds-legend">…</legend>…</fieldset>
   The label is the hit area (44px minimum), so the 20px box stays small. */
.ds-fieldset {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-inline-size: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.ds-legend {
  display: block;
  inline-size: auto;
  margin: 0;
  padding: 0 0 var(--space-2);
  color: var(--color-text-primary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
}
.ds-choice {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  box-sizing: border-box;
  min-block-size: var(--size-target);
  margin: 0;
  padding-block: var(--space-2);
  color: var(--color-text-primary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-body);
  line-height: var(--line-height-body);
  cursor: pointer;
}
.ds-choice:has(> .ds-check:disabled) {
  color: var(--color-text-tertiary);
  cursor: not-allowed;
}
.ds-check {
  --check-border: var(--color-text-tertiary);
  --check-bg: var(--color-surface);
  --check-mark: var(--color-surface);

  flex: none;
  display: inline-grid;
  place-content: center;
  box-sizing: border-box;
  inline-size: var(--size-choice);
  block-size: var(--size-choice);
  margin: 0;
  /* Centre the box on the first line of the label text. */
  margin-block-start: calc((1lh - var(--size-choice)) / 2);
  border: var(--border-width-hairline) solid var(--check-border);
  border-radius: var(--radius-xs);
  background-color: var(--check-bg);
  font: inherit;
  cursor: inherit;
  -webkit-appearance: none;
  appearance: none;
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    border-color var(--duration-fast) var(--easing-standard);
}
.ds-check[type="radio"] {
  border-radius: 50%;
}
/* The mark: a tick for checkbox, a dot for radio, a bar for an indeterminate
   checkbox. (Indeterminate is scoped to checkboxes: by spec every radio in a
   group with nothing selected also matches :indeterminate.)
   All three are drawn with borders, not backgrounds: in forced-colours mode
   (Windows High Contrast) backgrounds are replaced and would hide the mark. */
.ds-check::before {
  content: "";
  box-sizing: border-box;
  inline-size: 0.375rem;
  block-size: 0.6875rem;
  border-block-end: var(--border-width-strong) solid var(--check-mark);
  border-inline-end: var(--border-width-strong) solid var(--check-mark);
  translate: 0 -1px;
  rotate: 45deg;
  visibility: hidden;
}
.ds-check[type="radio"]::before {
  inline-size: var(--space-2);
  block-size: var(--space-2);
  border: calc(var(--space-2) / 2) solid var(--check-mark);
  border-radius: 50%;
  translate: none;
  rotate: none;
}
.ds-check[type="checkbox"]:indeterminate::before {
  inline-size: 0.625rem;
  block-size: 0;
  border: 0;
  border-block-start: var(--border-width-strong) solid var(--check-mark);
  translate: none;
  rotate: none;
}
.ds-check:checked::before,
.ds-check[type="checkbox"]:indeterminate::before {
  visibility: visible;
}
.ds-check:hover {
  --check-border: var(--color-text-primary);
}
.ds-check:checked,
.ds-check[type="checkbox"]:indeterminate {
  --check-border: var(--color-accent);
  --check-bg: var(--color-accent);
  --check-mark: var(--color-on-accent);
}
.ds-check[aria-invalid="true"] {
  --check-border: var(--color-danger);
  border-width: var(--border-width-strong);
}
.ds-check:disabled {
  --check-border: var(--color-surface-raised);
  --check-bg: var(--color-surface-secondary);
  --check-mark: var(--color-text-tertiary);
}
.ds-check:disabled:checked,
.ds-check[type="checkbox"]:disabled:indeterminate {
  --check-border: var(--color-surface-raised);
  --check-bg: var(--color-surface-secondary);
  --check-mark: var(--color-text-tertiary);
}

/* ---- 7.5 Metadata ------------------------------------------------------
   `.ds-tag`: a short label (platform, status, engine). Outlined by default;
   `--solid` is ink, for the one status that matters most on a card.
   `.ds-meta-list`: inline facts separated by hairlines (dates · role · stack).
   Use <ul class="ds-meta-list"><li>…</li></ul>. The separators are borders,
   so screen readers hear no stray punctuation. */
.ds-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  box-sizing: border-box;
  padding-block: calc(var(--space-1) - var(--border-width-hairline));
  padding-inline: var(--space-2);
  border: var(--border-width-hairline) solid var(--color-divider);
  border-radius: var(--radius-xs);
  color: var(--color-text-secondary);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-meta);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  white-space: nowrap;
}
.ds-tag--solid {
  border-color: var(--color-accent);
  background-color: var(--color-accent-tint);
  color: var(--color-accent);
}
/* Every item carries its leading separator. The list is pulled out by one
   separator width and that strip is clipped, so the first item on EVERY
   line (also after a wrap) shows no separator. (C1 fix: before, a wrapped
   line started with a stray hairline.) */
.ds-meta-list {
  display: flex;
  flex-wrap: wrap;
  row-gap: var(--space-1);
  margin: 0;
  margin-inline-start: calc(-1 * (var(--space-3) + var(--border-width-hairline)));
  padding: 0;
  clip-path: inset(0 0 0 calc(var(--space-3) + var(--border-width-hairline)));
  list-style: none;
  color: var(--color-text-secondary);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  line-height: var(--line-height-meta);
  letter-spacing: var(--letter-spacing-wide);
  font-variant-numeric: tabular-nums;
}
.ds-meta-list > li {
  margin: 0;
  padding-inline: var(--space-3);
  border-inline-start: var(--border-width-hairline) solid var(--color-divider);
}

/* ---- 7.6 Focus ring for components (also outside a `.ds` scope) ---- */
.ds-button:focus-visible,
.ds-link-quiet:focus-visible,
.ds-input:focus-visible,
.ds-check:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

/* ---- 7.7 Media ---------------------------------------------------------
   Gameplay media sits on dark "viewport" plates; behaviour is in
   assets/js/media.js (states, lightbox, video). Without that script every
   piece still renders and links still work.

   FRAME  <div class="ds-media ds-media--16x9"><img src alt width height loading="lazy"></div>
     Ratios: --21x9 --16x9 (default) --3x2 --4x3 --1x1 --4x5 --9x16, or
     --natural (the image's own ratio). Fit: cover by default, --contain to
     letterbox (e.g. a portrait screenshot in a landscape frame). Crop
     focus: style="--media-focus: 30% 20%" (object-position).
     States (data-media-state, set by media.js): loading → plate only, the
     image fades in; error / empty → the title plate. Frames reserve their
     height from the ratio, so nothing shifts while loading.
   TITLE PLATE  <div class="ds-title-plate"> meta / title / note </div>
     The typographic stand-in when there is no usable media (missing, NDA,
     failed). Inside a frame with an image it stays hidden unless the image
     fails. No fabricated visuals.
   FIGURE  <figure class="ds-figure"> frame + <figcaption class="ds-caption">
   GALLERY <div class="ds-gallery" data-ds-gallery> of
     <a class="ds-gallery__item" href="full.jpg" data-ds-lightbox> frame </a>
   VIDEO  <div class="ds-media ds-video" data-ds-video data-video-id="…"
     data-video-title="…"><a class="ds-video__facade" href="https://www.youtube.com/watch?v=…">
     poster img + <span class="ds-video__play">Play</span></a></div> */
.ds-media {
  --media-ratio: 16 / 9;
  --media-fit: cover;
  --media-focus: 50% 50%;

  position: relative;
  display: block;
  box-sizing: border-box;
  inline-size: 100%;
  aspect-ratio: var(--media-ratio);
  margin: 0;
  overflow: hidden;
  border-radius: var(--radius-control);
  background-color: var(--color-viewport);
  color: var(--color-viewport-text);
  container-type: inline-size;
}
.ds-media--21x9 { --media-ratio: 21 / 9; }
.ds-media--16x9 { --media-ratio: 16 / 9; }
.ds-media--3x2  { --media-ratio: 3 / 2; }
.ds-media--4x3  { --media-ratio: 4 / 3; }
.ds-media--1x1  { --media-ratio: 1 / 1; }
.ds-media--4x5  { --media-ratio: 4 / 5; }
.ds-media--9x16 { --media-ratio: 9 / 16; }
.ds-media--natural { aspect-ratio: auto; }
.ds-media--contain { --media-fit: contain; }

.ds-media > img,
.ds-media > picture,
.ds-media > video,
.ds-media > iframe,
.ds-media > .ds-video__facade,
.ds-media > .ds-video__embed {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  border: 0;
}
.ds-media > img,
.ds-media > picture > img,
.ds-media > video,
.ds-video__facade > img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: var(--media-fit);
  object-position: var(--media-focus);
  transition: opacity var(--duration-standard) var(--easing-standard);
}
.ds-media--natural > img,
.ds-media--natural > picture {
  position: static;
  block-size: auto;
}
.ds-media--natural > img,
.ds-media--natural > picture > img {
  block-size: auto;
}
/* Loading and failed images are transparent; a failed one stays in the
   accessibility tree so its alt text is still read. */
.ds-media[data-media-state="loading"] > img,
.ds-media[data-media-state="loading"] > picture > img,
.ds-media[data-media-state="loading"] > .ds-video__facade > img,
.ds-media[data-media-state="error"] > img,
.ds-media[data-media-state="error"] > picture > img,
.ds-media[data-media-state="error"] > .ds-video__facade > img {
  opacity: 0;
}

/* Title plate */
.ds-title-plate {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--space-2);
  box-sizing: border-box;
  padding: clamp(var(--space-4), 6cqi, var(--space-7));
  background-color: var(--color-viewport);
  color: var(--color-viewport-text);
}
.ds-media > img ~ .ds-title-plate,
.ds-media > picture ~ .ds-title-plate,
.ds-media > .ds-video__facade ~ .ds-title-plate {
  display: none;
}
.ds-media[data-media-state="error"] > .ds-title-plate {
  display: flex;
}
.ds-title-plate__meta {
  margin: 0;
  color: var(--color-panel-accent);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  line-height: var(--line-height-meta);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
}
.ds-title-plate__title {
  max-inline-size: 18ch;
  margin: 0;
  color: var(--color-viewport-text);
  font-family: var(--font-family-display);
  /* Scales with the frame, not the viewport, so the same plate works in a
     hero and in a gallery tile. */
  font-size: clamp(var(--font-size-h3), 7cqi, var(--font-size-display));
  font-weight: var(--font-weight-semibold);
  font-stretch: var(--font-width-condensed);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  text-wrap: balance;
}
.ds-title-plate__note {
  margin: 0;
  color: var(--color-viewport-muted);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  line-height: var(--line-height-meta);
}

/* Figure and caption */
.ds-figure {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin: 0;
}
.ds-caption {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-1) var(--space-4);
  margin: 0;
  color: var(--color-text-tertiary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-caption);
  line-height: var(--line-height-meta);
}
.ds-caption__credit {
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  letter-spacing: var(--letter-spacing-wide);
}

/* Gallery: 1 / 2 / 3 columns; --compact (portrait screenshots) 2 / 3 / 4;
   --feature makes the first item span the full row. */
.ds-gallery {
  --gallery-columns: 1;
  display: grid;
  grid-template-columns: repeat(var(--gallery-columns), minmax(0, 1fr));
  gap: var(--grid-gap);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ds-gallery--compact { --gallery-columns: 2; }
@media (min-width: 768px) {
  .ds-gallery { --gallery-columns: 2; }
  .ds-gallery--compact { --gallery-columns: 3; }
}
@media (min-width: 1024px) {
  .ds-gallery { --gallery-columns: 3; }
  .ds-gallery--compact { --gallery-columns: 4; }
}
.ds-gallery > * {
  min-inline-size: 0;
  margin: 0;
}
.ds-gallery--feature > :first-child {
  grid-column: 1 / -1;
}
.ds-gallery__item {
  display: block;
  border-radius: var(--radius-xs);
  color: inherit;
  text-decoration: none;
  cursor: zoom-in;
}
.ds-gallery__item:hover {
  color: inherit;
  text-decoration: none;
}
.ds-gallery__item:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.ds-gallery__item:hover .ds-media {
  outline: var(--border-width-hairline) solid var(--color-text-primary);
  outline-offset: var(--focus-ring-offset);
}

/* Lightbox: a full-screen native <dialog> on the viewport surface. B2
   buttons are re-coloured for the dark surface through their own
   custom properties. */
.ds-lightbox {
  --focus-ring-color: var(--color-panel-accent);

  position: fixed;
  inset: 0;
  box-sizing: border-box;
  inline-size: 100%;
  block-size: 100%;
  max-inline-size: none;
  max-block-size: none;
  margin: 0;
  padding: var(--space-4) var(--gutter);
  border: 0;
  background-color: var(--color-viewport);
  color: var(--color-viewport-text);
  font-family: var(--font-family-sans);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: var(--space-4);
}
.ds-lightbox:not([open]) {
  display: none;
}
.ds-lightbox::backdrop {
  background-color: var(--color-viewport);
}
:root:has(.ds-lightbox[open]) {
  overflow: hidden;
}
.ds-lightbox__bar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.ds-lightbox__counter {
  margin: 0;
  color: var(--color-viewport-muted);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  letter-spacing: var(--letter-spacing-wide);
  font-variant-numeric: tabular-nums;
}
.ds-lightbox__stage {
  grid-column: 1 / -1;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-3);
  min-block-size: 0;
  margin: 0;
}
.ds-lightbox__img {
  flex: 1 1 0;
  min-block-size: 0;
  inline-size: 100%;
  block-size: auto;
  object-fit: contain;
}
.ds-lightbox__img[data-state] {
  visibility: hidden;
}
.ds-lightbox__status {
  margin: 0;
  color: var(--color-viewport-muted);
  font-size: var(--font-size-small);
}
.ds-lightbox__caption {
  max-inline-size: var(--measure);
  margin: 0;
  color: var(--color-viewport-muted);
  font-size: var(--font-size-small);
  line-height: var(--line-height-meta);
  text-align: center;
}
.ds-lightbox__nav {
  grid-row: 3;
  padding-inline: var(--space-3);
}
.ds-lightbox__nav--prev { grid-column: 1; justify-self: start; }
.ds-lightbox__nav--next { grid-column: 2; justify-self: end; }
@media (min-width: 768px) {
  .ds-lightbox {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto minmax(0, 1fr);
  }
  .ds-lightbox__stage { grid-column: 2; }
  .ds-lightbox__nav { grid-row: 2; align-self: center; }
  .ds-lightbox__nav--prev { grid-column: 1; }
  .ds-lightbox__nav--next { grid-column: 3; }
}
.ds-lightbox .ds-button--secondary {
  --button-fg: var(--color-viewport-text);
  --button-border: var(--color-viewport-muted);
  --button-bg-hover: transparent;
  --button-fg-hover: var(--color-panel-accent);
  --button-border-hover: var(--color-panel-accent);
  --button-bg-active: transparent;
  --button-fg-active: var(--color-panel-accent);
  --button-border-active: var(--color-panel-accent);
}
.ds-lightbox .ds-button--text {
  --button-fg: var(--color-viewport-text);
  --button-fg-hover: var(--color-panel-accent);
  --button-fg-active: var(--color-panel-accent);
  --button-decoration-color: var(--color-viewport-muted);
}

/* Video facade → embed */
/* The facade stays above a fallback title plate (missing poster), so the
   Play button and the link remain on top. */
.ds-video > .ds-video__facade {
  z-index: 1;
}
/* In a video frame the Play button sits bottom-left, so the plate's text
   starts at the top instead and the two never overlap. */
.ds-video > .ds-title-plate {
  justify-content: flex-start;
}
.ds-video__facade {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.ds-video__facade:hover {
  color: inherit;
  text-decoration: none;
}
/* The frame clips its content, so the focus ring is drawn on the frame. */
.ds-video__facade:focus-visible {
  outline: none;
}
.ds-video:has(> .ds-video__facade:focus-visible) {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}
.ds-video__play {
  position: absolute;
  inset-inline-start: clamp(var(--space-3), 4cqi, var(--space-6));
  inset-block-end: clamp(var(--space-3), 4cqi, var(--space-6));
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  box-sizing: border-box;
  min-block-size: var(--size-target);
  padding-inline: var(--space-4);
  border-radius: var(--radius-xs);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  transition:
    background-color var(--duration-fast) var(--easing-standard),
    color var(--duration-fast) var(--easing-standard);
}
.ds-video__facade:hover .ds-video__play,
.ds-video__facade:focus-visible .ds-video__play {
  background-color: var(--color-accent-hover);
  color: var(--color-on-accent);
}
.ds-video__embed {
  display: block;
}

/* ---- 7.8 Site shell: skip link, header, footer (C1) --------------------
   Used by fully migrated pages (<html class="ds">). Legacy pages keep their
   own nav and footer until they migrate.
   <a class="ds-skip-link" href="#main">Skip to content</a>
   <header class="ds-site-header"><div class="ds-container ds-site-header__inner">
     <a class="ds-site-header__brand" href="/">Name</a>
     <nav class="ds-site-header__nav"><ul class="ds-site-header__list">
       <li><a class="ds-site-header__link" href>…</a></li></ul></nav>
     <a class="ds-button ds-button--secondary ds-site-header__action" href>…</a>
   </div></header>
   Mobile: brand and action on the first row, the links on a second row.
   From 768px: one row, and the header stays at the top while scrolling. */
.ds-skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-block-size: var(--size-target);
  padding-inline: var(--space-4);
  border-radius: var(--radius-control);
  background-color: var(--color-accent);
  color: var(--color-on-accent);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
  translate: 0 calc(-100% - var(--space-4));
}
.ds-skip-link:focus,
.ds-skip-link:focus-visible {
  translate: none;
  color: var(--color-on-accent);
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: var(--focus-ring-offset);
}

.ds-site-header {
  position: relative;
  z-index: 10;
  border-block-end: var(--border-hairline);
  background-color: var(--color-background);
}
.ds-site-header__link[aria-current] {
  color: var(--color-accent);
}
.ds-site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  column-gap: var(--space-5);
  padding-block: var(--space-2);
}
.ds-site-header__brand {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--size-target);
  color: var(--color-text-primary);
  font-family: var(--font-family-display);
  font-size: var(--font-size-lead);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--letter-spacing-snug);
  text-decoration: none;
}
.ds-site-header__brand:hover {
  color: var(--color-text-primary);
  text-decoration: none;
}
/* The brand may be the logo image instead of text. */
.ds-site-header__brand img {
  display: block;
  block-size: var(--space-6);
  inline-size: auto;
}
.ds-site-header__nav {
  order: 3;
  flex-basis: 100%;
  min-inline-size: 0;
}
.ds-site-header__list {
  display: flex;
  gap: var(--space-5);
  margin: 0;
  padding: 0;
  overflow-x: auto;
  list-style: none;
  scrollbar-width: none;
}
.ds-site-header__link {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--size-target);
  color: var(--color-text-secondary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
  text-decoration-line: none;
  text-decoration-thickness: var(--border-width-hairline);
  text-underline-offset: 0.3em;
  transition: color var(--duration-fast) var(--easing-standard);
}
.ds-site-header__link:hover,
.ds-site-header__link[aria-current] {
  color: var(--color-text-primary);
  text-decoration-line: underline;
}
.ds-site-header__brand:focus-visible,
.ds-site-header__link:focus-visible {
  outline: var(--focus-ring-width) solid var(--focus-ring-color);
  outline-offset: calc(var(--focus-ring-offset) * -1);
}
@media (min-width: 768px) {
  .ds-site-header {
    position: sticky;
    inset-block-start: 0;
  }
  .ds-site-header__nav {
    order: 0;
    flex-basis: auto;
    margin-inline-start: auto;
  }
  .ds-site-header__list {
    gap: var(--space-6);
    overflow: visible;
  }
}

.ds-site-footer {
  border-block-start: var(--border-hairline);
  background-color: var(--color-surface);
  padding-block: var(--space-6) var(--space-7);
  color: var(--color-text-secondary);
  font-family: var(--font-family-sans);
  font-size: var(--font-size-small);
}
.ds-site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-6);
}
.ds-site-footer__copy {
  margin: 0;
}
.ds-site-footer__list {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.ds-site-footer__list a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-block-size: var(--size-target);
}

/* ---- 7.9 Section head (C1, restyled C1.1) ----------------------------
   The opening of a page section, in the original site's voice: a green
   mono eyebrow with a leading rule, then the title with a green slash.
   <header class="ds-section-head">
     <p class="ds-section-head__index" aria-hidden="true">01 · Work</p>
     <h2 class="ds-section-head__title">…</h2>
     <p class="ds-section-head__lead">…</p>
     <p class="ds-section-head__aside">…</p>
   </header>
   The slash is generated content with empty alternative text, so screen
   readers hear only the title. Desktop: the aside sits at the right. */
.ds-section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  row-gap: var(--space-3);
  align-items: end;
}
.ds-section-head > * {
  min-inline-size: 0;
  margin: 0;
}
.ds-section-head__index {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-accent);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-meta);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-meta);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.ds-section-head__index::before {
  content: "";
  inline-size: var(--space-6);
  border-block-start: var(--border-width-hairline) solid var(--color-accent);
}
.ds-section-head__title {
  color: var(--color-text-primary);
  font-family: var(--font-family-display);
  font-size: var(--font-size-h1);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-heading);
  letter-spacing: var(--letter-spacing-snug);
  text-wrap: balance;
}
.ds-section-head__title::before {
  content: "/" / "";
  margin-inline-end: 0.2em;
  color: var(--color-accent);
  font-weight: var(--font-weight-regular);
}
.ds-section-head__lead {
  max-inline-size: 60ch;
  color: var(--color-text-secondary);
  font-size: var(--font-size-lead);
  line-height: var(--line-height-body);
  text-wrap: pretty;
}
.ds-section-head__aside {
  font-size: var(--font-size-small);
}
@media (min-width: 1024px) {
  .ds-section-head {
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: var(--grid-gap);
  }
  .ds-section-head > * {
    grid-column: 1;
  }
  .ds-section-head__aside {
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: end;
  }
}
