/* ==========================================================================
   hero3d.css — 3D-Klangraum hinter dem Startbereich der Gast-Startseite
   ==========================================================================
   Nutzer 2026-10-19 (Vorbild getartcraft.com, eigene Umsetzung): „Der
   hintergrund soll mehr 3d sein und beim teaser reinkommen mit übergang“.
   Nur app.html im Gast-Zweig lädt diese Datei, NACH css/teaser.css.
   Alle Werte aus tokens.css; eigene Größen stehen als --hero3d-* oben.

   Aufbau von #lock-section (.has-hero3d):
     .lock-inner   Startbereich, z-index 1, liegt über der Szene
     .hero3d       Hülle der Szene (#hero3d, aria-hidden), absolut ab dem
                   Abschnittsanfang. Höhe setzt das Skript: im Betrieb
                   Startbereich + Szene 1 des Teasers + eine Bildschirmhöhe,
                   statisch genau der Startbereich.
       .hero3d-stage    klebt (sticky) im Bild, solange die Hülle reicht
         .hero3d-poster statisches Bild: Horizontlicht, Bodenraster,
                        Spektrum-Silhouette (Fallback ohne JS/WebGL und bei
                        reduzierter Bewegung)
         canvas         die WebGL-Szene (hero3d-scene.js), blendet ein
         .hero3d-scrim  Abdunklung hinter dem Text für den Kontrast
     .nct-scroll   der Teaser, z-index 1, durchsichtig über der Szene

   Kein position: fixed und keine negativen Ränder: die Hülle endet mit
   ihrer Höhe, „Nach oben“ und die Fußzeile bleiben frei (siehe teaser.css).
   ========================================================================== */
.lock-screen.has-hero3d {
  --hero3d-horizon: 34%;            /* Lage des Horizonts im Bild (Poster) */
  --hero3d-title: clamp(2.5rem, 1.4rem + 4.2vw, 4.75rem);
  --hero3d-scrim: color-mix(in srgb, var(--bg) 74%, transparent);
  position: relative;
  isolation: isolate;
}

.lock-screen.has-hero3d > .lock-inner,
.lock-screen.has-hero3d > .nct-scroll {
  position: relative;
  z-index: 1;
}
.lock-screen.has-hero3d > .teaser-autoscroll { z-index: 3; }

.hero3d {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 100%;                     /* ohne JS: Abschnitt = Startbereich */
  z-index: 0;
  pointer-events: none;
}
html:not(.no-js) .hero3d { height: 100vh; height: 100svh; }

.hero3d-stage {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  contain: strict;
}
.hero3d:is([data-state="static"], [data-state="failed"]) .hero3d-stage {
  position: absolute;
  inset: 0;
  height: auto;
}

.hero3d-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}
.hero3d[data-state="live"] .hero3d-canvas { opacity: 1; }

/* Abdunklung hinter Überschrift und Einleitung: hält den Text bei jeder
   Lage der Säulen über 7:1 (Einleitung --text-secondary). */
.hero3d-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 46% 40% at 50% 34%, var(--hero3d-scrim) 0%, color-mix(in srgb, var(--bg) 50%, transparent) 55%, transparent 100%),
    linear-gradient(to bottom, color-mix(in srgb, var(--bg) 35%, transparent), transparent 22%, transparent 78%, color-mix(in srgb, var(--bg) 60%, transparent));
}

/* ---- Statisches Bild ------------------------------------------------------ */
.hero3d-poster {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 34% 16% at 50% var(--hero3d-horizon), color-mix(in srgb, var(--tone-5) 22%, transparent), transparent 70%),
    radial-gradient(ellipse 80% 38% at 50% calc(var(--hero3d-horizon) + 4%), color-mix(in srgb, var(--tone-1) 20%, transparent), transparent 72%),
    radial-gradient(ellipse 120% 60% at 50% 110%, color-mix(in srgb, var(--tone-3) 10%, transparent), transparent 70%);
}
/* Boden: Raster in Perspektive, läuft zum Horizont aus. */
.hero3d-poster::before {
  content: "";
  position: absolute;
  left: -60%;
  right: -60%;
  top: var(--hero3d-horizon);
  height: 140%;
  transform-origin: 50% 0;
  transform: perspective(420px) rotateX(66deg);
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--tone-2) 34%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--tone-2) 26%, transparent) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 60%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, #000 18%, #000 60%, transparent 100%);
}
/* Spektrum-Silhouette am Horizont: Pegel in der Tonleiter, Gasse in der
   Mitte frei, nach oben ausgeblendet. Form aus einer SVG-Maske (inline,
   keine fremde Quelle). */
.hero3d-poster::after {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: calc(100% - var(--hero3d-horizon) - 2px);
  height: clamp(50px, 11vh, 110px);
  background: linear-gradient(to top, color-mix(in srgb, var(--tone-4) 70%, transparent), color-mix(in srgb, var(--tone-1) 45%, transparent));
  opacity: 0.38;
  -webkit-mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'><rect x='182.0' y='39.3' width='4' height='60.7' rx='1'/><rect x='175.4' y='33.4' width='4' height='66.6' rx='1'/><rect x='168.8' y='36.7' width='4' height='63.3' rx='1'/><rect x='162.2' y='50.8' width='4' height='49.2' rx='1'/><rect x='155.6' y='54.0' width='4' height='46.0' rx='1'/><rect x='149.0' y='63.4' width='4' height='36.6' rx='1'/><rect x='142.4' y='33.8' width='4' height='66.2' rx='1'/><rect x='135.8' y='61.7' width='4' height='38.3' rx='1'/><rect x='129.2' y='25.1' width='4' height='74.9' rx='1'/><rect x='122.6' y='48.7' width='4' height='51.3' rx='1'/><rect x='116.0' y='57.0' width='4' height='43.0' rx='1'/><rect x='109.4' y='52.4' width='4' height='47.6' rx='1'/><rect x='102.8' y='74.3' width='4' height='25.7' rx='1'/><rect x='96.2' y='48.4' width='4' height='51.6' rx='1'/><rect x='89.6' y='62.2' width='4' height='37.8' rx='1'/><rect x='83.0' y='65.5' width='4' height='34.5' rx='1'/><rect x='76.4' y='77.7' width='4' height='22.3' rx='1'/><rect x='69.8' y='82.5' width='4' height='17.5' rx='1'/><rect x='63.2' y='73.5' width='4' height='26.5' rx='1'/><rect x='56.6' y='78.2' width='4' height='21.8' rx='1'/><rect x='50.0' y='82.8' width='4' height='17.2' rx='1'/><rect x='43.4' y='78.5' width='4' height='21.5' rx='1'/><rect x='36.8' y='86.4' width='4' height='13.6' rx='1'/><rect x='30.2' y='84.7' width='4' height='15.3' rx='1'/><rect x='23.6' y='86.8' width='4' height='13.2' rx='1'/><rect x='17.0' y='86.4' width='4' height='13.6' rx='1'/><rect x='10.4' y='90.0' width='4' height='10.0' rx='1'/><rect x='3.8' y='92.5' width='4' height='7.5' rx='1'/><rect x='214.0' y='44.4' width='4' height='55.6' rx='1'/><rect x='220.6' y='23.7' width='4' height='76.3' rx='1'/><rect x='227.2' y='27.0' width='4' height='73.0' rx='1'/><rect x='233.8' y='30.3' width='4' height='69.7' rx='1'/><rect x='240.4' y='38.3' width='4' height='61.7' rx='1'/><rect x='247.0' y='19.7' width='4' height='80.3' rx='1'/><rect x='253.6' y='37.6' width='4' height='62.4' rx='1'/><rect x='260.2' y='46.7' width='4' height='53.3' rx='1'/><rect x='266.8' y='23.0' width='4' height='77.0' rx='1'/><rect x='273.4' y='47.9' width='4' height='52.1' rx='1'/><rect x='280.0' y='43.8' width='4' height='56.2' rx='1'/><rect x='286.6' y='61.0' width='4' height='39.0' rx='1'/><rect x='293.2' y='73.9' width='4' height='26.1' rx='1'/><rect x='299.8' y='54.1' width='4' height='45.9' rx='1'/><rect x='306.4' y='74.0' width='4' height='26.0' rx='1'/><rect x='313.0' y='54.4' width='4' height='45.6' rx='1'/><rect x='319.6' y='74.1' width='4' height='25.9' rx='1'/><rect x='326.2' y='62.2' width='4' height='37.8' rx='1'/><rect x='332.8' y='64.5' width='4' height='35.5' rx='1'/><rect x='339.4' y='80.9' width='4' height='19.1' rx='1'/><rect x='346.0' y='77.5' width='4' height='22.5' rx='1'/><rect x='352.6' y='81.3' width='4' height='18.7' rx='1'/><rect x='359.2' y='89.0' width='4' height='11.0' rx='1'/><rect x='365.8' y='88.6' width='4' height='11.4' rx='1'/><rect x='372.4' y='87.9' width='4' height='12.1' rx='1'/><rect x='379.0' y='92.5' width='4' height='7.5' rx='1'/><rect x='385.6' y='90.5' width='4' height='9.5' rx='1'/><rect x='392.2' y='87.2' width='4' height='12.8' rx='1'/></svg>") center bottom / 100% 100% no-repeat;
  mask: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 400 100' preserveAspectRatio='none'><rect x='182.0' y='39.3' width='4' height='60.7' rx='1'/><rect x='175.4' y='33.4' width='4' height='66.6' rx='1'/><rect x='168.8' y='36.7' width='4' height='63.3' rx='1'/><rect x='162.2' y='50.8' width='4' height='49.2' rx='1'/><rect x='155.6' y='54.0' width='4' height='46.0' rx='1'/><rect x='149.0' y='63.4' width='4' height='36.6' rx='1'/><rect x='142.4' y='33.8' width='4' height='66.2' rx='1'/><rect x='135.8' y='61.7' width='4' height='38.3' rx='1'/><rect x='129.2' y='25.1' width='4' height='74.9' rx='1'/><rect x='122.6' y='48.7' width='4' height='51.3' rx='1'/><rect x='116.0' y='57.0' width='4' height='43.0' rx='1'/><rect x='109.4' y='52.4' width='4' height='47.6' rx='1'/><rect x='102.8' y='74.3' width='4' height='25.7' rx='1'/><rect x='96.2' y='48.4' width='4' height='51.6' rx='1'/><rect x='89.6' y='62.2' width='4' height='37.8' rx='1'/><rect x='83.0' y='65.5' width='4' height='34.5' rx='1'/><rect x='76.4' y='77.7' width='4' height='22.3' rx='1'/><rect x='69.8' y='82.5' width='4' height='17.5' rx='1'/><rect x='63.2' y='73.5' width='4' height='26.5' rx='1'/><rect x='56.6' y='78.2' width='4' height='21.8' rx='1'/><rect x='50.0' y='82.8' width='4' height='17.2' rx='1'/><rect x='43.4' y='78.5' width='4' height='21.5' rx='1'/><rect x='36.8' y='86.4' width='4' height='13.6' rx='1'/><rect x='30.2' y='84.7' width='4' height='15.3' rx='1'/><rect x='23.6' y='86.8' width='4' height='13.2' rx='1'/><rect x='17.0' y='86.4' width='4' height='13.6' rx='1'/><rect x='10.4' y='90.0' width='4' height='10.0' rx='1'/><rect x='3.8' y='92.5' width='4' height='7.5' rx='1'/><rect x='214.0' y='44.4' width='4' height='55.6' rx='1'/><rect x='220.6' y='23.7' width='4' height='76.3' rx='1'/><rect x='227.2' y='27.0' width='4' height='73.0' rx='1'/><rect x='233.8' y='30.3' width='4' height='69.7' rx='1'/><rect x='240.4' y='38.3' width='4' height='61.7' rx='1'/><rect x='247.0' y='19.7' width='4' height='80.3' rx='1'/><rect x='253.6' y='37.6' width='4' height='62.4' rx='1'/><rect x='260.2' y='46.7' width='4' height='53.3' rx='1'/><rect x='266.8' y='23.0' width='4' height='77.0' rx='1'/><rect x='273.4' y='47.9' width='4' height='52.1' rx='1'/><rect x='280.0' y='43.8' width='4' height='56.2' rx='1'/><rect x='286.6' y='61.0' width='4' height='39.0' rx='1'/><rect x='293.2' y='73.9' width='4' height='26.1' rx='1'/><rect x='299.8' y='54.1' width='4' height='45.9' rx='1'/><rect x='306.4' y='74.0' width='4' height='26.0' rx='1'/><rect x='313.0' y='54.4' width='4' height='45.6' rx='1'/><rect x='319.6' y='74.1' width='4' height='25.9' rx='1'/><rect x='326.2' y='62.2' width='4' height='37.8' rx='1'/><rect x='332.8' y='64.5' width='4' height='35.5' rx='1'/><rect x='339.4' y='80.9' width='4' height='19.1' rx='1'/><rect x='346.0' y='77.5' width='4' height='22.5' rx='1'/><rect x='352.6' y='81.3' width='4' height='18.7' rx='1'/><rect x='359.2' y='89.0' width='4' height='11.0' rx='1'/><rect x='365.8' y='88.6' width='4' height='11.4' rx='1'/><rect x='372.4' y='87.9' width='4' height='12.1' rx='1'/><rect x='379.0' y='92.5' width='4' height='7.5' rx='1'/><rect x='385.6' y='90.5' width='4' height='9.5' rx='1'/><rect x='392.2' y='87.2' width='4' height='12.8' rx='1'/></svg>") center bottom / 100% 100% no-repeat;
}
/* Läuft die Szene, tritt das Poster zurück: Boden, Pegel und Licht zeichnet
   WebGL, die Ferne läuft in --bg aus. Ein helleres Horizontlicht dahinter
   ließe die fernen Säulen als dunkle Kante stehen. */
.hero3d-poster { transition: opacity 1.2s var(--ease); }
.hero3d[data-state="live"] .hero3d-poster { opacity: 0; }

/* ---- Startbereich über der Szene ----------------------------------------- */
.lock-screen.has-hero3d .lock-inner {
  max-width: calc(880px + 2 * var(--page-pad-x));
}
.lock-screen.has-hero3d .lock-title {
  font-size: var(--hero3d-title);
  line-height: 1.02;
  letter-spacing: -0.03em;
  max-width: 13ch;
}
.lock-screen.has-hero3d .lock-lead { max-width: 34em; }

/* Örtliche Abdunklung direkt hinter Slogan und Einleitung (zusätzlich zur
   großen in .hero3d-scrim, die an der Bildmitte hängt): sie wandert mit dem
   Text, egal wie hoch der Startbereich auf dem Gerät ist. z-index -1 liegt
   im Stapelkontext von .lock-inner, also über der Szene, unter dem Text. */
.lock-screen.has-hero3d :is(.lock-claim, .lock-lead) { position: relative; }
.lock-screen.has-hero3d :is(.lock-claim, .lock-lead)::before {
  content: "";
  position: absolute;
  inset: calc(var(--space-6) * -1) calc(var(--space-12) * -1);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--bg) 90%, transparent) 0%, color-mix(in srgb, var(--bg) 82%, transparent) 62%, transparent 100%);
}

/* Während der Kamerafahrt hebt sich der Text und blendet aus (--hero-p
   setzt hero3d-scene.js, 0 oben … 1 am Teaser-Anfang). Nur wenn die Szene
   läuft und Bewegung erwünscht ist; sonst steht der Text normal. */
@media (prefers-reduced-motion: no-preference) {
  .lock-screen.hero3d-live > .lock-inner {
    opacity: clamp(0, calc(1.35 - var(--hero-p, 0) * 1.5), 1);
    transform: translateY(calc(var(--hero-p, 0) * -56px)) scale(calc(1 - var(--hero-p, 0) * 0.035));
    transform-origin: 50% 25%;
  }
}

@media (max-width: 759.98px) {
  .lock-screen.has-hero3d { --hero3d-horizon: 30%; }
  .lock-screen.has-hero3d .lock-title { max-width: 11ch; }
  .hero3d-poster::before { background-size: 34px 34px; }
}

/* Weniger Transparenz / mehr Kontrast: keine Szene, kein Bild, nur der
   ruhige Grund (wie das Kachelraster, style.css). */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
  .hero3d { display: none; }
}

/* „Teaser ansehen“ steht über der leuchtenden Spur: Kreis deckend, Text mit
   weichem Schatten im Grundton, damit beides über jeder Lage lesbar bleibt. */
.lock-screen.has-hero3d .lock-more { position: relative; text-shadow: 0 0 10px var(--bg), 0 0 3px var(--bg); }
.lock-screen.has-hero3d .lock-more::before {
  content: "";
  position: absolute;
  inset: calc(var(--space-4) * -1) calc(var(--space-8) * -1);
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--bg) 92%, transparent) 0%, color-mix(in srgb, var(--bg) 85%, transparent) 60%, transparent 100%);
}
.lock-screen.has-hero3d .lock-more svg { background: color-mix(in srgb, var(--panel-elevated) 92%, transparent); }
.lock-screen.has-hero3d .lock-more:hover svg { background: var(--surface-3); }

/* Sekundärknöpfe sind sonst halbdurchsichtig (--fill-2). Über bewegten,
   leuchtenden Säulen schwankte damit ihr Kontrast; hier deckend in den
   gleichen Tönen wie Menüs (--panel-elevated, beim Überfahren --surface-3).
   Weiß darauf 15,5:1 bzw. 14:1. */
.lock-screen.has-hero3d .btn-secondary { background: var(--panel-elevated); }
.lock-screen.has-hero3d .btn-secondary:hover { background: var(--surface-3); }
