/* =============================================================================
   Waidrn Theme 2.0 — deep scene + translucent hologram material layer
   =============================================================================
   Built for Vision 2.0 (ART-03/04/25/26/27/28). Everything here is ADDITIVE and
   scoped to `html[data-ui="v2"]`, so the v1 surfaces stay untouched until the
   THEME_V2 flag is on. One scene per page, selected by the scene registry
   (`templates/scenes.rs`) and exposed as `body[data-scene]`; the backdrop is a
   pure-CSS fixed layer (no extra DOM, no inline styles), the artwork is owned by
   the scene-art lane (`app/static/scenes/<key>-desktop.webp` + `<key>-phone.webp`,
   authored in `assets/scenes/<key>.svg`), and a per-scene gradient fallback keeps
   every page intentional before/without those files.

   Layout is preserved: only material (fill/border/blur/shadow/texture/colour),
   backdrop and typographic micro-treatment change here. Geometry, spacing,
   grid and information hierarchy come from app.css/hub.css/funding.css.

   Originality: no external images/fonts/requests; no readable brands or logos;
   gradients and any future scene art are original to Waidrn.
   ============================================================================= */

/* -----------------------------------------------------------------------------
   1. Global hologram tokens (dark default; see §4 for light theme)
   -------------------------------------------------------------------------- */
html[data-ui="v2"] {
  color-scheme: dark;

  /* base */
  --void: #07080a;
  --bg: var(--void);
  --bg-deep: #05070a;
  --body-bg: var(--void);
  --surface: rgba(16, 20, 26, 0.52);
  --surface-2: rgba(20, 25, 32, 0.62);
  --surface-3: rgba(27, 33, 41, 0.66);
  --surface-inset: rgba(8, 10, 14, 0.55);
  --header-bg: rgba(9, 12, 16, 0.66);

  /* text (unchanged semantics; scenes never lower these) */
  --ink: #f2ecdf;
  --ink-2: #d6cbb4;
  --ink-3: #b4ac9c;
  --ink-inverse: #14110d;

  /* identity + material */
  --gold: #e8c987;
  --gold-bright: #f7e6b9;
  --gold-deep: #c49a55;
  --gold-ghost: rgba(232, 201, 135, 0.13);
  --gold-line: rgba(232, 201, 135, 0.30);
  --accent-2: #8fc9bf;
  --accent-2-soft: rgba(143, 201, 191, 0.16);

  /* lines / elevation */
  --line: rgba(232, 201, 135, 0.14);
  --line-strong: rgba(232, 201, 135, 0.32);
  --focus: #ffd98a;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 6px 20px rgba(0, 0, 0, 0.38);
  --glow: 0 0 0 1px var(--glass-line), 0 18px 60px rgba(0, 0, 0, 0.55);

  /* glass material */
  --glass: rgba(16, 20, 26, 0.52);
  --glass-deep: rgba(10, 13, 17, 0.68);
  --glass-line: rgba(232, 201, 135, 0.26);
  --glass-line-strong: rgba(232, 201, 135, 0.5);
  --holo-scan: rgba(255, 255, 255, 0.035);
  --holo-glow: 0 0 0 1px var(--glass-line), 0 18px 60px rgba(0, 0, 0, 0.55);
  --holo-radius: 14px;
  --v2-blur: 14px;

  /* scene layer (overridden per scene below) */
  --scene-opacity: 0.58;
  --scene-dim: linear-gradient(180deg, rgba(4, 6, 10, 0.6) 0%, rgba(4, 6, 10, 0.8) 100%);
  --scene-image: none;
  --scene-fallback: radial-gradient(900px 600px at 50% 25%, rgba(232, 201, 135, 0.1), transparent 62%), linear-gradient(180deg, #0a0c10 0%, #05070a 100%);
  --scene-position: center 45%;
  --parallax-x: 0px;
  --parallax-y: 0px;
  --parallax-scale: 1.04;
}

/* body itself must stay transparent so the fixed scene layer is visible;
   the void base lives on <html>. */
html[data-ui="v2"],
html[data-ui="v2"] body {
  background-color: var(--void);
}
html[data-ui="v2"] body {
  background: transparent;
  color: var(--ink);
}

/* -----------------------------------------------------------------------------
   2. The scene layer — fixed, dimmed, behind everything, decorative
   -------------------------------------------------------------------------- */
html[data-ui="v2"] body::before {
  content: "";
  position: fixed;
  inset: -3%;
  z-index: -2;
  pointer-events: none;
  background-image: var(--scene-image), var(--scene-fallback);
  background-size: cover, cover;
  background-position: var(--scene-position), var(--scene-position);
  background-repeat: no-repeat, no-repeat;
  opacity: var(--scene-opacity);
  filter: saturate(0.72) brightness(0.66) contrast(1.02);
  transform: translate3d(var(--parallax-x), var(--parallax-y), 0) scale(var(--parallax-scale));
  will-change: transform;
  transition: transform 0.5s ease-out, opacity 0.9s ease-out;
}

html[data-ui="v2"] body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 38%, rgba(0, 0, 0, 0.5) 100%),
    var(--scene-dim),
    repeating-linear-gradient(0deg, var(--holo-scan) 0 1px, transparent 1px 3px);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  html[data-ui="v2"] body::before {
    transform: none !important;
    transition: none !important;
    will-change: auto;
  }
}

@media print {
  html[data-ui="v2"] body::before,
  html[data-ui="v2"] body::after {
    display: none !important;
  }
  html[data-ui="v2"] body {
    background: #ffffff;
    color: #111111;
  }
}

/* -----------------------------------------------------------------------------
   3. Per-scene backdrops (desktop crop + accent). Keys mirror templates/scenes.rs.
   -------------------------------------------------------------------------- */
html[data-ui="v2"] body[data-scene="gate"] {
  --scene-image: url("/static/scenes/gate-desktop.webp");
  --scene-fallback: radial-gradient(1200px 620px at 50% 18%, rgba(232,201,135,0.14), transparent 62%), radial-gradient(900px 500px at 82% 30%, rgba(143,201,191,0.10), transparent 60%), linear-gradient(180deg, #0b1016 0%, #070a0e 55%, #05070a 100%);
  --scene-opacity: 0.62;
  --scene-dim: linear-gradient(180deg, rgba(4,6,10,0.55) 0%, rgba(4,6,10,0.74) 55%, rgba(4,6,10,0.82) 100%);
  --scene-position: center 42%;
  --accent-2: #8fc9bf;
  --accent-2-soft: rgba(143,201,191,0.16);
  --parallax-max: 6px;
}

html[data-ui="v2"] body[data-scene="bazaar"] {
  --scene-image: url("/static/scenes/bazaar-desktop.webp");
  --scene-fallback: radial-gradient(900px 520px at 30% 20%, rgba(224,141,97,0.16), transparent 62%), radial-gradient(700px 420px at 80% 40%, rgba(232,201,135,0.10), transparent 60%), linear-gradient(180deg, #120d09 0%, #0b0805 60%, #070504 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(8,6,5,0.58) 0%, rgba(8,6,5,0.76) 60%, rgba(6,5,4,0.84) 100%);
  --scene-position: center 45%;
  --accent-2: #e08d61;
  --accent-2-soft: rgba(224,141,97,0.16);
  --parallax-max: 5px;
}

html[data-ui="v2"] body[data-scene="tree"] {
  --scene-image: url("/static/scenes/tree-desktop.webp");
  --scene-fallback: radial-gradient(820px 620px at 50% 8%, rgba(232,201,135,0.18), transparent 60%), radial-gradient(700px 460px at 20% 65%, rgba(126,166,138,0.10), transparent 62%), linear-gradient(180deg, #0b0f0c 0%, #080b09 55%, #050706 100%);
  --scene-opacity: 0.64;
  --scene-dim: linear-gradient(180deg, rgba(5,8,7,0.52) 0%, rgba(5,8,7,0.72) 60%, rgba(4,6,5,0.82) 100%);
  --scene-position: center 30%;
  --accent-2: #e8c987;
  --accent-2-soft: rgba(232,201,135,0.15);
  --parallax-max: 7px;
}

html[data-ui="v2"] body[data-scene="frames"] {
  --scene-image: url("/static/scenes/frames-desktop.webp");
  --scene-fallback: radial-gradient(900px 500px at 65% 20%, rgba(159,214,230,0.13), transparent 62%), radial-gradient(600px 400px at 25% 30%, rgba(232,201,135,0.08), transparent 60%), linear-gradient(180deg, #090d13 0%, #070a0f 60%, #05070a 100%);
  --scene-opacity: 0.58;
  --scene-dim: linear-gradient(180deg, rgba(5,7,10,0.55) 0%, rgba(5,7,10,0.74) 60%, rgba(4,5,8,0.84) 100%);
  --scene-position: center 40%;
  --accent-2: #9fd6e6;
  --accent-2-soft: rgba(159,214,230,0.14);
  --parallax-max: 5px;
}

html[data-ui="v2"] body[data-scene="gallery"] {
  --scene-image: url("/static/scenes/gallery-desktop.webp");
  --scene-fallback: radial-gradient(900px 520px at 50% 15%, rgba(195,166,216,0.12), transparent 62%), radial-gradient(700px 420px at 78% 55%, rgba(232,201,135,0.09), transparent 60%), linear-gradient(180deg, #0b0a0d 0%, #08070a 60%, #060506 100%);
  --scene-opacity: 0.56;
  --scene-dim: linear-gradient(180deg, rgba(7,6,8,0.55) 0%, rgba(7,6,8,0.75) 60%, rgba(5,5,6,0.85) 100%);
  --scene-position: center 45%;
  --accent-2: #c3a6d8;
  --accent-2-soft: rgba(195,166,216,0.14);
  --parallax-max: 4px;
}

html[data-ui="v2"] body[data-scene="cinema"] {
  --scene-image: url("/static/scenes/cinema-desktop.webp");
  --scene-fallback: radial-gradient(1000px 540px at 52% 12%, rgba(159,214,230,0.13), transparent 62%), radial-gradient(700px 400px at 30% 60%, rgba(230,194,143,0.10), transparent 60%), linear-gradient(180deg, #080b10 0%, #06080c 60%, #04060a 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(5,6,9,0.55) 0%, rgba(5,6,9,0.76) 60%, rgba(4,5,8,0.85) 100%);
  --scene-position: center 38%;
  --accent-2: #e6c28f;
  --accent-2-soft: rgba(230,194,143,0.15);
  --parallax-max: 6px;
}

html[data-ui="v2"] body[data-scene="nebula"] {
  --scene-image: url("/static/scenes/nebula-desktop.webp");
  --scene-fallback: radial-gradient(900px 620px at 45% 20%, rgba(169,184,255,0.16), transparent 62%), radial-gradient(760px 460px at 78% 55%, rgba(195,140,190,0.12), transparent 60%), linear-gradient(180deg, #080a14 0%, #060812 60%, #04050c 100%);
  --scene-opacity: 0.62;
  --scene-dim: linear-gradient(180deg, rgba(5,5,10,0.55) 0%, rgba(5,5,10,0.74) 60%, rgba(4,4,8,0.84) 100%);
  --scene-position: center 40%;
  --accent-2: #a9b8ff;
  --accent-2-soft: rgba(169,184,255,0.15);
  --parallax-max: 3px;
}

html[data-ui="v2"] body[data-scene="arcade"] {
  --scene-image: url("/static/scenes/arcade-desktop.webp");
  --scene-fallback: radial-gradient(980px 560px at 58% 22%, rgba(121,212,216,0.16), transparent 62%), radial-gradient(620px 420px at 22% 38%, rgba(168,120,190,0.12), transparent 60%), linear-gradient(180deg, #070a10 0%, #05080c 60%, #03060a 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(4,6,9,0.55) 0%, rgba(4,6,9,0.75) 60%, rgba(3,5,7,0.85) 100%);
  --scene-position: center 42%;
  --accent-2: #79d4d8;
  --accent-2-soft: rgba(121,212,216,0.15);
  --parallax-max: 7px;
}

html[data-ui="v2"] body[data-scene="forge"] {
  --scene-image: url("/static/scenes/forge-desktop.webp");
  --scene-fallback: radial-gradient(820px 520px at 30% 25%, rgba(224,141,97,0.16), transparent 62%), radial-gradient(700px 420px at 78% 50%, rgba(232,201,135,0.10), transparent 60%), linear-gradient(180deg, #100c08 0%, #0a0705 60%, #060403 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(8,6,4,0.55) 0%, rgba(8,6,4,0.76) 60%, rgba(6,4,3,0.86) 100%);
  --scene-position: center 45%;
  --accent-2: #e08d61;
  --accent-2-soft: rgba(224,141,97,0.16);
  --parallax-max: 4px;
}

html[data-ui="v2"] body[data-scene="planet"] {
  --scene-image: url("/static/scenes/planet-desktop.webp");
  --scene-fallback: radial-gradient(1000px 600px at 62% 18%, rgba(232,201,135,0.13), transparent 62%), radial-gradient(900px 520px at 20% 70%, rgba(159,180,200,0.12), transparent 62%), linear-gradient(180deg, #070a10 0%, #05080d 60%, #03060a 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(4,6,9,0.52) 0%, rgba(4,6,9,0.74) 60%, rgba(3,5,8,0.84) 100%);
  --scene-position: center 45%;
  --accent-2: #9fb4c8;
  --accent-2-soft: rgba(159,180,200,0.15);
  --parallax-max: 3px;
}

html[data-ui="v2"] body[data-scene="observatory"] {
  --scene-image: url("/static/scenes/observatory-desktop.webp");
  --scene-fallback: radial-gradient(900px 620px at 68% 16%, rgba(169,184,255,0.16), transparent 62%), radial-gradient(620px 400px at 26% 55%, rgba(255,255,255,0.06), transparent 60%), linear-gradient(180deg, #060812 0%, #05070e 60%, #04050a 100%);
  --scene-opacity: 0.58;
  --scene-dim: linear-gradient(180deg, rgba(4,5,9,0.52) 0%, rgba(4,5,9,0.74) 60%, rgba(3,4,7,0.84) 100%);
  --scene-position: center 42%;
  --accent-2: #a9b8ff;
  --accent-2-soft: rgba(169,184,255,0.14);
  --parallax-max: 2px;
}

html[data-ui="v2"] body[data-scene="agora"] {
  --scene-image: url("/static/scenes/agora-desktop.webp");
  --scene-fallback: radial-gradient(900px 520px at 42% 20%, rgba(216,160,106,0.15), transparent 62%), radial-gradient(760px 460px at 80% 60%, rgba(232,201,135,0.09), transparent 60%), linear-gradient(180deg, #100d09 0%, #0a0806 60%, #060504 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(7,6,5,0.55) 0%, rgba(7,6,5,0.75) 60%, rgba(5,4,3,0.85) 100%);
  --scene-position: center 45%;
  --accent-2: #d8a06a;
  --accent-2-soft: rgba(216,160,106,0.15);
  --parallax-max: 4px;
}

html[data-ui="v2"] body[data-scene="village"] {
  --scene-image: url("/static/scenes/village-desktop.webp");
  --scene-fallback: radial-gradient(880px 540px at 55% 25%, rgba(134,201,169,0.14), transparent 62%), radial-gradient(680px 420px at 25% 55%, rgba(232,201,135,0.09), transparent 60%), linear-gradient(180deg, #0a0f0c 0%, #070b09 60%, #050706 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(5,7,6,0.55) 0%, rgba(5,7,6,0.75) 60%, rgba(4,5,4,0.85) 100%);
  --scene-position: center 45%;
  --accent-2: #86c9a9;
  --accent-2-soft: rgba(134,201,169,0.15);
  --parallax-max: 5px;
}

html[data-ui="v2"] body[data-scene="spire"] {
  --scene-image: url("/static/scenes/spire-desktop.webp");
  --scene-fallback: radial-gradient(820px 560px at 60% 12%, rgba(143,166,187,0.14), transparent 62%), radial-gradient(700px 440px at 30% 62%, rgba(232,201,135,0.09), transparent 60%), linear-gradient(180deg, #090b0f 0%, #07090c 60%, #050609 100%);
  --scene-opacity: 0.58;
  --scene-dim: linear-gradient(180deg, rgba(5,6,8,0.55) 0%, rgba(5,6,8,0.76) 60%, rgba(4,5,6,0.86) 100%);
  --scene-position: center 40%;
  --accent-2: #8fa6bb;
  --accent-2-soft: rgba(143,166,187,0.15);
  --parallax-max: 3px;
}

html[data-ui="v2"] body[data-scene="studio"] {
  --scene-image: url("/static/scenes/studio-desktop.webp");
  --scene-fallback: radial-gradient(760px 520px at 62% 22%, rgba(232,201,135,0.16), transparent 62%), radial-gradient(700px 440px at 20% 60%, rgba(143,201,191,0.09), transparent 60%), linear-gradient(180deg, #0f0d0a 0%, #0a0806 60%, #060504 100%);
  --scene-opacity: 0.60;
  --scene-dim: linear-gradient(180deg, rgba(7,6,5,0.55) 0%, rgba(7,6,5,0.75) 60%, rgba(5,4,4,0.85) 100%);
  --scene-position: center 45%;
  --accent-2: #e8c987;
  --accent-2-soft: rgba(232,201,135,0.15);
  --parallax-max: 4px;
}

html[data-ui="v2"] body[data-scene="vault"] {
  --scene-image: url("/static/scenes/vault-desktop.webp");
  --scene-fallback: radial-gradient(820px 540px at 50% 25%, rgba(232,201,135,0.15), transparent 62%), radial-gradient(620px 400px at 25% 62%, rgba(159,214,184,0.11), transparent 60%), linear-gradient(180deg, #100e08 0%, #0b0905 60%, #070603 100%);
  --scene-opacity: 0.58;
  --scene-dim: linear-gradient(180deg, rgba(8,7,4,0.55) 0%, rgba(8,7,4,0.76) 60%, rgba(6,5,3,0.86) 100%);
  --scene-position: center 45%;
  --accent-2: #9fd6b8;
  --accent-2-soft: rgba(159,214,184,0.15);
  --parallax-max: 3px;
}

html[data-ui="v2"] body[data-scene="control"] {
  --scene-image: url("/static/scenes/control-desktop.webp");
  --scene-fallback: radial-gradient(920px 560px at 55% 20%, rgba(121,212,216,0.13), transparent 62%), radial-gradient(700px 440px at 24% 60%, rgba(232,201,135,0.10), transparent 60%), linear-gradient(180deg, #070b10 0%, #05080c 60%, #03060a 100%);
  --scene-opacity: 0.56;
  --scene-dim: linear-gradient(180deg, rgba(4,6,9,0.55) 0%, rgba(4,6,9,0.76) 60%, rgba(3,5,7,0.86) 100%);
  --scene-position: center 40%;
  --accent-2: #79d4d8;
  --accent-2-soft: rgba(121,212,216,0.15);
  --parallax-max: 2px;
}

html[data-ui="v2"] body[data-scene="doors"] {
  --scene-image: url("/static/scenes/doors-desktop.webp");
  --scene-fallback: radial-gradient(880px 560px at 50% 30%, rgba(232,201,135,0.13), transparent 62%), radial-gradient(700px 440px at 24% 60%, rgba(201,194,180,0.10), transparent 60%), linear-gradient(180deg, #0a0b0d 0%, #08080a 60%, #060607 100%);
  --scene-opacity: 0.56;
  --scene-dim: linear-gradient(180deg, rgba(6,7,8,0.55) 0%, rgba(6,7,8,0.76) 60%, rgba(5,5,6,0.86) 100%);
  --scene-position: center 45%;
  --accent-2: #c9c2b4;
  --accent-2-soft: rgba(201,194,180,0.13);
  --parallax-max: 4px;
}

html[data-ui="v2"] body[data-scene="default"] {
  --scene-image: url("/static/scenes/default-desktop.webp");
  --scene-fallback: radial-gradient(900px 600px at 50% 28%, rgba(232,201,135,0.10), transparent 62%), linear-gradient(180deg, #0a0c10 0%, #070a0e 60%, #05070a 100%);
  --scene-opacity: 0.48;
  --scene-dim: linear-gradient(180deg, rgba(4,6,10,0.62) 0%, rgba(4,6,10,0.80) 60%, rgba(3,5,8,0.88) 100%);
  --scene-position: center 50%;
  --accent-2: #e8c987;
  --accent-2-soft: rgba(232,201,135,0.12);
  --parallax-max: 2px;
}


/* Scene `tower` — software / technology (content-seed ART-02 extra key; used by
   the ART-24 dynamic project/creator themes for software/code/tech works). */
html[data-ui="v2"] body[data-scene="tower"] {
  --scene-image: url("/static/scenes/tower-desktop.webp");
  --scene-fallback: radial-gradient(900px 640px at 62% 12%, rgba(169,201,232,0.16), transparent 62%), radial-gradient(720px 420px at 28% 40%, rgba(214,120,190,0.10), transparent 60%), linear-gradient(180deg, #070b12 0%, #05090f 60%, #03060b 100%);
  --scene-opacity: 0.62;
  --scene-dim: linear-gradient(180deg, rgba(4,6,9,0.54) 0%, rgba(4,6,9,0.74) 60%, rgba(3,5,7,0.84) 100%);
  --scene-position: center 38%;
  --accent-2: #a9c9e8;
  --accent-2-soft: rgba(169,201,232,0.16);
  --parallax-max: 6px;
}

/* Phone crops: stronger focal point, slightly deeper dim, cheaper blur (ART-26). */
@media (max-width: 720px) {

  html[data-ui="v2"] body[data-scene="tower"] {
    --scene-image: url("/static/scenes/tower-phone.webp");
    --scene-position: center 30%;
  }
  html[data-ui="v2"] body[data-scene="gate"] {
    --scene-image: url("/static/scenes/gate-phone.webp");
    --scene-position: center 35%;
  }
  html[data-ui="v2"] body[data-scene="bazaar"] {
    --scene-image: url("/static/scenes/bazaar-phone.webp");
    --scene-position: center 55%;
  }
  html[data-ui="v2"] body[data-scene="tree"] {
    --scene-image: url("/static/scenes/tree-phone.webp");
    --scene-position: center 26%;
  }
  html[data-ui="v2"] body[data-scene="frames"] {
    --scene-image: url("/static/scenes/frames-phone.webp");
    --scene-position: center 50%;
  }
  html[data-ui="v2"] body[data-scene="gallery"] {
    --scene-image: url("/static/scenes/gallery-phone.webp");
    --scene-position: center 40%;
  }
  html[data-ui="v2"] body[data-scene="cinema"] {
    --scene-image: url("/static/scenes/cinema-phone.webp");
    --scene-position: center 32%;
  }
  html[data-ui="v2"] body[data-scene="nebula"] {
    --scene-image: url("/static/scenes/nebula-phone.webp");
    --scene-position: center 45%;
  }
  html[data-ui="v2"] body[data-scene="arcade"] {
    --scene-image: url("/static/scenes/arcade-phone.webp");
    --scene-position: center 48%;
  }
  html[data-ui="v2"] body[data-scene="forge"] {
    --scene-image: url("/static/scenes/forge-phone.webp");
    --scene-position: center 55%;
  }
  html[data-ui="v2"] body[data-scene="planet"] {
    --scene-image: url("/static/scenes/planet-phone.webp");
    --scene-position: center 30%;
  }
  html[data-ui="v2"] body[data-scene="observatory"] {
    --scene-image: url("/static/scenes/observatory-phone.webp");
    --scene-position: center 36%;
  }
  html[data-ui="v2"] body[data-scene="agora"] {
    --scene-image: url("/static/scenes/agora-phone.webp");
    --scene-position: center 52%;
  }
  html[data-ui="v2"] body[data-scene="village"] {
    --scene-image: url("/static/scenes/village-phone.webp");
    --scene-position: center 50%;
  }
  html[data-ui="v2"] body[data-scene="spire"] {
    --scene-image: url("/static/scenes/spire-phone.webp");
    --scene-position: center 32%;
  }
  html[data-ui="v2"] body[data-scene="studio"] {
    --scene-image: url("/static/scenes/studio-phone.webp");
    --scene-position: center 50%;
  }
  html[data-ui="v2"] body[data-scene="vault"] {
    --scene-image: url("/static/scenes/vault-phone.webp");
    --scene-position: center 50%;
  }
  html[data-ui="v2"] body[data-scene="control"] {
    --scene-image: url("/static/scenes/control-phone.webp");
    --scene-position: center 38%;
  }
  html[data-ui="v2"] body[data-scene="doors"] {
    --scene-image: url("/static/scenes/doors-phone.webp");
    --scene-position: center 50%;
  }
  html[data-ui="v2"] body[data-scene="default"] {
    --scene-image: url("/static/scenes/default-phone.webp");
    --scene-position: center 50%;
  }

  html[data-ui="v2"] {
    --v2-blur: 10px;
    --scene-opacity: 0.52;
  }
  html[data-ui="v2"] body::before {
    filter: saturate(0.68) brightness(0.7) contrast(1.0);
    inset: -1.5%;
  }
  /* More opaque panels on small screens keep text AA over busier crops. */
  html[data-ui="v2"] {
    --glass: rgba(13, 17, 22, 0.72);
    --glass-deep: rgba(9, 12, 16, 0.82);
    --surface: rgba(13, 17, 22, 0.72);
    --surface-2: rgba(17, 21, 27, 0.76);
  }
}

/* -----------------------------------------------------------------------------
   4. Light theme: same scene, low opacity + light scrim; never dark text on a
      dark scene (ART-25).
   -------------------------------------------------------------------------- */
html[data-ui="v2"][data-theme="light"] {
  color-scheme: light;

  --void: #f4eee2;
  --bg: var(--void);
  --bg-deep: #efe7d8;
  --body-bg: var(--void);
  --surface: rgba(255, 253, 247, 0.78);
  --surface-2: rgba(250, 246, 236, 0.84);
  --surface-3: rgba(243, 236, 222, 0.88);
  --surface-inset: rgba(241, 232, 214, 0.8);
  --header-bg: rgba(255, 253, 247, 0.82);

  --ink: #241d13;
  --ink-2: #4a3e2d;
  --ink-3: #5d503c;
  --ink-inverse: #fff9ec;

  --gold: #8f5f16;
  --gold-bright: #a8731f;
  --gold-deep: #6d470e;
  --gold-ghost: rgba(143, 95, 22, 0.1);
  --gold-line: rgba(143, 95, 22, 0.32);
  --glass: rgba(255, 253, 247, 0.78);
  --glass-deep: rgba(250, 246, 236, 0.86);
  --glass-line: rgba(143, 95, 22, 0.24);
  --glass-line-strong: rgba(143, 95, 22, 0.46);
  --holo-scan: rgba(36, 29, 19, 0.03);
  --line: rgba(143, 95, 22, 0.16);
  --line-strong: rgba(143, 95, 22, 0.3);
  --shadow: 0 16px 40px rgba(58, 42, 18, 0.18);
  --shadow-soft: 0 4px 14px rgba(58, 42, 18, 0.12);
  --focus: #7a4d08;
  --scene-opacity: 0.26;
  --scene-dim: linear-gradient(180deg, rgba(244, 238, 226, 0.82) 0%, rgba(244, 238, 226, 0.9) 100%);
}

html[data-ui="v2"][data-theme="light"] body::before {
  filter: saturate(0.55) brightness(1.12) contrast(0.96);
}

html[data-ui="v2"][data-theme="light"] body::after {
  background:
    radial-gradient(120% 90% at 50% 42%, transparent 42%, rgba(244, 238, 226, 0.55) 100%),
    var(--scene-dim);
  opacity: 1;
}

/* -----------------------------------------------------------------------------
   5. Material overrides — glass chrome, panels, cards, forms, tables, notices,
      buttons. Layout/geometry is inherited unchanged from app.css/hub.css/
      funding.css; only surface treatment is replaced.
   -------------------------------------------------------------------------- */

/* 5.1 Shell chrome ---------------------------------------------------------- */
html[data-ui="v2"] .site-header {
  background: linear-gradient(180deg, var(--glass-deep), rgba(8, 10, 14, 0.42));
  border-bottom: 1px solid var(--glass-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 40px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(var(--v2-blur)) saturate(1.06);
  backdrop-filter: blur(var(--v2-blur)) saturate(1.06);
}

html[data-ui="v2"] .hub-global-bar {
  background: linear-gradient(180deg, rgba(12, 15, 20, 0.66), rgba(8, 10, 14, 0.5));
  border-bottom: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(10px) saturate(1.04);
  backdrop-filter: blur(10px) saturate(1.04);
}

html[data-ui="v2"] .site-footer {
  background: linear-gradient(180deg, rgba(8, 10, 14, 0.5), rgba(5, 7, 10, 0.78));
  border-top: 1px solid var(--glass-line);
}

html[data-ui="v2"] .brand-name {
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}

/* 5.2 Panels / cards — projected glass panes ------------------------------- */
html[data-ui="v2"] .card,
html[data-ui="v2"] .work-card,
html[data-ui="v2"] .project-card,
html[data-ui="v2"] .hub-row,
html[data-ui="v2"] .hub-panel,
html[data-ui="v2"] .hub-rail,
html[data-ui="v2"] .stories-sidebar .filter-sidebar,
html[data-ui="v2"] .work-aside > *,
html[data-ui="v2"] .editor-section,
html[data-ui="v2"] .tag-kind-card,
html[data-ui="v2"] .auth-card,
html[data-ui="v2"] .error-card,
html[data-ui="v2"] .import-chapter-peek,
html[data-ui="v2"] .settings-grid > .card {
  position: relative;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0) 42%),
    var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--holo-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--holo-glow);
  -webkit-backdrop-filter: blur(var(--v2-blur)) saturate(1.05);
  backdrop-filter: blur(var(--v2-blur)) saturate(1.05);
}

html[data-ui="v2"] .card::before,
html[data-ui="v2"] .hub-row::before,
html[data-ui="v2"] .project-card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background-image: repeating-linear-gradient(0deg, var(--holo-scan) 0 1px, transparent 1px 3px);
  opacity: 0.7;
  mix-blend-mode: screen;
}

html[data-ui="v2"] .card:hover,
html[data-ui="v2"] .work-card:hover,
html[data-ui="v2"] .project-card:hover,
html[data-ui="v2"] .hub-row:hover {
  border-color: var(--glass-line-strong);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset,
    0 0 0 1px var(--accent-2-soft), 0 20px 60px rgba(0, 0, 0, 0.5);
}

/* 5.3 Rail / tabs / pills --------------------------------------------------- */
html[data-ui="v2"] .tabs {
  background: rgba(10, 13, 17, 0.5);
  border: 1px solid var(--glass-line);
  border-radius: 999px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

html[data-ui="v2"] .tab.active,
html[data-ui="v2"] .tab[aria-selected="true"] {
  background: var(--accent-2-soft);
  box-shadow: inset 0 0 0 1px var(--glass-line-strong);
  color: var(--ink);
}

html[data-ui="v2"] .pill {
  background: rgba(16, 20, 26, 0.5);
  border: 1px solid var(--glass-line);
  color: var(--ink-2);
}

html[data-ui="v2"] .pill:hover,
html[data-ui="v2"] .pill:focus-visible {
  border-color: var(--glass-line-strong);
  color: var(--ink);
  background: var(--gold-ghost);
}

html[data-ui="v2"] .pill-fandom {
  border-color: var(--gold-line);
  color: var(--gold-bright);
}

/* 5.4 Buttons — glass pills; primary adds gold fill + soft glow -------------- */
html[data-ui="v2"] .btn,
html[data-ui="v2"] button.btn,
html[data-ui="v2"] .action-button {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01)), var(--glass);
  border: 1px solid var(--glass-line);
  color: var(--ink);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}

html[data-ui="v2"] .btn:hover {
  border-color: var(--glass-line-strong);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.02)), var(--glass);
}

html[data-ui="v2"] .btn-primary {
  border-color: var(--gold-line);
  background: linear-gradient(180deg, var(--gold-ghost), rgba(232, 201, 135, 0.06)), rgba(20, 18, 12, 0.55);
  color: var(--gold-bright);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.1) inset, 0 0 24px rgba(232, 201, 135, 0.12);
}

html[data-ui="v2"] .btn-primary:hover {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 1px var(--gold-line), 0 0 30px rgba(232, 201, 135, 0.2);
}

html[data-ui="v2"] .btn-danger {
  border-color: rgba(240, 160, 148, 0.5);
  background: linear-gradient(180deg, rgba(240, 160, 148, 0.12), rgba(240, 160, 148, 0.03)), var(--glass);
  color: #f0b6ab;
}

/* 5.5 Forms — inset glass fields with luminous focus ------------------------ */
html[data-ui="v2"] input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="file"]),
html[data-ui="v2"] select,
html[data-ui="v2"] textarea {
  background: var(--surface-inset);
  border: 1px solid var(--glass-line);
  color: var(--ink);
  border-radius: 10px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03), 0 2px 10px rgba(0, 0, 0, 0.25) inset;
}

html[data-ui="v2"] input::placeholder,
html[data-ui="v2"] textarea::placeholder {
  color: var(--ink-3);
  opacity: 1;
}

html[data-ui="v2"] input:focus-visible,
html[data-ui="v2"] select:focus-visible,
html[data-ui="v2"] textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: var(--glass-line-strong);
  box-shadow: 0 0 0 3px var(--gold-ghost);
}

html[data-ui="v2"] .filter-legend,
html[data-ui="v2"] .field-label {
  color: var(--ink-2);
}

/* 5.6 Tables — glass sheet, luminous row rules ------------------------------ */
html[data-ui="v2"] .table,
html[data-ui="v2"] .studio-table,
html[data-ui="v2"] .table-compact {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--holo-radius);
  overflow: hidden;
}

html[data-ui="v2"] .table th,
html[data-ui="v2"] .studio-table th,
html[data-ui="v2"] .table-compact th {
  background: rgba(10, 13, 17, 0.6);
  color: var(--ink-3);
  border-bottom: 1px solid var(--glass-line);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

html[data-ui="v2"] .table td,
html[data-ui="v2"] .studio-table td,
html[data-ui="v2"] .table-compact td {
  border-bottom: 1px solid var(--line);
}

html[data-ui="v2"] .table tr:hover td,
html[data-ui="v2"] .studio-table tr:hover td {
  background: var(--accent-2-soft);
}

/* 5.7 Notices, flash/toast -------------------------------------------------- */
html[data-ui="v2"] .notice,
html[data-ui="v2"] .flash,
html[data-ui="v2"] .hub-notice,
html[data-ui="v2"] .form-error {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent), var(--glass-deep);
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--shadow-soft);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

html[data-ui="v2"] .notice-info { border-color: rgba(169, 199, 240, 0.4); }
html[data-ui="v2"] .notice-warn, html[data-ui="v2"] .notice-grace { border-color: rgba(236, 192, 106, 0.42); }
html[data-ui="v2"] .notice-error, html[data-ui="v2"] .notice-danger, html[data-ui="v2"] .form-error { border-color: rgba(240, 160, 148, 0.45); }
html[data-ui="v2"] .flash-success { border-color: rgba(143, 211, 154, 0.45); }
html[data-ui="v2"] .flash-error { border-color: rgba(240, 160, 148, 0.45); }
html[data-ui="v2"] .flash-info { border-color: rgba(169, 199, 240, 0.4); }

/* 5.8 Details/summary disclosures and small menus --------------------------- */
html[data-ui="v2"] .download-box,
html[data-ui="v2"] .share-box,
html[data-ui="v2"] .mirror-list,
html[data-ui="v2"] .hub-compact-menu nav,
html[data-ui="v2"] .work-tags-block,
html[data-ui="v2"] .tag-summary {
  background: rgba(12, 15, 20, 0.5);
  border: 1px solid var(--glass-line);
  border-radius: 12px;
}

html[data-ui="v2"] details > summary {
  color: var(--ink-2);
}

html[data-ui="v2"] details[open] > summary {
  color: var(--gold);
}

/* 5.9 Links / focus / selection -------------------------------------------- */
html[data-ui="v2"] a {
  color: var(--gold);
}

html[data-ui="v2"] a:hover {
  color: var(--gold-bright);
}

html[data-ui="v2"] ::selection {
  background: var(--accent-2-soft);
  color: var(--ink);
}

html[data-ui="v2"] :focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* 5.10 Micro-typography: holographic labels (not body copy) ----------------- */
html[data-ui="v2"] .filter-legend,
html[data-ui="v2"] .card-stat,
html[data-ui="v2"] .stat dt,
html[data-ui="v2"] .hub-eyebrow,
html[data-ui="v2"] .work-meta {
  letter-spacing: 0.03em;
}

html[data-ui="v2"] .hub-eyebrow,
html[data-ui="v2"] .filter-legend {
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-3);
}

/* 5.11 Project/funding pages: keep the composition, relight the surfaces ---- */
html[data-ui="v2"] .project-hero,
html[data-ui="v2"] .project-header,
html[data-ui="v2"] .funding-summary,
html[data-ui="v2"] .funding-panel,
html[data-ui="v2"] .ladder,
html[data-ui="v2"] .milestone-list > li,
html[data-ui="v2"] .milestone,
html[data-ui="v2"] .pledge-form,
html[data-ui="v2"] .build-summary,
html[data-ui="v2"] .project-card,
html[data-ui="v2"] .project-meta {
  border-color: var(--glass-line);
}

html[data-ui="v2"] .funding-summary,
html[data-ui="v2"] .funding-panel,
html[data-ui="v2"] .ladder,
html[data-ui="v2"] .pledge-form {
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.045), transparent 46%), var(--glass);
  border-radius: var(--holo-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--holo-glow);
  -webkit-backdrop-filter: blur(var(--v2-blur)) saturate(1.04);
  backdrop-filter: blur(var(--v2-blur)) saturate(1.04);
}

/* 5.12 Loading / empty states ---------------------------------------------- */
html[data-ui="v2"] .hub-empty,
html[data-ui="v2"] .empty-state {
  background: rgba(12, 15, 20, 0.42);
  border: 1px dashed var(--glass-line);
  border-radius: var(--holo-radius);
}

/* 5.13 Scrollbars stay consistent with the dark holo surface ---------------- */
html[data-ui="v2"] * {
  scrollbar-color: var(--line-strong) transparent;
}

/* -----------------------------------------------------------------------------
   6. Graceful degradation when backdrop-filter is unavailable (ART-28)
   -------------------------------------------------------------------------- */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  html[data-ui="v2"] {
    --glass: rgba(12, 15, 20, 0.88);
    --glass-deep: rgba(8, 10, 14, 0.94);
    --surface: rgba(12, 15, 20, 0.88);
    --surface-2: rgba(16, 19, 24, 0.9);
    --surface-3: rgba(20, 24, 30, 0.9);
    --header-bg: rgba(8, 10, 14, 0.95);
  }
  html[data-ui="v2"] body::before {
    filter: saturate(0.7) brightness(0.6);
  }
}

/* AA contrast guard: never allow translucent glass lighter than the floor the
   tokens were tested against (scenes stay dimmed; only the overlay is raised). */
@media (prefers-contrast: more) {
  html[data-ui="v2"] {
    --glass: rgba(10, 13, 17, 0.86);
    --glass-deep: rgba(7, 9, 12, 0.94);
    --surface: rgba(10, 13, 17, 0.86);
    --scene-opacity: 0.4;
  }
  html[data-ui="v2"] .card::before { display: none; }
}

/* Forced-colors / high-contrast OS mode: drop decorative texture, keep borders. */
@media (forced-colors: active) {
  html[data-ui="v2"] body::before,
  html[data-ui="v2"] body::after,
  html[data-ui="v2"] .card::before {
    display: none !important;
  }
}


/* -----------------------------------------------------------------------------
   7. Hub shell (`templates/hub.rs`) — the one-shell discovery surface uses its
      own document but the same hologram material language. Geometry from hub.css
      is preserved; only surfaces/borders/backdrop change (ART-03/04).
   -------------------------------------------------------------------------- */

/* The hub shell paints its own opaque body background; under v2 the fixed scene
   layer must show through, so the body goes transparent (void stays on <html>). */
html[data-ui="v2"] body.hub-body {
  background: transparent;
  color: var(--ink);
}

html[data-ui="v2"] .hub-topbar {
  background: linear-gradient(180deg, var(--glass-deep), rgba(8, 10, 14, 0.46));
  border-bottom: 1px solid var(--glass-line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 40px rgba(0, 0, 0, 0.35);
  -webkit-backdrop-filter: blur(var(--v2-blur)) saturate(1.06);
  backdrop-filter: blur(var(--v2-blur)) saturate(1.06);
}

html[data-ui="v2"] .hub-rail {
  background: linear-gradient(180deg, rgba(12, 15, 20, 0.62), rgba(8, 10, 14, 0.5));
  border: 1px solid var(--glass-line);
  border-radius: var(--holo-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, var(--shadow-soft);
  -webkit-backdrop-filter: blur(12px) saturate(1.04);
  backdrop-filter: blur(12px) saturate(1.04);
}

html[data-ui="v2"] .rail-link,
html[data-ui="v2"] .hub-rail a {
  color: var(--ink-2);
}

html[data-ui="v2"] .rail-link:hover,
html[data-ui="v2"] .hub-rail a:hover {
  background: var(--gold-ghost);
  color: var(--ink);
}

html[data-ui="v2"] .hub-hotbar,
html[data-ui="v2"] .hub-filterbar,
html[data-ui="v2"] .hub-sortbar,
html[data-ui="v2"] .hub-bottom-tabs nav {
  background: linear-gradient(180deg, rgba(14, 17, 22, 0.62), rgba(9, 11, 15, 0.5));
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(10px) saturate(1.04);
  backdrop-filter: blur(10px) saturate(1.04);
}

html[data-ui="v2"] .hub-panel,
html[data-ui="v2"] .hub-content,
html[data-ui="v2"] .hub-main-column > .card,
html[data-ui="v2"] .facet-panel,
html[data-ui="v2"] .hub-notice {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 42%),
    var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--holo-radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.06) inset, var(--holo-glow);
  -webkit-backdrop-filter: blur(var(--v2-blur)) saturate(1.05);
  backdrop-filter: blur(var(--v2-blur)) saturate(1.05);
}

html[data-ui="v2"] .hub-row {
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0) 46%),
    var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 12px;
  -webkit-backdrop-filter: blur(10px) saturate(1.03);
  backdrop-filter: blur(10px) saturate(1.03);
}

html[data-ui="v2"] .preset-chip,
html[data-ui="v2"] .medium-chip,
html[data-ui="v2"] .tag-chip {
  background: rgba(16, 20, 26, 0.5);
  border: 1px solid var(--glass-line);
  color: var(--ink-2);
}

html[data-ui="v2"] .preset-chip.active,
html[data-ui="v2"] .medium-chip.active,
html[data-ui="v2"] .tag-chip.active {
  background: var(--accent-2-soft);
  border-color: var(--glass-line-strong);
  color: var(--ink);
}

html[data-ui="v2"] .hub-search input[type="search"],
html[data-ui="v2"] .hub-command input {
  background: var(--surface-inset);
  border: 1px solid var(--glass-line);
  color: var(--ink);
}

html[data-ui="v2"] .hub-compact-menu nav {
  background: var(--glass-deep);
  border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(14px) saturate(1.05);
  backdrop-filter: blur(14px) saturate(1.05);
}

html[data-ui="v2"] .hub-compact-menu summary {
  background: rgba(16, 20, 26, 0.5);
  border: 1px solid var(--glass-line);
  color: var(--ink);
}

@media (max-width: 720px) {
  html[data-ui="v2"] .hub-rail,
  html[data-ui="v2"] .hub-hotbar,
  html[data-ui="v2"] .hub-filterbar,
  html[data-ui="v2"] .hub-sortbar {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(10, 13, 17, 0.82);
  }
}
