/* ============================================================
   Anaïs & Miller — "Aurore infinie"
   Un ciel de nuit qui ne s'arrête jamais de bouger : dégradé
   d'aurore en boucle, constellation de cœurs qui dérive sans fin,
   pulsation douce du titre. L'enveloppe est reconstruite en
   clip-path (pourcentages), donc elle ne casse plus, à aucune
   largeur d'écran.
   ============================================================ */

:root{
  --night:      #120c22;
  --night-mid:  #1d1533;
  --violet:     #3a1f4d;
  --magenta:    #ff4d80;
  --magenta-soft:#ff8fb0;
  --gold:       #ffd27a;
  --gold-soft:  #ffe9c2;
  --cream:      #fff7ef;
  --paper:      #fffaf3;
  --ink:        #2c2036;
  --ink-soft:   #6b5d72;

  --serif: "Playfair Display", Georgia, serif;
  --sans:  "DM Sans", Arial, sans-serif;

  --shadow-soft: 0 20px 60px rgba(30,10,40,.25);
  --shadow-deep: 0 32px 84px rgba(15,5,25,.45);
  --ease: cubic-bezier(.22,1,.36,1);
}

*{ box-sizing: border-box; }
html{ scroll-behavior: smooth; }
body{
  margin: 0;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  overflow-x: hidden;
}
::selection{ background: var(--magenta); color: #fff; }
.sr-only{ position:absolute; width:1px; height:1px; padding:0; clip:rect(0,0,0,0); overflow:hidden; white-space:nowrap; }

.noise{
  position: fixed; inset: 0; opacity: .04; pointer-events: none; z-index: 50; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

/* ---------- Header ---------- */
.site-header{
  position: absolute; z-index: 20; top: 0; left: 0; width: 100%;
  padding: 26px clamp(20px,5vw,72px);
  display: flex; justify-content: space-between; align-items: center; color: #fff;
}
.brand{ color: #fff; text-decoration: none; letter-spacing: 2px; font: 600 22px var(--serif); display: inline-flex; align-items: center; gap: 6px; }
.brand span{ color: var(--magenta-soft); animation: beat 2.2s ease-in-out infinite; display: inline-block; }
.sound-toggle{
  color: #fff; border: 1px solid rgba(255,255,255,.3); background: rgba(255,255,255,.08);
  backdrop-filter: blur(10px); border-radius: 30px; padding: 10px 16px; font: 500 12px var(--sans);
  letter-spacing: .3px; cursor: pointer; transition: background .35s var(--ease), border-color .35s, transform .35s var(--ease);
}
.sound-toggle:hover{ transform: translateY(-2px); border-color: rgba(255,255,255,.55); }
.sound-toggle.active{ background: linear-gradient(135deg, var(--magenta), var(--gold)); border-color: transparent; box-shadow: 0 10px 26px rgba(255,77,128,.4); }
.sound-toggle span + span{ margin-left: 6px; }

/* ---------- Loader ---------- */
#loader{ position: fixed; inset: 0; z-index: 100; background: var(--night); color: #fff; display: grid; place-content: center; text-align: center; transition: opacity .9s var(--ease), visibility .9s var(--ease); }
#loader.done{ opacity: 0; visibility: hidden; }
.loader-heart{ display:block; color: var(--magenta-soft); font-size: 40px; animation: beat 1.1s infinite; filter: drop-shadow(0 0 18px rgba(255,143,176,.6)); }
.loader-heart + p{ font: 600 clamp(32px,5vw,54px) var(--serif); margin: 14px 0 8px; }
.loader-heart + p i{ color: var(--gold); font-style: italic; }
#loader small{ opacity: .6; letter-spacing: .6px; }

.scene{ background: var(--night-mid); color: #fff; position: relative; overflow: hidden; }

/* ============================================================
   HERO — animations en boucle infinie
   ============================================================ */
.hero{
  min-height: 100svh; display: grid; place-items: center; padding: 120px 20px 80px;
  position: relative;
  background: linear-gradient(125deg, var(--night) 0%, var(--violet) 35%, #4a1f3f 55%, var(--night) 100%);
  background-size: 300% 300%;
  animation: aurora 18s ease-in-out infinite;
}
/* Constellation de cœurs qui dérive sans fin — pur CSS, aucun DOM ajouté */
.hero:before{
  content: "";
  position: absolute; inset: -20% -10%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Ctext x='10' y='40' font-size='22' fill='%23ff8fb0' opacity='0.35'%3E%E2%99%A5%3C/text%3E%3Ctext x='140' y='120' font-size='14' fill='%23ffd27a' opacity='0.3'%3E%E2%9C%A6%3C/text%3E%3Ctext x='60' y='170' font-size='17' fill='%23ff4d80' opacity='0.28'%3E%E2%99%A5%3C/text%3E%3Ctext x='180' y='30' font-size='12' fill='%23fff' opacity='0.25'%3E%E2%9C%A6%3C/text%3E%3C/svg%3E");
  background-size: 220px 220px;
  animation: drift-up 26s linear infinite;
  opacity: .8; pointer-events: none;
}
.hero:after, .finale:after{ content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, var(--night)); pointer-events: none; }

.hero-inner{ position: relative; z-index: 2; text-align: center; max-width: 900px; }
.eyebrow{ text-transform: uppercase; letter-spacing: 3px; font-size: 11px; font-weight: 700; color: var(--magenta-soft); margin: 0 0 16px; }
.hero .eyebrow, .finale .eyebrow{ color: var(--gold-soft); }

.hero h1{
  font: 600 clamp(56px,10vw,116px)/.95 var(--serif); margin: 0; letter-spacing: -.01em;
  color: #fff; animation: glow-pulse 4s ease-in-out infinite;
}
.hero h1 em{ font-weight: 500; font-style: italic; color: var(--magenta-soft); }

.hero-quote{ font: 400 clamp(18px,2.3vw,25px)/1.6 var(--serif); margin: 32px auto 38px; max-width: 620px; color: #f7eefa; }
.hero-quote strong{ font-weight: 600; font-style: italic; color: var(--gold-soft); }

.button{ display: inline-flex; align-items: center; gap: 16px; padding: 16px 26px; border-radius: 99px; text-decoration: none; font: 600 14px var(--sans); letter-spacing: .2px; position: relative; transition: transform .4s var(--ease), box-shadow .4s var(--ease); }
.button-primary{
  background: linear-gradient(135deg, var(--magenta), #c9367f); box-shadow: 0 14px 34px rgba(255,77,128,.4);
  color: #fff; border: 0; cursor: pointer; animation: float-y 3.2s ease-in-out infinite;
}
.button-primary span{ display: inline-block; transition: transform .4s var(--ease); }
.button-primary:hover{ transform: translateY(-4px) scale(1.02); box-shadow: 0 20px 44px rgba(255,77,128,.55); }
.button-primary:hover span{ transform: translateY(4px); }

.hint{ font-size: 11px; opacity: .6; margin: 36px 0 0; letter-spacing: .3px; }

.scroll-line{ position: absolute; bottom: 30px; width: 1px; height: 40px; z-index: 3; background: linear-gradient(180deg, transparent, rgba(255,255,255,.7)); animation: scroll-hint 2.2s ease infinite; }

.orb{ position: absolute; border-radius: 50%; filter: blur(4px); opacity: .75; will-change: transform; }
.orb-one{ width: 44vw; height: 44vw; background: radial-gradient(circle, rgba(255,77,128,.45), transparent 70%); top: -22vw; left: -12vw; animation: drift-one 14s ease-in-out infinite alternate; }
.orb-two{ width: 38vw; height: 38vw; background: radial-gradient(circle, rgba(58,31,77,.6), transparent 70%); bottom: -24vw; right: -8vw; animation: drift-two 17s ease-in-out infinite alternate; }
.orb-three{ width: 14vw; height: 14vw; background: radial-gradient(circle, rgba(255,210,122,.4), transparent 70%); top: 22%; right: 12%; animation: drift-three 10s ease-in-out infinite alternate; }

#stars{
  position: absolute; inset: 0; opacity: .5;
  background-image: radial-gradient(#fff 1px, transparent 1.5px), radial-gradient(#fff 1px, transparent 1.5px), radial-gradient(rgba(255,255,255,.7) 1px, transparent 1.5px);
  background-size: 60px 60px, 110px 110px, 150px 150px;
  background-position: 4px 14px, 30px 60px, 80px 20px;
  animation: twinkle 6s ease infinite;
}

/* ---------- Section shell ---------- */
.section{ padding: 120px max(20px,7vw); position: relative; }
.section-intro{ text-align: center; margin: 0 auto 58px; max-width: 680px; }
.section-intro h2{ font: 600 clamp(38px,5vw,64px)/1.05 var(--serif); margin: 0 0 16px; letter-spacing: -.01em; }
.section-intro > p:not(.eyebrow){ margin: 0; color: var(--ink-soft); font-size: 16px; }

/* ============================================================
   WELCOME / ENVELOPPE — reconstruite en clip-path (%),
   donc parfaitement fluide, aucun breakpoint requis.
   ============================================================ */
.welcome{ background: linear-gradient(150deg, #fdeaf0 0%, #fbdcee 45%, #ece0f5 100%); min-height: 680px; position: relative; }
.welcome:before{ content: ""; position: absolute; inset: 0; opacity: .5; pointer-events: none; background-image: radial-gradient(rgba(255,77,128,.14) 1px, transparent 1.5px); background-size: 30px 30px; }

.envelope-wrap{ text-align: center; margin: auto; max-width: 420px; position: relative; z-index: 1; padding: 0 16px; }

/* Le corps de l'enveloppe : ratio fixe, largeur fluide → jamais de proportions cassées */
.envelope{
  --pocket-depth: 58%; /* profondeur de la pointe du rabat, en % de la hauteur */
  width: min(320px, 100%);
  aspect-ratio: 3 / 2;
  margin: 0 auto;
  border: 0; cursor: pointer; position: relative;
  border-radius: 10px;
  background: linear-gradient(155deg, #ff8fb0, #d84673);
  box-shadow: var(--shadow-soft);
  transition: transform .55s var(--ease), box-shadow .55s var(--ease);
  overflow: hidden;
}
.envelope:hover{ transform: translateY(-6px); box-shadow: var(--shadow-deep); }

/* pochette (ombre du bas) — un simple triangle en clip-path, en % */
.envelope:before{
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(160deg, #e8577f, #c33463);
  clip-path: polygon(0 100%, 100% 100%, 100% 22%, 50% var(--pocket-depth), 0 22%);
}

/* le rabat qui s'ouvre — même logique en % que la pochette, donc toujours alignés */
.envelope-flap{
  position: absolute; inset: 0; z-index: 3;
  background: #d84673;
  clip-path: polygon(0 0, 100% 0, 50% var(--pocket-depth));
  transform-origin: top center;
  transition: transform .8s var(--ease), filter .8s var(--ease);
}

.envelope-heart{
  z-index: 4; position: absolute; left: 50%; top: 60%; transform: translate(-50%,-50%);
  color: #fff; font-size: clamp(22px, 8%, 32px); text-shadow: 0 3px 10px #691e378c;
  animation: beat 2.4s ease-in-out infinite;
}

.envelope-wrap.open .envelope-flap{ transform: rotateX(180deg); filter: brightness(.92); }
.envelope-wrap.open .envelope{ transform: translateY(-4px); }

.envelope-message{
  background: var(--paper); padding: clamp(18px,4vw,26px) clamp(18px,5vw,30px);
  box-shadow: 0 14px 40px rgba(110,40,70,.2);
  max-height: 0; overflow: hidden; opacity: 0; transform: translateY(-16px) scale(.97);
  transition: max-height .7s var(--ease), opacity .55s var(--ease), transform .7s var(--ease);
  margin: 14px auto 0; width: 100%; border-radius: 8px;
}
.envelope-message p{ font: 500 clamp(14px,4vw,16px)/1.75 var(--serif); margin: 0; color: #96364d; }
.envelope-wrap.open .envelope-message{ max-height: 70vh; opacity: 1; transform: translateY(0) scale(1); }
.tap-label{ font-size: 12px; color: #825a71; margin-top: 22px; letter-spacing: .2px; }

/* ---------- Story timeline ---------- */
.story{ background: var(--cream); }
.timeline{ max-width: 800px; margin: auto; position: relative; }
.timeline:before{ content: ""; position: absolute; width: 2px; top: 16px; bottom: 16px; left: 30px; background: linear-gradient(180deg, var(--magenta-soft), #c9367f); transform-origin: top; transform: scaleY(0); transition: transform 1.4s var(--ease); }
.timeline.in-view:before{ transform: scaleY(1); }
.moment{ position: relative; display: grid; grid-template-columns: 62px 1fr; gap: 22px; padding: 0 0 48px; }
.moment-icon{ width: 62px; height: 62px; z-index: 1; border-radius: 50%; display: grid; place-items: center; background: #fff2f5; font-size: 25px; border: 1px solid #f2c6d4; box-shadow: 0 8px 20px rgba(216,70,115,.14); }
.moment.visible .moment-icon{ animation: pop .6s var(--ease) both .1s; }
.moment-number{ color: #c9367f; text-transform: uppercase; letter-spacing: 1.6px; font-size: 10px; font-weight: 700; margin: 2px 0 8px; }
.moment h3{ font: 600 28px var(--serif); margin: 0 0 8px; }
.moment div > p:last-child{ margin: 0; line-height: 1.7; color: var(--ink-soft); }

/* ---------- Qualities ---------- */
.qualities{ background: linear-gradient(150deg, #ecdcf3, #fbe1ea); }
.quality-grid{ display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 20px; max-width: 980px; margin: auto; }
.quality-card{ border: 0; background: transparent; aspect-ratio: 1; perspective: 1200px; cursor: pointer; padding: 0; position: relative; }
.quality-card > span{ position: absolute; inset: 0; border-radius: 20px; backface-visibility: hidden; display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 20px; box-shadow: 0 12px 30px rgba(106,32,80,.14); transition: transform .7s var(--ease), box-shadow .35s; background: rgba(255,255,255,.72); border: 1px solid #fff; }
.quality-card:hover > span{ box-shadow: 0 16px 38px rgba(106,32,80,.22); }
.card-front{ font-size: 40px; }
.card-front b{ font: 600 23px var(--serif); margin: 10px 0; }
.card-front small{ color: #876677; font: 500 10px var(--sans); text-transform: uppercase; letter-spacing: 1.2px; }
.card-back{ background: linear-gradient(150deg, #c9367f, var(--violet)) !important; color: #fff; text-align: center; font: 500 18px/1.55 var(--serif); transform: rotateY(180deg); }
.quality-card.flipped .card-front{ transform: rotateY(180deg); }
.quality-card.flipped .card-back{ transform: rotateY(360deg); }

/* ---------- Surprises ---------- */
.surprises{ background: #fff8f3; text-align: center; }
.heart-choices{ display: flex; justify-content: center; align-items: center; gap: clamp(8px,3vw,30px); margin: 36px auto 28px; flex-wrap: wrap; }
.heart-choices button{ border: 0; background: none; color: #c9367f; font-size: clamp(36px,7vw,70px); cursor: pointer; text-shadow: 0 8px 18px rgba(203,54,116,.3); transition: transform .45s var(--ease), color .35s; }
.heart-choices button:nth-child(even){ color: var(--violet); transform: translateY(14px); }
.heart-choices button:hover{ transform: scale(1.22) rotate(-4deg); color: var(--gold); }
.heart-choices button.used{ transform: scale(1.3); color: var(--magenta); animation: used-pulse 1.8s ease-in-out infinite; }
.surprise-message{ min-height: 54px; max-width: 540px; margin: auto; color: #754c62; font: italic 24px/1.45 var(--serif); transition: opacity .4s var(--ease), transform .4s var(--ease); }
.surprise-message.updating{ opacity: 0; transform: translateY(6px); }

/* ---------- Letter ---------- */
.letter-section{ background: linear-gradient(150deg, #f5d7e5, #dfceef); }
.letter-paper{ max-width: 760px; margin: auto; background: var(--paper); padding: clamp(28px,7vw,74px); box-shadow: var(--shadow-soft); position: relative; border-radius: 4px; }
.letter-paper:before{ content: ""; position: absolute; inset: 12px; border: 1px solid #ecc9cc; pointer-events: none; }
.letter-paper p{ font: 500 clamp(17px,2vw,20px)/1.9 var(--serif); margin: 0 0 22px; position: relative; }
.letter-paper .signature{ text-align: right; margin-top: 36px; font-style: italic; }
.inline-heart{ color: #c9367f; }

/* ---------- Finale ---------- */
.finale{
  min-height: 640px; display: grid; place-items: center; text-align: center; position: relative;
  background: linear-gradient(125deg, #1e1030, #4a1f3f 45%, #1e1030 100%);
  background-size: 300% 300%; animation: aurora 20s ease-in-out infinite;
}
.finale-inner{ position: relative; z-index: 2; max-width: 690px; padding: 90px 20px; }
.finale h2{ font: 600 clamp(46px,7vw,84px)/1.02 var(--serif); margin: 0 0 26px; }
.finale-inner > p:not(.eyebrow){ font: 400 20px/1.75 var(--serif); color: #f8e8f0; margin: 0 auto 36px; }
.finale-button{ font-size: 15px; animation: float-y 3.2s ease-in-out infinite; }
.back-top{ display: block; margin: 32px auto 0; color: #fff; opacity: .6; font-size: 12px; text-decoration: none; transition: opacity .3s; }
.back-top:hover{ opacity: 1; }

footer{ padding: 26px 20px; text-align: center; background: var(--night); color: #d9c7df; font-size: 12px; letter-spacing: .2px; }

/* ---------- Cursor hearts + petals ---------- */
#cursor-hearts{ position: fixed; inset: 0; z-index: 80; pointer-events: none; }
.cursor-heart{ position: fixed; color: var(--magenta); text-shadow: 0 3px 8px rgba(90,20,50,.4); animation: heart-drift 1.1s var(--ease) forwards; will-change: transform, opacity; }
.petal{ position: fixed; top: -30px; z-index: 20; pointer-events: none; color: var(--magenta-soft); animation: fall linear forwards; opacity: .85; filter: drop-shadow(0 0 6px rgba(255,210,122,.25)); }

/* ---------- Reveal utility ---------- */
.reveal{ opacity: 0; transform: translateY(34px); transition: opacity .9s var(--ease), transform .9s var(--ease); }
.reveal.visible{ opacity: 1; transform: none; }
.stagger.visible > *{ transition-delay: calc(var(--i, 0) * 90ms); }

a:focus-visible, button:focus-visible{ outline: 2px solid var(--gold); outline-offset: 4px; border-radius: 6px; }

/* ---------- Keyframes ---------- */
@keyframes beat{ 0%,100%{ transform: scale(1); } 50%{ transform: scale(1.18); } }
@keyframes aurora{ 0%,100%{ background-position: 0% 50%; } 50%{ background-position: 100% 50%; } }
@keyframes drift-up{ from{ background-position: 0 0; } to{ background-position: 0 -220px; } }
@keyframes glow-pulse{ 0%,100%{ text-shadow: 0 10px 44px rgba(10,5,15,.55), 0 0 26px rgba(255,143,176,.15); } 50%{ text-shadow: 0 10px 44px rgba(10,5,15,.55), 0 0 52px rgba(255,143,176,.45); } }
@keyframes float-y{ 0%,100%{ transform: translateY(0); } 50%{ transform: translateY(-8px); } }
@keyframes scroll-hint{ 0%{ transform: translateY(0); opacity: 1; } 70%,100%{ transform: translateY(18px); opacity: 0; } }
@keyframes drift-one{ to{ transform: translate(6vw,5vh) scale(1.1); } }
@keyframes drift-two{ to{ transform: translate(-5vw,-4vh) scale(1.14); } }
@keyframes drift-three{ to{ transform: translate(-4vw,6vh) scale(1.2); } }
@keyframes twinkle{ 50%{ opacity: .8; } }
@keyframes pop{ from{ transform: scale(.5); opacity: 0; } to{ transform: scale(1); opacity: 1; } }
@keyframes used-pulse{ 0%,100%{ text-shadow: 0 8px 18px rgba(203,54,116,.3); } 50%{ text-shadow: 0 0 26px rgba(255,210,122,.75); } }
@keyframes heart-drift{ 0%{ transform: translate(0,0) scale(.6) rotate(0deg); opacity: .95; } 100%{ transform: translate(var(--dx,0), -46px) scale(.2) rotate(var(--rot,20deg)); opacity: 0; } }
@keyframes fall{ to{ transform: translate3d(var(--drift),110vh,0) rotate(460deg); opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 650px){
  .section{ padding: 84px 20px; }
  .section-intro{ margin-bottom: 40px; }
  .quality-grid{ grid-template-columns: repeat(2,1fr); gap: 12px; }
  .card-front{ font-size: 30px; }
  .card-front b{ font-size: 19px; }
  .card-back{ font-size: 15px; }
  .site-header{ padding: 20px; }
  .sound-label{ display: none; }
  .hero{ padding-top: 104px; }
  .hero-quote{ margin-top: 26px; }
  .heart-choices{ gap: 6px; }
  .letter-paper:before{ inset: 8px; }
}

@media (prefers-reduced-motion: reduce){
  *, *:before, *:after{ animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .hero, .finale{ animation: none !important; background-position: 0 0 !important; }
  .orb, .petal, #stars, .hero:before{ animation: none !important; }
}