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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Cormorant Garamond', Georgia, serif;
  background: #FAFAF7;
  color: #2d2a27;
  overflow-x: hidden;
}

/* ===== DEFAULT STATE (no JS / reduced-motion) ===== */
/* Readable static page: text visible, content flows normally */

.background-layer {
  display: none;
}

.grain-overlay {
  display: none;
}

#planeCanvas {
  display: none;
}

.progress-bar {
  display: none;
}

.static-hero {
  display: block;
  width: clamp(400px, 90vw, 1200px);
  max-width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  margin: 2rem auto;
  background: #FAFAF7;
}

.scroll-container {
  position: relative;
}

.beat {
  position: relative;
  padding: 3rem 0;
}

.beat-silence {
  padding: 1rem 0;
}

.beat-content {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 2rem;
  pointer-events: none;
}

.beat-takeoff .beat-content {
  flex-direction: column;
}

.beat-climb .beat-content {
  flex-direction: column;
  gap: 3rem;
  align-items: flex-start;
}

/* Shared text base: visible by default */
.text-beat {
  text-align: center;
  max-width: min(750px, calc(100vw - 3rem));
  padding: 0 2rem;
  opacity: 1;
  font-weight: 300;
  letter-spacing: 0.01em;
}

/* Left/right positioning: static in default layout */
.text-left {
  text-align: left;
  padding-left: 8vw;
}

.text-right {
  text-align: right;
  padding-right: 8vw;
  align-self: flex-end;
}

/* Question + detail pair */
.text-question {
  font-size: clamp(1.6rem, 3.5vw, 2.6rem);
  font-weight: 300;
  line-height: 1.25;
  letter-spacing: 0.015em;
}

.text-detail {
  font-size: clamp(0.9rem, 1.6vw, 1.05rem);
  font-weight: 400;
  opacity: 0.6;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid currentColor;
  line-height: 1.65;
  max-width: 380px;
  letter-spacing: 0.01em;
}

.text-right .text-detail {
  margin-left: auto;
}

/* Text variants */
.text-title {
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  line-height: 1;
  text-align: center;
  opacity: 1;
}

.text-subtitle {
  font-size: clamp(0.65rem, 1vw, 0.8rem);
  font-weight: 400;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: #9b9590;
  margin-top: 2.5rem;
  text-align: center;
}

.text-section {
  max-width: min(500px, calc(100vw - 6rem));
}

.text-descent {
  font-size: clamp(1.4rem, 3.5vw, 2.4rem);
  letter-spacing: 0.01em;
}

.text-coda {
  font-size: clamp(1.2rem, 3vw, 2rem);
  line-height: 1.6;
  letter-spacing: 0.01em;
}

@media (max-width: 768px) {
  .text-left,
  .text-right {
    padding-left: 5vw;
    padding-right: 5vw;
    text-align: left;
    align-self: flex-start;
  }

  .text-right .text-detail {
    margin-left: 0;
  }
}

/* ===== JS-ENABLED STATE ===== */
/* Scroll-driven experience: fixed positioning, opacity-driven text */

.js .background-layer {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 0;
  background: #FAFAF7;
}

.js .background-layer::after {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.15) 100%);
  pointer-events: none;
}

.js .grain-overlay {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 200;
  pointer-events: none;
  opacity: 0.04;
  background-repeat: repeat;
  background-size: 150px 150px;
}

.js #planeCanvas {
  display: block;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: clamp(400px, 95vw, 1400px);
  height: auto;
  z-index: 5;
  pointer-events: none;
  will-change: opacity, filter;
}

.js .progress-bar {
  display: block;
  position: fixed;
  top: 0;
  left: 0;
  width: 0%;
  height: 2px;
  background: linear-gradient(to right, #4A85C5, #D64A5B);
  z-index: 100;
  pointer-events: none;
  transition: width 0.3s ease-out, opacity 0.4s ease-out;
}

.js .static-hero {
  display: none;
}

.js .scroll-container {
  z-index: 20;
}

.js .beat {
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  padding: 0;
}

.js .beat-takeoff  { height: 120vh; height: 120dvh; }
.js .beat-climb    { height: 250vh; height: 250dvh; }
.js .beat-apex     { height: 100vh; height: 100dvh; }
.js .beat-descent  { height: 100vh; height: 100dvh; }
.js .beat-legacy   { height: 100vh; height: 100dvh; }
.js .beat-coda     { height: 100vh; height: 100dvh; }
.js .beat-silence  { height: 80vh;  height: 80dvh; }

.js .beat-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  padding: 0;
  align-items: flex-end;
  padding-bottom: 10vh;
}

.js .beat-takeoff .beat-content {
  align-items: center;
  justify-content: flex-start;
  padding-top: 10vh;
  padding-bottom: 0;
}

.js .beat-climb .beat-content {
  flex-direction: row;
  gap: 0;
  align-items: flex-end;
  padding-bottom: 12vh;
}

.js .text-beat {
  opacity: 0;
}

.js .text-title {
  opacity: 0;
}

.js .text-subtitle {
  opacity: 0;
}

.js .text-left {
  position: absolute;
  left: 8vw;
  right: auto;
  padding-left: 0;
  padding-right: 0;
}

.js .text-right {
  position: absolute;
  right: 8vw;
  left: auto;
  padding-left: 0;
  padding-right: 0;
  align-self: auto;
}

.js .text-left .text-detail {
  border-top-color: rgba(7, 90, 170, 0.75);
}

.js .text-right .text-detail {
  border-top-color: rgba(186, 11, 49, 0.7);
}

@media (max-width: 768px) {
  .js .text-left,
  .js .text-right {
    left: 5vw;
    right: 5vw;
    text-align: left;
    align-self: auto;
  }

  .js .text-right .text-detail {
    margin-left: 0;
  }
}

/* Restart link */
.restart {
  display: none;
}

.js .beat-silence {
  position: relative;
}

.js .restart {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 300;
  letter-spacing: 0.12em;
  line-height: 1;
  color: rgba(212, 210, 203, 0);
  cursor: default;
  pointer-events: none;
  z-index: 50;
  transition: color 1.2s ease;
}

.js .restart.visible {
  color: rgba(212, 210, 203, 0.5);
  pointer-events: auto;
  cursor: pointer;
}

.js .restart:hover {
  color: rgba(212, 210, 203, 0.85);
}

/* Noscript message */
.noscript-msg {
  text-align: center;
  padding: 2rem;
  font-size: 0.9rem;
  opacity: 0.5;
  font-style: italic;
}
