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

:root {
  --red-1: #b00d2a;
  --red-2: #7a0a1e;
  --cream: #ffe9ec;
  --gold: #f4c95d;
}

html, body { height: 100%; }

body {
  font-family: "Playfair Display", Georgia, serif;
  background: #16060b;
  color: var(--cream);
  overflow: hidden; /* verrouillé jusqu'à l'ouverture */
}
body.revealed { overflow-y: auto; overflow-x: hidden; }

.screen {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
}
.hidden { display: none !important; }

/* ===================== 1. DIGICODE ===================== */
#lock {
  z-index: 100;
  background: radial-gradient(circle at 50% 38%, #fffdfc, #f1e6e3);
}
.lock-card {
  text-align: center;
  padding: 20px 28px 40px;
  animation: fadeUp .8s ease both;
}
.lock-heart {
  font-size: 3rem;
  line-height: 1;
  color: #d81f3c;
  filter: drop-shadow(0 4px 10px rgba(216,31,60,.28));
  animation: beat 1.6s ease-in-out infinite;
}
.pass-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 30px auto 14px;
  max-width: 320px;
}
.pass-wrap.shake { animation: shake .5s; }
.pass-input {
  flex: 1;
  min-width: 0;
  padding: 14px 18px;
  border: none;
  border-radius: 999px;
  background: #fff;
  color: #3a3a3a;
  font-family: "Playfair Display", Georgia, serif;
  font-size: 1.15rem;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  outline: none;
  letter-spacing: .04em;
}
.pass-input::placeholder { color: #c9a9ae; font-style: italic; }
.pass-input:focus { box-shadow: 0 4px 18px rgba(216,31,60,.28); }
.pass-btn {
  flex-shrink: 0;
  width: 52px; height: 52px;
  border: none;
  border-radius: 50%;
  background: #d81f3c;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(216,31,60,.35);
  transition: transform .08s ease, background .12s ease;
  -webkit-tap-highlight-color: transparent;
}
.pass-btn:active { transform: scale(.9); }
.pass-btn:disabled { opacity: .6; cursor: default; }
.pass-msg {
  min-height: 1.2em;
  font-size: .95rem;
  font-style: italic;
  color: #d81f3c;
  opacity: .9;
}

/* ===================== 2. FLEURS ===================== */
/* PAS de fond ici : ce sont les 2 portes qui cachent le portfolio.
   Sinon ce fond resterait au-dessus du portfolio pendant l'écartement
   et on ne verrait que du vide jusqu'à la suppression du stage. */
#flower-stage {
  background: transparent;
}
.flower-canvas {
  position: absolute;
  top: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;   /* suit la zone visible (barre d'URL mobile) */
  display: block;
}

/* Portes qui s'ouvrent (chaque moitié montre sa part du même champ) */
.door {
  position: fixed;
  top: 0;
  height: 100%;
  width: 50vw;
  overflow: hidden;
  /* dégradé ancré à l'écran (fixed) -> les 2 portes forment un seul dégradé
     centré, identique à celui du portfolio -> raccord invisible à l'ouverture */
  background: radial-gradient(circle at 50% 50%, #3a0d1a, #120409) fixed;
  transition: transform 1.4s cubic-bezier(.7,0,.3,1);
  z-index: 60;
}
.door-left  { left: 0; }
.door-right { right: 0; }
.door-left  .flower-canvas { left: 0; }
.door-right .flower-canvas { left: -50vw; }
#flower-stage.opening .door-left  { transform: translateX(-100%); }
#flower-stage.opening .door-right { transform: translateX(100%); }

/* ===================== 3. HERO / PHOTOS ===================== */
#gift {
  position: relative;
  z-index: 0;
  min-height: 100vh;
  min-height: 100dvh;
  /* même fond que la scène fleurs -> continuité à l'ouverture des portes */
  background: radial-gradient(circle at 50% 50%, #3a0d1a, #120409);
  background-attachment: fixed;
}
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.collage { position: absolute; inset: 0; }
.photo-card {
  position: absolute;
  width: clamp(64px, 12vw, 118px);
  border: 4px solid rgba(255, 255, 255, .8);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  object-fit: cover;
  aspect-ratio: 3/4;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.85) rotate(var(--rot, 0deg));
  animation: photoIn .7s ease forwards;
  animation-delay: var(--pdelay, 0s);
}
.hero-center {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 20px;
  background: radial-gradient(circle, rgba(18,4,9,.55) 42%, transparent 72%);
}
.love {
  font-family: "Dancing Script", cursive;
  font-size: clamp(3.2rem, 12vw, 7rem);
  color: #fff;
  text-shadow: 0 4px 18px rgba(0,0,0,.4);
  line-height: 1;
}
.love-sub {
  margin-top: 10px;
  font-style: italic;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
  opacity: .9;
}
.scroll-cue {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  font-size: .95rem;
  letter-spacing: .05em;
  opacity: .8;
  animation: bob 1.8s ease-in-out infinite;
}

/* ===================== 4. LETTRE ===================== */
.section-title {
  font-family: "Dancing Script", cursive;
  font-size: clamp(2.4rem, 8vw, 4rem);
  color: var(--gold);
  text-align: center;
  margin-bottom: 26px;
}
.letter-section {
  padding: 90px 24px;
  display: flex;
  justify-content: center;
}
.letter {
  max-width: 620px;
  width: 100%;
  padding: 46px clamp(24px, 6vw, 54px);
  border: 1px solid rgba(244, 201, 93, .35);
  border-radius: 16px;
  background: rgba(255, 255, 255, .035);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  font-family: "Dancing Script", cursive;
  color: var(--cream);
  text-align: center;
}
.poem-text {
  white-space: pre-line;
  font-family: "Dancing Script", cursive;
  font-size: clamp(1.5rem, 5.5vw, 2.1rem);
  line-height: 1.8;
  color: var(--cream);
  text-align: center;
  /* réserve la hauteur -> pas de saut de mise en page pendant la frappe */
  min-height: clamp(260px, 42vh, 400px);
}
.poem-text.typing::after {
  content: "▌";
  color: var(--gold);
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

/* ===================== 5. MUSIQUES ===================== */
.music-section {
  padding: 60px 24px 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.music-intro { opacity: .85; margin-bottom: 26px; font-style: italic; }
.tracks {
  width: 100%;
  max-width: 760px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
}
.track {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--cream);
  text-decoration: none;
  transition: background .15s ease, transform .1s ease;
}
.track:active, .track:hover { background: rgba(255,255,255,.16); transform: translateY(-2px); }
.track-cover {
  width: 60px; height: 60px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0,0,0,.4);
}
.track-meta { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.track-meta b { font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-meta small { opacity: .7; font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.track-play { font-size: 1.15rem; opacity: .8; flex-shrink: 0; }

/* ===================== 6. FINAL (cœurs) ===================== */
.final-section {
  position: relative;
  min-height: 90vh;
  min-height: 90dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 40px 24px;
}
.hearts { position: absolute; inset: 0; pointer-events: none; }
.float-heart {
  position: absolute;
  color: #e23b57;
  opacity: 0;
  animation: floatHeart linear infinite;
  will-change: transform, opacity;
}
.final-msg {
  position: relative;
  z-index: 2;
  font-family: "Dancing Script", cursive;
  font-size: clamp(2.2rem, 8vw, 4.4rem);
  color: #fff;
  text-align: center;
  text-shadow: 0 4px 20px rgba(0,0,0,.5);
  max-width: 800px;
  line-height: 1.2;
}

/* ===================== ANIMATIONS ===================== */
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-12px); }
  40% { transform: translateX(12px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes photoIn {
  /* opacité finale basse -> photos en fond discret, le texte ressort devant */
  to { opacity: .38; transform: translate(-50%, -50%) scale(1) rotate(var(--rot, 0deg)); }
}
@keyframes bob {
  0%,100% { transform: translateX(-50%) translateY(0); }
  50%     { transform: translateX(-50%) translateY(8px); }
}
@keyframes beat {
  0%,100% { transform: scale(1); }
  30%     { transform: scale(1.25); }
}
@keyframes floatHeart {
  0%,100% { transform: translateY(0) scale(var(--s, 1));            opacity: .22; }
  50%     { transform: translateY(-12px) scale(calc(var(--s, 1) * 1.15)); opacity: .6; }
}
@keyframes blink { 50% { opacity: 0; } }

/* Respecte les gens qui coupent les animations
   (les fleurs canvas sont gérées côté JS via REDUCED) */
@media (prefers-reduced-motion: reduce) {
  .photo-card { animation-duration: .3s; }
  .float-heart { animation: none; opacity: .4; }
  .scroll-cue, .footer-heart, .lock-heart { animation: none; }
}

/* Mobile : collage plus simple */
@media (max-width: 620px) {
  .keypad { grid-template-columns: repeat(3, 68px); gap: 14px; }
  .key { height: 68px; }
}
