/* ============================================================
   Haus der Wahrheit — style.css
   Bühne weiß (passt zu den Frames), Hero creme, Akzent Oliv.
   ============================================================ */

:root {
  --stage: #ede6da;          /* Bühne = Creme, matcht die freigestellten Frames */
  --cream: #ede6da;          /* Hero / warme Akzentflächen */
  --cream-deep: #e2ddd1;
  --ink: #1a1c17;            /* warmes Fast-Schwarz */
  --ink-soft: #5f6459;       /* gedämpfter Fließtext */
  --line: #d8d3c7;
  --accent: #6b7a4f;         /* Oliv / Waldgrün */
  --accent-deep: #3f4a2e;
  --warn: #e0632a;           /* nur „Symptom" */
  --text-on-dark: #f0ede5;
  --bg-dark: #16180f;

  --font-display: 'Inter Tight', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; background: var(--stage); }

body {
  font-family: var(--font-body);
  background: var(--stage);
  color: var(--ink);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent); color: #fff; }

.accent { color: var(--accent); }
.warn { color: var(--warn); }

/* ---------- Loader ---------- */
#loader {
  position: fixed; inset: 0; z-index: 200;
  background: var(--cream);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
#loader.hidden { opacity: 0; visibility: hidden; }
.loader-inner { width: min(340px, 74vw); text-align: center; }
.loader-brand {
  display: flex; align-items: center; justify-content: center; gap: 0.6rem;
  font-family: var(--font-display); font-weight: 700; letter-spacing: -0.01em;
  font-size: 1.1rem; color: var(--ink); margin-bottom: 1.6rem;
}
.loader-brand .mark { width: 30px; height: 25px; color: var(--ink); }
#loader-bar {
  height: 2px; width: 100%; background: var(--cream-deep); overflow: hidden;
}
#loader-fill { display: block; height: 100%; width: 0%; background: var(--accent); transition: width 0.2s linear; }
#loader-percent {
  margin-top: 0.8rem; font-size: 0.72rem; letter-spacing: 0.16em;
  text-transform: uppercase; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}

/* ---------- Header ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 120;
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.4rem clamp(1.2rem, 5vw, 3.2rem);
  mix-blend-mode: normal;
}
.brand { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--ink); }
.brand .mark { width: 26px; height: 22px; color: var(--ink); }
.brand-text {
  font-family: var(--font-display); font-weight: 700; font-size: 0.98rem;
  letter-spacing: -0.005em; text-transform: uppercase;
}
.header-cta {
  font-family: var(--font-display); font-weight: 600; font-size: 0.82rem;
  letter-spacing: 0.02em; text-decoration: none; color: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 100px;
  padding: 0.5rem 1.1rem; transition: background 0.3s var(--ease), color 0.3s var(--ease);
}
.header-cta:hover { background: var(--ink); color: var(--cream); }

/* Header über der dunklen Stats-Fläche aufhellen */
body.dark-active .brand,
body.dark-active .brand-text,
body.dark-active .brand .mark { color: var(--text-on-dark); }
body.dark-active .header-cta { color: var(--text-on-dark); border-color: rgba(240,237,229,0.5); }
body.dark-active .header-cta:hover { background: var(--text-on-dark); color: var(--ink); }
.brand .mark, .brand-text, .header-cta { transition: color 0.4s var(--ease), border-color 0.4s var(--ease), background 0.3s var(--ease); }

/* ---------- Hero ---------- */
.hero-standalone {
  position: relative; z-index: 90;
  height: 100vh; width: 100%;
  background: var(--cream);
  display: flex; flex-direction: column; justify-content: center;
  padding: 0 clamp(1.4rem, 6vw, 5rem);
}
.hero-inner { max-width: 1100px; }
.hero-heading {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 9.2vw, 9rem);
  line-height: 0.99;
  letter-spacing: -0.035em;
  color: var(--ink);
}
.hero-heading .line { display: block; padding-bottom: 0.06em; }
.hero-heading .w { display: inline-block; }
.hero-heading .accent { color: var(--accent-deep); }
.hero-tagline {
  margin-top: 2rem; max-width: 42ch;
  font-size: clamp(1rem, 1.4vw, 1.22rem); line-height: 1.55;
  color: var(--ink-soft); font-weight: 450;
}
.hero-actions { margin-top: 2.4rem; display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap; }
.hero-btn {
  font-family: var(--font-display); font-weight: 600; font-size: 1rem;
  padding: 0.95rem 1.8rem; border-radius: 100px; text-decoration: none;
  background: var(--accent-deep); color: var(--cream);
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}
.hero-btn:hover { background: var(--ink); transform: translateY(-1px); }
.hero-note { font-size: 0.82rem; color: var(--ink-soft); }
.cta-subnote { margin-top: 1rem; font-size: 0.82rem; color: rgba(240,237,229,0.55); }
.section-label {
  display: inline-block;
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.74rem; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 1.4rem;
}
.section-label.light { color: var(--accent); }
.scroll-indicator {
  position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem;
  color: var(--ink-soft);
}
.scroll-indicator span { font-size: 0.68rem; letter-spacing: 0.16em; text-transform: uppercase; }
.scroll-indicator svg { animation: bob 1.8s ease-in-out infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(5px); } }

/* ---------- Canvas ---------- */
.canvas-wrap {
  position: fixed; inset: 0; z-index: 10;
  background: var(--stage);
}
#canvas { display: block; width: 100%; height: 100%; }

/* ---------- Dark overlay ---------- */
#dark-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg-dark); opacity: 0;
  pointer-events: none;
}
/* ---------- Light overlay (CTA bookend) ---------- */
#light-overlay {
  position: fixed; inset: 0; z-index: 42;
  background: var(--cream); opacity: 0;
  pointer-events: none;
}

/* ---------- KPI overlay (signature): untere Instrument-Reihe ---------- */
#kpi-overlay {
  position: fixed; inset: 0; z-index: 55;
  pointer-events: none; opacity: 0;
  will-change: opacity;
}
/* weiches Scrim am unteren Rand für Lesbarkeit über hellen Frames */
#kpi-overlay::before {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 30vh;
  background: linear-gradient(to top, rgba(237,230,218,0.94) 0%, rgba(237,230,218,0) 100%);
}
.kpi-stack {
  position: absolute; left: 50%; bottom: 6vh; transform: translateX(-50%);
  display: flex; flex-direction: row; align-items: flex-start;
  gap: clamp(1.6rem, 4vw, 3.6rem);
  max-width: 92vw;
}
.kpi-tile {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  min-width: 7rem;
  border-top: 2px solid rgba(107, 122, 79, 0.55);
  padding-top: 0.75rem;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.55s var(--ease), transform 0.55s var(--ease);
}
.kpi-tile.is-shown { opacity: 1; transform: translateY(0); }
.kpi-label {
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 0.45rem;
}
.kpi-value { display: flex; align-items: baseline; gap: 0.3rem; }
.kpi-num {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.9rem, 2.8vw, 2.7rem); line-height: 1;
  letter-spacing: -0.02em; color: var(--ink);
  font-variant-numeric: tabular-nums; font-feature-settings: "tnum";
}
.kpi-unit {
  font-family: var(--font-display); font-weight: 500;
  font-size: 0.78rem; color: var(--ink-soft); white-space: nowrap;
}
.kpi-badge {
  margin-top: 0.5rem;
  font-family: var(--font-display); font-weight: 600;
  font-size: 0.74rem; letter-spacing: 0.01em;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  opacity: 0; white-space: nowrap; min-height: 1em;
}
.kpi-badge.has-delta { opacity: 1; }
.kpi-badge[data-good="true"] { color: var(--accent-deep); }
.kpi-badge[data-good="false"] { color: var(--warn); }
.kpi-badge.is-fresh { animation: badgePop 1.2s var(--ease); }
@keyframes badgePop {
  0% { transform: translateY(3px) scale(0.9); filter: brightness(1.4); }
  35% { transform: translateY(0) scale(1.04); }
  100% { transform: translateY(0) scale(1); filter: brightness(1); }
}
.kpi-disclaimer {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: 2.2vh;
  font-size: 0.66rem; letter-spacing: 0.05em; color: var(--ink-soft); opacity: 0.7;
  white-space: nowrap;
}

/* ---------- Marquee ---------- */
.marquee-wrap {
  position: fixed; top: 50%; left: 0; z-index: 45;
  width: 100%; transform: translateY(-50%);
  pointer-events: none; opacity: 0; overflow: hidden;
  will-change: opacity;
}
.marquee-text {
  font-family: var(--font-display); font-weight: 800;
  font-size: 13vw; line-height: 1; letter-spacing: -0.02em;
  white-space: nowrap; color: var(--accent);
  opacity: 0.1;
}

/* ---------- Scroll container & sections ---------- */
#scroll-container { position: relative; height: 900vh; z-index: 50; }

.scroll-section {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center;
  pointer-events: none;
  opacity: 0; visibility: hidden;
}
.section-inner { max-width: 40vw; position: relative; z-index: 1; }
.align-left { justify-content: flex-start; padding-left: clamp(1.4rem, 5vw, 4rem); padding-right: 52vw; }
.align-right { justify-content: flex-end; padding-right: clamp(1.4rem, 5vw, 4rem); padding-left: 52vw; }
.align-right .section-inner { text-align: right; }
/* weicher Rand-Scrim hebt Text vom Haus ab — kein Karten-Look */
.align-left::before, .align-right::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.align-left::before {
  background: linear-gradient(to right, rgba(237,230,218,0.96) 0%, rgba(237,230,218,0.85) 26%, rgba(237,230,218,0) 46%);
}
.align-right::before {
  background: linear-gradient(to left, rgba(237,230,218,0.96) 0%, rgba(237,230,218,0.85) 26%, rgba(237,230,218,0) 46%);
}

.section-heading {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.9rem, 3.6vw, 3.5rem); line-height: 1.02;
  letter-spacing: -0.025em; color: var(--ink);
}
.section-body {
  margin-top: 1.4rem; max-width: 42ch;
  font-size: clamp(0.98rem, 1.15vw, 1.12rem); line-height: 1.6;
  color: var(--ink-soft); font-weight: 450;
}
.align-right .section-body { margin-left: auto; }

/* ---------- Stats ---------- */
.section-stats { justify-content: center; text-align: center; }
.stats-inner { width: min(1080px, 88vw); }
.section-stats .section-label { color: var(--accent); }
.section-stats .accent { color: #9DB177; } /* helleres Oliv für Kontrast auf Dunkel */
.stats-heading {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 3.4rem); line-height: 1.03;
  letter-spacing: -0.025em; color: var(--text-on-dark);
  margin-bottom: 3rem;
}
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: clamp(1.2rem, 3vw, 3rem);
}
.stat { display: flex; flex-direction: column; align-items: center; }
.stat-number {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.4rem, 5.5vw, 4.6rem); line-height: 1;
  letter-spacing: -0.03em; color: var(--text-on-dark);
  font-variant-numeric: tabular-nums;
}
.stat-suffix {
  font-family: var(--font-display); font-weight: 600;
  font-size: clamp(1rem, 1.6vw, 1.4rem); color: var(--accent);
  margin-top: 0.3rem;
}
.stat-label {
  margin-top: 0.9rem; font-size: 0.8rem; letter-spacing: 0.08em;
  text-transform: uppercase; color: rgba(240,237,229,0.6);
}

/* ---------- CTA ---------- */
.section-cta { justify-content: center; text-align: center; }
.cta-inner { width: min(680px, 88vw); pointer-events: auto; }
.cta-heading {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(2.2rem, 5vw, 4.4rem); line-height: 1; letter-spacing: -0.03em;
  color: var(--ink); margin-bottom: 1.2rem;
}
.cta-body {
  font-size: clamp(1rem, 1.3vw, 1.18rem); line-height: 1.55;
  color: var(--ink-soft); max-width: 46ch; margin: 0 auto 2.4rem;
}
.cta-form {
  display: flex; flex-direction: column; gap: 0.6rem; max-width: 520px; margin: 0 auto;
}
.cta-fields { display: flex; gap: 0.6rem; }
.cta-fields .cta-input { flex: 1; min-width: 0; }
.cta-textarea {
  flex: none; width: 100%; border-radius: 20px; resize: vertical;
  min-height: 3rem; line-height: 1.45;
}
.cta-input {
  flex: 1; font-family: var(--font-body); font-size: 1rem;
  padding: 0.95rem 1.2rem; border: 1.5px solid var(--line);
  border-radius: 100px; background: #fff; color: var(--ink);
  outline: none; transition: border-color 0.25s var(--ease);
}
.cta-input:focus { border-color: var(--accent); }
.cta-input::placeholder { color: #a7a294; }
.cta-button {
  font-family: var(--font-display); font-weight: 600; font-size: 0.98rem;
  padding: 0.95rem 1.7rem; border: none; border-radius: 100px;
  background: var(--accent-deep); color: var(--cream); cursor: pointer;
  transition: background 0.25s var(--ease), transform 0.25s var(--ease);
  white-space: nowrap; width: 100%;
}
.cta-button:hover { background: var(--ink); transform: translateY(-1px); }
.cta-note { margin-top: 1.2rem; color: var(--accent-deep); font-weight: 500; }
.hidden-field { position: absolute; left: -9999px; }

/* ---------- Finale (Vorher/Nachher + Frühzugang, dunkel & bleibend) ---------- */
.section-finale { justify-content: center; text-align: center; }
.finale-inner { width: min(1040px, 90vw); pointer-events: auto; }
.section-finale .section-label { color: var(--accent); }
.section-finale .accent { color: #9db177; }
.section-finale .stats-heading { margin-bottom: 2.2rem; }
.section-finale .stat-number { font-size: clamp(2.2rem, 4.6vw, 3.9rem); }
.finale-cta {
  margin-top: 2.8rem; padding-top: 2.4rem;
  border-top: 1px solid rgba(240,237,229,0.16);
}
.section-finale .cta-heading {
  color: var(--text-on-dark);
  font-size: clamp(1.5rem, 3.2vw, 2.6rem); margin-bottom: 0.7rem;
}
.section-finale .cta-body {
  color: rgba(240,237,229,0.68); margin: 0 auto 1.8rem; max-width: 42ch;
  font-size: clamp(0.98rem, 1.2vw, 1.12rem);
}
.section-finale .cta-input { border-color: rgba(240,237,229,0.28); }
.section-finale .cta-button { background: var(--accent); }
.section-finale .cta-button:hover { background: #7d8f5d; }
.section-finale .cta-note { color: #9db177; }

/* ---------- Focus visibility ---------- */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}

/* ---------- Mobile ---------- */
@media (max-width: 768px) {
  #scroll-container { height: 620vh; }

  .section-inner { width: 100%; max-width: 100%; }
  .section-heading, .cta-heading, .stats-heading, .hero-heading {
    overflow-wrap: break-word; hyphens: none;
  }
  .section-heading { font-size: clamp(1.5rem, 5.8vw, 2rem); }
  /* Text sitzt in der unteren Mitte auf Creme — Haus oben bleibt frei sichtbar */
  /* dvh = dynamische Viewport-Höhe → stabil, wenn die iOS-URL-Leiste ein/ausblendet */
  .align-left, .align-right {
    justify-content: center; align-items: flex-start;
    padding: 46vh 1.3rem 0;
    padding: 46dvh 1.3rem 0;
    text-align: center;
  }
  .align-left::before, .align-right::before { display: none; }
  .align-right .section-inner, .align-right .section-body { text-align: center; margin-left: 0; }
  .scroll-section:not(.section-stats):not(.section-cta) .section-inner {
    background: none; padding: 0;
  }
  .section-body { font-size: 0.92rem; line-height: 1.45; }
  .hero-inner, .stats-inner, .cta-inner { max-width: 100%; }
  .hero-tagline, .section-body, .cta-body {
    max-width: 100%; margin-left: auto; margin-right: auto;
  }
  .hero-heading { font-size: clamp(2.6rem, 12vw, 3.4rem); }
  .hero-standalone { padding: 0 1.3rem; }

  /* KPI → elegantes 2×2-Raster mit Haarlinien */
  /* weicher Creme-Verlauf hinter dem Raster: verdeckt Text sauber, falls er nah kommt */
  #kpi-overlay::before {
    content: ""; display: block; position: absolute;
    left: 0; right: 0; bottom: 0; height: 32dvh;
    background: linear-gradient(to top, var(--stage) 46%, rgba(237,230,218,0) 100%);
    pointer-events: none;
  }
  .kpi-stack {
    left: 1.4rem; right: 1.4rem;
    bottom: calc(3vh + env(safe-area-inset-bottom));
    bottom: calc(3dvh + env(safe-area-inset-bottom));
    top: auto; max-width: none; transform: none;
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 0; background: none;
    border-top: 1px solid var(--line);
  }
  .kpi-tile {
    display: flex; flex-direction: column; align-items: flex-start; text-align: left;
    min-width: 0; border-top: none;
    padding: 0.65rem 0.4rem 0.65rem 0;
    border-bottom: 1px solid var(--line);
  }
  .kpi-tile:nth-child(odd) { border-right: 1px solid var(--line); padding-right: 0.7rem; }
  .kpi-tile:nth-child(even) { padding-left: 0.85rem; }
  .kpi-tile:nth-child(3), .kpi-tile:nth-child(4) { border-bottom: none; }
  .kpi-label { font-size: 0.58rem; letter-spacing: 0.08em; margin-bottom: 0.3rem; line-height: 1.15; }
  .kpi-num { font-size: 1.6rem; }
  .kpi-value { gap: 0.25rem; align-items: baseline; }
  .kpi-unit { font-size: 0.66rem; }
  .kpi-badge { font-size: 0.66rem; margin-top: 0.28rem; }
  .kpi-disclaimer { display: none; }

  .marquee-text { font-size: 20vw; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 1.3rem 1rem; }
  .cta-fields { gap: 0.5rem; }

  /* Finale kompakt, damit Zahlen + Frühzugang zusammen in den Viewport passen */
  .section-finale .stats-heading { margin-bottom: 1.5rem; font-size: clamp(1.5rem, 6vw, 2rem); }
  .section-finale .stat-number { font-size: clamp(1.7rem, 8vw, 2.3rem); }
  .section-finale .stat-suffix { font-size: 0.9rem; }
  .section-finale .stat-label { font-size: 0.62rem; margin-top: 0.5rem; }
  .finale-cta { margin-top: 1.8rem; padding-top: 1.5rem; }
  .section-finale .cta-heading { font-size: clamp(1.3rem, 6vw, 1.7rem); }
  .section-finale .cta-body { font-size: 0.9rem; margin-bottom: 1.2rem; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .scroll-indicator svg { animation: none; }
  .kpi-badge.is-fresh { animation: none; }
  * { scroll-behavior: auto; }
}
