/* ═══════════════════════════════════════════════════════
   3D Page Overlay UI
   ═══════════════════════════════════════════════════════ */

.page-3d {
  background: #000;
  overflow: hidden;
  height: 100vh;
  /* iOS Safari: dynamische Viewport-Höhe (URL-Bar) */
  height: 100dvh;
  overscroll-behavior: none;
}
html, body { overscroll-behavior: none; }

.nav--solid {
  background: rgba(8, 9, 11, 0.88);
  backdrop-filter: blur(18px) saturate(180%);
  -webkit-backdrop-filter: blur(18px) saturate(180%);
  border-bottom: 1px solid rgba(244, 241, 234, 0.18);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  z-index: 50;
}
.nav--solid .nav__links a { color: rgba(244, 241, 234, 0.85); }
.nav--solid .nav__links a:hover { color: #fff; }
.nav--solid .nav__cta {
  color: var(--ink);
  border-color: rgba(244, 241, 234, 0.3);
  background: rgba(244, 241, 234, 0.06);
}
.nav--solid .nav__cta:hover {
  background: var(--accent);
  border-color: var(--accent);
}
.nav--solid .nav__logo-mark { color: var(--ink); }
.nav--solid .nav__logo-sub  { color: rgba(244, 241, 234, 0.55); }

.scene-root {
  position: fixed;
  inset: 0;
  overflow: hidden;
}
#three-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  touch-action: none;
}

/* ─── LOADER ───────────────────────────── */
.scene-loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: linear-gradient(180deg, #0d0e10, #1a1612);
  z-index: 30;
  transition: opacity 0.8s var(--ease), visibility 0s linear 0.8s;
}
.scene-loader.is-done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.scene-loader__pct {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 300;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-feature-settings: "tnum";
  margin-bottom: 16px;
  background: linear-gradient(180deg, var(--ink) 0%, var(--ink-soft) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: opacity 0.3s var(--ease);
}
.scene-loader__bar {
  width: 280px;
  height: 2px;
  background: var(--line);
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
  border-radius: 1px;
}
.scene-loader__bar span {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-2) 100%);
  width: 0%;
  border-radius: 1px;
  transition: width 0.3s var(--ease);
  box-shadow: 0 0 14px rgba(212, 69, 43, 0.5);
}
/* Pre-load indeterminate state (before any progress events) */
.scene-loader.is-indeterminate .scene-loader__bar span {
  width: 30%;
  animation: loadSweep 1.4s ease-in-out infinite;
}
@keyframes loadSweep {
  0%   { left: -30%; }
  100% { left: 100%; }
}
.scene-loader__text {
  font-size: 11px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 8px;
}
.scene-loader__sub {
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-mute);
}

/* ─── TITLE OVERLAY ───────────────────────────── */
.scene-title {
  position: absolute;
  top: 110px;
  left: var(--gutter);
  max-width: 480px;
  z-index: 10;
  pointer-events: none;
  opacity: 0;
  transform: translateY(20px);
  animation: fadeUp 1s var(--ease) 0.6s forwards;
  transition: color 0.6s var(--ease);
}
.scene-title h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: 18px;
  transition: color 0.6s var(--ease), text-shadow 0.6s var(--ease);
}
.scene-title h1 em {
  font-style: italic;
  transition: color 0.6s var(--ease);
}
.scene-title__hint {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 14px;
  transition: color 0.6s var(--ease), text-shadow 0.6s var(--ease);
}
.scene-title .eyebrow {
  transition: color 0.6s var(--ease), text-shadow 0.6s var(--ease);
}

/* TAG-MODUS: dunkler Text auf hellem Himmel */
body.is-day .scene-title h1 {
  color: #1a1814;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 20px rgba(255, 255, 255, 0.4);
}
body.is-day .scene-title h1 em {
  color: var(--accent);
}
body.is-day .scene-title__hint {
  color: rgba(26, 24, 20, 0.7);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
}
body.is-day .scene-title .eyebrow {
  color: var(--accent);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
}

/* NACHT-MODUS: heller Text auf dunklem Himmel */
body.is-night .scene-title h1 {
  color: var(--ink);
  text-shadow: 0 4px 30px rgba(0, 0, 0, 0.7);
}
body.is-night .scene-title h1 em {
  color: var(--accent-2);
}
body.is-night .scene-title__hint {
  color: var(--ink-soft);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}
body.is-night .scene-title .eyebrow {
  color: var(--accent-2);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* ─── TOOLBAR ───────────────────────────── */
.scene-toolbar {
  position: absolute;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 12px;
  z-index: 10;
  opacity: 0;
  animation: fadeUp 1s var(--ease) 1s forwards;
}
.scene-toolbar__group {
  display: flex;
  gap: 4px;
  background: rgba(13,14,16,0.7);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px;
}
.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  transition: all 0.25s var(--ease);
  white-space: nowrap;
}
.tool-btn:hover { color: var(--ink); background: rgba(244,241,234,0.06); }
.tool-btn.is-active {
  background: var(--ink);
  color: var(--bg);
}
.tool-btn.is-active svg { stroke: var(--bg); }
.tool-btn svg { flex-shrink: 0; }

@media (max-width: 720px) {
  .scene-toolbar {
    flex-direction: column;
    align-items: center;
    bottom: max(14px, env(safe-area-inset-bottom));
    gap: 8px;
    width: calc(100% - 24px);
    max-width: 460px;
  }
  .scene-toolbar__group {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }
  .tool-btn {
    padding: 10px 12px;
    font-size: 11.5px;
    flex: 1 1 auto;
    justify-content: center;
    min-height: 38px;       /* iOS-Touch-Mindestgröße */
  }
  .scene-title {
    top: 78px;
    left: 14px;
    right: 14px;
    max-width: none;
  }
  .scene-title h1 {
    font-size: clamp(22px, 6.5vw, 34px);
    margin-bottom: 10px;
  }
  .scene-title__hint {
    font-size: 10px;
    letter-spacing: 0.14em;
  }
  .scene-title .eyebrow {
    font-size: 9.5px;
    letter-spacing: 0.28em;
  }
}
@media (max-width: 420px) {
  .scene-title h1 br { display: none; }
  .scene-title h1 em::before { content: ' '; }
  .tool-btn { padding: 9px 10px; font-size: 11px; gap: 4px; }
  .tool-btn svg { width: 14px; height: 14px; }
  /* Auf sehr schmalen Screens nur Icon-Labels für Steuer-Buttons */
  .scene-toolbar__group:last-child .tool-btn span { display: none; }
}
/* Loader auf Mobile etwas kompakter */
@media (max-width: 720px) {
  .scene-loader__pct { font-size: 48px; margin-bottom: 12px; }
  .scene-loader__bar { width: 220px; }
}

/* ─── LEGEND ───────────────────────────── */
.scene-legend {
  position: absolute;
  top: 110px;
  right: var(--gutter);
  background: rgba(13,14,16,0.7);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px 20px;
  z-index: 10;
  min-width: 200px;
  opacity: 0;
  animation: fadeUp 1s var(--ease) 1.2s forwards;
}
.scene-legend .eyebrow { margin-bottom: 12px; font-size: 10px; }
.scene-legend ul { list-style: none; }
.scene-legend li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color 0.2s, padding-left 0.2s var(--ease);
}
.scene-legend li:hover { color: var(--ink); padding-left: 4px; }
.scene-legend li span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
  flex-shrink: 0;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot, var(--accent)) 20%, transparent);
}

@media (max-width: 720px) {
  .scene-legend { display: none; }
}

/* ─── SOURCE BANNER ───────────────────────────── */
.scene-source[hidden] { display: none !important; }
.scene-source {
  position: absolute;
  bottom: 32px;
  right: var(--gutter);
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(13,14,16,0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  z-index: 10;
  opacity: 0;
  animation: fadeUp 1s var(--ease) 1.4s forwards;
}
.scene-source__dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-2);
  animation: pulse 2.4s ease-in-out infinite;
}
.scene-source.is-real .scene-source__dot {
  background: #5dd684;
  box-shadow: 0 0 0 0 rgba(93,214,132,0.6);
}

@media (max-width: 720px) {
  .scene-source { bottom: auto; top: 90px; right: var(--gutter); font-size: 9px; padding: 6px 12px; }
  .scene-toolbar__group:last-child .tool-btn span { display: none; }
}
