:root {
  --ink: #2e2718;
  --paper: #f2ede0;
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}
body.night {
  --ink: #ece7da;
  --paper: #10142a;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; overflow: hidden; background: #f6d9a8; transition: background 1.4s ease; }
body.night { background: #0a0f24; }
body {
  font-family: "Cormorant Garamond", Georgia, serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
}
#crater { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

/* veil intro */
#veil {
  position: fixed; inset: 0; z-index: 30;
  background: var(--paper);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.6s ease, background 1.4s ease;
}
#veil.gone { opacity: 0; pointer-events: none; }
.wordmark {
  font-weight: 500; font-size: clamp(2.6rem, 12vw, 5.5rem);
  letter-spacing: 0.12em; color: var(--ink);
  opacity: 0; transform: translateY(14px);
  animation: rise 2.2s var(--ease-spring) 0.3s forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

/* chrome */
.chrome { transition: opacity 0.9s ease; }
.chrome.idle { opacity: 0; pointer-events: none; }

#masthead {
  position: fixed; top: max(1.1rem, env(safe-area-inset-top)); left: 1.4rem; z-index: 20;
}
.wordmark-small {
  font-size: 1.25rem; letter-spacing: 0.22em; font-weight: 500;
  color: var(--ink); opacity: 0.92;
  text-shadow: 0 1px 10px rgba(242, 237, 224, 0.7);
  transition: color 1.2s ease;
}
body.night .wordmark-small { text-shadow: 0 1px 10px rgba(8, 10, 20, 0.7); }

#caption {
  position: fixed; left: 0; right: 0; bottom: 15.5vh; z-index: 20;
  text-align: center; font-style: italic;
  font-size: clamp(1.3rem, 5.4vw, 1.9rem); color: var(--ink);
  padding: 0.2rem 2rem; pointer-events: none;
  opacity: 0; transform: translateY(10px);
  background: radial-gradient(ellipse 70% 160% at 50% 50%, rgba(242, 237, 224, 0.45), rgba(242, 237, 224, 0));
  transition: opacity 1.1s ease, transform 1.1s var(--ease-spring), color 1.2s ease;
  text-shadow: 0 1px 14px rgba(242, 237, 224, 0.75);
}
body.night #caption { text-shadow: 0 1px 14px rgba(8, 10, 20, 0.7); background: radial-gradient(ellipse 70% 160% at 50% 50%, rgba(16, 20, 42, 0.4), rgba(16, 20, 42, 0)); }
#caption.show { opacity: 1; transform: none; }

#whisper {
  position: fixed; left: 0; right: 0; bottom: 11vh; z-index: 20;
  text-align: center; font-size: clamp(0.95rem, 3.8vw, 1.1rem);
  color: var(--ink); opacity: 0; padding: 0.35rem 3rem; pointer-events: none;
  transition: opacity 1.4s ease, color 1.2s ease;
  text-shadow: 0 1px 12px rgba(242, 237, 224, 0.9), 0 0 4px rgba(242, 237, 224, 0.8);
  background: radial-gradient(ellipse 78% 190% at 50% 50%, rgba(242, 237, 224, 0.74), rgba(242, 237, 224, 0));
}
#whisper.show { opacity: 1; }
body.night #whisper {
  text-shadow: 0 1px 12px rgba(8, 10, 20, 0.85), 0 0 4px rgba(8, 10, 20, 0.7);
  background: radial-gradient(ellipse 78% 190% at 50% 50%, rgba(16, 20, 42, 0.66), rgba(16, 20, 42, 0));
}

/* dock */
#dock {
  position: fixed; left: 50%; bottom: max(1.6rem, env(safe-area-inset-bottom));
  transform: translateX(-50%); z-index: 20;
  display: flex; gap: 0.4rem;
  padding: 0.5rem 0.7rem; border-radius: 999px;
  background: rgba(242, 237, 224, 0.42);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 24px rgba(46, 39, 24, 0.12), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: opacity 0.9s ease, background 1.2s ease;
  touch-action: pan-y;
}
body.night #dock {
  background: rgba(16, 20, 42, 0.45);
  box-shadow: 0 6px 24px rgba(4, 6, 14, 0.45), inset 0 1px 0 rgba(255,255,255,0.12);
}
.dot {
  appearance: none; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 10px 4px; border-radius: 14px;
  transition: transform 0.5s var(--ease-spring), background 0.4s ease;
  -webkit-tap-highlight-color: transparent;
}
.dot i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink); opacity: 0.35; display: block;
  transition: transform 0.5s var(--ease-spring), opacity 0.3s ease, background 1.2s ease;
}
.dot span {
  font-family: inherit; font-size: 0.72rem; letter-spacing: 0.08em;
  color: var(--ink); opacity: 0; max-height: 0; overflow: hidden;
  transition: opacity 0.4s ease, max-height 0.5s var(--ease-spring), color 1.2s ease;
}
.dot:hover { transform: translateY(-2px); }
.dot:active { transform: scale(0.9); }
.dot.active { background: rgba(242, 237, 224, 0.55); }
body.night .dot.active { background: rgba(236, 231, 218, 0.14); }
.dot.active i { opacity: 0.95; transform: scale(1.5); }
.dot.active span { opacity: 0.7; max-height: 1.2em; }

/* keyboard focus */
.dot:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* Reachable scene navigation: stable labels and a separate text stack. */
:root { --dock-bottom: max(1rem, env(safe-area-inset-bottom)); }
#journey-text { position:fixed; left:0; right:0; bottom:calc(var(--dock-bottom) + 4.5rem + 1rem); z-index:20; pointer-events:none; display:grid; gap:.25rem; }
#caption, #whisper { position:static; margin:0; }
#dock { bottom:var(--dock-bottom); min-height:4.5rem; padding:.5rem; gap:.25rem; background:rgba(242,237,224,.88); }
body.night #dock { background:rgba(16,20,42,.9); }
.dot { min-width:3.5rem; min-height:3.5rem; justify-content:center; }
.dot span { opacity:.85; max-height:none; font-size:.85rem; }
.dot.active { background:var(--ink); }
.dot.active span { color:var(--paper); opacity:1; max-height:none; }
.dot.active i { background:var(--paper); }
body.night .dot.active { background:var(--ink); }
@media (max-height:450px) { #journey-text { bottom:calc(var(--dock-bottom) + 4.5rem + .5rem); } #caption { font-size:1.2rem; } #whisper { font-size:.95rem; padding:.15rem 1.5rem; } }
@media (prefers-reduced-motion:reduce) { .chrome,#caption,#whisper,#dock,.dot,.dot i,.dot span { transition:none; } }

/* quiet orbs: sound + return-to-view */
#orbs {
  position: fixed; top: max(1.1rem, env(safe-area-inset-top)); right: 1.2rem; z-index: 20;
  display: flex; gap: 0.55rem;
}
.orb {
  appearance: none; border: 0; cursor: pointer;
  width: 2.9rem; height: 2.9rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--ink);
  background: rgba(242, 237, 224, 0.42);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 6px 20px rgba(46, 39, 24, 0.14), inset 0 1px 0 rgba(255,255,255,0.5);
  transition: transform 0.5s var(--ease-spring), background 0.4s ease, color 1.2s ease, opacity 0.9s ease;
  -webkit-tap-highlight-color: transparent;
}
body.night .orb {
  color: var(--ink);
  background: rgba(16, 20, 42, 0.5);
  box-shadow: 0 6px 20px rgba(4, 6, 14, 0.45), inset 0 1px 0 rgba(255,255,255,0.12);
}
.orb:hover { transform: translateY(-2px); }
.orb:active { transform: scale(0.88); }
.orb:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
#audio-orb .wav { opacity: 0.25; transition: opacity 0.3s ease; }
#audio-orb[aria-pressed="true"] .wav { opacity: 1; }
#reset-orb[hidden] { display: none; }
@media (prefers-reduced-motion:reduce) { .orb { transition: none; } }

/* A bounded reading surface: no scene-spanning caption bands. */
#journey-text { left:50%; right:auto; transform:translateX(-50%); width:min(92vw,42rem); border-radius:1rem; padding:.65rem .6rem; background:rgba(242,237,224,.96); }
#caption,#whisper { background:none; text-shadow:none; padding:.15rem .65rem; }
body.night #journey-text { background:rgba(16,20,42,.96); }
body.night #caption,body.night #whisper { background:none; text-shadow:none; }

.wordmark-small { display:inline-block; background:rgba(242,237,224,.96); padding:.35rem .55rem; border-radius:.5rem; opacity:1; text-shadow:none; }
body.night .wordmark-small { background:rgba(16,20,42,.96); text-shadow:none; }
