/* ════════════════════════════════════════════════════════
   HORIZON — journal de mission HF-2260
   Palette tirée du footage : nuit chaude + accrétion
   ════════════════════════════════════════════════════════ */

:root {
  --void:   #060302;
  --ember:  #ff7a1a;
  --photon: #ffd9a0;
  --bone:   #f2ece3;
  --ash:    #93857a;

  --f-display: "Unbounded", sans-serif;
  --f-serif:   "Cormorant Garamond", serif;
  --f-mono:    "Space Mono", monospace;
}

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

html { scroll-behavior: auto; }

body {
  background: var(--void);
  color: var(--bone);
  font-family: var(--f-serif);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--ember); color: var(--void); }

/* ─── Préloader ─────────────────────────────────────────── */

#preloader {
  position: fixed; inset: 0; z-index: 100;
  background: var(--void);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 1.1s ease, visibility 1.1s;
}
#preloader.done { opacity: 0; visibility: hidden; }

.pre-inner { text-align: center; width: min(420px, 78vw); }

.pre-eyebrow {
  font-family: var(--f-mono); font-size: 0.6875rem;
  letter-spacing: 0.35em; color: var(--ash);
  margin-bottom: 2.2rem;
}
.pre-pct {
  font-family: var(--f-display); font-weight: 300;
  font-size: clamp(3.5rem, 10vw, 5.5rem);
  color: var(--bone); line-height: 1;
  font-variant-numeric: tabular-nums;
}
.pre-sym { font-size: 0.35em; color: var(--ember); margin-left: 0.15em; }

.pre-bar {
  height: 1px; background: rgba(242, 236, 227, 0.14);
  margin: 2.4rem 0 1.2rem;
}
#pre-fill {
  height: 100%; width: 0%;
  background: var(--ember);
  box-shadow: 0 0 12px var(--ember);
  transition: width 0.25s ease;
}
.pre-label {
  font-family: var(--f-mono); font-size: 0.625rem;
  letter-spacing: 0.3em; color: var(--ash);
}

/* ─── Scène fixe ────────────────────────────────────────── */

#stage {
  position: fixed; inset: 0; z-index: 1;
  pointer-events: none;
  visibility: hidden;
}
#stage.live { visibility: visible; }

.layer { position: absolute; inset: 0; overflow: hidden; }

.layer video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}

#layer-v1 { will-change: clip-path, opacity; }
#layer-v2 video { will-change: transform; }
#layer-v2 { display: none; }

#whiteflash {
  position: absolute; inset: 0;
  background: #fff;
  opacity: 0;
}

#iris-ring {
  position: absolute;
  border: 1px solid var(--photon);
  border-radius: 50%;
  box-shadow: 0 0 24px rgba(255, 122, 26, 0.55), inset 0 0 18px rgba(255, 217, 160, 0.35);
  opacity: 0;
  transform: translate(-50%, -50%);
}

#blackout {
  position: absolute; inset: 0;
  background: var(--void);
  opacity: 0;
}

/* ─── Légendes ──────────────────────────────────────────── */

#captions { position: absolute; inset: 0; }

.cap {
  position: absolute;
  opacity: 0;
  max-width: min(520px, 82vw);
}
.cap-mono {
  font-family: var(--f-mono); font-size: 0.6875rem;
  letter-spacing: 0.3em; color: var(--ember);
  margin-bottom: 0.9rem;
  text-shadow: 0 1px 6px rgba(6, 3, 2, 0.95), 0 0 20px rgba(6, 3, 2, 0.8);
}
.cap-serif {
  font-family: var(--f-serif); font-style: italic; font-weight: 400;
  font-size: clamp(1.6rem, 3.2vw, 2.6rem);
  line-height: 1.25; color: var(--bone);
  text-shadow: 0 2px 24px rgba(6, 3, 2, 0.9);
}
.cap-big { font-size: clamp(2.2rem, 5vw, 4rem); }

.cap-flash .cap-serif { color: #3a2c1e; text-shadow: none; }

.pos-bl { left: clamp(1.5rem, 6vw, 7rem); bottom: 16vh; }
.pos-br { right: clamp(1.5rem, 6vw, 7rem); bottom: 16vh; text-align: right; }
.pos-tl { left: clamp(1.5rem, 6vw, 7rem); top: 16vh; }
.pos-tr { right: clamp(1.5rem, 6vw, 7rem); top: 16vh; text-align: right; }
.pos-c  { left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; }
.pos-bc { left: 50%; bottom: 14vh; transform: translateX(-50%); text-align: center; }

/* ─── Hero ──────────────────────────────────────────────── */

#hero {
  position: relative; z-index: 2;
  height: 100vh; height: 100svh;
  background: var(--void);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}

.starfield { position: absolute; inset: 0; width: 100%; height: 100%; }

.hero-inner { position: relative; text-align: center; padding: 0 1.5rem; }

.hero-eyebrow {
  font-family: var(--f-mono); font-size: 0.6875rem;
  letter-spacing: 0.4em; color: var(--ash);
  margin-bottom: 3rem;
}

.hero-title {
  font-family: var(--f-display); font-weight: 900;
  font-size: clamp(3rem, 12.5vw, 11rem);
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--bone);
  overflow: hidden;
}
.hero-title .lt {
  display: inline-block;
  transform: translateY(115%);
  transition: transform 1s cubic-bezier(0.2, 0.7, 0.2, 1);
}
body.entered .hero-title .lt { transform: translateY(0); }
.hero-title .lt:nth-child(1) { transition-delay: 0.05s; }
.hero-title .lt:nth-child(2) { transition-delay: 0.12s; }
.hero-title .lt:nth-child(3) { transition-delay: 0.19s; }
.hero-title .lt:nth-child(4) { transition-delay: 0.26s; }
.hero-title .lt:nth-child(5) { transition-delay: 0.33s; }
.hero-title .lt:nth-child(6) { transition-delay: 0.40s; }
.hero-title .lt:nth-child(7) { transition-delay: 0.47s; }

.o-ring {
  color: transparent;
  -webkit-text-stroke: 2px var(--ember);
  text-shadow: 0 0 32px rgba(255, 122, 26, 0.45);
}

.hero-sub {
  font-family: var(--f-serif); font-style: italic;
  font-size: clamp(1.2rem, 2.4vw, 1.75rem);
  color: var(--ash);
  margin-top: 2.4rem;
}

.reveal {
  opacity: 0; transform: translateY(18px);
  transition: opacity 1.2s ease 0.7s, transform 1.2s ease 0.7s;
}
body.entered .reveal { opacity: 1; transform: none; }

.scroll-hint {
  position: absolute; bottom: 0; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 1rem;
}
.hint-txt {
  font-family: var(--f-mono); font-size: 0.625rem;
  letter-spacing: 0.35em; color: var(--ash);
}
.hint-line {
  width: 1px; height: 72px;
  background: linear-gradient(to bottom, var(--ember), transparent);
  animation: hintdrop 2.2s ease-in-out infinite;
  transform-origin: top;
}
@keyframes hintdrop {
  0%   { transform: scaleY(0); }
  45%  { transform: scaleY(1); }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ─── Espaceur ──────────────────────────────────────────── */

#journey { height: 1100vh; position: relative; z-index: 0; }

/* ─── Finale ────────────────────────────────────────────── */

#finale {
  position: relative; z-index: 2;
  min-height: 100vh;
  background: var(--void);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  padding: 4rem 1.5rem;
}
.finale-inner { position: relative; text-align: center; }

.fin-mono {
  font-family: var(--f-mono); font-size: 0.6875rem;
  letter-spacing: 0.4em; color: var(--ash);
  margin-bottom: 2.5rem;
}
.fin-title {
  font-family: var(--f-display); font-weight: 700;
  font-size: clamp(2.2rem, 7vw, 5.5rem);
  line-height: 1.12; color: var(--bone);
}
.fin-serif {
  font-family: var(--f-serif); font-style: italic;
  font-size: clamp(1.15rem, 2.2vw, 1.6rem);
  color: var(--ash);
  margin-top: 2rem;
}
#replay {
  margin-top: 3.5rem;
  font-family: var(--f-mono); font-size: 0.75rem;
  letter-spacing: 0.3em;
  color: var(--photon);
  background: none;
  border: 1px solid rgba(255, 122, 26, 0.45);
  border-radius: 999px;
  padding: 1.1rem 2.4rem;
  cursor: pointer;
  transition: background 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}
#replay:hover, #replay:focus-visible {
  background: var(--ember); color: var(--void);
  box-shadow: 0 0 42px rgba(255, 122, 26, 0.5);
}
#replay:focus-visible { outline: 2px solid var(--photon); outline-offset: 4px; }

.fin-credit {
  font-family: var(--f-mono); font-size: 0.625rem;
  letter-spacing: 0.18em; color: rgba(147, 133, 122, 0.55);
  margin-top: 4.5rem;
}

/* ─── HUD ───────────────────────────────────────────────── */

#hud {
  position: fixed; inset: 0; z-index: 10;
  pointer-events: none;
  font-family: var(--f-mono);
  opacity: 0;
  transition: opacity 1.4s ease 1s;
}
body.entered #hud { opacity: 1; }

.hud-tl {
  position: absolute; top: 1.6rem; left: 1.8rem;
  display: flex; align-items: center; gap: 1.4rem;
}
.hud-mark {
  font-family: var(--f-display); font-weight: 700;
  font-size: 0.75rem; letter-spacing: 0.3em; color: var(--bone);
}
.hud-rec {
  font-size: 0.5625rem; letter-spacing: 0.25em; color: var(--ash);
  display: flex; align-items: center; gap: 0.5rem;
}
.hud-rec i {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ember);
  animation: blink 1.6s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0.15; } }

.hud-tr {
  position: absolute; top: 1.6rem; right: 1.8rem;
  text-align: right;
  display: flex; flex-direction: column; gap: 0.45rem;
}
#hud-clock {
  font-size: 0.8125rem; color: var(--bone);
  font-variant-numeric: tabular-nums; letter-spacing: 0.12em;
}
#hud-tele {
  font-size: 0.5625rem; letter-spacing: 0.22em; color: var(--ember);
  font-variant-numeric: tabular-nums;
}

.hud-rail {
  position: absolute; right: 1.8rem; top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 1.6rem;
}
.rail-item {
  font-size: 0.5625rem; letter-spacing: 0.22em;
  color: rgba(147, 133, 122, 0.5);
  display: flex; align-items: center; justify-content: flex-end; gap: 0.7rem;
  transition: color 0.5s ease;
}
.rail-item i {
  width: 5px; height: 5px; border-radius: 50%;
  background: currentColor;
  transition: box-shadow 0.5s ease;
}
.rail-item.on { color: var(--photon); }
.rail-item.on i { box-shadow: 0 0 10px var(--ember); background: var(--ember); }

#hud-progress {
  position: absolute; bottom: 0; left: 0;
  height: 2px; width: 0%;
  background: var(--ember);
  box-shadow: 0 0 10px rgba(255, 122, 26, 0.7);
}

/* ─── Grain + vignette cinéma ───────────────────────────── */

#film {
  position: fixed; inset: 0; z-index: 9;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 58%, rgba(6, 3, 2, 0.5) 100%);
}
#film::after {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
  opacity: 0.055;
  mix-blend-mode: overlay;
}

/* ─── Responsive ────────────────────────────────────────── */

@media (max-width: 768px) {
  .hud-rail { display: none; }
  .hud-tl { left: 1.1rem; top: 1.1rem; }
  .hud-tr { right: 1.1rem; top: 1.1rem; }
  .pos-bl, .pos-br, .pos-tl, .pos-tr { bottom: auto; top: auto; }
  .pos-bl, .pos-br { bottom: 12vh; }
  .pos-tl, .pos-tr { top: 12vh; }
  #journey { height: 900vh; }
}

/* ─── Mouvement réduit ──────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .hint-line, .hud-rec i { animation: none; }
  .hero-title .lt, .reveal, #preloader, #hud { transition: none; }
}
