:root{
  --ink: #1f2430;
  --muted: rgba(31,36,48,.72);
  --sage: #6C7D3A;
  --pollen: #C9812A;

  --ease: cubic-bezier(.35, .0, .10, 1);
  --dur: 2720ms; /* 15% plus rapide (3200 * 0.85) */

  --slot: 360px;

  --shadow: 0 32px 90px rgba(0,0,0,.18);
  --shadow-strong: 0 54px 140px rgba(0,0,0,.25);
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #eef6f6;
  overflow:hidden;
}
/* En mobile, permettre le scroll vertical */
@media (max-width: 520px){
  html, body{
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
}

/* === Animated pastel background === */
.bg{position:fixed; inset:0; z-index:0}
.bg__gradients{
  position:absolute; inset:-18%;
  background:
    radial-gradient(620px 520px at 18% 18%, rgba(178, 211, 255, .58), transparent 62%),
    radial-gradient(720px 560px at 78% 20%, rgba(255, 187, 214, .58), transparent 64%),
    radial-gradient(680px 560px at 20% 82%, rgba(182, 240, 220, .56), transparent 62%),
    radial-gradient(860px 620px at 82% 82%, rgba(255, 228, 171, .52), transparent 66%),
    linear-gradient(180deg, rgba(244,250,250,1) 0%, rgba(242,248,246,1) 55%, rgba(246,241,231,1) 100%);
  filter: saturate(1.06);
  animation: drift 14s ease-in-out infinite alternate;
}
@keyframes drift{
  0%{ transform: translate3d(-1.4%, -1.0%, 0) scale(1.02); filter: blur(0px) saturate(1.05); }
  100%{ transform: translate3d(1.4%, 1.1%, 0) scale(1.05); filter: blur(.8px) saturate(1.10); }
}
.bg__particles{position:absolute; inset:0; width:100%; height:100%; opacity:.58}
.bg__grain{
  position:absolute; inset:0;
  opacity:.10;
  mix-blend-mode:multiply;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='https://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='260' height='260' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  background-size:260px 260px;
}
.bg__vignette{
  position:absolute; inset:0;
  background: radial-gradient(1000px 700px at 50% 45%, rgba(255,255,255,.0), rgba(0,0,0,.10));
  opacity:.22;
}

/* === Layout === */
.stage{
  position:relative;
  z-index:1;
  min-height:100vh;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  text-align:center;
  padding: 80px 18px 120px;
}
.hero{
  max-width: 880px;
  flex-shrink: 0; /* Empêche le hero de rétrécir */
  position: relative;
}

/* === Bouton Tirage 3 cartes / 1 carte (discret, au-dessus d'Oracle) === */
.tirage3-btn, .tirage1-btn{
  display: block;
  margin: 0 auto 28px;
  max-width: 640px;
  appearance: none;
  border: 1px solid rgba(31,36,48,.15);
  background: rgba(246,241,231,.7);
  color: rgba(31,36,48,.7);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 12px;
  font-family: "Inter", sans-serif;
  font-weight: 500;
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease, color 200ms ease, box-shadow 200ms ease;
  letter-spacing: 0.15px;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,.04);
}
.tirage3-btn:hover, .tirage1-btn:hover{
  background: rgba(246,241,231,.9);
  border-color: rgba(31,36,48,.25);
  color: rgba(31,36,48,.88);
  box-shadow: 0 3px 12px rgba(0,0,0,.06);
}
.tirage3-btn:active, .tirage1-btn:active{
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}

.nav-bottom{
  margin-top: 32px;
  padding-top: 24px;
  width: 100%;
}
.hero .nav-bottom{
  margin-top: 0;
  padding-top: 0;
  margin-bottom: 1.5rem;
}
.nav-bottom .tirage3-btn,
.nav-bottom .tirage1-btn{
  margin-bottom: 0;
}
.nav-bottom__text{
  margin: 0 auto 0.75rem;
  max-width: 520px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted, rgba(31,36,48,.7));
}

.kicker{
  font-family:"Cormorant Garamond", serif;
  font-weight:700;
  font-size: 20px;
  letter-spacing:.6px;
  color: rgba(31,36,48,.74);
  position: relative;
  z-index: 1000;
  margin-bottom: 0.5rem;
}
.title{
  font-family:"Cormorant Garamond", serif;
  font-weight:700;
  font-size: clamp(44px, 5.4vw, 76px);
  line-height: 1.0;
  margin: 20px 0 18px;
  color: rgba(31,36,48,.92);
  text-shadow: 0 18px 75px rgba(0,0,0,.12);
  position: relative;
  z-index: 1000;
}
.sub{
  margin: 0 auto;
  max-width: 940px;
  padding-top: 4px;
  color: var(--muted);
  font-size: 15px;
  position: relative;
  z-index: 1000;
  line-height: 1.55;
}

.center{
  margin-top: 15px;
  display:flex;
  flex-direction:column;
  position: relative;
  z-index: 1000; /* Au-dessus des fleurs (z-index: 999) */
  align-items:center;
  gap: 14px;
  /* Réserver l'espace pour le bouton ghost (hauteur + margin-top) même quand il est caché */
  min-height: calc(min(var(--slot), 92vw) + 14px + 24px + 40px); /* slot + gap + margin-top ghost + hauteur ghost */
  height: calc(min(var(--slot), 92vw) + 14px + 24px + 40px);
}
.slot{
  width: min(var(--slot), 92vw);
  height: min(var(--slot), 92vw);
  min-height: min(var(--slot), 92vw); /* Hauteur minimale fixe pour éviter le décalage */
  border-radius: 999px;
  display:grid;
  place-items:center;
  position:relative;
  perspective: 1200px;
  flex-shrink: 0; /* Empêche le slot de rétrécir */
}

/* === CTA button === */
.cta{
  width: 100%;
  height: 100%;
  box-sizing: border-box; /* Assurer que border est inclus dans la taille */
  position: relative;
  z-index: 1000; /* Au-dessus des fleurs (z-index: 999) */
  border-radius: 999px;
  border: 1px solid rgba(31,36,48,.16);
  background: rgba(246,241,231,.92);
  box-shadow: var(--shadow);
  cursor:pointer;
  font-family:"Cormorant Garamond", serif;
  font-weight:700;
  font-size: 21px; /* 30% plus petit (30px * 0.7) */
  color: rgba(47,58,30,.94);
  letter-spacing:.2px;
  position:relative;
  overflow:hidden;
  transform: translateZ(0);
  transition: transform 300ms ease-out, opacity 300ms ease;
  animation: gentlePulse 3s ease-in-out infinite;
}
@keyframes gentlePulse{
  0%, 100%{ opacity: 1; }
  50%{ opacity: 0.96; }
}
.cta:hover{
  transform: translateZ(0) scale(1.05);
}
.cta:active{ 
  opacity: 0.85;
  transform: translateZ(0) scale(1.02);
}
.cta[disabled]{
  opacity:.65; 
  cursor:not-allowed;
  animation: none;
}
.cta__label{ 
  position:relative; 
  z-index:2;
  display: inline-block;
  transition: opacity 300ms ease;
}
.cta__label.reveal{
  opacity: 0;
}

.cta__img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 999px;
  display: block;
  pointer-events: none;
}
/* Toujours afficher l'image, jamais le texte, sur le bouton image */
.cta--image .cta__label{
  display: none !important;
}
.cta--image{
  padding: 0;
  border: none;
  background: transparent;
  box-shadow: none;
  animation: none;
}
.cta--image:hover{
  background: transparent;
  transform: translateZ(0) scale(1.05);
}
.cta--image:active{
  background: transparent;
  transform: translateZ(0) scale(1.02);
}
.cta--image[disabled]{
  opacity: 0.7;
}
.cta--image::after{
  display: none;
}

.cta__dots{
  display: none; /* Particules retirées du bouton */
}
.cta::after{
  content:"";
  position:absolute; inset:-1px;
  border-radius: 999px;
  background:
    radial-gradient(260px 260px at 26% 22%, rgba(108,125,58,.12), transparent 70%),
    radial-gradient(320px 320px at 72% 28%, rgba(201,129,42,.10), transparent 70%);
  opacity:.95;
  z-index:0;
}

/* === Card (SANS HOVER) === */
.cardWrap{
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  border-radius: 999px;
  position:relative;
  display:grid;
  place-items:center;
  transform-style: preserve-3d;
  transform-origin: center center;
  animation: popIn 1.6s ease-in-out 0.05s both;
}
/* Apparition : de 0 à 100 */
@keyframes popIn{
  0%{ opacity: 0; transform: scale(0.5) rotateX(-10deg); }
  100%{ opacity: 1; transform: scale(1) rotateX(0deg); }
}
.card3d{
  width: 100%;
  height: 100%;
  border-radius: 999px;
  position:relative;
  transform-style: preserve-3d;
}
.cardFace{
  position:absolute; inset:0;
  border-radius: 999px;
  overflow:hidden;
  backface-visibility:hidden;
  border: 1px solid rgba(31,36,48,.14);
  box-shadow: var(--shadow);
  background: rgba(246,241,231,.92);
  transform: translateZ(10px);
}
.cardFace img{
  width:100%; height:100%;
  object-fit: cover;
  display:block;
}
.cardEdge{
  position:absolute; inset:0;
  border-radius: 999px;
  transform: translateZ(-10px);
  background: linear-gradient(180deg, rgba(255,255,255,.60), rgba(220,210,190,.42));
  border: 1px solid rgba(31,36,48,.10);
}
.cardShine{
  position:absolute; inset:-24%;
  border-radius: 999px;
  background: radial-gradient(420px 260px at 28% 18%, rgba(255,255,255,.38), transparent 58%);
  opacity: 0.3;
  transform: translateZ(14px);
  pointer-events:none;
}

/* === Secondary button === */
.ghost{
  appearance:none;
  border: 1px solid rgba(31,36,48,.14);
  background: rgba(255,255,255,.36);
  color: rgba(31,36,48,.80);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  cursor:pointer;
  transition: opacity 240ms ease, visibility 240ms ease;
  height: 40px; /* Hauteur fixe pour éviter le décalage */
  min-height: 40px;
  flex-shrink: 0; /* Empêche le bouton de rétrécir */
  margin-top: 24px; /* Descendre un peu plus le bouton de réinitialisation */
}
.ghost:active{ opacity: 0.7; }
.ghost:not([hidden]){ margin-bottom: 48px; }
.ghost[hidden]{
  display: block !important; /* Réserver l'espace même avec [hidden] (évite le décalage à l'apparition) */
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  min-height: 40px; /* Garder la place même si le contenu est vide */
}

/* === Modal / Pop-up === */
.modal{
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden]{
  display: none;
}
.modal__overlay{
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
}
.modal__content{
  position: relative;
  z-index: 1;
  background: rgba(246,241,231,.98);
  border-radius: 24px;
  padding: 40px 32px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 32px 90px rgba(0,0,0,.25);
  border: 1px solid rgba(31,36,48,.12);
}
.modal__content--iframe{
  max-width: 560px;
  padding: 24px 24px 32px;
}
.modal__content--iframe .modal__title{
  margin-bottom: 16px;
}
.modal__iframe-wrap{
  width: 100%;
  height: 490px;
  min-height: 490px;
  border-radius: 3px;
  overflow: hidden;
}
.modal__close{
  position: absolute;
  top: 16px;
  right: 16px;
  appearance: none;
  border: none;
  background: transparent;
  font-size: 32px;
  line-height: 1;
  color: rgba(31,36,48,.6);
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 200ms ease;
}
.modal__close:hover{
  background: rgba(31,36,48,.08);
  color: rgba(31,36,48,.9);
}
.modal__title{
  font-family: "Cormorant Garamond", serif;
  font-weight: 700;
  font-size: 32px;
  color: rgba(31,36,48,.92);
  margin: 0 0 8px;
  text-align: center;
}
.modal__subtitle{
  font-size: 15px;
  color: var(--muted);
  text-align: center;
  margin: 0 0 32px;
  line-height: 1.5;
}
.modal__form{
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.form__group{
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.form__label{
  font-size: 14px;
  font-weight: 500;
  color: rgba(31,36,48,.80);
  font-family: Inter, system-ui, sans-serif;
}
.form__input{
  appearance: none;
  border: 1px solid rgba(31,36,48,.16);
  background: rgba(255,255,255,.8);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 15px;
  font-family: Inter, system-ui, sans-serif;
  color: rgba(31,36,48,.92);
  transition: all 200ms ease;
}
.form__input:focus{
  outline: none;
  border-color: rgba(31,36,48,.30);
  background: rgba(255,255,255,.95);
  box-shadow: 0 0 0 3px rgba(31,36,48,.05);
}
.form__submit{
  appearance: none;
  border: 1px solid rgba(31,36,48,.16);
  background: rgba(31,36,48,.85);
  color: white;
  border-radius: 12px;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: Inter, system-ui, sans-serif;
  cursor: pointer;
  transition: all 200ms ease;
  margin-top: 8px;
}
.form__submit:hover{
  background: rgba(31,36,48,.95);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.form__submit:active{
  transform: translateY(0);
}
.form__submit:disabled{
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}
.modal__message{
  margin-top: 20px;
  padding: 16px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  line-height: 1.5;
}
.modal__message.success{
  background: rgba(182,240,220,.3);
  color: rgba(31,36,48,.85);
  border: 1px solid rgba(182,240,220,.5);
}
.modal__message.error{
  background: rgba(255,187,214,.3);
  color: rgba(31,36,48,.85);
  border: 1px solid rgba(255,187,214,.5);
}

/* === Flowers (FLOTTEMENT FLUIDE AVEC CSS) === */
.flowers{
  position:fixed; inset:0;
  z-index:999;
  pointer-events:none;
}
.flower{
  position:fixed;
  transform-origin: center center;
  /* Transition par défaut pour le retour fluide à la position initiale */
  transition:
    left var(--dur, 3200ms) var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    top var(--dur, 3200ms) var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    transform var(--dur, 3200ms) var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    opacity var(--dur, 3200ms) var(--ease, cubic-bezier(0.4, 0, 0.2, 1)),
    filter var(--dur, 3200ms) var(--ease, cubic-bezier(0.4, 0, 0.2, 1));
  transform: translate(-50%, -50%);
}

/* Animation de flottement fluide - effet de respiration */
.flower.floating{
  will-change: transform;
  /* Animation de respiration active par défaut */
  animation: breathe var(--float-duration, 6.8s) ease-in-out infinite; /* 15% plus rapide (8*0.85) */
  animation-delay: var(--float-delay, 0s);
}

@keyframes breathe{
  0%, 100%{ 
    transform: translate(-50%, -50%) scale(1);
  }
  50%{ 
    transform: translate(-50%, -50%) scale(1.1);
  }
}

/* Disparition rapide du contenu du slot (bouton ou carte) avant la nouvelle carte */
.slot.slot--reveal .cta{
  transform: translateZ(0) scale(0.92);
  opacity: 0;
  transition: transform 0.35s ease-out, opacity 0.35s ease-out;
}
.slot.slot--reveal .cardWrap{
  animation: popOutFast 0.35s ease-out forwards;
}
@keyframes popOutFast{
  0%{ opacity: 1; transform: scale(1) rotateX(0deg); }
  100%{ opacity: 0; transform: scale(0.92) rotateX(-4deg); }
}

/* État rassemblé - pause l'animation pendant la transition */
body.is-gather .flower.gathering{
  /* On pause l'animation pendant la transition, mais on la garde active */
  animation-play-state: paused !important;
  /* La transition CSS va gérer le transform pendant le rassemblement */
}

body.is-gather .flower.gathering{
  left: calc(var(--slot-center-x, 50vw) + var(--gather-x, 0px)) !important;
  top: calc(var(--slot-center-y, 50vh) + var(--gather-y, 0px)) !important;
  transform: translate(-50%, -50%) rotate(var(--gather-rotate, 0deg)) scale(var(--gather-scale, 1.6)) !important;
  opacity: 0.95 !important;
  filter: saturate(1.08) !important;
}

/* Embed */
body.embed .hero{ display:none; }
.stage--embed{ padding: 24px 14px 28px; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *,*::before,*::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .bg__gradients{ animation: none; }
  .cta__dots{ animation: none; }
  .flower.floating{ animation: none; }
}

/* Tablet: permettre le scroll pour voir les 3 boutons */
@media (min-width: 521px) and (max-width: 1024px){
  html, body{
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
  .stage{
    min-height: auto; /* Permettre le scroll */
    height: auto;
  }
}

/* Desktop : permettre le scroll pour voir tout le contenu (ex. premier texte en haut) */
@media (min-width: 1025px){
  html, body{
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
  .stage{
    min-height: auto;
    height: auto;
  }
}

/* Mobile paysage : permettre le scroll */
@media (max-width: 1024px) and (orientation: landscape){
  html, body{
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100vh;
  }
  .stage{
    min-height: auto;
    height: auto;
  }
}

@media (max-width: 520px){
  /* Les règles overflow pour html/body sont déjà définies en haut du fichier */
  :root{ --slot: 320px; --dur: 2890ms; } /* 15% plus rapide (3400 * 0.85) */
  .title{ font-size: 48px; }
  .cta{ font-size: 18px; } /* 30% plus petit (26px * 0.7 ≈ 18px) */
  /* En mobile : oublier les mouvements de fleur au clic - pas de changement */
  body.is-gather .flower.gathering{ 
    /* Aucun changement : les fleurs restent exactement où elles sont */
  }
  .stage{
    padding-bottom: 60px; /* Margin avant l'apparition du bouton "Tirer à nouveau" */
  }
  /* En mobile : garder la place du bouton ghost pour éviter le décalage à l'apparition */
  .center{
    height: auto;
    min-height: calc(min(var(--slot), 92vw) + 14px + 24px + 40px); /* slot + gap + ghost (margin + hauteur) */
  }
  .center:has(.ghost:not([hidden])){
    padding-bottom: 30px; /* Espace sous le bouton "Tirer à nouveau" */
  }
  .tirage3-btn, .tirage1-btn{
    margin-bottom: 16px;
    font-size: 11px;
    padding: 6px 14px;
  }
  .modal__content{
    padding: 32px 24px;
  }
  .modal__title{
    font-size: 28px;
  }
}

/* ==================== ADD TO HOME ==================== */
.add-to-home{
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  margin-top: 32px;
  margin-bottom: 16px;
  color: rgba(31,36,48,.5);
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  line-height: 1.4;
  text-align: center;
  z-index: 1000;
  cursor: pointer;
  transition: color 0.2s ease;
  user-select: none;
}

.add-to-home:hover{
  color: rgba(31,36,48,.7);
}

.add-to-home:active{
  color: rgba(31,36,48,.6);
}

.add-to-home__icon{
  flex-shrink: 0;
  color: rgba(31,36,48,.5);
  width: 14px;
  height: 14px;
  transition: color 0.2s ease;
}

.add-to-home:hover .add-to-home__icon{
  color: rgba(31,36,48,.7);
}

.add-to-home__text{
  max-width: 320px;
}

@media (max-width: 768px){
  /* Mobile : image bouton toujours visible (éviter affichage du texte) */
  .cta--image .cta__img{
    min-width: 140px;
    min-height: 140px;
  }
  .add-to-home{
    font-size: 11px;
    padding: 10px 16px;
    margin-top: 24px;
    margin-bottom: 40px;
    gap: 5px;
  }
  .add-to-home__icon{
    width: 13px;
    height: 13px;
  }
  .add-to-home__text{
    max-width: 280px;
  }
}
