/* --- Poppins: full family, matching your actual file list exactly.
   Drop all 18 .ttf files into a /fonts folder next to this stylesheet. --- */
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Thin.ttf") format("truetype"); font-weight: 100; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ThinItalic.ttf") format("truetype"); font-weight: 100; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ExtraLight.ttf") format("truetype"); font-weight: 200; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ExtraLightItalic.ttf") format("truetype"); font-weight: 200; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Light.ttf") format("truetype"); font-weight: 300; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-LightItalic.ttf") format("truetype"); font-weight: 300; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Italic.ttf") format("truetype"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-MediumItalic.ttf") format("truetype"); font-weight: 500; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-SemiBoldItalic.ttf") format("truetype"); font-weight: 600; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-BoldItalic.ttf") format("truetype"); font-weight: 700; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ExtraBold.ttf") format("truetype"); font-weight: 800; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-ExtraBoldItalic.ttf") format("truetype"); font-weight: 800; font-style: italic; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-Black.ttf") format("truetype"); font-weight: 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Poppins"; src: url("fonts/Poppins-BlackItalic.ttf") format("truetype"); font-weight: 900; font-style: italic; font-display: swap; }

:root {
  --bg: #22325C;
  --surface: #22325C;
  --box: #141D34;
  --box-alt: #202941; /* a touch lighter than --box, for hover contrast */
  --text: #f2f2f0;
  --text-dim: #9a9a96;
  --accent: #47FFC1; /* default/fallback accent — the 6-color cycle below overrides this per tag/card */
  --radius: 14px;
}

* { box-sizing: border-box; }
/* Phones/tablets flash a translucent coloured square over whatever is tapped
   (buttons, arrows, links). This switches that flash off everywhere. It only
   exists on touch screens, so nothing changes on a computer. */
* { -webkit-tap-highlight-color: transparent; }

/* Buttons don't inherit the page's font by default in most browsers —
   they use the OS's system font unless told otherwise. This is why the
   tag filter chips (built as <button> elements) were skipping Poppins
   even though everything else on the page had it. */
button {
  font-family: inherit;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Poppins", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 40px; /* was 24px — trimmed along with the logo to shorten the header */
  /* (there used to be a thin grey line along the bottom edge of the header here; removed) */
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

/* Header logo: a Rive embed (link in header-logo.txt) in a box.
   Resize it by changing --header-logo-w (width). --header-logo-ratio is the
   width-to-height proportion (4.5 = 4.5 times wider than tall); height
   follows from those two automatically. Empty = dashed placeholder.

   The Rive artboard has empty space around the visible lettering, so the
   box is nudged to cancel it out (otherwise the logo looks pushed right and
   the header gets too tall):
     --logo-x-trim  = fraction of the box's WIDTH that is empty space on the
                      left of the lettering. The box is pulled left by that
                      much so the lettering sits at the header's left padding.
     --logo-y-trim  = fraction of the box's HEIGHT that is empty space above
                      (and below) the lettering. The box pokes out by that
                      much into the header's padding, which makes the header
                      shorter without shrinking the logo.
   If you change the Rive artboard, these two numbers are what to retune
   (bigger x-trim = logo moves further left; bigger y-trim = shorter header). */
.logo-embed {
  /* New header Rive file (artboard 475 x 225, i.e. 2.111 times wider than tall; its lettering
     spans 14.1% to 85.8% of the width and 33.3% to 66.0% of the height). The numbers below
     were worked out from that, so the lettering is the same width as before (about 152px)
     and the header is the same height as before. Re-measure if the Rive file's artboard
     or artwork changes. (The old file used 405px, ratio 4.5, x-trim 0.313, y-trim 0.17.) */
  --header-logo-w: 212px;
  --header-logo-ratio: 2.111; /* 475 x 225 */
  --logo-x-trim: 0.141;
  --logo-y-trim: 0.204;
  /* Real width: the wanted width, but never wider than what leaves room for
     the nav on its right, so the logo shrinks as the window narrows instead
     of pushing the nav off the edge. 460px = the header's 80px of side
     padding + the nav (about 340px wide) + a little breathing room (the
     x-trim is subtracted first). If you add/remove header links or icons,
     adjust that 460px. The phone layout (hamburger) overrides this below. */
  --logo-real-w: min(var(--header-logo-w), calc((100vw - 460px) / (1 - var(--logo-x-trim))));
  width: var(--logo-real-w);
  aspect-ratio: var(--header-logo-ratio);
  margin-left: calc(var(--logo-real-w) * var(--logo-x-trim) * -1);
  margin-block: calc(var(--logo-real-w) / var(--header-logo-ratio) * var(--logo-y-trim) * -1);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed rgba(255,255,255,0.25); /* only visible on the placeholder */
  border-radius: 8px;
  font-size: 9px;
  line-height: 1.2;
  text-align: center;
  flex-shrink: 0;
}
.logo-embed iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.logo-embed:has(iframe) { border: 0; } /* real logo: no placeholder outline */

nav { display: flex; align-items: center; gap: 28px; } /* align-items centers the text links on the same midline as the taller icons */
nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  display: inline-block;
  transition: color 0.15s ease, transform 0.15s ease;
}
nav a:hover {
  color: var(--nav-color, var(--accent));
  transform: scale(1.12); /* was 1.08 — about 50% more growth on hover */
}
nav a.active {
  color: var(--nav-color, var(--accent));
}
nav a.active:hover {
  transform: scale(1); /* the current page stays at its normal size even on hover — only its color is already "on" */
}

/* Hamburger / X buttons are hidden on wider screens; the phone-width block
   further down ("max-width: 640px", search "HAMBURGER MENU") turns them on. */
.menu-toggle, .menu-close { display: none; }

/* --- Social icon row (generated by build.py from /social-links) ---
   The same row is written into the header and the footer, but each
   spot has its own class so the whole row can be sized independently:
   change --social-size (icon height) and gap under each one below.
   Icons inside the header's <nav> also pick up the "nav a" hover pop. */
.social-links {
  display: flex;
  align-items: center;
}
.social-links a {
  display: block;
  line-height: 0;
  transition: transform 0.15s ease;
}
.social-links a:hover { transform: scale(1.08); }
/* Header icons grow on hover by the same amount as the header's page links
   (see "nav a:hover"); footer icons keep the milder .social-links pop above. */
.social-links--header a:hover { transform: scale(1.12); }
.social-links img {
  display: block;
  height: var(--social-size);
  width: auto; /* each icon keeps its own proportions at that height */
}
.social-links--header { --social-size: 25px; gap: 20px; }
.social-links--footer { --social-size: 32px; gap: 26px; }

/* --- Hero: Rive embed on top, video embed below --- */
.hero-embed {
  /* 30px top and bottom: the cat's frame hangs into both, so it touches the ticker
     bars above and below the section. */
  padding: 30px 40px 30px;
  /* The enlarged name's frame reaches past the right edge on narrow desktop
     windows (its empty margin only); clip so that never adds a sideways scrollbar. */
  overflow-x: clip;
}
.hero-rive-wrap {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 420px; /* caps how much vertical space it takes on load, even on wide screens */
  background: transparent; /* sits directly on the page background */
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  text-align: center;
  padding: 20px;
}
.hero-rive-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- Hero pair: the standalone Rive cat on a bean bag sits to the LEFT of the
   name animation (hero-rive-wrap). On narrow windows they stack, the cat BELOW
   the name.

   THE CAT'S FRAME. The cat's Rive file is 3:2 (1200 x 800) so its shadows and
   the wall outlet have room at the sides. The frame (iframe) is exactly that
   shape: --cat-h tall (the name's height + 60px for the section's top and bottom
   padding + the height of one ticker (--ticker-h) on each side, so the frame
   reaches UNDER both scrolling tickers: they have no background and sit in front,
   so the cat is visible behind their text and never cut off at their edges) and
   1.5 x that wide. The wrapper around it (.hero-cat-wrap) runs from the
   window's left edge to the name's frame; on desktop the frame is free to reach
   past it, UNDER the name's frame (the name is in front and its Rive background
   is transparent), so nothing of the cat is ever cut off at the right.

   WHERE THEY STAND (desktop). The cat and the name form one group of fixed
   shape, scaled by --h and centred in the window (see LAYOUT RULE below): the
   space between the cat's visible right edge and the name's first letter is
   always --clear x --h, and the space left of the cat and right of the name is
   the same (--m). Measured on the Rive files (as fractions of their own frame,
   so they scale with the window):
     - name: its letters start/end 14.17% of its frame in from the frame's sides,
       plus the frame's 20px padding (hero-rive-wrap) -> "+ 14.3px + 0.1417 *"
     - cat: its visible left/right edges (the soft shadow's far end, then the
       outlet / the bean bag's right side) are --cat-edge-l (0.2119) and 0.6851 of
       the cat frame's width
   Re-measure if either Rive file changes size or artwork.

   The pair is stretched to the full window width (negative side margins cancel
   .hero-embed's 40px padding); the right-hand padding (--spacer) is what places
   the name's frame, and --cat-left places the cat's.

   Everything below is measured against .hero-embed, which is a size container
   so "cqw" (1% of its content width = the window width minus its 80px padding)
   can be used without being thrown off by a page scrollbar. --- */
.hero-embed {
  container-type: inline-size;
  --hero-pad: 40px; /* .hero-embed's side padding; 20px on phones (rule at the end) */
}
.hero-pair {
  /* SCALE. Everything in the pair is proportional to --h, the height of the name's
     frame (420px at full size), so the cat and the name always shrink TOGETHER and
     keep the same size and spacing relative to each other. --h stops growing at
     420px; below that it is the largest size at which the whole group (see --grp-w
     below) still leaves --margin-min (70px) of empty space on each side of the window:
       --h = (window width - 2 x --margin-min + 34.3px) / 2.7011, with 2.7011 = 0.9951 (cat's
       visible width) + --clear (0.15) + 1.556 (the name's visible width, enlarged
       by --name-scale 1.2: 1.2 x 0.7166 x 1.8095) and 34.3 = 1.2 x 28.6.
       The window's width is (100cqw + 80px).
     Re-derive these numbers if either Rive file's artwork or size, --clear or
     --name-scale changes. */
  --margin-min: 70px; /* the least empty space at each side of the group (left of the cat, right of the name) */
  --h: min(420px, calc((100cqw + 80px - 2 * var(--margin-min) + 34.3px) / 2.7011)); /* height of the name's frame */
  /* LAYOUT RULE (desktop): the cat and the name are one fixed-shape group that is
     scaled by --h and centred. The group runs from the cat's visible left edge to
     the name's visible right edge; between the cat's visible right edge and the
     name's first letter there is always --clear x --h of space, so the spatial
     relationship of the two never changes with the window's width. --m is the
     empty space on each side of the group (the window's width less the group, halved). */
  --clear: 0.15;                                 /* cat-to-name space, as a fraction of --h */
  --grp-w: calc((0.9951 + var(--clear)) * var(--h) + var(--name-scale) * (0.7166 * var(--name-w) - 28.6px)); /* 0.9951 = cat's visible width / --h */
  --m: calc((100cqw + 80px - var(--grp-w)) / 2); /* space left of the cat and right of the name */
  --spacer: calc(var(--m) - var(--name-scale) * (14.3px + 0.1417 * var(--name-w)) + (var(--name-scale) - 1) * var(--name-w)); /* name's frame to the window's right edge: puts the name's visible right edge --m from it */
  --name-w: calc(var(--h) * 1.8095);              /* width of the name's frame (760px at full size) */
  /* The cat's frame (3:2, so --cat-w is 1.5 x --cat-h) is --cat-h tall: at full
     size that is the name's height, +30px at the top and bottom (the section's
     padding) and + one ticker's height each side (588.8px with the 54.4px ticker),
     so it reaches under both tickers and nothing of the cat is cut off there. It
     scales with --h like everything else (1.4019 = 588.8 / 420). The WRAPPER around
     it (--cat-wrap-h) always keeps the full reach; when the window is narrow the
     frame is shorter than the wrapper and is centred in it (the frame's backdrop is
     the page's own blue, so no edge shows). If the ticker's size changes, so does
     588.8 and therefore the 1.4019. */
  --cat-h: calc(var(--h) * 1.4019);
  --cat-wrap-h: calc(var(--h) + 60px + 2 * var(--ticker-h));
  /* The cat's frame is 3:2 and as tall as the wrapper. It may reach to the right
     under the name's frame (the name is in front and its background is
     transparent, so nothing of the cat is hidden or cut). */
  --cat-w: calc(1.5 * var(--cat-h));
  --cat-edge-l: 0.2119;                          /* the cat's visible left edge, as a fraction of --cat-w */
  --cat-edge-c: 0.4485;                          /* the middle of the cat's visible content, same units */
  /* Left edge of the frame: where the centring rule wants it (left gap = the name's right gap, --name-gap-r). On narrow windows that is
     LEFT of the window's edge (the frame has transparent margin around the artwork,
     which .hero-embed's overflow-x: clip simply cuts off), so the artwork is never
     pushed away from the edge by its own empty margin and the whole group stays
     centred. */
  --name-scale: 1.2; /* how much bigger the name is drawn than its frame (see .hero-rive-wrap below); 1 = no enlargement */
  --cat-nudge: 50px; /* extra push of the cat to the LEFT on desktop only (the name stays put); 0px = the old position. Stacked layout (820px and narrower) ignores it. */
  --cat-left: calc(var(--m) - var(--cat-edge-l) * var(--cat-w) - var(--cat-nudge)); /* puts the cat's visible left edge --m from the window's left edge (the frame may start left of the window: its empty margin is clipped) */
  display: flex;
  align-items: center;
  margin: 0 -40px;
  padding-right: var(--spacer);
}
.hero-pair .hero-cat-wrap {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: var(--cat-wrap-h);
  margin-top: calc(-30px - var(--ticker-h));    /* hangs up through .hero-embed's top padding and under the top ticker */
  margin-bottom: calc(-30px - var(--ticker-h)); /* hangs down through the bottom padding and under the bottom ticker, without pushing the page */
  background: transparent; /* the animation's backdrop is the page's own blue */
  z-index: 1; /* below the name (z-index 2), which the cat may reach under */
}
.hero-pair .hero-cat-wrap iframe {
  position: absolute;
  left: var(--cat-left);
  top: calc(50% - var(--cat-h) / 2); /* centred in the wrapper (mobile: --cat-h is the wrapper's height, so 0) */
  width: var(--cat-w);
  height: var(--cat-h);
  border: 0;
  display: block;
}
.hero-pair .hero-rive-wrap {
  position: relative;
  z-index: 2; /* the name is always in front of the cat */
  flex: 0 0 var(--name-w);
  min-width: 0;
  height: var(--h);
  max-height: none;
  aspect-ratio: auto;
  /* NAME SIZE. The name is drawn --name-scale times bigger than its frame, grown
     from the frame's LEFT-hand edge (transform-origin: left) so it only gets
     bigger toward the right, away from the cat. This is a visual scale only: the
     frame's box, the cat's position and every spacing rule above keep working on
     the unscaled frame. 1 = the old size, 1.2 = 20% larger (the number is set on .hero-pair above, where the cat's position uses it too). Desktop only: stacked
     (820px and narrower) the name already fills the window's width. */
  transform: scale(var(--name-scale));
  transform-origin: left center;
}
@media (max-width: 820px) {
  .hero-pair {
    flex-direction: column-reverse; /* the cat comes first in the page, so reversed it lands below the name */
    gap: 0; /* no gap: the cat's frame instead reaches UP under the name's frame (see --cat-ov below) */
    margin: 0;
    padding-right: 0;
  }
  .hero-pair .hero-rive-wrap {
    flex: none;
    /* Stacked, the name is drawn --name-scale-m times bigger around its own middle (a
       visual scale only: the frame's box and the spacing rules are unchanged; the
       frame's empty side margins just reach past the window and are clipped). */
    --name-scale-m: 1.25;
    transform: scale(var(--name-scale-m));
    transform-origin: center;
    width: 100%;
    max-width: none;
    height: auto;
    aspect-ratio: 16 / 9;
    max-height: 420px;
  }
  /* Stacked: the cat's wrapper runs edge to edge (left, right) and down to the
     demo-reel band, as on desktop. The frame inside keeps its 3:2 shape, as tall
     as the wrapper, and is placed so the MIDDLE of the cat's visible content
     (--cat-edge-c) sits in the middle of the window; whatever is wider than the
     window is clipped. */
  .hero-pair .hero-cat-wrap {
    flex: none;
    min-width: 0;
    width: calc(100% + 2 * var(--hero-pad));
    margin-left: calc(-1 * var(--hero-pad));
    margin-right: calc(-1 * var(--hero-pad));
    /* Stacked: the cat's frame starts --cat-ov ABOVE its place in the page, under
       the name's frame (the name is in front and has no background), so the cat's
       top isn't cut off where the name ends and the two sit closer together. */
    --cat-ov: 70px;
    --cat-scale-m: 0.7; /* the cat is drawn at this fraction of its old size when stacked (1 = old size) */
    --cat-gap-m: 90px;  /* how far the cat's frame reaches UP under the name's frame: more = the cat sits closer to the name */
    margin-top: calc(-1 * var(--cat-gap-m));
    --cat-h: calc(var(--cat-scale-m) * (min(100cqw + 2 * var(--hero-pad), 520px) + 30px + var(--ticker-h) + var(--cat-ov))); /* the old frame (+ 30px padding + the bottom ticker + the old 70px overlap), scaled */
    overflow: hidden; /* stacked: clip at the window's edges */
    --cat-w: calc(1.5 * var(--cat-h)); /* re-derived here: custom properties are resolved where they are declared */
    height: var(--cat-h);
  }
  .hero-pair .hero-cat-wrap iframe {
    left: calc(50% - var(--cat-edge-c) * var(--cat-w));
  }
}
@media (max-width: 640px) {
  .hero-embed { --hero-pad: 20px; }
}

/* --- Scrolling tickers: a line of text above and one below the landing
   section (markup in index.html, text in ticker.txt, built by the script in
   index.html). White text on the page background, in an italic Poppins, with
   each bullet in the next colour of the accent palette (set in index.html's
   script). Top one slides left to right, bottom one right to left.
     --ticker-speed    how fast the text moves, in pixels per second
     font-size/weight  the text's size and weight (100 = Thin italic; 200 = Extra Light,
                       300 = Light, 400 = Regular, 500 = Medium)
     padding           the space above and below the text --- */
/* The ticker's height, shared with the cat's frame below (which reaches under
   both tickers, so --ticker-h must match the real height: 2 x padding + one
   line of text). Change the size/padding here, not on .ticker itself. */
:root {
  --ticker-pad: 14px;
  --ticker-font: 22px;
  --ticker-h: calc(2 * var(--ticker-pad) + 1.2 * var(--ticker-font));
}
.ticker {
  --ticker-speed: 60;
  position: relative;
  z-index: 3;          /* the text is in front of the cat, whose frame reaches under the ticker */
  pointer-events: none; /* ...but never blocks clicks on the cat beneath it */
  color: var(--text);
  overflow: hidden;
  padding: var(--ticker-pad) 0;
  font-style: italic;
  font-weight: 300; /* Poppins Light Italic */
  font-size: var(--ticker-font);
  line-height: 1.2;
  white-space: nowrap;
}
.ticker[hidden] { display: none; }
.ticker-track {
  display: flex;
  width: max-content;
  animation: ticker-scroll var(--ticker-dur, 30s) linear infinite;
}
.ticker--ltr .ticker-track { animation-direction: reverse; } /* top bar: left to right */
.ticker-group { display: flex; flex: none; }
.ticker-dot { margin: 0 0.9em; font-style: normal; }
@keyframes ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
@media (max-width: 640px) {
  :root { --ticker-pad: 12px; --ticker-font: 21px; }
}
@media (prefers-reduced-motion: reduce) {
  .ticker-track { animation: none; }
}

/* Full-bleed color band behind the video embed — stretches edge to edge
   regardless of the site's normal side padding. */
.hero-video-band {
  background: #141D34;
  width: 100%;
  /* 30px of breathing room top and bottom PLUS the extra height the box used
     to have when it was 16:10 instead of 16:9 (that difference is 3.125% of
     the box's width, split across top and bottom) — so the band is the same
     overall height as before while the video itself now fills its box. */
  padding: calc(30px + min(1100px, 100vw - 80px) * 0.03125) 40px;
  margin-top: 0; /* the bottom ticker bar sits directly above it */
}
.hero-video-wrap {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  /* Must match the video's real shape (16:9) — if this box is taller than the
     video, Vimeo letterboxes it with dark bars INSIDE the iframe, and the
     video's own corners then sit away from the box's edge where no rounding
     can reach them. (The old 16:10 shape caused exactly that.) If you ever
     embed a video with a different shape, change this ratio to match it. */
  aspect-ratio: 16 / 9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  text-align: center;

  /* ROUNDED CORNERS: this wrapper acts as a mask over the video iframe.
     Browsers are inconsistent about clipping a video-playing iframe to
     rounded corners (it gets its own GPU layer and can ignore the parent's
     rounding), so several independent techniques are stacked here — any one
     of them working is enough, and the rest are harmless:
       1. border-radius + overflow:hidden       (the standard way)
       2. clip-path: inset(... round ...)       (clips the painted result)
       3. mask-image                            (an opaque mask: it changes
          nothing visually, but forces Safari/Chrome to render the wrapper
          as one flattened, properly-clipped layer — the classic
          "-webkit-radial-gradient(white, black)" fix for iframe corners)
       4. isolation + translateZ(0)             (its own stacking/GPU layer) */
  border-radius: var(--radius);
  overflow: hidden;
  clip-path: inset(0 round var(--radius));
  -webkit-mask-image: -webkit-radial-gradient(white, black);
  mask-image: radial-gradient(white, black);
  isolation: isolate;
  transform: translateZ(0);
}
.hero-video-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
  clip-path: inset(0 round var(--radius)); /* same rounding applied to the iframe itself too */
}

/* --- Tag filter bar --- */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 32px; /* space between one tag category and the next heading (was 14px) */
  padding: 20px 40px 34px; /* bottom padding is the gap between the tags and the project cards (it used to hold the "Showing N projects" line) */
  align-items: center; /* centers each group (label + chip row) horizontally */
  text-align: center;
}
.tag-group-label {
  font-size: 19px; /* was 11px */
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
  margin-bottom: 8px;
}
.tag-group-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center; /* chips wrap onto new rows centered, not left-aligned */
  gap: 10px;
}
/* RAISED-BUTTON LOOK. Each chip is a pill that looks like a button standing up
   off the page, with a solid "extrusion" showing behind it to the lower right.
   How it works: the extrusion is a hard-edged box-shadow (no blur) the same
   shape as the pill, pushed --lift-x / --lift-y to the lower right, and the pill
   itself is moved the opposite way by the same amount. So the extrusion always
   stays put at the chip's real position, and the pill face floats up and to the
   left of it.
     - normal:   face raised, extrusion in the dark card blue
     - hover:    stroke AND extrusion turn the chip's highlight color
     - selected: the face slides down onto the extrusion's spot while the
                 extrusion shrinks to nothing, like a button pressed flat into
                 the page (and the face fills with the highlight color, as before)
   To change how tall the button looks, change --lift-x / --lift-y below. Set both
   to 0px for the old flat outline chips. */
.tag-chip {
  --lift-x: 3px; /* how far the extrusion sticks out to the right */
  --lift-y: 4px; /* how far the extrusion sticks out downward */
  border: 1px solid var(--box); /* same dark blue as the project cards */
  background: transparent;
  color: var(--text);
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13px;
  cursor: pointer;
  transform: translate(calc(-1 * var(--lift-x)), calc(-1 * var(--lift-y)));
  box-shadow: var(--lift-x) var(--lift-y) 0 0 var(--box); /* the extrusion */
  /* The press / release: move and extrusion animate together (200ms, gentle
     ease in and out) so the face lands exactly on the spot the extrusion
     occupied. Change both 200ms values to speed up or slow down. */
  transition: transform 200ms ease-in-out, box-shadow 200ms ease-in-out, background 200ms ease-in-out, border-color 200ms ease-in-out, color 200ms ease-in-out;
}
/* --tag-color is set inline per chip in JS, cycling through the 6 accent colors */
/* Hover look only where a real mouse exists. On a touch screen a tapped button
   stays "hovered" until the next tap elsewhere, which left an unselected tag
   stuck in its highlight color; with this wrapper a touch screen never shows it,
   so an unselected tag goes straight back to the normal raised look. */
@media (hover: hover) and (pointer: fine) {
  .tag-chip:hover {
    border-color: var(--tag-color, var(--accent));
    box-shadow: var(--lift-x) var(--lift-y) 0 0 var(--tag-color, var(--accent));
    color: var(--text);
  }
}
/* Selected = pressed down: face moves onto the extrusion's spot, extrusion gone. */
.tag-chip.active,
.tag-chip.active:hover {
  background: var(--tag-color, var(--accent));
  border-color: var(--tag-color, var(--accent));
  color: #111;
  font-weight: 600;
  transform: translate(0, 0);
  box-shadow: 0 0 0 0 var(--tag-color, var(--accent));
}
/* --- Project grid --- */
.grid {
  position: relative; /* lets a card that's fading out be pinned in place (position:absolute) while the others re-flow */
  display: grid;
  /* Minimum card width (was 320px). The grid fits as many columns as it
     can at this minimum, then stretches the cards to fill the row. Raising
     it makes cards wider and drops the count per row by about one at each
     window width. min(..., 100%) keeps a card from ever being wider than a
     very narrow screen. */
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  gap: 20px;
  padding: 0 40px 60px;
}

/* --- Centered last row (see centerLastRow() in index.html) ---
   Plain CSS grid always left-aligns a short last row. To centre it, the script
   adds .centered-last and sets --cols (how many cards fit per row). The grid
   then uses TWICE that many half-width tracks and every card spans 2 of them,
   so a short last row can start on a half-column and sit in the middle.
   The 20px gap is made from 10px of margin on each side of a card (and 30px of
   side padding instead of 40) so the cards come out exactly the same size as
   in the normal grid. TO TURN IT OFF: delete the "centered-last" line in
   centerLastRow() in index.html (or this whole block). */
.grid.centered-last {
  grid-template-columns: repeat(calc(var(--cols) * 2), 1fr);
  column-gap: 0;
  row-gap: 20px;
  padding: 0 30px 60px;
}
.grid.centered-last > .project {
  grid-column: span 2;
  margin: 0 10px;
}

.project {
  background: var(--box);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  border: 2px solid transparent; /* --card-accent (set inline per card in JS) shows on hover */
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.15s ease;
  opacity: 1;
  transform: translateY(0);
}
.project:hover {
  border-color: var(--card-accent, var(--accent));
}

/* Filtered out: drifts up slightly + fades (0.25s), then gets display:none by
   JS once that finishes (see applyFilter). Filtered back in reverses it. */
.project.leaving {
  opacity: 0;
  transform: translateY(-6px);
  pointer-events: none;
}
.project.hidden { display: none; }
/* Added by applyFilter (index.html) to a card that's gliding to its new grid
   spot after a filter change: same 0.25s as the fade, but an
   ease-in-out curve on the movement with a strong ease-out at the end. Its starting offset is set inline in JS. */
.project.gliding {
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.25s cubic-bezier(0.45, 0, 0.1, 1), /* was (0.45, 0, 0.55, 1): the 0.55 -> 0.1 gives about double the ease-out at the end */
              border-color 0.15s ease;
}

.thumb {
  position: relative;
  /* Shape of the thumbnail area on every project card. It was 4 / 3; 5 / 3 is
     20% shorter (a bit wider-screen, but not a full 16 / 9), which makes each
     whole card roughly 17% shorter, since the text area below stays the same
     height. The thumbnail and hover images below fill this area edge to edge
     with object-fit: cover — scaled to fit, never stretched or squished, with
     any overflow cropped. Change the second number (e.g. 5 / 3.4) to adjust. */
  aspect-ratio: 5 / 3;
  border-radius: 12px 12px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.thumb-inner {
  width: 60%;
  height: 55%;
  border-radius: 10px;
  background: rgba(255,255,255,0.08);
}
.thumb-static,
.thumb-gif {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.thumb-gif {
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Hover-to-GIF swap only on devices that actually have hover + a precise
   pointer (mouse/trackpad). Touch devices never match this, so a tap
   goes straight to opening the project — no flicker, no stuck hover state. */
@media (hover: hover) and (pointer: fine) {
  .project:hover .thumb-static { opacity: 0; }
  .project:hover .thumb-gif { opacity: 1; }
  .thumb-static { transition: opacity 0.25s ease; }
}

.project-info { padding: 16px 18px 18px; }
.project-info h3 {
  margin: 0 0 4px;
  font-size: 22.5px; /* was 15px */
  font-weight: 600;
}
.project-info .cat {
  margin: 0 0 10px;
  font-size: 15.6px; /* was 12.5px */
  color: var(--text);
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
/* background/color for each mini-tag is set inline in JS, cycling per tag */
.mini-tag {
  font-size: 10.5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
/* Tags on the homepage project CARDS: white text on a blue-gray a step
   lighter than the card's dark blue (--box), but still clearly darker than
   the page background (--bg).
   (The colored version from miniTag in index.html is currently unused.) */
.project-tags .mini-tag {
  background: #263149;
  border: none;
  color: var(--text);
}
/* Tags inside the project POPUP: the reverse — pure white pill with text in
   the popup's own blue (--surface), so they stand out against that blue. */
.modal-tags .mini-tag {
  background: #ffffff;
  border: none;
  color: var(--surface);
}

.empty-state {
  padding: 60px 40px;
  text-align: center;
  color: var(--text);
  display: none;
}
.empty-state.show { display: block; }

/* Footer: same dark blue as the project cards. Text column on the left,
   the social icon row on the right — padded to line up with the header's
   name (left) and nav/icons (right). */
footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;       /* on narrow screens the icons drop below the text instead of squeezing it */
  gap: 24px;
  padding: 44px 40px;
  background: var(--box);
  color: var(--text);
}
.footer-title {
  margin: 0 0 4px;
  font-size: 28px;
  font-weight: 700;
}
.footer-email {
  margin: 0;
  font-size: 17px;
  font-weight: 400;
}
/* The email is a mailto: link (opens a new email to Ana with the subject
   "Hello from your portfolio!" - the subject is in each page's footer, after
   "?subject="). It looks like plain text until hovered, then gets an underline. */
.footer-email a {
  color: inherit;
  text-decoration: none;
}
.footer-email a:hover,
.footer-email a:focus-visible {
  text-decoration: underline;
}

/* --- Static page bodies (About / Sandbox) --- */
.page-body {
  padding: 50px 40px 80px;
  max-width: 720px;
}
.page-body h1 {
  font-size: 40px;
  margin: 0 0 20px;
}
.page-body p {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin: 0 0 16px;
}

/* --- Centered page header (About's "Hi there!") --- */
.centered-header {
  text-align: center;
  padding: 60px 40px 30px;
}
.centered-header h1 {
  font-size: 40px;
  margin: 0;
}
/* About page only: the big "Hi there!" greeting — twice the size of the
   shared 40px heading above (the Sandbox page's heading keeps the 40px). */
.about-hello h1 {
  font-size: 80px; /* was 40px */
  font-weight: 600; /* SemiBold — one step lighter than the default Bold (700) */
}
/* The Rive animation below slides up so its top edge overlaps the bottom of
   "Hi there!". The animation's frame is opaque (same blue as the page), so
   the greeting is lifted above it in the stacking order, or the frame would
   paint over the bottoms of the letters. */
.about-hello {
  position: relative;
  z-index: 2;
}

/* --- Spline embed slot, styled the same way as the homepage's Rive
   slot: transparent, sits directly on the page background --- */
.spline-wrap {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  background: transparent;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  text-align: center;
  padding: 20px 40px;
}
.spline-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --- About page intro: the Rive animation, the bio and the resume button, in
   ONE centered column at every window size (after "Hi there!"). The only
   side margins are the page margins on .about-intro (40px, 20px on phones),
   so every element stops at the same distance from the window edges. --- */
.about-intro {
  padding: 0 40px;
}
.about-intro .spline-wrap {
  /* The animation's scene is square, so its frame is a square too. 875px is
     25% larger than the 700px it was before; on windows too narrow for that
     it simply fills the width between the page margins. Centered. */
  width: min(875px, 100%);
  max-width: none;
  aspect-ratio: 1 / 1;
  /* The negative top margin pulls the frame UP into "Hi there!" so their
     edges overlap slightly (the greeting's section has 30px of bottom padding,
     so -66px = about 36px of real overlap into the greeting's line). Make it
     more negative for more overlap, closer to 0 for less. */
  margin: -66px auto 0;
  padding: 0;
}
.about-intro .page-body {
  /* The bio: a centered block 864px wide at most (that's the usual 720px
     reading width plus 20%), with the text itself left-aligned inside it. */
  max-width: 864px;
  /* The negative top margin pulls the bio UP into the bottom of the Rive
     frame so they overlap slightly (the text starts about 20px above the
     frame's bottom edge). Kept above the frame in the stacking order so the
     frame never covers the text. */
  margin: -20px auto 0;
  padding: 0 0 20px;       /* side margins come from .about-intro */
  text-align: left;
  position: relative;
  z-index: 2;
}
.about-intro .resume-button-wrap {
  padding: 10px 0 60px;
  text-align: center;      /* resume button centered under the bio */
}
@media (max-width: 640px) {
  .about-intro { padding-left: 20px; padding-right: 20px; } /* phone page margins */
}

/* --- Resume button: filled white pill, same rounded shape as the tag
   chips, sized up to read as an actual button --- */
.resume-button-wrap {
  padding: 10px 40px 60px;
}
.resume-button {
  display: inline-block;
  background: #ffffff;
  color: #22325C;
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 999px;
  transition: transform 0.15s ease, opacity 0.15s ease;
}
.resume-button:hover {
  transform: translateY(-2px);
  opacity: 0.9;
}

/* --- Info boxes: two-column layout, each box has a title above a
   rounded block containing either bullets or an icon grid. This whole area
   is a full-width WHITE band (it starts right where the resume button's
   spacing ends, so the white never reaches the bio or the button, and it
   runs down to the footer). Inside the band the headings and the boxes use
   the site's normal blue (--bg), with the box text staying white. --- */
.info-boxes {
  background: #ffffff;
  padding: 60px 40px 70px;
}
.boxes-columns {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}
.boxes-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 36px;
}
.info-box-title {
  font-size: 39px; /* was 26px */
  font-weight: 600; /* SemiBold — was 700 (Bold) */
  color: var(--bg); /* the site's blue, since the band behind it is white */
  margin: 0 0 14px;
}
.info-box {
  background: var(--bg); /* the site's blue (was the darker --box navy) */
  border-radius: var(--radius);
  padding: 26px;
}
.info-bullet {
  margin-bottom: 32px; /* was 18px — space between one item block and the next */
}
.info-bullet:last-child {
  margin-bottom: 0;
}
.info-bullet-heading {
  font-weight: 600;
  font-size: 22px; /* was 15px */
  line-height: 1.2; /* was the browser default (~1.5 for Poppins) */
  margin: 0 0 4px;
}
.info-bullet-line {
  font-weight: 400;
  font-size: 13px;
  line-height: 1.2; /* was 1.5 */
  margin: 0;
}

/* Icon grid (the Software box): more generous, even padding than a tight
   edge-to-edge grid — each tile has room to breathe */
.icon-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 22px;
  padding: 6px;
}
.icon-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
}

@media (max-width: 640px) {
  .boxes-columns { flex-direction: column; }
}

/* --- Project modal --- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  /* (A 2px backdrop-filter blur used to be here. It made the browser re-blur
     the whole page behind the popup on every scrolled frame, and now and then
     a frame was dropped - the scrim AND the popup vanished for one frame, as
     if the project cards were showing. The blur was barely visible under the
     70% black, so it was removed.) */
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
  z-index: 100;
}
.overlay.visible { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 20px;
  max-width: 1014px; /* was 780px (30% larger); still shrinks to fit narrower windows */
  width: 100%;
  overflow: hidden;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.overlay.open .modal {
  opacity: 1;
  transform: translateY(0);
}

.modal-header {
  position: relative;
}
.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}
.modal-close:hover { background: rgba(0,0,0,0.75); }

.modal-video {
  aspect-ratio: var(--video-ratio, 16 / 9);
  background: var(--box-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
}
/* A main image (instead of a video) fills the same box edge to edge. */
.modal-video img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-body { padding: 28px 32px 32px; }
.modal-body h2 { margin: 0 0 4px; font-size: 64px; line-height: 1.2; /* was the browser default (~1.5 for Poppins) */ }
.modal-body .cat { color: var(--text); font-size: 13.5px; margin: 0 0 18px; }

.modal-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.modal-desc {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text);
  margin: 0 0 24px;
}

/* --- Modal sections: each one is a header, body text, and its own gallery,
   all living inside one alternating color block --- */
.modal-section {
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 20px;
  background: var(--section-bg, transparent); /* transparent = shows the
    modal's own blue background straight through, for odd sections */
  color: var(--section-text, var(--text));
}
.modal-section:last-child {
  margin-bottom: 0;
}
/* Link block: a grey callout (e.g. "This is a Rive file! / Check it out on
   the Marketplace!") — the first line plain white, the second line orange
   and clickable, with an underline that fades in on hover. Built from
   a section folder with "type: link" (see build.py's LINK BLOCKS note). */
.modal-link-block {
  background: #212121;
  border-radius: var(--radius);
  padding: 40px 24px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 26px;
  line-height: 1.5;
}
.modal-link-block:last-child { margin-bottom: 0; }
.link-block-text {
  margin: 0;
  color: #ffffff;
  font-weight: 400;
}
.link-block-link {
  display: inline-block;
  color: #FF9500;
  font-weight: 400;
  text-decoration: underline;
  text-decoration-color: transparent; /* underline is there but invisible... */
  text-underline-offset: 5px;
  transition: text-decoration-color 0.25s ease;
}
.link-block-link:hover,
.link-block-link:focus-visible {
  text-decoration-color: currentColor; /* ...and fades in on hover */
}
.modal-section.alt {
  --section-bg: #ffffff;
  --section-text: #22325C;
}
.modal-section h3 {
  font-size: 36px;
  margin: 0 0 8px;
  color: inherit;
}
.modal-section .section-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: inherit;
  margin: 0 0 16px;
}

/* Justified gallery: rows are built in fixed-count groups (imagesPerRow),
   then JS measures each image's real aspect ratio and computes a row
   height so all of them, at their natural proportions, fit edge to edge
   across the row — 2 images or 20 images in a row both just work. */
.modal-gallery {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gallery-row {
  display: flex;
  gap: 10px;
}
.gallery-row img.g-box {
  height: 150px; /* placeholder height until JS measures and resizes it */
  width: auto;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
}
.gallery-row .g-box.placeholder {
  width: 150px;
  height: 150px;
  background: var(--box);
  border-radius: 10px;
  flex-shrink: 0;
}

/* --- Slideshow (see SLIDESHOWS in build.py): a fixed-shape frame holding a
   row of slides that slides sideways, with arrows sitting INSIDE the frame,
   overlapping the image. --slideshow-ratio is set inline per slideshow. --- */
.slideshow {
  position: relative;
  aspect-ratio: var(--slideshow-ratio, 16 / 9);
  overflow: hidden;
  border-radius: 10px; /* same corner rounding as the gallery images */
  margin-top: 10px;
  background: var(--box);
}
.slideshow:first-child { margin-top: 0; }
.slideshow-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.45, 0, 0.1, 1);
  touch-action: pan-y; /* a sideways drag swipes the slideshow; vertical still scrolls the page */
}
.slideshow-slide {
  flex: 0 0 100%;
  height: 100%;
}
.slideshow-slide img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* fills the frame edge to edge; same-shaped images are never cropped */
  display: block;
  user-select: none;
}
.slideshow-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 56px;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: #ffffff;
  transition: opacity 0.2s ease, transform 0.15s ease;
}
.slideshow-prev { left: 4px; }
.slideshow-next { right: 4px; }
.slideshow-arrow svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 3.2;
  stroke-linecap: round;  /* completely round ends */
  stroke-linejoin: round;
  /* a soft shadow keeps the white arrow readable over light images */
  filter: drop-shadow(0 1px 4px rgba(0,0,0,0.55));
}
.slideshow-arrow:hover { transform: translateY(-50%) scale(1.12); }
.slideshow-arrow.is-hidden {
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: reduce) {
  .slideshow-track { transition: none; }
}

/* --- Video embed inside a section (see VIDEO EMBEDS IN A SECTION in
   build.py): a fixed-shape frame, same corner rounding as galleries and
   slideshows. --section-video-ratio is set inline per video folder. --- */
.section-video {
  aspect-ratio: var(--section-video-ratio, 16 / 9);
  border-radius: 10px;
  overflow: hidden;
  clip-path: inset(0 round 10px); /* belt-and-suspenders, as on the other video frames */
  margin-top: 10px;
  background: var(--box);
}
.section-video:first-child { margin-top: 0; }
.section-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* When numbered media folders put a rows gallery AFTER a slideshow or a
   video (or another gallery), keep the same 10px gap between the blocks. */
.slideshow + .modal-gallery,
.section-video + .modal-gallery,
.modal-gallery + .modal-gallery {
  margin-top: 10px;
}

body.modal-locked {
  overflow: hidden;
  padding-right: var(--scrollbar-comp, 0px);
}

/* --- Sandbox intro text: slightly narrower than the default page-body
   max-width isn't needed here — reuse .page-body as-is, just centered
   under the header via margin auto and text-align via its own class --- */
.sandbox-intro {
  text-align: center;
  max-width: 640px;
  margin: 0 auto;
  padding-top: 0;
  padding-bottom: 40px;
}

/* --- Sandbox cards: a "masonry" grid. Each card keeps the height its own
   contents need (so cards differ in height, with no empty space inside them
   and none between them), AND cards are placed in the order of the numbered
   folders in /sandbox-items: the first row left to right, then each next
   card into the next free spot, top to bottom.
   How it works: the grid's rows are only 1px tall, and a small script in
   sandbox.html tells each card how many of those rows to span (its measured
   height + the 20px gap), updating whenever a card's height changes (e.g.
   when its images finish loading). The grid itself then places the cards in
   order. (Plain CSS columns can't do this — they fill top to bottom first,
   which scrambled the order.) --- */
.sandbox-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(420px, 100%), 1fr));
  grid-auto-rows: 1px;  /* tiny rows; each card spans however many it needs */
  column-gap: 20px;     /* the vertical gap is added to each card's span in the script */
  row-gap: 0;
  align-items: start;   /* cards keep their own natural height instead of stretching */
  padding: 0 40px 70px;
}
.sandbox-card {
  background: var(--box);
  border-radius: var(--radius);
  overflow: hidden;
  align-self: start; /* natural height; see the masonry note above */
}
.sandbox-media {
  /* Shape of the media box: set per card with "aspect_ratio: W:H" in that
     card's info.txt (see build.py). Match it to the embed's real shape so
     the media fills the box edge to edge. Default 16:9. */
  aspect-ratio: var(--media-ratio, 16 / 9);
  background: var(--box-alt);
  margin: 20px 20px 0;
  border-radius: var(--radius);
  overflow: hidden;
  clip-path: inset(0 round var(--radius)); /* same belt-and-suspenders
    clipping used on the homepage video band — overflow:hidden alone
    isn't always enough to round an embedded video iframe's corners */
  transform: translateZ(0); /* works around a Chrome bug where a
    video-playing iframe ignores the parent's rounded corners entirely */
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-size: 13px;
  text-align: center;
}
/* The embed itself fills the box with no inner padding. The padding is only
   for the "Media placeholder" text shown when a card has no embed yet. */
.sandbox-media:not(:has(iframe)) { padding: 16px; }
.sandbox-media iframe {
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: var(--radius);
}
.sandbox-card-body {
  padding: 24px;
}
.sandbox-card-body h2 {
  font-size: 22px;
  margin: 0 0 14px;
}
.sandbox-desc {
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 14px;
}
.sandbox-desc:last-of-type {
  margin-bottom: 16px;
}
.sandbox-card-body .modal-gallery {
  margin-top: 4px;
}

@media (max-width: 640px) {
  /* Phone: only the hamburger sits beside the logo, so it gets 315px, trimmed
     to whatever fits next to that button. */
  .logo-embed {
    --header-logo-w: 164px; /* (old file: 315px) */
    --logo-real-w: min(var(--header-logo-w), calc((100vw - 110px) / (1 - var(--logo-x-trim))));
  }
  header, .hero-embed, .filter-bar, .grid, footer, .page-body { padding-left: 20px; padding-right: 20px; }
  .modal-body { padding: 22px 20px 26px; }
  .sandbox-cards { padding-left: 20px; padding-right: 20px; }
}

/* --- HAMBURGER MENU (phone width only) ---
   At 640px and below, the header's <nav> (page links + social icons) turns
   into a panel that slides in from the right edge, one stacked column,
   only as wide as its widest item. The big name on the left stays put; a
   hamburger button takes the nav's place in the header. Opening/closing is
   just an "open" class toggled by menu.js. */
@media (max-width: 640px) {
  .menu-toggle {
    display: flex;
    background: none;
    border: none;
    padding: 4px;
    color: var(--text);
    cursor: pointer;
  }
  nav {
    position: fixed;       /* escapes the header, pinned to the screen's right edge */
    top: 0;
    right: 0;
    height: 100vh;
    height: 100dvh;        /* real visible height on phones with collapsing browser bars */
    flex-direction: column;
    align-items: center;   /* everything in the column is centered */
    text-align: center;
    gap: 30px;
    min-width: 55vw;       /* at least over half the screen; grows past that only if content needs it */
    padding: 24px 48px 48px;
    background: var(--box);
    box-shadow: -8px 0 24px rgba(0,0,0,0.35);
    overflow-y: auto;
    z-index: 20;
    transform: translateX(100%);  /* parked just off the right edge */
    visibility: hidden;           /* also keeps hidden links out of tab order */
    /* visibility waits until the slide-out finishes before hiding */
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  nav.open {
    transform: translateX(0);
    visibility: visible;
    transition: transform 0.25s ease, visibility 0s;
  }
  nav a { font-size: 20px; }
  .menu-close {
    display: flex;
    align-self: flex-end;  /* X sits at the panel's top-right */
    background: none;
    border: none;
    padding: 4px;
    margin: 0 -8px 8px 0;
    color: var(--text);
    cursor: pointer;
  }
  .social-links--header {
    flex-direction: column;
    align-items: center;
    gap: 26px;
    margin-top: 10px;
    --social-size: 32px;   /* slightly bigger icons to suit the wider menu */
  }
}

/* --- CUSTOM RIVE CURSOR (see cursor.js) ---
   A canvas that covers the whole window, drawn above everything (the project
   popup is z-index 100, the header 10, the slide-out menu 20). It IGNORES THE
   MOUSE (pointer-events: none), so every link, button, video and gallery
   underneath stays fully clickable. It stays hidden — and the real cursor stays
   visible — until cursor.js has confirmed the Rive file is running and adds the
   "rive-cursor-on" class to <html>. */
#riveCursorCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  visibility: hidden;
}
html.rive-cursor-on #riveCursorCanvas {
  visibility: visible;
}
/* Hide the real cursor everywhere — including over links and buttons, which
   normally switch it to a pointing hand. Embeds (iframes) are left alone: what
   shows over them is decided by the embed itself, and cursor.js switches the
   Rive cursor off while the mouse is over one. */
html.rive-cursor-on,
html.rive-cursor-on *:not(iframe) {
  cursor: none !important;
}
html.rive-cursor-on iframe {
  cursor: auto !important;
}



/* ═══════════════════════════════════════════════════════════════════════
   SECRET CORNER (Work page): the folded "?" corner in the top-right of the
   landing section, and the fade used when it is clicked.
   Behavior: secret-corner.js. File: corner-rive/ (Rive file 2713154).
   ═══════════════════════════════════════════════════════════════════════ */
/* The anchor sits right under the header (the header is sticky and in front, so
   when the page scrolls the corner slides away under it). It has no height of its
   own: the corner just hangs from its top edge, in front of the top ticker bar. */
.secret-corner-anchor {
  position: relative;
  height: 0;
  z-index: 4;                 /* above the ticker bars (3) and the hero, below the header (10) */
}
.secret-corner {
  position: absolute;
  top: 0;
  right: 0;                   /* touches the right edge of the window */
  /* SIZE: 150px on a computer; on a phone it shrinks with the screen (35% of its width). */
  --corner-size: min(150px, 35vw);
  width: var(--corner-size);
  height: var(--corner-size);
}
.secret-corner iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: transparent;
  /* Until the corner's animation is over the (mostly empty) square must not block the
     ticker or the name beneath it; secret-corner.js adds .is-live when it is ready. */
  pointer-events: none;
}
.secret-corner.is-live iframe { pointer-events: auto; }

/* Fade to the site's blue (the Work page fades OUT with it, the hidden page fades IN from it). */
.page-fade {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 500ms ease;
}
.page-fade.on { opacity: 1; pointer-events: auto; }


/* ═══════════════════════════════════════════════════════════════════════
   BLUEPRINT PAGE (making-of.html): the hidden "making of" page.
   Background = a blueprint grid of dashed lines; each section is a framed
   "drawing" whose corner strokes run past the corners and fade away.
   Everything here is scoped to body.blueprint-page / .bp-* so no other page
   is affected. Sections use the same text sizes and spacing as the Work
   page's project popup (24px padding, 36px headings, 14.5px body, 20px gaps).
   ═══════════════════════════════════════════════════════════════════════ */
.page-fade--in {
  /* Starts fully covering the window in the site blue, then fades away. */
  opacity: 1;
  animation: pageFadeAway 700ms ease 120ms forwards;
}
@keyframes pageFadeAway {
  from { opacity: 1; }
  to   { opacity: 0; visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .page-fade--in { animation-duration: 1ms; animation-delay: 0s; }
}

body.blueprint-page {
  --bp-ink: #22325C;                      /* the blueprint line / text blue (same as the site background) */
  --bp-paper: #ffffff;
  --bp-grid: 120px;                       /* distance between grid lines */
  --bp-tilt: 7deg;                        /* how far the whole grid is turned (0deg = straight, + = clockwise) */
  background-color: var(--bp-paper);
  color: var(--bp-ink);
  overflow-x: clip;                       /* the faded corner strokes may reach past the window edge: never a sideways scrollbar */
}
/* THE GRID. It lives on a big see-through sheet behind the page content that is turned by
   --bp-tilt, so the lines run diagonally while every crossing stays a perfect "+" (a plain turn,
   no stretching). One tile = one grid cell, drawn as an SVG: a vertical and a horizontal dashed
   line crossing in the middle of the tile, repeated forever. The dash pattern (14 on, 16 off,
   shifted by 7) puts a dash CENTERED on every crossing. Round line caps give each dash rounded
   ends. To change the look: stroke-width (thickness), stroke-opacity (strength), and the dash
   numbers ("14 16" must always add up to 30, which divides the 120px cell evenly; the shift is
   half of the first number). The sheet is wider and taller than the page so turning it never
   leaves a bare corner; the page script (making-of.html) sets --bp-spill to match the page height. */
.bp-main {
  position: relative;
  isolation: isolate;
  overflow: clip;                         /* the oversized sheet is cut off here: no extra scrolling */
}
.bp-main::before {
  content: "";
  position: fixed;                        /* FIXED: the grid stays still on the visitor's window while the page scrolls over it */
  z-index: -1;
  pointer-events: none;
  /* A big square, centred on the window, then turned. Its side (150 of the window's longer side)
     is more than enough to cover every corner of any window even after the turn, so no bare
     corner ever shows. (The old scrolling version needed --bp-spill; a fixed sheet does not.) */
  top: 50%;
  left: 50%;
  width: 150vmax;
  height: 150vmax;
  transform: translate(-50%, -50%) rotate(var(--bp-tilt));
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%2322325C' stroke-opacity='0.55' stroke-width='1.5' stroke-linecap='round' stroke-dasharray='14 16' stroke-dashoffset='7'%3E%3Cpath d='M60 0V120'/%3E%3Cpath d='M0 60H120'/%3E%3C/g%3E%3C/svg%3E");
  background-size: var(--bp-grid) var(--bp-grid);
  background-position: center;
}
/* THE WINDOW-EDGE FADE. Because the grid now stays put on the window, three soft white fades are
   fixed to the window's top, left and right edges too (just above the grid, below all content),
   so the dotted lines never seem to touch the edge of the browser. The page's own fades are the
   intro's wash (below the title text) and the bottom fade (.bp-sections::after, above the footer).
   To change them: the pixel sizes (--bp-edge-x for the sides, --bp-edge-top for the top) and the
   middle stop's opacity (how quickly they become see-through). */
body.blueprint-page { --bp-edge-x: 140px; --bp-edge-top: 90px; --bp-solid: 17.5%; /* --bp-solid = how much of each fade (from the very edge) is PURE white, hiding the grid completely, before it starts fading out */ }
.bp-main::after {
  content: "";
  position: fixed;
  inset: var(--bp-header-h, 74px) 0 0 0;  /* starts just under the sticky header (making-of.html measures its height), so the top fade is seen, not hidden behind it */
  z-index: -1;                            /* later than ::before, so it sits on top of the grid */
  pointer-events: none;
  background:
    linear-gradient(to bottom, #fff 0, #fff var(--bp-solid, 35%), rgba(255,255,255,.55) 65%, rgba(255,255,255,0) 100%) top / 100% var(--bp-edge-top) no-repeat,
    linear-gradient(to right,  #fff 0, #fff var(--bp-solid, 35%), rgba(255,255,255,.55) 65%, rgba(255,255,255,0) 100%) left / var(--bp-edge-x) 100% no-repeat,
    linear-gradient(to left,   #fff 0, #fff var(--bp-solid, 35%), rgba(255,255,255,.55) 65%, rgba(255,255,255,0) 100%) right / var(--bp-edge-x) 100% no-repeat;
}

/* The grid and the edge fades are FIXED to the window, so they would otherwise paint over the footer
   (which comes after the page content). The footer is lifted above them. */
body.blueprint-page footer { position: relative; z-index: 2; }

/* --- Title + intro: sit on a white wash that fades out downwards, so the text never fights the grid --- */
.bp-intro {
  position: relative;
  padding: 72px 28px 0;
  text-align: center;
}
.bp-intro::before {
  content: "";
  position: absolute;
  inset: 0 0 -170px 0;                    /* reaches 170px below the text: that stretch is the fade */
  z-index: 0;
  background: linear-gradient(to bottom,
    var(--bp-paper) 0,
    var(--bp-paper) calc(100% - 170px),
    rgba(255, 255, 255, 0) 100%);
  pointer-events: none;
}
.bp-intro > * { position: relative; z-index: 1; }
.bp-title {
  margin: 0 auto;
  max-width: 1014px;
  font-size: clamp(40px, 8.4vw, 104px);   /* big, and shrinks with the window */
  line-height: 1.08;
  font-weight: 700;
  color: var(--bp-ink);
}
.bp-intro-text {
  max-width: 720px;
  margin: 28px auto 0;
  padding-bottom: 8px;
}
.bp-intro-text p {
  margin: 0 0 16px;
  font-size: 14.5px;                      /* same as a project's description */
  line-height: 1.6;
  color: var(--bp-ink);
}
.bp-intro-text p:last-child { margin-bottom: 0; }

/* --- The framed sections --- */
.bp-sections {
  max-width: 1014px;                      /* same width as the project popup */
  margin: 0 auto;
  padding: 150px 28px 110px;              /* the top padding lets the title's white wash fade out before the first frame */
  display: flex;
  flex-direction: column;
  /* WIDE gaps, this page only: room to see every corner stroke run out and fade (each reaches
     --e past its corner, so 2 x --e + some air), then clear space before the next frame. */
  gap: 190px;
}
/* The bottom fade: white at the very bottom of the page content (just above the footer), fading
   up into the grid. It scrolls with the page, so it is only seen when you reach the end. */
.bp-sections { position: relative; }
.bp-sections::after {
  content: "";
  position: absolute;
  left: 50%; width: 100vw; bottom: 0;     /* as wide as the whole window (.bp-sections itself is narrower), so the fade reaches both window edges */
  transform: translateX(-50%);
  height: 230px;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(to top, #fff 0, #fff var(--bp-solid, 35%), rgba(255,255,255,.55) 65%, rgba(255,255,255,0) 100%);
}
.bp-section {
  --e: 52px;                              /* how far the corner strokes run past each corner */
  --w: 4px;                               /* stroke thickness */
  --ink: var(--bp-ink);
  --fade: rgba(255, 255, 255, 0);         /* what the strokes fade into: white at 0% opacity */
  position: relative;
  isolation: isolate;
  padding: 24px;
  border: var(--w) solid var(--ink);
  background: var(--bp-paper);
  color: var(--bp-ink);
}
.bp-section.alt {                         /* every second section: blue fill, white text */
  background: var(--bp-ink);
  color: #ffffff;
}
/* The overextended corner strokes. A box slightly larger than the frame (it reaches --e past
   every edge) holds eight little gradient lines, two per corner: each one is a continuation of
   a frame edge, running past the corner and fading from the stroke color into transparent white. */
.bp-section::before {
  content: "";
  position: absolute;
  inset: calc(-1 * (var(--e) + var(--w)));
  z-index: -1;
  pointer-events: none;
  background:
    /* horizontal, top-left / top-right / bottom-left / bottom-right */
    linear-gradient(to right, var(--fade), var(--ink)) left 0 top var(--e) / var(--e) var(--w) no-repeat,
    linear-gradient(to left,  var(--fade), var(--ink)) right 0 top var(--e) / var(--e) var(--w) no-repeat,
    linear-gradient(to right, var(--fade), var(--ink)) left 0 bottom var(--e) / var(--e) var(--w) no-repeat,
    linear-gradient(to left,  var(--fade), var(--ink)) right 0 bottom var(--e) / var(--e) var(--w) no-repeat,
    /* vertical, top-left / top-right / bottom-left / bottom-right */
    linear-gradient(to bottom, var(--fade), var(--ink)) left var(--e) top 0 / var(--w) var(--e) no-repeat,
    linear-gradient(to bottom, var(--fade), var(--ink)) right var(--e) top 0 / var(--w) var(--e) no-repeat,
    linear-gradient(to top,    var(--fade), var(--ink)) left var(--e) bottom 0 / var(--w) var(--e) no-repeat,
    linear-gradient(to top,    var(--fade), var(--ink)) right var(--e) bottom 0 / var(--w) var(--e) no-repeat;
}
.bp-section h3 {
  font-size: 36px;                        /* same as a project section heading */
  margin: 0 0 8px;
  color: inherit;
}
.bp-section .section-body {
  font-size: 14.5px;
  line-height: 1.6;
  color: inherit;
  margin: 0 0 16px;
}
.bp-section .section-body:last-child { margin-bottom: 0; }
/* Quotes from my own prompts: an indented block with a bar, in the frame's own colors. */
.bp-section .section-body.is-quote,
.bp-section blockquote {
  margin: 0 0 16px;
  padding: 2px 0 2px 16px;
  border-left: 3px solid currentColor;
  font-style: italic;
}
.bp-section .slideshow:not(:first-child),
.bp-section .modal-gallery:not(:first-child),
.bp-section .section-video:not(:first-child) { margin-top: 10px; }
.bp-sections .modal-link-block { position: relative; z-index: 1; }

@media (max-width: 640px) {
  .bp-intro { padding: 48px 20px 0; }
  .bp-sections { padding: 130px 24px 80px; }
  .bp-section { --e: 36px; }
  .bp-sections { gap: 150px; }
}

/* ═══════════════════════════════════════════════════════════════════════
   HERO BACKGROUND VIDEO (Work page): a looping video behind everything in
   the landing section (top ticker, cat, name, bottom ticker).
   File: hero-background.mp4 (see build.py). Script: hero-bg.js (sets up the
   videos, the blue tint and the seamless loop; its settings are at its top).
   ═══════════════════════════════════════════════════════════════════════ */
.hero-stage {
  position: relative;
  isolation: isolate;          /* keeps the video's z-index -1 inside this block, behind the tickers/cat/name but above the page */
}
.hero-bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;            /* cuts off the video's slightly enlarged, blurred edges */
  pointer-events: none;        /* never blocks the cat, the name or the tickers */
  isolation: isolate;          /* the tint layers below blend with the video only, not with the page */
  background: var(--bg);       /* what shows until the video's first frame is ready (the section's own blue) */
}
.hero-bg:empty { display: none; }
.hero-bg video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;           /* "cover": always fills the whole section, never stretched; the overflow is cropped */
  object-position: center;
  /* Black and white, slightly blurred. The scale hides the blurred edges. (--hero-bg-blur is set by hero-bg.js.) */
  filter: grayscale(1) blur(var(--hero-bg-blur, 3px));
  transform: scale(1.04);
  opacity: 0;                  /* only the video that is currently playing is visible; hero-bg.js swaps them at the loop point */
}
.hero-bg video.is-on { opacity: 1; }
/* The blue tint: two layers that map the video's black to one blue and its white to another, in
   a straight line in between (so the video keeps its own contrast, just in blue). --hero-bg-mult
   and --hero-bg-screen are worked out by hero-bg.js from the two blues chosen at its top. */
.hero-bg::before,
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.hero-bg::before { background: var(--hero-bg-mult, #4a639b); mix-blend-mode: multiply; z-index: 2; }
.hero-bg::after  { background: var(--hero-bg-screen, #1c2b58); mix-blend-mode: screen; z-index: 3; }
