:root {
  --bg: #04080f;
  --deep: #0a1622;
  --sand: #e6d8bd;
  --amber: #e2b16a;
  --teal: #6d9ba1;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--sand);
  font-family: Georgia, "Times New Roman", serif;
}

a {
  color: inherit;
  text-decoration: none;
}

.experience,
.panel,
.scene-shell {
  position: absolute;
  inset: 0;
}

.experience {
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

.scene-shell {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 42%, rgba(236, 228, 210, 0.02), transparent 24%),
    radial-gradient(circle at 76% 30%, rgba(109, 155, 161, 0.06), transparent 28%),
    linear-gradient(180deg, #02060b, #08111a 54%, #061018);
}

.scene-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.extra-shell::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.014), transparent 18%),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 58px,
      rgba(255, 255, 255, 0.005) 59px
    );
  mix-blend-mode: soft-light;
}

.extra-overlay {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  padding: 6vh clamp(1.4rem, 3.8vw, 4rem) 4vh;
  pointer-events: none;
}

.extra-hero {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.letter-field {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.letter-layer {
  position: absolute;
  left: 0;
  top: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: clamp(4.6rem, 8vw, 7.2rem);
  min-height: clamp(4.6rem, 8vw, 7.2rem);
  padding: 0.22em 0.18em 0.12em;
  font-size: clamp(5.2rem, 11vw, 9.8rem);
  line-height: 1;
  font-weight: 500;
  letter-spacing: -0.04em;
  color: rgba(236, 228, 210, 0.9);
  text-shadow:
    0 0 12px rgba(232, 219, 188, 0.06),
    0 0 28px rgba(226, 177, 106, 0.02),
    0 18px 44px rgba(0, 0, 0, 0.36);
  will-change: transform, opacity;
  user-select: none;
}

.panel-nav {
  position: absolute;
  z-index: 11;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.92rem 1rem;
  color: var(--sand);
  border: 1px solid rgba(230, 216, 189, 0.14);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0.006)),
    rgba(7, 12, 20, 0.56);
  box-shadow:
    inset 0 0 0 1px rgba(226, 177, 106, 0.025),
    0 18px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(6px);
  font-family: "Courier New", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.panel-prev {
  left: 3rem;
}

.panel-prev::after {
  content: "\2190";
  font-size: 1rem;
}

.chapter-transition {
  position: fixed;
  inset: 0;
  z-index: 12;
  pointer-events: none;
  opacity: 0;
}

.transition-film {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 46% 52%, rgba(255, 247, 228, 0.18), transparent 24%),
    linear-gradient(90deg, rgba(226, 177, 106, 0), rgba(226, 177, 106, 0.08), rgba(226, 177, 106, 0));
}

body.arrival-transition .chapter-transition,
body.departure-transition .chapter-transition {
  opacity: 1;
}

body.arrival-transition .transition-film {
  animation: transition-film-fade 860ms cubic-bezier(0.18, 0.82, 0.14, 1) forwards;
}

body.departure-transition .transition-film {
  animation: transition-film-fade 720ms cubic-bezier(0.18, 0.82, 0.14, 1) forwards reverse;
}

@keyframes transition-film-fade {
  0% { opacity: 0; }
  30% { opacity: 1; }
  100% { opacity: 0; }
}
