/* =====================================================
   MAIN.CSS — Gate & Timeline
   ===================================================== */

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

:root {
  --bg:          #080814;
  --gold:        #c8a96e;
  --gold-light:  #e4c890;
  --gold-dim:    rgba(200,169,110,0.15);
  --gold-glow:   rgba(200,169,110,0.35);
  --cream:       #f0e6d3;
  --muted:       rgba(240,230,211,0.45);
  --radius:      12px;
}

html, body { width: 100%; height: 100%; overflow: hidden; }

/* =====================================================
   ISLAMIC PATTERN OVERLAY (très subtil)
   ===================================================== */
.pattern-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'%3E%3Cg fill='none' stroke='%23c8a96e' stroke-width='0.6' opacity='0.11'%3E%3Cpolygon points='60,8 72,36 102,36 79,55 88,83 60,66 32,83 41,55 18,36 48,36'/%3E%3Cpolygon points='60,22 68,40 88,40 73,52 79,70 60,59 41,70 47,52 32,40 52,40'/%3E%3Ccircle cx='60' cy='60' r='3' fill='%23c8a96e' opacity='0.08'/%3E%3Cline x1='0' y1='0' x2='120' y2='120' stroke-width='0.3' opacity='0.06'/%3E%3Cline x1='120' y1='0' x2='0' y2='120' stroke-width='0.3' opacity='0.06'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 120px 120px;
}

/* =====================================================
   FLOATING STARS
   ===================================================== */
.stars { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
.star {
  position: absolute; border-radius: 50%; background: #fff;
  animation: twinkle var(--dur, 3s) ease-in-out infinite var(--delay, 0s);
}
@keyframes twinkle {
  0%,100% { opacity: var(--min-op,.08); transform: scale(1); }
  50%      { opacity: var(--max-op,.7);  transform: scale(1.4); }
}

/* =====================================================
   ██████  GATE PAGE
   ===================================================== */
.gate-body {
  background-color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Lato', sans-serif;
  position: relative; min-height: 100vh;
}

/* Moon */
.moon-container {
  position: relative; width: 100px; height: 100px;
  margin: 0 auto 2.8rem;
}
.moon {
  width: 100px; height: 100px;
  filter: drop-shadow(0 0 22px rgba(200,169,110,0.45));
  animation: moonFloat 7s ease-in-out infinite;
}
@keyframes moonFloat {
  0%,100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}
.moon-star-1, .moon-star-2 {
  position: absolute; color: var(--gold); animation: starPulse 2.5s ease-in-out infinite;
}
.moon-star-1 { top: 8px; right: -8px; font-size: 13px; }
.moon-star-2 { bottom: 14px; right: -18px; font-size: 9px; animation-delay: 1.2s; }
@keyframes starPulse {
  0%,100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.3); }
}

/* Gate container */
.gate-container {
  position: relative; z-index: 2; text-align: center;
  padding: 2rem 1.5rem; max-width: 560px; width: 100%;
}

/* Ornament */
.ornament {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin: 1.8rem 0; color: rgba(200,169,110,0.35);
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
}
.ornament::before, .ornament::after {
  content: ''; flex: 1; max-width: 70px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(200,169,110,0.3), transparent);
}

/* Typewriter phrase */
.gate-phrase { margin-bottom: 2.8rem; min-height: 90px; }
.typewriter {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1.15rem, 2.8vw, 1.65rem);
  font-style: italic; color: var(--cream);
  line-height: 1.65; letter-spacing: 0.4px;
}
.cursor {
  display: inline-block; width: 2px; height: 1.2em;
  background: var(--gold); margin-left: 3px;
  vertical-align: middle;
  animation: cursorBlink 0.85s step-end infinite;
}
@keyframes cursorBlink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Input */
.gate-form { transition: opacity 0.6s ease; }
.input-wrapper {
  display: flex; align-items: center; gap: 0;
  border: 1px solid rgba(200,169,110,0.3);
  border-radius: 50px; padding: 5px 5px 5px 26px;
  max-width: 300px; margin: 0 auto 1rem;
  background: rgba(200,169,110,0.04);
  backdrop-filter: blur(12px);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.input-wrapper:focus-within {
  border-color: rgba(200,169,110,0.7);
  box-shadow: 0 0 24px rgba(200,169,110,0.18);
}
.input-wrapper.shake { animation: shake 0.4s ease; }
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%      { transform: translateX(-9px); }
  40%      { transform: translateX(9px); }
  60%      { transform: translateX(-6px); }
  80%      { transform: translateX(6px); }
}

.key-input {
  background: none; border: none; outline: none;
  color: var(--cream); font-size: 1.05rem;
  font-family: 'Lato', sans-serif; letter-spacing: 5px;
  width: 150px; text-align: center;
}
.key-input::placeholder { letter-spacing: 7px; color: var(--muted); font-size: 1.2rem; }

.key-btn {
  background: var(--gold); border: none; border-radius: 50%;
  width: 42px; height: 42px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.key-btn svg { width: 18px; height: 18px; stroke: var(--bg); }
.key-btn:hover { background: var(--gold-light); box-shadow: 0 0 14px rgba(200,169,110,0.4); }
.key-btn:active { transform: scale(0.92); }

.gate-hint { color: var(--muted); font-size: 0.78rem; font-style: italic; margin-bottom: 0.4rem; }
.gate-error { color: #e07a7a; font-size: 0.82rem; min-height: 1.2em; }

/* Gate transition overlay */
.gate-transition {
  position: fixed; inset: 0; z-index: 100; background: var(--bg);
  transform: scaleY(0); transform-origin: bottom; pointer-events: none;
}

/* =====================================================
   ██████  TIMELINE PAGE
   ===================================================== */
.timeline-body {
  background-color: var(--bg);
  font-family: 'Lato', sans-serif;
  position: relative; overflow: hidden;
  width: 100vw; height: 100vh;
}

/* Music toggle */
.music-btn {
  position: fixed; top: 20px; right: 20px; z-index: 50;
  background: rgba(200,169,110,0.12); border: 1px solid rgba(200,169,110,0.25);
  border-radius: 50%; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; backdrop-filter: blur(8px);
  transition: background 0.2s, border-color 0.2s;
  color: var(--gold); font-size: 16px;
}
.music-btn:hover { background: rgba(200,169,110,0.22); border-color: rgba(200,169,110,0.5); }

/* Progress dots */
.progress-dots {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 7px; z-index: 50;
}
.dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(200,169,110,0.3); transition: all 0.4s ease;
}
.dot.active { background: var(--gold); transform: scale(1.4); }
.dot.done   { background: rgba(200,169,110,0.55); }

/* Click hint */
.click-hint {
  position: fixed; bottom: 55px; left: 50%; transform: translateX(-50%);
  color: var(--muted); font-size: 0.72rem; letter-spacing: 2.5px;
  text-transform: uppercase; z-index: 50;
  animation: hintPulse 2.5s ease-in-out infinite;
}
@keyframes hintPulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.9; } }

/* =====================================================
   SLIDE BASE
   ===================================================== */
.slide {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
}
.slide.active { opacity: 1; pointer-events: all; }

.slide-media {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.slide-media img,
.slide-media video {
  max-width: 85vw; max-height: 78vh;
  object-fit: contain; border-radius: 4px;
  display: block;
}

/* Placeholder for empty slots */
.media-placeholder {
  width: min(500px, 82vw); height: min(340px, 55vh);
  border: 1px solid rgba(200,169,110,0.18);
  border-radius: 8px;
  background: rgba(200,169,110,0.03);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px;
  color: rgba(200,169,110,0.3);
}
.media-placeholder svg { width: 48px; height: 48px; opacity: 0.4; }
.media-placeholder span { font-size: 0.75rem; letter-spacing: 2px; text-transform: uppercase; }

/* Caption area */
.slide-caption {
  position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
  text-align: center; width: 90%; max-width: 680px; z-index: 10;
}
.slide-date {
  font-size: 0.72rem; letter-spacing: 3px; text-transform: uppercase;
  color: var(--gold); margin-bottom: 8px; opacity: 0;
}
.slide-phrase {
  font-family: 'Playfair Display', serif;
  font-size: clamp(1rem, 2.5vw, 1.5rem);
  font-style: italic; color: var(--cream);
  line-height: 1.6; opacity: 0;
}

/* =====================================================
   CURTAIN (élément 1)
   ===================================================== */
.curtain-left, .curtain-right {
  position: fixed; top: 0; height: 100%; width: 50%;
  background: var(--bg); z-index: 30;
}
.curtain-left  { left: 0; transform-origin: left; }
.curtain-right { right: 0; transform-origin: right; }

.curtain-fold {
  position: absolute; top: 0; height: 100%; width: 30px;
  background: linear-gradient(90deg, rgba(200,169,110,0.1), transparent);
}
.curtain-left  .curtain-fold { right: 0; }
.curtain-right .curtain-fold { left: 0; transform: scaleX(-1); }

/* =====================================================
   ÉLÉMENT 17 — EXCEPTIONNEL
   ===================================================== */
#special-canvas {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0;
}

.special-frame {
  position: relative; display: inline-block;
}
.special-frame::before {
  content: '';
  position: absolute; inset: -8px;
  border-radius: 6px;
  background: linear-gradient(45deg, var(--gold), transparent, var(--gold-light), transparent, var(--gold));
  background-size: 400% 400%;
  animation: shimmerBorder 3s ease infinite;
  z-index: -1;
  filter: blur(8px);
}
@keyframes shimmerBorder {
  0%,100% { background-position: 0% 50%; }
  50%      { background-position: 100% 50%; }
}
.special-phrase {
  text-shadow: 0 0 30px rgba(200,169,110,0.6), 0 0 60px rgba(200,169,110,0.3);
}

/* Flash overlay */
.flash-overlay {
  position: fixed; inset: 0; z-index: 25;
  background: white; opacity: 0; pointer-events: none;
}

/* =====================================================
   TRANSITION: Venetian Blinds
   ===================================================== */
.blinds-container {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; display: flex;
}
.blind { flex: 1; background: var(--bg); transform-origin: top; }

/* =====================================================
   TRANSITION: Iris
   ===================================================== */
.iris-overlay {
  position: fixed; inset: 0; z-index: 20; pointer-events: none;
  background: var(--bg);
  clip-path: circle(0% at 50% 50%);
}

/* =====================================================
   TRANSITION: Light Leak
   ===================================================== */
.light-leak {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,250,240,0.95) 50%, transparent 100%);
  transform: translateX(-100%);
}

/* =====================================================
   TRANSITION: Film Burn
   ===================================================== */
.film-burn {
  position: fixed; inset: 0; z-index: 20; pointer-events: none; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255,180,60,0.9) 0%, rgba(200,80,20,0.8) 40%, transparent 70%);
}

/* =====================================================
   FILM GRAIN overlay (éléments 19-20)
   ===================================================== */
.grain-overlay {
  position: fixed; inset: 0; z-index: 15; pointer-events: none; opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  animation: grainShift 0.15s steps(1) infinite;
}
@keyframes grainShift { 0%{background-position:0 0} 25%{background-position:-30px 15px} 50%{background-position:20px -10px} 75%{background-position:-15px -25px} }

/* =====================================================
   POLAROID
   ===================================================== */
.polaroid-wrap {
  background: #fff; padding: 18px 18px 60px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  transform: rotate(-1.5deg); border-radius: 2px;
  filter: brightness(0) contrast(0);
}
.polaroid-wrap img { display: block; max-width: 60vw; max-height: 50vh; }

/* =====================================================
   FINAL slide (#20)
   ===================================================== */
.final-stars {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
}
.final-star {
  position: absolute; border-radius: 50%; background: var(--gold);
  animation: finalStarFloat var(--dur, 8s) ease-in-out infinite var(--delay, 0s);
  opacity: 0;
}
@keyframes finalStarFloat {
  0%   { opacity: 0; transform: translateY(0) scale(0); }
  20%  { opacity: 0.8; transform: translateY(-20px) scale(1); }
  80%  { opacity: 0.6; transform: translateY(-60px) scale(0.8); }
  100% { opacity: 0; transform: translateY(-120px) scale(0.3); }
}

/* =====================================================
   ADMIN CSS (inline minimal)
   ===================================================== */
