/* ============================================================
   BASE — variables, reset, typographie, boutons
   Palette : Burgundy + Olive + Or
   ============================================================ */

:root{
  /* --- Palette fournie --- */
  --burgundy:        #701E2D;
  --burgundy-light:  #8A3140;
  --olive:           #73784B;
  --olive-dark:      #4A5630;
  --cream:           #E7DDCC;

  /* --- Déclinaisons --- */
  --burgundy-900:    #2a0a12;
  --burgundy-850:    #3a0f19;
  --burgundy-800:    #4e1521;
  --burgundy-700:    var(--burgundy);
  --burgundy-600:    var(--burgundy-light);
  --burgundy-500:    #a24455;

  --olive-900:       #232a12;
  --olive-800:       #333c1d;
  --olive-700:       var(--olive-dark);
  --olive-500:       var(--olive);
  --olive-300:       #9aa06c;

  --cream-100:       #faf5ec;
  --cream-200:       var(--cream);
  --cream-300:       #d6c9b2;

  /* --- Or --- */
  --gold-050:        #fff8e2;
  --gold-100:        #ffeec0;
  --gold-200:        #f3d894;
  --gold-300:        #dfb75f;
  --gold-400:        #c79a3c;
  --gold-500:        #a87c26;
  --gold-600:        #7d5a16;
  --gold-700:        #513a0c;

  --ink:             #3b1119;

  /* --- Typographie --- */
  --f-display: "Cinzel", "Times New Roman", serif;
  --f-script:  "Pinyon Script", "Snell Roundhand", cursive;
  --f-body:    "Cormorant Garamond", Georgia, serif;

  /* --- Dimensions scène --- */
  --env-w: clamp(290px, 78vw, 580px);

  /* --- Durées --- */
  --t-flap: 1350ms;
  --t-card: 1250ms;

  --foil: linear-gradient(118deg,
      var(--gold-700) 0%, var(--gold-300) 18%, var(--gold-050) 32%,
      var(--gold-400) 46%, var(--gold-100) 60%, var(--gold-500) 78%,
      var(--gold-200) 92%, var(--gold-600) 100%);
}

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

html,body{ height:100%; }

body{
  margin:0;
  min-height:100svh;
  background:#140409;
  color:var(--cream-200);
  font-family:var(--f-body);
  font-size:17px;
  line-height:1.6;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  -webkit-tap-highlight-color:transparent;
}

body.is-reading{ overflow:hidden; }

img,svg{ display:block; max-width:100%; }
button{ font:inherit; color:inherit; }

.svg-lib{ position:absolute; width:0; height:0; overflow:hidden; }

/* --- apparition au chargement : un rideau bordeaux s'efface PAR-DESSUS.
       La scène 3D, elle, ne bouge pas (un fondu sur elle forçait le téléphone
       à tout recalculer, d'où un petit saut à la fin). --- */
.curtain{
  position:fixed; inset:0;
  z-index:60;
  background:#5a1724;
  pointer-events:none;
  transition:opacity 1.1s ease .1s, visibility 0s linear 1.3s;
}
body.is-ready .curtain{ opacity:0; visibility:hidden; }


/* ============================================================
   SCÈNE
   ============================================================ */
.scene{
  position:fixed; inset:0;
  z-index:2;
}
/* une fois ouverte, l'enveloppe ne gêne plus la lecture */
body.is-reading .scene{ pointer-events:none; }   /* les rabats restent visibles autour de la lettre */

/* ============================================================
   INDICE "Touchez le sceau"
   ============================================================ */
.hint{
  position:absolute;
  left:50%; bottom:max(9vh,calc(env(safe-area-inset-bottom) + 36px));
  transform:translateX(-50%);
  z-index:3;
  margin:0;
  display:flex; align-items:center; gap:14px;
  white-space:nowrap;
  max-width:100%;
  font-family:var(--f-display);
  font-size:clamp(10px,2.6vw,12.5px);
  font-weight:600;
  letter-spacing:.34em;
  text-transform:uppercase;
  color:#f3ead8;
  opacity:0;
  text-shadow:0 1px 2px rgba(0,0,0,.35),0 0 18px rgba(0,0,0,.25);
  animation:hintIn 1.4s 2.4s ease forwards, hintPulse 3.4s 3.8s ease-in-out infinite;
  pointer-events:none;
  padding-left:.34em;
}
.hint__line{
  display:block; width:clamp(26px,9vw,62px); height:1px;
  background:linear-gradient(90deg,transparent,rgba(243,234,216,.7));
}
.hint__line:last-child{ background:linear-gradient(270deg,transparent,rgba(243,234,216,.7)); }

@keyframes hintIn{ to{ opacity:1; } }
@keyframes hintPulse{ 0%,100%{ opacity:.72; } 50%{ opacity:1; } }

body.is-opening .hint{ animation:none; opacity:0; transition:opacity .3s ease; }


/* ============================================================
   BOUTONS FLOTTANTS
   ============================================================ */
.iconBtn{
  position:fixed;
  display:inline-flex; align-items:center; gap:9px;
  padding:10px 16px;
  border:1px solid rgba(223,183,95,.3);
  border-radius:999px;
  background:rgba(20,6,12,.55);
  backdrop-filter:blur(10px);
  -webkit-backdrop-filter:blur(10px);
  color:var(--gold-200);
  font-family:var(--f-display);
  font-size:11px; letter-spacing:.2em; text-transform:uppercase;
  cursor:pointer;
  z-index:30;
  transition:border-color .3s, color .3s, background .3s, opacity .5s, transform .5s;
}
@media (hover:hover) and (pointer:fine){ .iconBtn:hover{ border-color:rgba(243,216,148,.65); color:var(--gold-050); background:rgba(45,12,20,.7); } }
.iconBtn svg{ width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.7;
              stroke-linecap:round; stroke-linejoin:round; }
.iconBtn svg path[d^="M4 9v6h3"]{ fill:currentColor; stroke-width:1.2; }

.soundBtn{
  top:max(16px,env(safe-area-inset-top)); right:16px;
  padding:11px; gap:0;
}
.soundBtn .ico--off{ display:none; }
.soundBtn[aria-pressed="false"] .ico--on{ display:none; }
.soundBtn[aria-pressed="false"] .ico--off{ display:block; }




/* ============================================================
   ACCESSIBILITÉ / MOUVEMENT RÉDUIT
   ============================================================ */
:focus-visible{
  outline:2px solid var(--gold-200);
  outline-offset:5px;
  border-radius:4px;
}

@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms !important;
    animation-iteration-count:1 !important;
    transition-duration:.18s !important;
  }
}


/* ---------- Adaptations ambiance « jour » ---------- */
html[data-ambiance="jour"] .iconBtn{
  background:rgba(255,253,248,.7);
  border-color:rgba(112,30,45,.2);
  color:#5b2230;
}
@media (hover:hover) and (pointer:fine){ html[data-ambiance="jour"] .iconBtn:hover{
  background:rgba(255,255,255,.92);
  border-color:rgba(112,30,45,.4);
  color:var(--burgundy);
} }



/* ---------- « Pour Marie » sur la couverture ---------- */
.forGuest{
  position:absolute;
  left:0; right:0; top:max(15vh,calc(env(safe-area-inset-top) + 70px));
  z-index:3;
  margin:0;
  text-align:center;
  font-family:var(--f-script);
  font-size:clamp(34px,10vw,52px);
  color:#efe4d2;
  text-shadow:0 2px 12px rgba(30,4,10,.45);
  pointer-events:none;
  opacity:0;
  animation:hintIn 1.4s 1s ease forwards;
}
body.is-opening .forGuest{ animation:none; opacity:0; transition:opacity .4s ease; }


/* ---------- finitions tactiles ---------- */
html{ background:#5a1724; }
button, a, .chip, .card, .seal{
  touch-action:manipulation;            /* pas de zoom au double-toucher */
  -webkit-user-select:none; user-select:none;
}
img{ -webkit-touch-callout:none; }      /* pas de menu « enregistrer l'image » sur un appui long */
input, textarea{ -webkit-user-select:text; user-select:text; }

/* la musique : petit bouton rond doré en bas à droite, comme sur la vidéo de référence */
body.is-reading .soundBtn{
  top:auto; right:16px;
  bottom:max(18px, calc(env(safe-area-inset-bottom) + 12px));
  width:40px; height:40px; padding:0; justify-content:center;
  border-color:rgba(223,183,95,.7);
  background:rgba(60,14,24,.55);
}
