/* Themes (PLAN.md §3.4, §3.5 WP1 row, §4.1). WP1 owns this file.
   1. Any .themed element (class="themed" data-theme data-scheme + themeStyle) remaps the brand's semantic tokens to
      its palette, so components (buttons, chips, fields, links, focus rings) follow light and dark themes.
   2. Headline treatments .hl--gold-foil and .hl--chrome (any element; the card adds them from theme.background.headline).
   3. The shared overlays: <div class="ov ov--<name>" aria-hidden="true"> (Overlays.tsx). Most are CSS only (gradients and
      SVG data-URI masks coloured with --t-* variables); the illustration overlays (3b) are full-colour SVG art from
      /img/themes/. A genre theme's own overlay slots (<id>-sky, -set, -frame) are drawn in src/themes/<id>.css (genres.css),
      and that file restyles its card too (round 3). All are pointer-events:none, sized in --ou (the overlay unit: 1 % of the card's
      shorter side, set by card.css; 1cqmin anywhere else, see :root below) so they scale with the card,
      a swatch or (outside any container) the viewport. Hidden under forced-colors. The parent must be positioned.
   4. [data-theme] card treatments: per-theme polish on top of the data-driven card.css.
   Motion: only transform/opacity animate, plus --holo-angle on .hl--chrome (the §9 WP1 "slow rotation"). */

@property --holo-angle { syntax: "<angle>"; inherits: true; initial-value: 0deg; }
/* The overlay unit (see 3.): a card sets its own in card.css; anywhere else (a swatch, the OG art, a /live sky layer) it is
   1 % of the nearest size container's shorter side, as the overlays were always sized. */
:root { --ou: 1cqmin; }

/* ── 1. Semantic remap on themed surfaces ─────────────────────────────────────────────────────────── */
.themed {
  --bg: var(--t-bg);
  --surface: var(--t-surface);
  --surface-2: color-mix(in srgb, var(--t-surface) 88%, var(--t-text));
  --text: var(--t-text);
  --text-2: var(--t-muted);
  --text-3: var(--t-muted);
  --line: color-mix(in srgb, var(--t-text) 16%, transparent);
  --accent: var(--t-cta);
  --accent-ink: var(--t-cta);       /* links and accent text, as --accent was before the light scheme had its own (tokens.css) */
  --cta: var(--t-cta);
  --cta-text: var(--t-cta-text);
}
/* A theme's `background` may have translucent parts (sketchbook's ruled lines are 13 % blue on nothing), so every themed
   surface also gets its opaque base colour: over a dark page the rules stay light blue instead of turning navy.
   The transparent stage card is the one themed element that must stay see-through. */
.themed { background-color: var(--t-bg); }
.gcard--stage.themed { background: none; }
.themed[data-scheme="dark"] { color-scheme: dark; }
.themed[data-scheme="light"] {
  color-scheme: light;
  --focus: var(--t-cta);
  --danger-text: #B42318;
  --danger: #C2410C;
}
.themed[data-scheme="light"] :focus-visible { outline-color: var(--t-cta); }
/* Site chrome inside a themed page stays night (only /g could have one, and it is a night page: shared/scheme.ts). */
.themed :is(.site-header, .site-footer, .site-minimal, .dev-banner) {
  --bg: var(--night-900); --surface: var(--night-800); --surface-2: var(--night-700);
  --text: var(--ink); --text-2: var(--ink-2); --text-3: var(--ink-3);
  --line: color-mix(in srgb, var(--ink) 14%, transparent);
  --accent: var(--candle); --accent-ink: var(--candle); --cta: var(--candle); --cta-text: var(--night-900); --focus: var(--candle);
  color-scheme: dark;
}

/* ── 2. Headline treatments ──────────────────────────────────────────────────────────────────────── */
/* Gradient type is a background clipped to the glyphs. Clipping only sees the text painted in the element's own layer:
   a name that a page splits into spans and animates with transforms (the Grand Display splits it per grapheme) would
   turn transparent. So every leaf descendant paints the same fill for its own glyphs, and the element keeps it too
   for any text it holds directly. --hl-fill / --hl-blend are set per treatment below; `color` is the solid fallback
   for browsers without background-clip:text. */
.hl--gold-foil {
  --hl-fill: linear-gradient(174deg, #FFF7DA 0%, #F3E5AB 14%, #E2BF52 30%, #A47E26 45%, #F0D27A 58%, #FFF3C4 68%, #D4AF37 82%, #8A6A1E 100%);
  color: #E2BF52;
  filter: drop-shadow(0 .03em 0 rgb(0 0 0 / .6)) drop-shadow(0 0 .28em rgb(212 175 55 / .25));
}
/* Chrome: a horizon-line gradient over a slow rainbow. --chrome-k is 1 for short names and fades to 0 as the name
   gets long (and its letters small): the white horizon band and the pale reflection fold into mid purple, so a 24-letter
   name stays readable instead of dissolving into pixel-thin stripes. */
.hl--chrome {
  --chrome-k: clamp(0, calc((15 - var(--len, 6)) / 8), 1);
  --hl-fill: linear-gradient(180deg, #24164A 0%, #4F3B86 26%,
      color-mix(in srgb, #DCD0FF calc(var(--chrome-k) * 100%), #6F55C4) 44%,
      color-mix(in srgb, #FFFFFF calc(var(--chrome-k) * 100%), #6F55C4) 49%,
      #3A2564 52%, #7A3FB0 70%,
      color-mix(in srgb, #E3D6FF calc(var(--chrome-k) * 100%), #8C6BDA) 100%),
    conic-gradient(from var(--holo-angle), #FF5FB1, #7FE7FF, #B8FFDB, #C9B6FF, #FF5FB1);
  --hl-blend: hard-light, normal;
  color: #4F3B86;
  /* A hairline of deep violet keeps the pale horizon band readable on a pale card. It is four 0-blur shadows (a box
     dilation of the glyphs, outside only), not -webkit-text-stroke: the letters of a variable font overlap their own
     contours and a stroke draws those inner lines through the fill (the bowl of the "a" in Mia). */
  filter: drop-shadow(.01em 0 0 #34205F) drop-shadow(-.01em 0 0 #34205F) drop-shadow(0 .01em 0 #34205F) drop-shadow(0 -.01em 0 #34205F)
    drop-shadow(0 .035em 0 #2B1B4A) drop-shadow(0 .1em .12em rgb(122 31 162 / .3));
  animation: hl-holo 18s steps(180) infinite;    /* 10 repaints a second, not 60: a slow shimmer is enough */
}
@keyframes hl-holo { to { --holo-angle: 360deg; } }
@supports ((background-clip: text) or (-webkit-background-clip: text)) {
  :is(.hl--gold-foil, .hl--chrome, .gcard[data-theme="midnight-fireworks"] .gcard__name),
  :is(.hl--gold-foil, .hl--chrome, .gcard[data-theme="midnight-fireworks"] .gcard__name) :not(:has(*)) {
    background-image: var(--hl-fill);
    background-blend-mode: var(--hl-blend, normal);
    background-origin: padding-box;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
  /* The fill is painted inside the element's own box, so ink that hangs over the box is lost: an italic J's tail, the
     hook of an f, the dots of ë, the ring of Å, the acute of É. Every clipped box therefore gets room on all sides,
     paid back with an equal negative margin so the layout does not move: the card's name keeps its side margin (--mx)
     and its vertical rhythm, and a split name (a leaf span per grapheme) keeps its advance widths. The zero-specificity
     :where() rules are defaults a page can override. */
  .gcard__name:is(.hl--gold-foil, .hl--chrome),
  .gcard[data-theme="midnight-fireworks"] .gcard__name {
    --hl-x: min(.3em, var(--mx));      /* never more than the side margin, so the box stays inside the card */
    --hl-top: .3em;
    --hl-bottom: .34em;
    padding-inline: var(--hl-x);
    padding-block: var(--hl-top) var(--hl-bottom);
    margin-inline: calc(var(--mx) - var(--hl-x));
    margin-block: calc(var(--pad-top) - var(--hl-top)) calc(var(--pad-bottom) - var(--hl-bottom));
    max-inline-size: calc(100% - 2 * var(--mx) + 2 * var(--hl-x));
  }
  :where(.hl--gold-foil:not(.gcard__name), .hl--chrome:not(.gcard__name)) { padding-inline: .3em; margin-inline: -.3em; }
  :where(:is(.hl--gold-foil, .hl--chrome, .gcard[data-theme="midnight-fireworks"] .gcard__name) :not(:has(*))) {
    padding-inline: var(--hl-x, .3em);
    margin-inline: calc(-1 * var(--hl-x, .3em));
    padding-block: var(--hl-top, .3em) var(--hl-bottom, .34em);
    margin-block: calc(-1 * var(--hl-top, .3em)) calc(-1 * var(--hl-bottom, .34em));
  }
}

/* ── 3. Overlays ─────────────────────────────────────────────────────────────────────────────────── */
.ov { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ov::before, .ov::after { content: ""; position: absolute; pointer-events: none; }
/* No will-change on the animated layers: every card carries its own overlays, and a promoted layer per overlay costs
   more to composite than the opacity and transform animations cost to run (measured: 42 → 60 fps with 5 cards). */

/* stars: four prime-sized tiles (no visible repeat) + a twinkling layer + three 4-point sparkles */
.ov--stars {
  background:
    radial-gradient(circle at 23% 31%, rgb(255 248 231 / .95) 0 .9px, transparent 1.5px) 0 0 / 89px 97px,
    radial-gradient(circle at 71% 64%, rgb(255 248 231 / .7) 0 .7px, transparent 1.3px) 0 0 / 113px 131px,
    radial-gradient(circle at 42% 82%, rgb(255 230 180 / .95) 0 1.1px, transparent 1.8px) 0 0 / 173px 157px,
    radial-gradient(circle at 88% 12%, rgb(190 215 255 / .9) 0 1px, transparent 1.7px) 0 0 / 211px 199px,
    radial-gradient(circle at 10% 70%, rgb(255 255 255 / .55) 0 .6px, transparent 1.1px) 0 0 / 67px 71px;
  mask-image: linear-gradient(to bottom, #000 0%, #000 45%, transparent 86%);
}
.ov--stars::before {
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 1.3px, transparent 2.2px) 31px 17px / 137px 149px,
    radial-gradient(circle at 50% 50%, #FFE7A8 0 1.1px, transparent 2px) 77px 59px / 181px 167px;
  animation: ov-twinkle 3.4s var(--ease-io) infinite alternate;
}
.ov--stars::after {
  inset: 0;
  background: var(--t-text);
  mask:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 13% 15% / clamp(9px, calc(3.6*var(--ou)), 40px) no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 86% 23% / clamp(7px, calc(2.6*var(--ou)), 30px) no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 64% 8% / clamp(5px, calc(1.7*var(--ou)), 20px) no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 30% 38% / clamp(4px, calc(1.2*var(--ou)), 14px) no-repeat;
  animation: ov-twinkle 4.6s var(--ease-io) infinite alternate-reverse;
}
@keyframes ov-twinkle { from { opacity: .35; } to { opacity: 1; } }
/* On a thumb the sparkles would land on the eyebrow and the milestone: they stay in the top corners instead */
.gcard--thumb .ov--stars::after { mask-position: 9% 4%, 91% 7%, 62% 2%, 50% -30%; }

/* skyline: silhouette + lit windows, tiled along the bottom, with a horizon glow (and a far skyline: 3b) */
.ov--skyline::before, .ov--skyline::after { inset: auto 0 0; height: 24%; }
.ov--skyline::before {
  background: linear-gradient(to bottom, color-mix(in srgb, var(--t-bg) 70%, var(--t-a4)), color-mix(in srgb, var(--t-bg) 60%, #000) 60%);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 120' preserveAspectRatio='none'><path d='M0 120V84V84H16V64H34V74H44V46H52V36l2-6 2 6V46H64V70H78V58H102V78H114V34H121V20h2V34H130V54H152V72H162V62L175 54L188 62V76H202V40a10 7.692307692307692 0 0 1 20 0V66H238V80H250V50H278V70H288V26H296V12h2V26H306V60H328V74H342V44H352V34l2-6 2 6V44H366V68H378V56H404V72H420V48L430 40L440 48V66H454V76H470V84H480V84H480V120Z'/></svg>") bottom center / auto 100% repeat-x;
}
.ov--skyline::after {
  background: color-mix(in srgb, var(--t-a1) 85%, #fff);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 480 120' preserveAspectRatio='none'><path d='M3 89h2v2.6h-2zM3 95h2v2.6h-2zM27 69h2v2.6h-2zM23 81h2v2.6h-2zM23 105h2v2.6h-2zM37 97h2v2.6h-2zM51 51h2v2.6h-2zM59 51h2v2.6h-2zM51 63h2v2.6h-2zM47 105h2v2.6h-2zM55 105h2v2.6h-2zM47 111h2v2.6h-2zM51 111h2v2.6h-2zM71 75h2v2.6h-2zM67 87h2v2.6h-2zM67 111h2v2.6h-2zM81 63h2v2.6h-2zM85 63h2v2.6h-2zM89 75h2v2.6h-2zM97 75h2v2.6h-2zM93 81h2v2.6h-2zM81 87h2v2.6h-2zM85 93h2v2.6h-2zM93 93h2v2.6h-2zM93 99h2v2.6h-2zM97 99h2v2.6h-2zM85 105h2v2.6h-2zM97 105h2v2.6h-2zM117 45h2v2.6h-2zM121 57h2v2.6h-2zM117 63h2v2.6h-2zM117 75h2v2.6h-2zM125 75h2v2.6h-2zM121 93h2v2.6h-2zM121 99h2v2.6h-2zM121 111h2v2.6h-2zM137 65h2v2.6h-2zM141 71h2v2.6h-2zM145 71h2v2.6h-2zM133 77h2v2.6h-2zM137 77h2v2.6h-2zM141 77h2v2.6h-2zM145 77h2v2.6h-2zM141 83h2v2.6h-2zM145 83h2v2.6h-2zM133 89h2v2.6h-2zM141 101h2v2.6h-2zM141 107h2v2.6h-2zM137 113h2v2.6h-2zM141 113h2v2.6h-2zM155 77h2v2.6h-2zM155 83h2v2.6h-2zM165 67h2v2.6h-2zM177 67h2v2.6h-2zM181 67h2v2.6h-2zM169 73h2v2.6h-2zM181 103h2v2.6h-2zM169 115h2v2.6h-2zM181 115h2v2.6h-2zM209 45h2v2.6h-2zM209 57h2v2.6h-2zM205 63h2v2.6h-2zM209 63h2v2.6h-2zM217 63h2v2.6h-2zM213 69h2v2.6h-2zM217 69h2v2.6h-2zM213 75h2v2.6h-2zM217 75h2v2.6h-2zM209 81h2v2.6h-2zM209 87h2v2.6h-2zM217 99h2v2.6h-2zM205 105h2v2.6h-2zM225 77h2v2.6h-2zM225 89h2v2.6h-2zM229 107h2v2.6h-2zM225 113h2v2.6h-2zM229 113h2v2.6h-2zM245 85h2v2.6h-2zM241 91h2v2.6h-2zM241 109h2v2.6h-2zM245 109h2v2.6h-2zM253 55h2v2.6h-2zM269 55h2v2.6h-2zM273 55h2v2.6h-2zM253 61h2v2.6h-2zM265 73h2v2.6h-2zM269 73h2v2.6h-2zM273 79h2v2.6h-2zM253 85h2v2.6h-2zM257 85h2v2.6h-2zM269 85h2v2.6h-2zM253 91h2v2.6h-2zM257 91h2v2.6h-2zM261 91h2v2.6h-2zM273 91h2v2.6h-2zM273 97h2v2.6h-2zM257 103h2v2.6h-2zM269 103h2v2.6h-2zM273 103h2v2.6h-2zM295 37h2v2.6h-2zM299 49h2v2.6h-2zM295 55h2v2.6h-2zM299 55h2v2.6h-2zM291 73h2v2.6h-2zM299 115h2v2.6h-2zM309 65h2v2.6h-2zM313 65h2v2.6h-2zM313 77h2v2.6h-2zM317 77h2v2.6h-2zM321 77h2v2.6h-2zM317 83h2v2.6h-2zM317 89h2v2.6h-2zM317 95h2v2.6h-2zM321 95h2v2.6h-2zM313 101h2v2.6h-2zM313 113h2v2.6h-2zM335 91h2v2.6h-2zM331 97h2v2.6h-2zM349 49h2v2.6h-2zM353 55h2v2.6h-2zM357 61h2v2.6h-2zM361 67h2v2.6h-2zM357 73h2v2.6h-2zM353 85h2v2.6h-2zM349 91h2v2.6h-2zM345 97h2v2.6h-2zM349 103h2v2.6h-2zM369 79h2v2.6h-2zM369 85h2v2.6h-2zM369 91h2v2.6h-2zM373 103h2v2.6h-2zM381 61h2v2.6h-2zM381 67h2v2.6h-2zM385 67h2v2.6h-2zM389 67h2v2.6h-2zM381 79h2v2.6h-2zM385 79h2v2.6h-2zM397 79h2v2.6h-2zM381 91h2v2.6h-2zM381 97h2v2.6h-2zM389 97h2v2.6h-2zM385 109h2v2.6h-2zM389 109h2v2.6h-2zM393 109h2v2.6h-2zM393 115h2v2.6h-2zM411 77h2v2.6h-2zM415 83h2v2.6h-2zM407 89h2v2.6h-2zM407 95h2v2.6h-2zM415 95h2v2.6h-2zM423 53h2v2.6h-2zM427 53h2v2.6h-2zM431 53h2v2.6h-2zM435 53h2v2.6h-2zM427 59h2v2.6h-2zM435 71h2v2.6h-2zM423 107h2v2.6h-2zM435 113h2v2.6h-2zM447 77h2v2.6h-2zM443 89h2v2.6h-2zM447 107h2v2.6h-2zM461 81h2v2.6h-2zM457 87h2v2.6h-2zM465 93h2v2.6h-2zM461 105h2v2.6h-2zM465 111h2v2.6h-2zM473 89h2v2.6h-2zM473 101h2v2.6h-2z'/></svg>") bottom center / auto 100% repeat-x;
  opacity: .7;
}

/* blobs: two soft organic shapes off the corners + sprinkles kept to the edges */
.ov--blobs::before {
  inset: calc(-16*var(--ou));
  background: linear-gradient(225deg, color-mix(in srgb, var(--t-a2) 40%, transparent) 35%, color-mix(in srgb, var(--t-a3) 30%, transparent) 65%);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><path d='M104 10C146 6 184 32 190 76S172 160 132 180 40 190 18 150-4 64 30 34 74 12 104 10Z'/></svg>") top right / calc(70*var(--ou)) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'><path d='M96 16C138 22 178 44 184 90S158 178 110 186 22 168 14 120 30 30 96 16Z'/></svg>") bottom left / calc(64*var(--ou)) no-repeat;
}
.ov--blobs::after {
  inset: 0;
  background: conic-gradient(from 20deg at 50% 50%, var(--t-a1), var(--t-a2), var(--t-a3), var(--t-a4), var(--t-a1));
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 150 150'><g><rect x='12' y='18' width='16' height='5.5' rx='2.75' transform='rotate(-30 20 21)'/><circle cx='74' cy='26' r='3.6'/><rect x='108' y='12' width='16' height='5.5' rx='2.75' transform='rotate(40 116 15)'/><rect x='40' y='70' width='16' height='5.5' rx='2.75' transform='rotate(72 48 73)'/><circle cx='124' cy='74' r='3'/><rect x='88' y='104' width='16' height='5.5' rx='2.75' transform='rotate(-14 96 107)'/><circle cx='20' cy='118' r='3.6'/><rect x='54' y='128' width='13' height='5.5' rx='2.75' transform='rotate(28 60 131)'/><path d='M120 126l4 7 4-7 4 7' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/></g></svg>") 0 0 / clamp(110px, calc(40*var(--ou)), 300px), radial-gradient(farthest-side at 50% 50%, transparent 72%, #000 96%);
  mask-composite: intersect;
  opacity: .9;
}

/* deco: double rule frame, stepped fan corners and a top fan (art deco) */
.ov--deco { background: radial-gradient(120% 90% at 50% 42%, transparent 52%, rgb(0 0 0 / .5)); }
.ov--deco::before {
  inset: calc(3.4*var(--ou));
  border: 1px solid color-mix(in srgb, var(--t-a1) 70%, transparent);
  outline: 1px solid color-mix(in srgb, var(--t-a1) 32%, transparent);
  outline-offset: calc(-1.5*var(--ou));
}
.ov--deco::after {
  inset: calc(1.6*var(--ou));
  background: linear-gradient(135deg, color-mix(in srgb, var(--t-a1) 55%, #fff), var(--t-a1) 40%, color-mix(in srgb, var(--t-a1) 62%, #000) 70%, var(--t-a1));
  mask:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='%23000' stroke-width='2'><g transform='translate(0 0)'><path d='M8 130V8h122M18 96V18h78M8 8l26 26M18 44h26V18'/><path d='M60 18a42 42 0 0 1-42 42M74 18a56 56 0 0 1-56 56'/><path d='M18 18L58 34M18 18L46 46M18 18L34 58' stroke-width='1.2'/><path d='M130 8l6-4 6 4-6 4z M8 130l-4 6 4 6 4-6z' fill='%23000'/><circle cx='30' cy='30' r='3' fill='%23000'/></g></svg>") top left / calc(21*var(--ou)) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='%23000' stroke-width='2'><g transform='translate(160 0) scale(-1 1)'><path d='M8 130V8h122M18 96V18h78M8 8l26 26M18 44h26V18'/><path d='M60 18a42 42 0 0 1-42 42M74 18a56 56 0 0 1-56 56'/><path d='M18 18L58 34M18 18L46 46M18 18L34 58' stroke-width='1.2'/><path d='M130 8l6-4 6 4-6 4z M8 130l-4 6 4 6 4-6z' fill='%23000'/><circle cx='30' cy='30' r='3' fill='%23000'/></g></svg>") top right / calc(21*var(--ou)) no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='%23000' stroke-width='2'><g transform='translate(0 160) scale(1 -1)'><path d='M8 130V8h122M18 96V18h78M8 8l26 26M18 44h26V18'/><path d='M60 18a42 42 0 0 1-42 42M74 18a56 56 0 0 1-56 56'/><path d='M18 18L58 34M18 18L46 46M18 18L34 58' stroke-width='1.2'/><path d='M130 8l6-4 6 4-6 4z M8 130l-4 6 4 6 4-6z' fill='%23000'/><circle cx='30' cy='30' r='3' fill='%23000'/></g></svg>") bottom left / calc(21*var(--ou)) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 160 160' fill='none' stroke='%23000' stroke-width='2'><g transform='translate(160 160) scale(-1 -1)'><path d='M8 130V8h122M18 96V18h78M8 8l26 26M18 44h26V18'/><path d='M60 18a42 42 0 0 1-42 42M74 18a56 56 0 0 1-56 56'/><path d='M18 18L58 34M18 18L46 46M18 18L34 58' stroke-width='1.2'/><path d='M130 8l6-4 6 4-6 4z M8 130l-4 6 4 6 4-6z' fill='%23000'/><circle cx='30' cy='30' r='3' fill='%23000'/></g></svg>") bottom right / calc(21*var(--ou)) no-repeat,
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 64' fill='none' stroke='%23000' stroke-width='1.4'><path d='M100 0L146 0M100 0L144.4 11.9M100 0L139.8 23M100 0L132.5 32.5M100 0L123 39.8M100 0L111.9 44.4M100 0L100 46M100 0L88.1 44.4M100 0L77 39.8M100 0L67.5 32.5M100 0L60.2 23M100 0L55.6 11.9M100 0L54 0'/><path d='M54 0a46 46 0 0 0 92 0M40 0a60 60 0 0 0 120 0' stroke-width='2'/><path d='M100 60l5 4h-10z' fill='%23000'/></svg>") top calc(1.6*var(--ou)) center / calc(26*var(--ou)) auto no-repeat;
}

/* clouds: four puffs drifting slowly, sunlit on top and shaded underneath (full-colour art, 3b) */
.ov--clouds::before, .ov--clouds::after { inset: 0 -4%; }
.ov--clouds::before {
  background: url("/img/themes/bb-cloud-a.svg") 4% 24% / calc(34*var(--ou)) auto no-repeat, url("/img/themes/bb-cloud-b.svg") 96% 40% / calc(24*var(--ou)) auto no-repeat;
  opacity: .96;
  animation: ov-drift 28s ease-in-out infinite alternate;
}
.ov--clouds::after {
  background: url("/img/themes/bb-cloud-b.svg") 14% 92% / calc(28*var(--ou)) auto no-repeat, url("/img/themes/bb-cloud-a.svg") 100% 82% / calc(36*var(--ou)) auto no-repeat;
  opacity: .8;
  animation: ov-drift 36s ease-in-out infinite alternate-reverse;
}
@keyframes ov-drift { from { transform: translateX(-2.2%); } to { transform: translateX(2.2%); } }

/* bunting: one swag per tile (≤ 980 px), flags coloured a1–a4 in turn */
.ov--bunting::before, .ov--bunting::after { inset: -.4% 0 0; }
.ov--bunting::before {
  background: color-mix(in srgb, var(--t-text) 50%, transparent);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 150' fill='none' stroke='%23000' stroke-width='3'><path d='M0 6Q450 86 900 6'/></svg>") top center / clamp(300px, 100%, 980px) auto repeat-x;
}
.ov--bunting::after {
  background: linear-gradient(90deg,var(--t-a1) 0% 9.1%,var(--t-a2) 9.1% 18.2%,var(--t-a3) 18.2% 27.3%,var(--t-a4) 27.3% 36.4%,var(--t-a1) 36.4% 45.5%,var(--t-a2) 45.5% 54.5%,var(--t-a3) 54.5% 63.6%,var(--t-a4) 63.6% 72.7%,var(--t-a1) 72.7% 81.8%,var(--t-a2) 81.8% 90.9%,var(--t-a3) 90.9% 100%) top center / clamp(300px, 100%, 980px) 100% repeat-x;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 900 150'><path d='M11.3 8.2L70.5 17.7L38.8 66.9ZM93 21L152.5 28.6L121 78.8ZM174.7 31.3L234.4 36.9L203.3 88.1ZM256.4 38.8L316.3 42.6L285.5 94.7ZM338.2 43.8L398.2 45.6L367.8 98.7ZM420 46.1L480 45.9L450 100ZM501.8 45.7L561.8 43.7L532.3 98.7ZM583.7 42.7L643.6 38.7L614.5 94.7ZM665.6 37L725.3 31.2L696.8 88.1ZM747.5 28.7L807 20.9L779 78.8ZM829.5 17.8L888.7 8.1L861.3 66.9Z'/></svg>") top center / clamp(300px, 100%, 980px) auto repeat-x;
}

/* grain: fractal noise, multiplied on light themes, overlaid on dark ones */
.ov--grain { background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>") 0 0 / 220px 220px; opacity: .14; mix-blend-mode: multiply; }
[data-scheme="dark"] .ov--grain { opacity: .2; mix-blend-mode: overlay; }

/* floral corners: leafy sprigs with five-petal blossoms, top left and bottom right */
.ov--floral-corners::before {
  inset: 0;
  background: color-mix(in srgb, var(--t-a3) 78%, #2b4a33);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><path d='M0 0C40 30 70 60 92 120M0 0C50 10 110 16 200 12M60 40C90 34 120 44 150 54M30 60C24 90 26 120 22 150' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/><path d='M0 0C10.2 -12.2 25.5 -9.8 34 0C25.5 9.8 10.2 12.2 0 0Z' transform='translate(120 15) rotate(-30)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(160 12) rotate(20)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(70 52) rotate(60)'/><path d='M0 0C8.4 -10.1 21 -8.1 28 0C21 8.1 8.4 10.1 0 0Z' transform='translate(96 116) rotate(110)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(26 130) rotate(100)'/><path d='M0 0C7.2 -8.6 18 -6.9 24 0C18 6.9 7.2 8.6 0 0Z' transform='translate(198 12) rotate(-15)'/><path d='M0 0C7.8 -9.4 19.5 -7.5 26 0C19.5 7.5 7.8 9.4 0 0Z' transform='translate(120 46) rotate(40)'/><circle cx='46' cy='40' r='5.4'/><circle cx='104' cy='26' r='3.5'/><circle cx='28' cy='106' r='3.8'/><circle cx='150' cy='54' r='2.2'/><circle cx='70' cy='86' r='1.9'/></svg>") top left / clamp(60px, calc(46*var(--ou)), 520px) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><g transform='rotate(180 120 120)'><path d='M0 0C40 30 70 60 92 120M0 0C50 10 110 16 200 12M60 40C90 34 120 44 150 54M30 60C24 90 26 120 22 150' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'/><path d='M0 0C10.2 -12.2 25.5 -9.8 34 0C25.5 9.8 10.2 12.2 0 0Z' transform='translate(120 15) rotate(-30)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(160 12) rotate(20)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(70 52) rotate(60)'/><path d='M0 0C8.4 -10.1 21 -8.1 28 0C21 8.1 8.4 10.1 0 0Z' transform='translate(96 116) rotate(110)'/><path d='M0 0C9 -10.8 22.5 -8.6 30 0C22.5 8.6 9 10.8 0 0Z' transform='translate(26 130) rotate(100)'/><path d='M0 0C7.2 -8.6 18 -6.9 24 0C18 6.9 7.2 8.6 0 0Z' transform='translate(198 12) rotate(-15)'/><path d='M0 0C7.8 -9.4 19.5 -7.5 26 0C19.5 7.5 7.8 9.4 0 0Z' transform='translate(120 46) rotate(40)'/><circle cx='46' cy='40' r='5.4'/><circle cx='104' cy='26' r='3.5'/><circle cx='28' cy='106' r='3.8'/><circle cx='150' cy='54' r='2.2'/><circle cx='70' cy='86' r='1.9'/></g></svg>") bottom right / clamp(60px, calc(46*var(--ou)), 520px) no-repeat;
  opacity: .8;
}
.ov--floral-corners::after {
  inset: 0;
  background: linear-gradient(150deg, var(--t-a1) 0%, color-mix(in srgb, var(--t-a1) 55%, var(--t-a2)) 45%, var(--t-a1) 100%);
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><defs><mask id='m'><rect width='240' height='240' fill='%23fff'/><circle cx='46' cy='40' r='7.5' fill='%23000'/><circle cx='104' cy='26' r='4.8' fill='%23000'/><circle cx='28' cy='106' r='5.3' fill='%23000'/><circle cx='150' cy='54' r='3.1' fill='%23000'/><circle cx='70' cy='86' r='2.6' fill='%23000'/></mask></defs><g mask='url(%23m)'><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(8 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(80 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(152 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(224 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(296 46 40)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(30 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(102 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(174 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(246 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(318 104 26)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(-12 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(60 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(132 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(204 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(276 28 106)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(18 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(90 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(162 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(234 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(306 150 54)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(40 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(112 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(184 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(256 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(328 70 86)'/><ellipse cx='188' cy='30' rx='7' ry='10' transform='rotate(60 188 30)'/><ellipse cx='20' cy='160' rx='7' ry='10' transform='rotate(-20 20 160)'/></g></svg>") top left / clamp(60px, calc(46*var(--ou)), 520px) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 240 240'><g transform='rotate(180 120 120)'><defs><mask id='m'><rect width='240' height='240' fill='%23fff'/><circle cx='46' cy='40' r='7.5' fill='%23000'/><circle cx='104' cy='26' r='4.8' fill='%23000'/><circle cx='28' cy='106' r='5.3' fill='%23000'/><circle cx='150' cy='54' r='3.1' fill='%23000'/><circle cx='70' cy='86' r='2.6' fill='%23000'/></mask></defs><g mask='url(%23m)'><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(8 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(80 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(152 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(224 46 40)'/><ellipse cx='46' cy='18.9' rx='14.3' ry='21.1' transform='rotate(296 46 40)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(30 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(102 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(174 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(246 104 26)'/><ellipse cx='104' cy='12.4' rx='9.2' ry='13.6' transform='rotate(318 104 26)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(-12 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(60 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(132 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(204 28 106)'/><ellipse cx='28' cy='91.1' rx='10.1' ry='14.9' transform='rotate(276 28 106)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(18 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(90 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(162 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(234 150 54)'/><ellipse cx='150' cy='45.3' rx='5.9' ry='8.7' transform='rotate(306 150 54)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(40 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(112 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(184 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(256 70 86)'/><ellipse cx='70' cy='78.6' rx='5' ry='7.4' transform='rotate(328 70 86)'/><ellipse cx='188' cy='30' rx='7' ry='10' transform='rotate(60 188 30)'/><ellipse cx='20' cy='160' rx='7' ry='10' transform='rotate(-20 20 160)'/></g></g></svg>") bottom right / clamp(60px, calc(46*var(--ou)), 520px) no-repeat;
}

/* glass: a frosted panel behind the content with a slow light sweep and glints */
.ov--glass {
  inset: calc(6.5*var(--ou)) calc(6*var(--ou));
  border: 1.5px solid rgb(255 255 255 / .8);
  border-radius: calc(5*var(--ou));
  background: linear-gradient(145deg, rgb(255 255 255 / .66), rgb(255 255 255 / .26) 52%, rgb(255 255 255 / .44));
  box-shadow: inset 0 1px 0 #fff, inset 0 -1px 0 rgb(122 31 162 / .08), 0 28px 60px -30px rgb(122 31 162 / .5);
}
.ov--glass::before {
  inset: -40% auto -40% -50%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / .6), transparent);
  transform: rotate(16deg) translateX(0);
  animation: ov-glass-sheen 9s var(--ease-io) 1s infinite;
}
.ov--glass::after {
  inset: 0;
  background: #fff;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 5% 7% / calc(6*var(--ou)) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 95% 92% / calc(8*var(--ou)) no-repeat, url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'><path d='M20 0C21.5 13 27 18.5 40 20 27 21.5 21.5 27 20 40 18.5 27 13 21.5 0 20 13 18.5 18.5 13 20 0Z'/></svg>") 91% 9% / calc(3.2*var(--ou)) no-repeat;
  filter: drop-shadow(0 0 calc(.5*var(--ou)) #fff);
}
@keyframes ov-glass-sheen { 0% { transform: rotate(16deg) translateX(0); } 32%, 100% { transform: rotate(16deg) translateX(560%); } }

/* synth-sun: a striped retro sun setting on the horizon (62 %), with a glow */
.ov--synth-sun { background: radial-gradient(calc(46*var(--ou)) calc(40*var(--ou)) at 50% 50%, color-mix(in srgb, var(--t-a1) 34%, transparent), transparent 72%); }
.ov--synth-sun::before {
  left: 50%;
  bottom: 38%;
  width: calc(46*var(--ou));
  aspect-ratio: 1;
  translate: -50% 0;
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--t-a3) 6%, color-mix(in srgb, var(--t-a3) 40%, var(--t-a1)) 36%, var(--t-a1) 64%, var(--t-a4) 100%);
  mask: linear-gradient(to bottom, #000 0 48%, transparent 48% 52%, #000 52% 60%, transparent 60% 64.5%, #000 64.5% 71%, transparent 71% 76.5%, #000 76.5% 82%, transparent 82% 88.5%, #000 88.5% 93%, transparent 93%);
}

/* synthwave-grid: a perspective floor below the horizon, scrolling slowly towards the viewer */
.ov--synthwave-grid {
  inset: 62% 0 0;
  perspective: calc(30*var(--ou));
  perspective-origin: 50% 0;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--t-a1) 75%, #fff) 0 1.5px, color-mix(in srgb, var(--t-a1) 18%, transparent) 2px, transparent 70%);
}
.ov--synthwave-grid::before {
  inset: 0 -80% -60%;
  background:
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--t-a2) 70%, transparent) 0 2px, transparent 2px calc(8*var(--ou))),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--t-a1) 72%, transparent) 0 2px, transparent 2px calc(8*var(--ou)));
  transform-origin: 50% 0;
  transform: rotateX(70deg);
  mask: linear-gradient(to bottom, transparent 0, #000 18%);
  animation: ov-grid 3s linear infinite;
}
@keyframes ov-grid { from { transform: rotateX(70deg) translateY(0); } to { transform: rotateX(70deg) translateY(calc(8*var(--ou))); } }

/* scanlines: CRT lines and a vignette */
.ov--scanlines {
  background:
    repeating-linear-gradient(to bottom, rgb(0 0 0 / .28) 0 1px, transparent 1px 3px),
    radial-gradient(130% 100% at 50% 50%, transparent 58%, rgb(0 0 0 / .55));
  mix-blend-mode: multiply;
  opacity: .75;
}

/* tape: two strips of washi tape across the top corners */
.ov--tape::before, .ov--tape::after { top: calc(3.2*var(--ou)); width: calc(30*var(--ou)); height: calc(7.5*var(--ou)); mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'><path d='M5 0 0 4 5 8 0 12 5 16 0 20 5 24 0 28 5 32 0 36 5 40H195L200 36 195 32 200 28 195 24 200 20 195 16 200 12 195 8 200 4 195 0Z'/></svg>") center / 100% 100% no-repeat; }
.ov--tape::before {
  left: calc(-6*var(--ou));
  background: repeating-linear-gradient(90deg, rgb(255 255 255 / .2) 0 calc(.9*var(--ou)), transparent calc(.9*var(--ou)) calc(1.8*var(--ou))), color-mix(in srgb, var(--t-a3) 70%, transparent);
  transform: rotate(-38deg);
}
.ov--tape::after {
  right: calc(-6*var(--ou));
  background: repeating-linear-gradient(45deg, rgb(255 255 255 / .22) 0 calc(.7*var(--ou)), transparent calc(.7*var(--ou)) calc(1.6*var(--ou))), color-mix(in srgb, var(--t-a1) 55%, transparent);
  transform: rotate(36deg);
}

/* ── 3b. Illustration overlays ───────────────────────────────────────────────────────────────────────── */
/* Full-colour art (public/img/themes/*.svg: shading, highlights and gradients a one-colour mask cannot draw), painted for one
   theme each, so they do not take the theme palette. Same contract as the overlays above: pointer-events:none, sized in --ou,
   hidden under forced-colors, still on thumbs and swatches. The art keeps to the edges and corners, clear of the centred text. */

/* skyline (above) gains a far skyline: a hazy violet row of towers that peeks over the near one */
.ov--skyline {
  background:
    url("/img/themes/mf-skyline-far.svg") bottom center / auto 32% repeat-x,
    radial-gradient(80% 30% at 50% 100%, color-mix(in srgb, var(--t-a4) 40%, transparent), transparent 72%);
}

/* chrome: chrome stars and a chrome heart, an iridescent butterfly and soap bubbles, floating over the glass edge */
.ov--chrome {
  background:
    url("/img/themes/hy-chrome-a.svg") right calc(-3*var(--ou)) top calc(-2*var(--ou)) / calc(36*var(--ou)) auto no-repeat,
    url("/img/themes/hy-chrome-b.svg") left calc(-4*var(--ou)) bottom calc(14*var(--ou)) / calc(34*var(--ou)) auto no-repeat;
}

/* mountains: wireframe peaks standing on the horizon (62 %, as synth-sun and synthwave-grid) in its glow, under a pixel starfield */
.ov--mountains { background: radial-gradient(70% 22% at 50% 62%, rgb(255 42 109 / .25), transparent 70%); }
.ov--mountains::before {
  inset: auto 0 38%;
  aspect-ratio: 1000 / 120;
  background: url("/img/themes/na-mountains.svg") bottom center / 100% auto no-repeat;
}
.ov--mountains::after {
  inset: 0 0 42%;
  background: url("/img/themes/na-stars.svg") 0 0 / calc(52*var(--ou)) auto repeat;
  mask-image: linear-gradient(to bottom, #000 35%, transparent);
  animation: ov-twinkle 3.8s var(--ease-io) infinite alternate;
}

/* ── 4. Card treatments per theme ────────────────────────────────────────────────────────────────── */

/* Midnight Fireworks: warm cream serif glowing on the night sky */
.gcard[data-theme="midnight-fireworks"] .gcard__name {
  --hl-fill: linear-gradient(180deg, #FFFDF6 35%, #FFE1A0 100%);
  color: #FFF1CF;
  filter: drop-shadow(0 0 .2em rgb(255 201 74 / .38));
}
:is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow {
  display: flex;
  align-items: center;
  gap: .9em;
}
:is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow::before,
:is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow::after {
  content: "";
  flex: none;
  inline-size: 2.6em;
  block-size: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}
:is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow::after { transform: scaleX(-1); }
/* On a narrow card (every thumb, a phone's page card or preview) the eyebrow often wraps to two lines, and the rules
   would float beside the first line: there the eyebrow stands on its own. */
@container gcard (max-width: 380px) {
  :is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow::before,
  :is(.gcard[data-theme="midnight-fireworks"], .gcard[data-theme="golden-gala"]) .gcard__eyebrow::after { display: none; }
}
.gcard[data-theme="midnight-fireworks"] .gcard__milestone {
  border-color: color-mix(in srgb, var(--t-a1) 60%, transparent);
  background: color-mix(in srgb, var(--t-a1) 12%, transparent);
}

/* Confetti Pop: poster type with a two-colour offset shadow, a ribbon eyebrow */
.gcard[data-theme="confetti-pop"] .gcard__name {
  letter-spacing: -.035em;
  text-shadow: .045em .05em 0 var(--t-a2), .09em .1em 0 color-mix(in srgb, var(--t-a3) 80%, transparent);
}
.gcard[data-theme="confetti-pop"] .gcard__eyebrow {
  padding: .62em 1.2em .58em calc(1.2em + .24em);
  border-radius: var(--radius-pill);
  background: var(--t-cta);
  color: var(--t-cta-text);
  rotate: -2.5deg;
  box-shadow: 0 .28em 0 color-mix(in srgb, var(--t-cta) 55%, #000);
}
.gcard[data-theme="confetti-pop"] .gcard__milestone { border: 0; background: var(--t-a2); color: var(--t-text); }

/* Golden Gala: gold foil serif inside an art deco frame */
.gcard[data-theme="golden-gala"] .gcard__eyebrow { letter-spacing: .34em; }
.gcard[data-theme="golden-gala"] .gcard__sender > [data-f] { color: var(--t-a2); }
.gcard[data-theme="golden-gala"] .gcard__milestone {
  border-color: color-mix(in srgb, var(--t-a1) 70%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--t-a1) 20%, transparent), color-mix(in srgb, var(--t-a1) 6%, transparent));
  color: var(--t-a2);
}

/* Balloon Bash: chunky sticker type with a white outline */
.gcard[data-theme="balloon-bash"] .gcard__name {
  -webkit-text-stroke: .16em #fff;
  paint-order: stroke fill;
  letter-spacing: -.01em;
  filter: drop-shadow(0 .07em 0 rgb(20 48 90 / .22));
}
.gcard[data-theme="balloon-bash"] .gcard__eyebrow {
  padding: .6em 1.15em .56em calc(1.15em + .24em);
  border-radius: var(--radius-pill);
  background: var(--t-cta);
  color: var(--t-cta-text);
  box-shadow: 0 .25em 0 color-mix(in srgb, var(--t-cta) 60%, #000);
}
.gcard[data-theme="balloon-bash"] .gcard__milestone { border: 0; background: var(--t-a2); color: var(--t-text); }

/* Blossom Garden: rose serif on painted paper, inside a hairline stationery frame */
.gcard[data-theme="blossom-garden"] .gcard__name { color: color-mix(in srgb, var(--t-cta) 72%, var(--t-text)); }
/* the eyebrow and the signature sit on the pink wash and the floral corners: a shade deeper keeps them at AA */
.gcard[data-theme="blossom-garden"] { --t-eyebrow: color-mix(in srgb, var(--t-cta) 68%, var(--t-text)); }
.gcard[data-theme="blossom-garden"] .gcard__sender { color: color-mix(in srgb, var(--t-muted) 45%, var(--t-text)); }
.gcard[data-theme="blossom-garden"] .gcard__overlays::after {
  content: "";
  position: absolute;
  inset: 3.6cqi;
  border: 1px solid color-mix(in srgb, var(--t-a1) 45%, transparent);
  border-radius: 2.4cqi;
}
.gcard[data-theme="blossom-garden"] .gcard__milestone { border-color: transparent; background: color-mix(in srgb, var(--t-a2) 70%, transparent); }

/* A framed theme keeps the content inside its frame, whatever the size of the preview (the stage has no frame) */
.gcard--preview[data-theme="golden-gala"] { --edge-top: max(22px, calc(7 * var(--hu))); --edge-bottom: max(22px, calc(7 * var(--hu))); }
.gcard--preview[data-theme="blossom-garden"] { --edge-top: max(22px, calc(6 * var(--hu))); --edge-bottom: max(22px, calc(7 * var(--hu))); }
.gcard--preview[data-theme="holo-y2k"] { --edge-top: max(26px, calc(8 * var(--hu))); --edge-bottom: max(26px, calc(8 * var(--hu))); }

/* The seat badge sits between the bottom corner ornaments, inside the double rule (not across it) */
.gcard--page[data-theme="golden-gala"] .gcard__seat {
  inset-inline-start: 50%;
  inset-block-end: 8.5cqi;
  translate: -50% 0;
}

/* Holo Y2K: chrome type on an iridescent field behind frosted glass */
.gcard[data-theme="holo-y2k"] { --name-k: 168cqi; --name-max: 23cqi; }
/* the glass panel is inset 6.5 % of the card's shorter side: the seat badge and the corner emoji sit inside it, not across its edge */
.gcard--page[data-theme="holo-y2k"] .gcard__seat { inset-inline-start: 10cqi; inset-block-end: 10cqi; }
.gcard--page[data-theme="holo-y2k"] .gcard__emoji { inset-inline-end: 9.5cqi; inset-block-end: 9cqi; }
.gcard[data-theme="holo-y2k"] .gcard__name { letter-spacing: -.02em; line-height: .92; }
.gcard[data-theme="holo-y2k"] .gcard__eyebrow {
  padding: .58em 1.15em .54em calc(1.15em + .24em);
  border: 1px solid #fff;
  border-radius: var(--radius-pill);
  background: linear-gradient(180deg, #fff, #F1E8FF);
  box-shadow: 0 .3em .8em -.3em rgb(122 31 162 / .45), inset 0 -.15em 0 rgb(122 31 162 / .1);
}
.gcard[data-theme="holo-y2k"] .gcard__milestone {
  border-color: #fff;
  background: linear-gradient(90deg, #FFD6EC, #C9F6FF, #D6FFEB);
}

/* Neon Arcade: glowing tube type, a LEVEL UP kicker, synthwave horizon */
.gcard[data-theme="neon-arcade"] { --font-msg: "Chakra Petch", var(--font-ui); --font-sign: "Chakra Petch", var(--font-ui); --sign-style: normal; }
.gcard[data-theme="neon-arcade"] .gcard__name {
  color: #F4FEFF;
  -webkit-text-stroke: .06em color-mix(in srgb, var(--t-bg) 92%, transparent);        /* where the name crosses the sun's yellow it was 1.4:1 */
  paint-order: stroke fill;
  text-shadow: 0 0 .03em #fff, 0 0 .12em var(--t-a2), 0 0 .34em var(--t-a2), 0 0 .8em color-mix(in srgb, var(--t-a1) 75%, transparent);
}
.gcard[data-theme="neon-arcade"] .gcard__eyebrow {
  padding: .5em .9em .45em calc(.9em + .3em);
  border-radius: 3px;
  background: color-mix(in srgb, var(--t-bg) 78%, transparent);      /* legible across the sun */
  font-family: "Chakra Petch", var(--font-display);
  color: #FF6A9A;
  letter-spacing: .3em;
  text-shadow: 0 0 .8em color-mix(in srgb, var(--t-a1) 80%, transparent);
}
.gcard[data-theme="neon-arcade"] .gcard__kicker {
  padding: .5em .9em .45em calc(.9em + .3em);
  border: 2px solid currentColor;
  border-radius: 3px;
  background: color-mix(in srgb, var(--t-bg) 82%, transparent);
  font-family: "Chakra Petch", var(--font-display);
  color: var(--t-a3);
  text-shadow: 0 0 .5em color-mix(in srgb, var(--t-a3) 70%, transparent);
  box-shadow: 0 0 .9em color-mix(in srgb, var(--t-a3) 40%, transparent), inset 0 0 .6em color-mix(in srgb, var(--t-a3) 25%, transparent);
}
.gcard[data-theme="neon-arcade"] .gcard__message,
.gcard[data-theme="neon-arcade"] .gcard__sender { letter-spacing: .01em; text-shadow: 0 0 2px var(--t-bg), 0 0 6px var(--t-bg), 0 0 12px var(--t-bg); }
/* the message is an arcade dialog box: the synthwave grid never cuts through the words */
.gcard[data-theme="neon-arcade"] .gcard__message {
  padding: .62em .95em .68em;
  border: max(1px, .09em) solid color-mix(in srgb, var(--t-a2) 62%, transparent);
  border-radius: 4px;
  background: color-mix(in srgb, var(--t-bg) 82%, transparent);
  box-shadow: 0 0 .9em color-mix(in srgb, var(--t-a2) 24%, transparent), inset 0 0 .8em color-mix(in srgb, var(--t-a2) 12%, transparent);
  text-shadow: none;
}
.gcard[data-theme="neon-arcade"] .gcard__sender {
  padding: .28em .7em .24em;
  border-radius: 3px;
  background: color-mix(in srgb, var(--t-bg) 72%, transparent);   /* the grid never strikes through the signature */
  text-transform: uppercase;
  letter-spacing: .14em;
}
.gcard--page[data-theme="neon-arcade"] .gcard__sender { font-size: clamp(12px, 3cqi, 17px); }
/* On the Grand Display the stack is laid out by viewport height and a long message already fills it: the plates stay snug.
   The preview is the stage in miniature, and neon is its tallest card (a phone-wide preview grew to 315 px for 280 characters). */
:is(.gcard--stage, .gcard--preview)[data-theme="neon-arcade"] :is(.gcard__eyebrow, .gcard__kicker) { padding-block: .32em .28em; }
:is(.gcard--stage, .gcard--preview)[data-theme="neon-arcade"] .gcard__message { padding: .3em .8em .34em; }
:is(.gcard--stage, .gcard--preview)[data-theme="neon-arcade"] .gcard__sender { padding-block: .14em .1em; }
.gcard[data-theme="neon-arcade"] .gcard__milestone {
  border-color: color-mix(in srgb, var(--t-a2) 80%, transparent);
  background: color-mix(in srgb, var(--t-bg) 70%, color-mix(in srgb, var(--t-a2) 30%, transparent));
  box-shadow: 0 0 .8em color-mix(in srgb, var(--t-a2) 35%, transparent);
}
.gcard--page[data-theme="neon-arcade"], .gcard--preview[data-theme="neon-arcade"] {
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--t-a4) 45%, transparent), 0 24px 60px -18px rgb(0 0 0 / .6), 0 0 80px -20px color-mix(in srgb, var(--t-a1) 55%, transparent);
}

/* Sketchbook: a taped notebook page, hand lettering, a highlighter swipe, left-aligned like a zine */
.gcard[data-theme="sketchbook"] {
  --font-msg: "Caveat Variable", var(--font-ui);
  --font-sign: "Caveat Variable", var(--font-ui);
  --sign-style: normal;
  --name-k: 168cqi;               /* the left margin (the red rule) leaves ~73 % of the width, not 84 % */
  --name-max: 22.5cqi;
}
.gcard[data-theme="sketchbook"] .gcard__eyebrow {
  font-family: "Caveat Variable", var(--font-display);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  padding-inline-start: 0;
  rotate: -2deg;
}
.gcard[data-theme="sketchbook"] .gcard__message { font-weight: 500; line-height: 1.22; }
/* sizes are per variant: page here, thumb below, preview and stage in card.css (they scale with the 16:9 box) */
.gcard--page[data-theme="sketchbook"] .gcard__eyebrow { font-size: clamp(18px, 5cqi, 28px); }
.gcard--page[data-theme="sketchbook"] .gcard__message[data-len="s"] { font-size: clamp(24px, 7.4cqi, 41px); }
.gcard--page[data-theme="sketchbook"] .gcard__message[data-len="m"] { font-size: clamp(20px, 5.6cqi, 31px); }
.gcard--page[data-theme="sketchbook"] .gcard__message[data-len="l"] { font-size: clamp(18px, 4.3cqi, 24px); }
.gcard[data-theme="sketchbook"] .gcard__sender { font-weight: 700; color: var(--t-muted); }
.gcard--page[data-theme="sketchbook"] .gcard__sender { font-size: clamp(20px, 5.4cqi, 30px); }
.gcard[data-theme="sketchbook"] .gcard__sender > [data-f] { color: var(--t-cta); }
.gcard[data-theme="sketchbook"] .gcard__milestone {
  border: 2px solid var(--t-a2);
  border-radius: 46% 54% 42% 58% / 58% 46% 54% 42%;
  background: none;
  font-family: "Caveat Variable", var(--font-ui);
  font-weight: 700;
  rotate: 1.5deg;
}
.gcard--page[data-theme="sketchbook"] .gcard__milestone { font-size: clamp(16px, 4.2cqi, 23px); }
:is(.gcard--page, .gcard--thumb)[data-theme="sketchbook"] {
  align-items: flex-start;
  text-align: start;
  border-radius: 6px;
}
:is(.gcard--page, .gcard--thumb)[data-theme="sketchbook"] > :is(p, h2) { margin-inline: max(13cqi, 58px) 8cqi; }
.gcard--thumb[data-theme="sketchbook"] > :is(p, h2) { margin-inline: 24cqi 6cqi; }
.gcard--thumb[data-theme="sketchbook"] { --name-k: 126cqi; --name-max: 19cqi; }     /* 70 % of the width is left of the margin */
.gcard--page[data-theme="sketchbook"] {
  box-shadow: 0 1px 1px rgb(0 0 0 / .1), 0 2px 0 -1px #fff, 0 3px 2px -1px rgb(0 0 0 / .12), 0 22px 46px -18px rgb(0 0 0 / .55);
}

/* Thumbs stay proportional: theme sizes with px minimums apply to the larger variants only. */
.gcard--thumb[data-theme] .gcard__eyebrow { font-size: 3.8cqi; }
.gcard--thumb[data-theme] .gcard__milestone { font-size: 3.6cqi; }
.gcard--thumb[data-theme] .gcard__sender { font-size: 5.2cqi; }
.gcard--thumb[data-theme="sketchbook"] .gcard__eyebrow { font-size: 5.6cqi; }
.gcard--thumb[data-theme="sketchbook"] .gcard__milestone { font-size: 4.6cqi; white-space: nowrap; }
.gcard--thumb[data-theme="sketchbook"] .gcard__sender { font-size: 6.2cqi; }
.gcard--thumb[data-theme="neon-arcade"] .gcard__sender { font-size: 3.8cqi; }
/* the thumb clamps the message to three lines and clips at the padding edge: vertical padding would show a fourth */
.gcard--thumb[data-theme="neon-arcade"] .gcard__message { padding-block: 0; }

/* ── Miniatures hold still ───────────────────────────────────────────────────────────────────────── */
/* Ambient motion (twinkling stars, drifting clouds, the glass sheen, the scrolling grid, the chrome shimmer) belongs
   to the cards you actually look at: a page or stage card, the 16:9 preview, the sky behind /live. Thumbs and swatches
   are static: a grid of them would otherwise run dozens of masked, animated layers at once. */
.gcard--thumb .ov, .gcard--thumb .ov::before, .gcard--thumb .ov::after,
.swatch__card .ov, .swatch__card .ov::before, .swatch__card .ov::after,
.gcard--thumb .hl--chrome { animation: none; }

/* ── Reduced motion, Calm mode, forced colors ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .hl--chrome, .ov--stars::before, .ov--stars::after, .ov--clouds::before, .ov--clouds::after,
  .ov--glass::before, .ov--synthwave-grid::before, .ov--mountains::after { animation: none !important; }
}
:root[data-calm] .hl--chrome,
:root[data-calm] .ov--stars::before, :root[data-calm] .ov--stars::after,
:root[data-calm] .ov--clouds::before, :root[data-calm] .ov--clouds::after,
:root[data-calm] .ov--glass::before, :root[data-calm] .ov--synthwave-grid::before,
:root[data-calm] .ov--mountains::after { animation: none !important; }
@media (forced-colors: active) {
  .ov { display: none; }
  .hl--gold-foil, .hl--chrome, .gcard[data-theme="midnight-fireworks"] .gcard__name {
    background: none; -webkit-text-fill-color: CanvasText; color: CanvasText; filter: none;
  }
  /* The name is plain text in the system's colours. A theme's stroke (Balloon Bash's white sticker outline, Neon Arcade's dark
     rim), its shadow stack and its drop-shadow are each drawn in ONE forced colour: the 14 px outline became black and merged the
     letters into a solid blob with a grey bar under it (the Grand Display, the greeting page and the previews alike). card.css
     drops the filter and the shadow too, but a theme's own rule (.gcard[data-theme] .gcard__name) is more specific than that one;
     this one comes after them all. The stroke is a text property, so it goes from the letters themselves as well. */
  .gcard[data-theme] .gcard__name, .gcard[data-theme] .gcard__name * {
    -webkit-text-stroke: 0; paint-order: normal; text-shadow: none; filter: none;
  }
}
