/* ==========================================================================
   Site styles — built on tokens.css (load tokens.css first)

   THE SYSTEM — every section is built from the same few pieces:

   <section class="section [--alt|--dark|--black|--red|--green|--blue|--off-white] [--flush-top]">
     <div class="wrap [LAYOUT]">            page-width container
       <div class="text">…</div>            heading + body
       <div class="media"><img></div>       EVERY image/video sits in a .media
     </div>
   </section>

   LAYOUT (on the .wrap, or on a block inside it):
     .stack                         blocks top-to-bottom (text, then media…)
     .split  --media-right|left     text beside media; HTML always text first
     .grid   --3|--4|--cards|--sheet   equal columns (2 by default)
     .narrow                        centred column INSIDE a .wrap, width = --media-scale

   MEDIA: the image/video always fills its .media container at 100% width,
   and the container is sized by the layout — so everything scales with the
   page.  Modifiers: --square (crop to a square), --logo (mark centred on a
   tile), --dark, --glyph, --cutout (transparent PNG: no rounded corners),
   --fit (whole image, no crop), --tilt (rotated 45°, used by a home card).
   ========================================================================== */

/* ---- Reset ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, h1, h2, h3, h4, p, figure, blockquote, ul, ol { margin: 0; padding: 0; }
img, video, iframe { display: block; max-width: 100%; }
img { height: auto; }
[hidden] { display: none !important; }   /* hidden slots stay in the HTML, just not shown */

/* ---- Base ------------------------------------------------------------------- */
body {
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
h1 { font-size: var(--fs-h1); font-weight: var(--fw-semibold); line-height: 1.4; }
h2 { font-size: var(--fs-h2); font-weight: var(--fw-bold); line-height: var(--lh-tight);
     text-transform: uppercase; }
h3 { font-size: var(--fs-h3); font-weight: var(--fw-regular); line-height: 1.5; }
p  { margin-top: 0.6em; }
p + p { margin-top: 1em; }
a { color: inherit; }

:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; border-radius: 2px; }
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--on-accent); padding: 0.75rem 1rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- Sections (full-width bands) ------------------------------------------- */
.section              { padding-block: var(--section-y); background: var(--paper); }
.section--alt         { background: var(--paper-alt); }
.section--dark        { background: var(--paper-dark); }
.section--black       { background: #000; }
.section--red         { background: var(--fox-red); }
.section--green       { background: var(--stamp-green); }
.section--blue        { background: var(--poster-blue); }
.section--off-white   { background: var(--off-white); color: var(--ink-on-light); }
.section--off-white .media > img { mix-blend-mode: multiply; }   /* white artwork takes on the off-white */
.section--dark, .section--black, .section--red,
.section--green, .section--blue { color: var(--on-accent); }
/* Foxy glow: the video has its own circular gradient baked in, so the band's glow is
   anchored to the video and measured in video widths (cqw) to line up at every size.
   Matched by eye against the playing video (2026-11-28). A layer behind the video carries it out to the band edges. */
.section--red {
  position: relative; z-index: 0; overflow: hidden;
  --fox-x: 50; --fox-y: 73; --fox-r: 76;     /* glow centre + edge radius, in % of the video width */
}
.section--red .narrow { container-type: inline-size; }
.section--red .media { position: relative; }
.section--red .media::before {
  content: ""; position: absolute; inset: -150vmax; z-index: -1;
  background: radial-gradient(circle at calc(150vmax + var(--fox-x) * 1cqw) calc(150vmax + var(--fox-y) * 1cqw),
                              var(--fox-glow) 0, var(--fox-red) calc(var(--fox-r) * 1cqw));
}
.section--flush-top   { padding-top: 0; }   /* sits tight under the band above */

/* ---- Containers -------------------------------------------------------------- */
.wrap {
  max-width: calc(var(--content-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.wrap--wide { max-width: calc(var(--wide-max) + 2 * var(--gutter)); }
.wrap--text { max-width: calc(var(--prose-max) + 2 * var(--gutter)); }   /* one centred reading column (resume) */

.text   { max-width: var(--prose-max); }
.text h2 + * { margin-top: 0.75rem; }   /* breathing room under a section heading */
.center { text-align: center; margin-inline: auto; }

/* ---- Layouts ----------------------------------------------------------------- */
/* Stack: blocks top to bottom with even space between them */
.stack        { display: grid; gap: var(--stack-gap); }
.stack--loose { gap: var(--section-y); }

/* Split: text beside media. Always write the .text first in the HTML. */
.split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--gap);
  align-items: center;
}
/* .split--media-right = text left, media right (the HTML order) */
.split--media-left > .text { order: 2; text-align: right; justify-self: end; }   /* media left, text right (aligned to the outer edge) */

/* Grid: equal columns of .media (or cards) */
.grid {
  --cols: 2;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  gap: var(--gap-tight);
}
.grid--3     { --cols: 3; }
.grid--4     { --cols: 4; }
.grid--cards { gap: var(--gap); max-width: calc(var(--cards-max) + 2 * var(--gutter)); }  /* home page project cards */
/* Sheet: 2x2 cut-outs that overlap by --sheet-overlap, like a stamp sheet.
   Grid gaps can't be negative, so each item grows half the overlap inward. */
.grid--sheet { gap: 0; }
.grid--sheet > * { --o: var(--sheet-overlap); width: calc(100% + var(--o) / 2); }
.grid--sheet > :nth-child(odd)  { margin-right: calc(var(--o) / -2); }
.grid--sheet > :nth-child(even) { margin-left:  calc(var(--o) / -2); }
.grid--sheet > :nth-child(n+3)  { margin-top:   calc(var(--o) * -1); }

/* Narrow: a centred column; titles + media inside it share the same edges */
.narrow { width: var(--media-scale); margin-inline: auto; }

/* Phones */
@media (max-width: 720px) {
  .split { grid-template-columns: 1fr; }
  .split--media-left > .text { order: 0; text-align: left; justify-self: start; }   /* text above media, left-aligned */
  .grid { --cols: 1; }
  .grid--3, .grid--4, .grid--sheet { --cols: 2; }
  .narrow { width: 100%; }
}

/* ---- Media: the one container for every image and video ---------------------- */
.media { display: block; }
.media > img,
.media > video { display: block; width: 100%; height: auto; border-radius: var(--radius); }
.media > video { background: var(--paper-dark); }

.media--square {                       /* crop to a square (cards, sketch tiles) */
  aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--radius); background: var(--paper-alt);
}
.media--square > :is(img, video) { height: 100%; object-fit: cover; border-radius: 0; }
/* Tilt: image turned 45° inside its square, scaled ×1.415 (√2) so no corners
   show. Uses the separate rotate/scale properties so hover zoom still works. */
.media--tilt > :is(img, video) { rotate: 45deg; scale: 1.415; }

.media--cutout > :is(img, video) { border-radius: 0; }   /* transparent PNGs keep their own edges */

/* Viewer page: photos stacked top to bottom with the same black gap between
   each. Every photo is as large as fits on one screen (limited by width OR
   height, never cropped); its box is the photo's own height, so the gaps stay
   uniform. The img width/height attributes reserve the space before loading. */
html:has(.viewer-page) { background: #000; scroll-snap-type: y proximity; }
.viewer-page { background: #000; }
.viewer { display: grid; gap: var(--viewer-gap); padding-block: var(--viewer-gap); }
.media--fit {
  scroll-margin-top: calc(var(--strip-h) + var(--viewer-gap));  /* #p05 lands just under the bar */
  scroll-snap-align: start;                                     /* scrolling settles on a photo */
}
.media--fit > img {
  width: 100%; height: auto; border-radius: 0; object-fit: contain;
  max-height: calc(100vh - var(--strip-h) - 2 * var(--viewer-gap));
  max-height: calc(100svh - var(--strip-h) - 2 * var(--viewer-gap));
}

.media--logo {                         /* a mark centred on a square tile */
  display: grid; place-items: center;
  aspect-ratio: 1 / 1; padding: 18%;
  border-radius: var(--radius); background: var(--paper-alt);
}
.section--alt .media--logo:not(.media--dark, .media--glyph) { background: var(--paper); }   /* white tiles on gray bands; letterforms stay bare */
.media--logo > img { height: 100%; object-fit: contain; border-radius: 0; }
.media--dark { background: var(--paper-dark); }
.media--dark > .invert { filter: invert(1); }   /* black-only SVG shown white */
/* Dark mode: letterforms flip to white; black marks keep a light tile instead. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .media--glyph > img { filter: invert(1); }
  :root:not([data-theme="light"]) .media--logo:not(.media--dark, .media--glyph) { background: var(--logo-tile); }
}
:root[data-theme="dark"] .media--glyph > img { filter: invert(1); }   /* forced dark (js/theme.js) */
:root[data-theme="dark"] .media--logo:not(.media--dark, .media--glyph) { background: var(--logo-tile); }
/* Letterforms: each glyph SVG's viewBox is its full mark's height, so drawing
   every glyph at the tile's full inner height gives one shared scale and keeps
   each letter at its real position (e.g. the F sits at the top). */
.media--glyph { container-type: size; background: none; }   /* letterforms sit on the section, no tile */
.media--glyph > img { height: 100cqh; width: auto; max-width: none; }

/* ---- Logo row: sketch · mark · letterforms ------------------------------------
   Every tile is the same size (--tile, a share of the row width), and the space
   BETWEEN groups stretches so the row spans the full width. A group's width is
   just its tiles — no counting needed. */
.logo-row {
  container-type: inline-size;
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: flex-start;
  row-gap: 1.5rem;
}
.logo-row__group {
  --tile: 13cqw;                       /* 6 tiles ≈ 78% of the row */
  --inner: 1.2cqw;                     /* gap between tiles in a group */
  position: relative;
  display: grid; grid-auto-flow: column;
  grid-auto-columns: var(--tile); column-gap: var(--inner);
  padding-top: calc(var(--fs-small) * var(--lh-body) + 0.75rem);   /* room for the label */
}
.logo-row__group > .label { position: absolute; top: 0; left: 0; margin: 0; white-space: nowrap; }
@media (max-width: 720px) {            /* phones: bigger tiles, wraps to 2 lines */
  .logo-row__group { --tile: 29cqw; --inner: 3cqw; }
}

/* ---- Photo gallery: masonry columns, click opens full size --------------------- */
.gallery { columns: 3 18rem; column-gap: var(--gallery-gap); padding-top: var(--gallery-gap); }
.gallery > .media { padding-bottom: var(--gallery-gap); break-inside: avoid;   /* padding, not margin: Safari carries a margin over to the top of the next column */
                    scroll-margin-top: calc(var(--strip-h) + 1rem); }  /* clear the sticky bar */
.gallery > .media > img { transition: opacity var(--dur-zoom) var(--ease); }
.gallery > .media:hover > img { opacity: 0.85; }

/* ---- Home: hero + project cards ------------------------------------------------- */
.hero {
  height: var(--hero-h);
  display: grid; place-items: center;
  padding: 4rem var(--gutter);
  background: var(--orange) var(--gradient-hero);
  color: var(--on-accent);
  text-align: center;
  /* scrolls away until only --hero-peek is left, then sticks on top of the page */
  position: sticky; top: calc(var(--hero-peek) - var(--hero-h)); z-index: 10;
}
.hero h3 { margin-top: 1rem; }

.card { display: block; text-decoration: none; color: inherit; }
.card .media { margin-bottom: 1rem; }
.card .media > * { transition: transform var(--dur-zoom) var(--ease); }
.card:hover .media > *,
.card:focus-visible .media > * { transform: scale(var(--zoom-scale)); }
.card h2 { text-transform: none; }     /* card titles stay title case */
/* One column (same 720px switch as .grid): title above the image, more room between
   cards. Must come AFTER the .card rules above, or .card { display: block } wins. */
@media (max-width: 720px) {
  .grid--cards { row-gap: var(--card-gap-phone); }
  .card { display: flex; flex-direction: column; }
  .card .media { order: 1; margin: 0.75rem 0 0; }
}

/* ---- Project header (top of a project page) ------------------------------------- */
.project-head h1 {
  font-size: var(--fs-display); font-weight: var(--fw-bold);
  line-height: var(--lh-tight); text-transform: uppercase;
}
.project-head h3 { color: var(--ink-muted); margin-top: 0.75rem; }

/* ---- Nav strip (the orange gradient bar) ---------------------------------------- */
.strip {
  display: block; position: relative; isolation: isolate;
  padding: 0.8rem 1.25rem;
  background: var(--orange) var(--gradient-strip);
  color: var(--on-accent); text-align: center; text-decoration: none;
}
.strip::after {                        /* gradients can't transition: fade a 2nd layer in */
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: var(--pink) var(--gradient-strip-hover);
  opacity: 0; transition: opacity var(--dur-strip) var(--ease);
}
.strip:hover::after, .strip:focus-visible::after { opacity: 1; }
.strip--sticky { position: sticky; top: 0; z-index: 10; }
.strip--plain::after { content: none; }      /* a bar with no link: no hover colour */
/* Bottom bar + theme toggle (js/theme.js wraps the last strip and adds the button) */
.strip-bar { position: relative; }
.theme-toggle {                        /* full bar height, 1rem either side of the emoji */
  position: absolute; top: 0; bottom: 0; right: 0; z-index: 1;
  display: grid; place-items: center; padding: 0 1rem;
  border: 0; background: none; font-size: 1.1rem; line-height: 1; cursor: pointer;
}

/* ---- Small pieces ------------------------------------------------------------------ */
.button {                              /* call-to-action, gradient like the strips */
  display: inline-block;
  padding: 0.8rem 1.6rem; border-radius: 999px;
  background: var(--orange) var(--gradient-strip);
  color: var(--on-accent); text-decoration: none; font-weight: var(--fw-semibold);
  transition: transform 0.2s var(--ease);
}
.button:hover { transform: translateY(-2px); }
.button + .label { margin-top: 1rem; }    /* small note under a button (e.g. download size) */

.label {                               /* small caps sub-heading above media */
  margin: 0 0 0.75rem;
  font-size: var(--fs-small); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-muted);
}

.footer {
  text-align: center; color: var(--ink-muted);
  font-size: var(--fs-small); padding-block: 1.5rem;
}

/* ---- Transparent media --------------------------------------------------------------
   .grid--middle   centres items of different heights on the same line
   .media--icon    an app icon (transparent PNG with its own shape): padded, no tile behind it
   .theme-light / .theme-dark   two versions of one image (e.g. dark lines vs white lines on a
                   transparent background); only the one matching the page theme shows, and with
                   loading="lazy" the hidden one isn't downloaded. Follows the toggle in js/theme.js. */
.grid--middle { align-items: center; }
.media--icon { display: grid; place-items: center; padding: 10%; }
.media--icon > img { border-radius: 0; }
.media > .theme-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .media > .theme-dark  { display: block; }
  :root:not([data-theme="light"]) .media > .theme-light { display: none; }
}
:root[data-theme="dark"] .media > .theme-dark  { display: block; }
:root[data-theme="dark"] .media > .theme-light { display: none; }
/* .media--small   shows its picture at 55% of the column width, centred (e.g. one menu bar bottle beside a few lines of text) */
.media--small > img { width: 55%; margin-inline: auto; }
/* .steps   a numbered list whose wrapped lines line up under the first word, not under the number */
.steps { list-style: none; padding: 0; counter-reset: step; }
.steps > li { display: grid; grid-template-columns: auto 1fr; column-gap: 0.3em; counter-increment: step; }
.steps > li::before { content: counter(step) "."; }
.steps > li + li { margin-top: 1em; }
