/* ---------- Tokens ---------- */
:root {
  --paper: #f3ead9;
  --ink: #0b0e14;
  --gold: #e3b56a;
  --gold-soft: #f2e6cf;

  --font-display: "Fraunces", "Iowan Old Style", serif;
  --font-ui: "Manrope", system-ui, sans-serif;

  --dur-scene: 900ms;
  --ease-scene: cubic-bezier(0.22, 0.8, 0.28, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #0b0e14;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  color: var(--gold-soft);
}

/* ---------- Stage ---------- */
.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  overflow: hidden;
}

.scene {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur-scene) var(--ease-scene);
}

.scene.is-active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

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

.scene-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.35) 72%,
    rgba(0, 0, 0, 0.55) 100%
  );
  pointer-events: none;
}

/* ---------- Text content ---------- */
.scene-content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 8vh 6vw 16vh;
  text-align: center;
}

.scene-caption {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--gold);
  margin: 0 0 1.1rem;
  opacity: 0;
  transform: translateY(6px);
}

.scene-message {
  max-width: 46ch;
  opacity: 0;
  transform: translateY(10px);
}

.scene-message p {
  font-family: var(--font-display);
  font-weight: 480;
  font-size: clamp(1.5rem, 3.4vw, 2.4rem);
  line-height: 1.35;
  margin: 0 0 0.7em;
  color: var(--paper);
  text-wrap: balance;
}

.scene-message--final {
  max-width: 56ch;
}

.scene-message--final p {
  font-size: clamp(1.15rem, 2vw, 1.45rem);
  font-weight: 400;
  line-height: 1.6;
  text-align: left;
}

.scene.is-active .scene-caption,
.scene.is-active .scene-message {
  animation: rise-in 1000ms var(--ease-scene) 260ms forwards;
}

@keyframes rise-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Navigation ---------- */
.stage-nav {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4.5vh;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.1rem;
}

.stage-dots {
  list-style: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(243, 234, 217, 0.32);
  transition:
    background 400ms ease,
    transform 400ms ease;
}

.dot.is-active {
  background: var(--gold);
  transform: scale(1.35);
}

.btn-next {
  font-family: var(--font-ui);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--gold-soft);
  border: none;
  border-radius: 999px;
  padding: 0.85em 2.1em;
  cursor: pointer;
  transition:
    transform 220ms ease,
    background 220ms ease;
}

.btn-next:hover {
  background: #fff;
}
.btn-next:active {
  transform: scale(0.97);
}

.btn-next:focus-visible,
.dot:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

/* ---------- Retour au site (scène finale uniquement) ---------- */
.btn-back {
  position: absolute;
  top: 2rem;
  right: 2rem;
  z-index: 4;
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gold-soft);
  text-decoration: none;
  background: transparent;
  border: 1px solid rgba(243, 234, 217, 0.4);
  border-radius: 999px;
  padding: 0.6em 1.4em;
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 500ms var(--ease-scene),
    border-color 220ms ease,
    background 220ms ease;
}

.btn-back.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.btn-back:hover {
  background: rgba(243, 234, 217, 0.1);
  border-color: var(--gold);
}

.btn-back:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

@media (max-width: 640px) {
  .btn-back {
    top: 1.2rem;
    right: 1.2rem;
    font-size: 0.78rem;
    padding: 0.5em 1.1em;
  }
}

/* ---------- Scene: Avion ---------- */
.stars circle {
  fill: #fdf6e3;
  opacity: 0.85;
}
.scene--avion .stars circle {
  animation: twinkle 3.6s ease-in-out infinite;
}
.scene--avion .stars circle:nth-child(3n) {
  animation-delay: 0.6s;
}
.scene--avion .stars circle:nth-child(4n) {
  animation-delay: 1.3s;
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.35;
  }
  50% {
    opacity: 1;
  }
}

.scene--avion .plane {
  animation: float-plane 6s ease-in-out infinite;
}
@keyframes float-plane {
  0%,
  100% {
    transform: translate(300px, 300px);
  }
  50% {
    transform: translate(300px, 286px);
  }
}

/* ---------- Scene: Concert ---------- */
.scene--concert .beam {
  transform-origin: top center;
  animation: sway 5s ease-in-out infinite;
}
.beam--a {
  animation-delay: 0s;
}
.beam--b {
  animation-delay: 1.2s;
}
.beam--c {
  animation-delay: 0.6s;
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-4deg);
    opacity: 0.75;
  }
  50% {
    transform: rotate(4deg);
    opacity: 1;
  }
}

.phone-lights circle {
  fill: #fdf6e3;
  animation: twinkle 2.4s ease-in-out infinite;
}
.phone-lights circle:nth-child(2n) {
  animation-delay: 0.5s;
}
.phone-lights circle:nth-child(3n) {
  animation-delay: 1s;
}

/* ---------- Scene: Chez moi ---------- */
.scene--maison .lamp-glow {
  animation: breathe 4.5s ease-in-out infinite;
}
@keyframes breathe {
  0%,
  100% {
    opacity: 0.85;
  }
  50% {
    opacity: 1;
  }
}

/* ---------- Scene: Paris ---------- */
.scene--paris .bulb {
  animation: twinkle 2.8s ease-in-out infinite;
}
.scene--paris .bulb:nth-child(2n) {
  animation-delay: 0.5s;
}
.scene--paris .bulb:nth-child(3n) {
  animation-delay: 1s;
}

/* ---------- Scene: Road trip ---------- */
.scene--roadtrip .route-line {
  transition: stroke-dashoffset 2.6s var(--ease-scene) 500ms;
}
.scene--roadtrip.is-active .route-line {
  stroke-dashoffset: 0;
}

.route-points text {
  font-family: var(--font-ui);
  opacity: 0;
  transition: opacity 600ms ease;
}
.scene--roadtrip.is-active .route-points text {
  opacity: 1;
  transition-delay: 2.4s;
}

.route-endpoint {
  animation: breathe 2.2s ease-in-out infinite;
}

/* ---------- Scene: Avenir ---------- */
.scene--avenir .stars--fade circle {
  fill: #fdf6e3;
  animation: twinkle 4s ease-in-out infinite;
}

/* ---------- Scene: Handball ---------- */
.scene--handball .gym-light {
  animation: breathe 3.6s ease-in-out infinite;
}
.scene--handball .gym-light:nth-child(2) {
  animation-delay: 1s;
}
.scene--handball .gym-light:nth-child(3) {
  animation-delay: 2s;
}

.scene--handball .hands-touch {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  transition: stroke-dashoffset 900ms var(--ease-scene) 700ms;
}
.scene--handball.is-active .hands-touch {
  stroke-dashoffset: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .scene-content {
    padding: 6vh 6vw 18vh;
  }
  .scene-message p {
    font-size: 1.4rem;
  }
  .scene-message--final p {
    font-size: 1.05rem;
  }
  .scene-caption {
    font-size: 0.85rem;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .scene,
  .scene-caption,
  .scene-message,
  .dot,
  .btn-next,
  .plane,
  .beam,
  .phone-lights circle,
  .lamp-glow,
  .bulb,
  .stars circle,
  .route-line,
  .route-endpoint,
  .gym-light,
  .hands-touch {
    animation: none !important;
    transition-duration: 200ms !important;
  }
  .scene.is-active .scene-caption,
  .scene.is-active .scene-message {
    opacity: 1;
    transform: none;
  }
  .scene--roadtrip.is-active .route-line {
    stroke-dashoffset: 0;
  }
  .route-points text {
    opacity: 1;
  }
  .scene--handball.is-active .hands-touch {
    stroke-dashoffset: 0;
  }
}
