/* ─────────────────────────────────────────────
   BASE — layout, mechanics, animations
   Palette lives in themes/*.css via CSS variables
   ───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;600&family=JetBrains+Mono:wght@400;600&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { overflow-x: hidden; }

body {
  background: var(--bg);
  min-height: 100vh;
  font-family: 'Cormorant Garamond', Georgia, serif;
  color: var(--text-primary);
  overflow: hidden;
  position: relative;
}

/* Vignette */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, var(--vignette) 100%);
  pointer-events: none;
  z-index: 10;
}

/* Grain overlay — enable via body.theme-grain */
body.theme-grain::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: repeating-linear-gradient(0deg, rgba(255,255,255,0.008) 0px, rgba(255,255,255,0.008) 1px, transparent 1px, transparent 3px);
  pointer-events: none;
  z-index: 11;
}

/* ── Chapter header ── */
.chapter-header {
  position: fixed;
  top: 24px;
  left: 32px;
  z-index: 20;
}

.chapter-header .meta {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.35em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.chapter-header .title {
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
}

/* ── Scenes ── */
#scene-wrap {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 8vw 12rem;
  z-index: 5;
}

.scene {
  position: absolute;
  inset: 0;
  padding: 4rem 8vw 11rem;
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
  overflow-y: auto;
}

.scene.actief {
  opacity: 1;
  pointer-events: auto;
}

/* Dark text panel behind scene content — improves readability on any image */
.scene::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to right,
    rgba(0,0,0,0.78) 0%,
    rgba(0,0,0,0.62) 30%,
    rgba(0,0,0,0.30) 55%,
    rgba(0,0,0,0.05) 75%,
    transparent 90%
  );
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.2s ease;
}

.scene.actief::before {
  opacity: 1;
}

.scene-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: var(--scene-bg-filter);
  z-index: 0;
  transform: scale(1.05);
  animation: slowZoom 20s ease-in-out infinite alternate;
}

.scene-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--scene-wash);
}

@keyframes slowZoom {
  from { transform: scale(1.05); }
  to { transform: scale(1.15); }
}

.image-credit {
  position: absolute;
  bottom: 155px;
  left: 8vw;
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  opacity: 0.6;
  animation: fadeInUp 1.6s ease 1s both;
  z-index: 2;
}

.scene .date-stamp {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.4em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 1.5rem;
  animation: fadeInUp 1.4s ease;
  position: relative;
  z-index: 2;
}

.scene h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(32px, 5.5vw, 68px);
  line-height: 1.05;
  color: var(--text-strong);
  letter-spacing: -0.01em;
  max-width: 900px;
  margin-bottom: 1.5rem;
  animation: fadeInUp 1.6s ease 0.2s both;
  position: relative;
  z-index: 2;
  text-shadow: var(--text-shadow-h2), 0 2px 20px rgba(0,0,0,0.5);
}

.scene h2 em {
  font-style: italic;
  color: var(--accent);
  font-weight: 400;
}

.scene .kicker {
  font-size: clamp(18px, 2.2vw, 26px);
  line-height: 1.5;
  color: var(--text-secondary);
  max-width: 780px;
  font-weight: 300;
  font-style: italic;
  animation: fadeInUp 1.6s ease 0.4s both;
  position: relative;
  z-index: 2;
  text-shadow: var(--text-shadow-kicker), 0 1px 12px rgba(0,0,0,0.5);
}

.scene .body {
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.6;
  color: var(--text-primary);
  max-width: 680px;
  font-weight: 300;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.6s ease, opacity 0.6s ease, margin-top 0.6s ease;
  margin-top: 0;
  position: relative;
  z-index: 2;
  text-shadow: var(--text-shadow-body), 0 1px 8px rgba(0,0,0,0.6);
}

.scene .body.open {
  max-height: 1200px;
  opacity: 1;
  margin-top: 1.25rem;
}

.scene .body p + p { margin-top: 1rem; }
.scene .body em { font-style: italic; color: var(--accent); }

.scene .read-more-btn {
  margin-top: 1.5rem;
  background: var(--btn-bg);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 8px 20px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
  align-self: flex-start;
  animation: fadeInUp 1.6s ease 0.6s both;
  position: relative;
  z-index: 2;
  backdrop-filter: blur(4px);
}

.scene .read-more-btn:hover {
  color: var(--accent-strong);
  border-color: var(--accent);
}

.scene .stats {
  display: flex;
  gap: 3rem;
  margin-top: 2rem;
  animation: fadeInUp 1.6s ease 0.5s both;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}

.scene .stat { font-family: 'JetBrains Mono', monospace; }

.scene .stat .value {
  font-size: 28px;
  font-weight: 600;
  color: var(--stat-value);
  display: block;
  margin-bottom: 4px;
  text-shadow: 0 1px 8px rgba(0,0,0,0.6);
}

.scene .stat .label {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Timeline ── */
#timeline {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 140px;
  padding: 1rem 3rem 1.5rem;
  z-index: 30;
  background: var(--timeline-bg);
}

#timeline-line {
  position: relative;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--border) 20%, var(--border) 80%, transparent);
  margin-top: 60px;
}

#timeline-progress {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(to right, var(--accent-dim), var(--accent));
  transition: width 0.8s ease;
  box-shadow: 0 0 12px var(--accent-glow);
}

.tl-dot {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--dot-bg);
  border: 2px solid var(--border);
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 2;
}

.tl-dot:hover {
  background: var(--dot-hover);
  border-color: var(--accent-dim);
  transform: translate(-50%, -50%) scale(1.3);
}

.tl-dot.bezocht {
  border-color: var(--accent-dim);
  background: var(--dot-visited);
}

.tl-dot.actief {
  background: var(--accent);
  border-color: var(--accent-strong);
  box-shadow: 0 0 16px var(--accent-glow);
  transform: translate(-50%, -50%) scale(1.4);
}

.tl-label {
  position: absolute;
  top: -32px;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.15em;
  pointer-events: none;
  transition: color 0.3s;
}

.tl-dot.actief .tl-label {
  color: var(--accent);
  font-weight: 600;
}

/* ── Story navigation ── */
.chapter-header .atlas-link {
  display: block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.35em;
  color: var(--text-muted);
  text-decoration: none;
  text-transform: uppercase;
  margin-bottom: 8px;
  transition: color 0.2s;
}

.chapter-header .atlas-link:hover {
  color: var(--accent);
}

.next-story {
  position: fixed;
  bottom: 155px;
  right: 3rem;
  z-index: 25;
  text-decoration: none;
  color: inherit;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--btn-bg);
  backdrop-filter: blur(4px);
  transition: border-color 0.2s, transform 0.2s;
  max-width: 280px;
}

.next-story:hover {
  border-color: var(--accent-dim);
  transform: translateX(-4px);
}

.next-story .ns-label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.3em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 4px;
}

.next-story .ns-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.2;
}

.next-story .ns-title em {
  color: var(--accent);
}

.next-story:hover .ns-title {
  color: var(--text-strong);
}

/* ── Navigation ── */
.nav-btn {
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  background: var(--btn-bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  width: 52px;
  height: 52px;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
  z-index: 25;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn:hover {
  background: var(--btn-bg-hover);
  border-color: var(--accent-dim);
  color: var(--accent-strong);
}

.nav-btn:disabled { opacity: 0.25; cursor: default; }

#nav-prev { left: 2rem; }
#nav-next { right: 2rem; }

/* ── Hint ── */
#hint {
  position: fixed;
  bottom: 160px;
  right: 3rem;
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  z-index: 20;
  opacity: 0.6;
}

/* ── Audio button ── */
#audio-btn {
  position: fixed;
  top: 24px;
  right: 32px;
  z-index: 40;
  background: none;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 6px 14px;
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.2em;
  cursor: pointer;
  text-transform: uppercase;
  transition: color 0.2s, border-color 0.2s;
}

#audio-btn:hover {
  color: var(--text-secondary);
  border-color: var(--accent-dim);
}

#audio-btn.on {
  color: var(--accent);
  border-color: var(--accent-dim);
}

@media (max-width: 700px) {
  .chapter-header { left: 16px; top: 16px; }
  .chapter-header .title { font-size: 15px; }
  #audio-btn { right: 16px; top: 16px; }
  .scene { padding: 5rem 6vw 12rem; }
  .nav-btn { width: 40px; height: 40px; font-size: 16px; }
  #nav-prev { left: 8px; }
  #nav-next { right: 8px; }
  #timeline { padding: 1rem 1rem 1.5rem; }
  .tl-label { display: none; }
  #hint { display: none; }
  .next-story { display: none; }

  /* Mobile: lighter image, dark panel only where the text sits */
  .scene::before {
    background: linear-gradient(to bottom,
      rgba(0,0,0,0.15) 0%,
      rgba(0,0,0,0.40) 45%,
      rgba(0,0,0,0.65) 100%
    );
  }
  .scene-bg { filter: brightness(1.3) contrast(1.05); }
  .scene-bg::after { opacity: 0.5; }
  body::before { opacity: 0.5; }
}