/* ============================================================
   COULEUR D'AMBRE · Pop-up « Carte cadeau » (fêtes de fin d'année)
   Version : 1.0.0 · 2026-11-13
   Affichée une fois par visite, jusqu'au 24 décembre (carte-cadeau.js).
   Préfixe « cadeau- » partout : aucune règle du site n'est touchée.
   ============================================================ */

.cadeau {
  --cadeau-brun: #5E3A24;
  --cadeau-nuit: #2B1810;
  --cadeau-or: #F7A415;
  --cadeau-or-clair: #FFD27A;
  --cadeau-creme: #FAF7F2;
  --cadeau-ressort: cubic-bezier(0.34, 1.56, 0.64, 1);
  --cadeau-doux: cubic-bezier(0.22, 1, 0.36, 1);

  position: fixed;
  inset: 0;
  margin: auto;
  width: min(440px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 0;
  border-radius: 28px;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--cadeau-brun);
  background:
    radial-gradient(140% 60% at 50% 0%, #FFF1D6 0%, rgba(255, 241, 214, 0) 60%),
    linear-gradient(180deg, #FFF8EC 0%, var(--cadeau-creme) 100%);
  box-shadow: 0 30px 80px rgba(43, 24, 16, 0.45), 0 0 0 1px rgba(247, 164, 21, 0.25);
  font-family: 'Inter', sans-serif;
  line-height: 1.5;
  z-index: 10050; /* repli quand le navigateur n'a pas de couche du dessus */
  animation: cadeau-entree 620ms var(--cadeau-ressort) both;
}

.cadeau:not([open]) { display: none; }
.cadeau:focus { outline: none; } /* la boîte prend le focus à l'ouverture, sans anneau */

.cadeau::backdrop {
  background: rgba(43, 24, 16, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: cadeau-voile 400ms ease both;
}

/* Repli sans <dialog> modal : le voile est un élément à part */
.cadeau-voile {
  position: fixed;
  inset: 0;
  z-index: 10049;
  background: rgba(43, 24, 16, 0.6);
  animation: cadeau-voile 400ms ease both;
}

html.cadeau-ouvert { overflow: hidden; }

.cadeau.cadeau-sortie { animation: cadeau-sortie 260ms ease-in both; }
.cadeau.cadeau-sortie::backdrop { animation: cadeau-voile-sortie 260ms ease-in both; }

/* === Fermer (croix) === */
.cadeau-fermer {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(94, 58, 36, 0.08);
  color: var(--cadeau-brun);
  cursor: pointer;
  transition: background 200ms ease, transform 200ms ease;
}
.cadeau-fermer:hover { background: rgba(94, 58, 36, 0.16); transform: rotate(90deg); }
.cadeau-fermer:focus-visible,
.cadeau-bouton:focus-visible {
  outline: 3px solid var(--cadeau-or);
  outline-offset: 3px;
}

/* === La scène : soleil, carte, étincelles === */
/* Le soleil du logo se lève derrière la carte */
.cadeau-scene {
  position: relative;
  height: 300px;
  display: grid;
  place-items: end center;
  padding-bottom: 18px;
  perspective: 900px;
}

.cadeau-scene::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  width: 320px;
  height: 220px;
  margin-left: -160px;
  background: radial-gradient(closest-side, rgba(247, 164, 21, 0.28), rgba(247, 164, 21, 0));
  animation: cadeau-voile 1200ms ease 200ms both;
  pointer-events: none;
}

.cadeau-halo {
  position: absolute;
  width: 180px;
  height: 180px;
  top: 2px;
  left: 50%;
  margin-left: -90px;
  animation: cadeau-halo-entree 1200ms var(--cadeau-doux) 120ms both;
}
.cadeau-halo img {
  width: 100%;
  height: 100%;
  opacity: 0.9;
  animation: cadeau-tourne 48s linear infinite;
}

.cadeau-vol {
  position: relative;
  z-index: 1;
  animation: cadeau-vol 1000ms var(--cadeau-ressort) 260ms both;
}
.cadeau-flotte { animation: cadeau-flotte 4.2s ease-in-out 1300ms infinite alternate; }

/* La carte et son nœud penchent ensemble */
.cadeau-incline {
  position: relative;
  transform: rotate(-5deg);
}

.cadeau-carte {
  position: relative;
  width: min(290px, 72vw);
  aspect-ratio: 1.586;
  border-radius: 16px;
  overflow: hidden;
  background:
    radial-gradient(110% 90% at 12% 0%, rgba(247, 164, 21, 0.32) 0%, rgba(247, 164, 21, 0) 55%),
    linear-gradient(140deg, #6B4329 0%, #4A2C1B 50%, var(--cadeau-nuit) 100%);
  box-shadow:
    0 22px 40px rgba(43, 24, 16, 0.38),
    0 4px 10px rgba(43, 24, 16, 0.25),
    inset 0 1px 0 rgba(255, 210, 122, 0.35);
}

/* Le double filet, comme sur l'affiche des tarifs */
.cadeau-carte::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(255, 210, 122, 0.45);
  border-radius: 11px;
  pointer-events: none;
}

/* Le reflet qui passe */
.cadeau-carte::after {
  content: '';
  position: absolute;
  inset: -40% -60%;
  background: linear-gradient(105deg, rgba(255, 255, 255, 0) 40%, rgba(255, 236, 190, 0.38) 50%, rgba(255, 255, 255, 0) 60%);
  transform: translateX(-70%);
  animation: cadeau-reflet 4.5s ease-in-out 1500ms infinite;
  pointer-events: none;
}

.cadeau-ruban {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 15%;
  width: 14px;
  background: linear-gradient(90deg, #C97F06 0%, var(--cadeau-or) 30%, var(--cadeau-or-clair) 50%, var(--cadeau-or) 70%, #C97F06 100%);
  box-shadow: 0 0 0 1px rgba(43, 24, 16, 0.15);
}

.cadeau-mention {
  position: absolute;
  top: 16px;
  right: 18px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.24em;
  color: var(--cadeau-or-clair);
}

.cadeau-logo {
  position: absolute;
  left: 26%;
  top: 42%;
  width: 68%;
  height: auto;
  transform: translateY(-50%);
}

.cadeau-pour {
  position: absolute;
  left: 26%;
  right: 9%;
  bottom: 18px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 13px;
  color: rgba(250, 247, 242, 0.85);
}
.cadeau-pour::after {
  content: '';
  flex: 1;
  border-bottom: 1px dotted rgba(255, 210, 122, 0.7);
  transform: translateY(-3px);
}

/* Le nœud, posé sur le ruban, hors de la carte */
.cadeau-noeud {
  position: absolute;
  z-index: 2;
  width: 76px;
  height: 55px;
  top: -26px;
  left: calc(15% + 7px - 38px);
  transform-origin: 50% 70%;
  animation: cadeau-noeud 700ms var(--cadeau-ressort) 950ms both;
  filter: drop-shadow(0 4px 6px rgba(43, 24, 16, 0.3));
}

.cadeau-etincelle {
  position: absolute;
  z-index: 2;
  color: var(--cadeau-or);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  animation: cadeau-etincelle 2.6s ease-in-out infinite;
  pointer-events: none;
}
.cadeau-etincelle:nth-of-type(1) { top: 14%; left: 20%; animation-delay: 1.2s; }
.cadeau-etincelle:nth-of-type(2) { top: 6%; right: 26%; font-size: 13px; animation-delay: 1.7s; }
.cadeau-etincelle:nth-of-type(3) { bottom: 20%; right: 7%; font-size: 22px; animation-delay: 2.1s; }
.cadeau-etincelle:nth-of-type(4) { bottom: 10%; left: 8%; font-size: 12px; animation-delay: 2.6s; }

/* === Le texte === */
.cadeau-corps {
  padding: 6px 28px 28px;
  text-align: center;
}

.cadeau-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(247, 164, 21, 0.14);
  border: 1px solid rgba(247, 164, 21, 0.35);
  font-size: 13px;
  font-weight: 600;
  color: var(--cadeau-brun);
}
.cadeau-badge::before,
.cadeau-badge::after { content: '✦'; color: var(--cadeau-or); }

.cadeau-titre {
  margin: 14px 0 8px;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: clamp(1.55rem, 5.5vw, 1.9rem);
  line-height: 1.15;
  color: var(--cadeau-brun);
}
.cadeau-titre em {
  font-style: italic;
  font-weight: 600;
  color: #D98A00;
}

.cadeau-texte {
  font-size: 15px;
  color: rgba(94, 58, 36, 0.85);
}

.cadeau-rdv {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 16px;
  background: #FFF1D6;
  font-size: 15px;
  font-weight: 600;
  color: var(--cadeau-brun);
  text-wrap: balance;
}
.cadeau-texte { text-wrap: pretty; }
.cadeau-infos {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 500;
  color: rgba(94, 58, 36, 0.75);
}

.cadeau-gestes {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.cadeau-bouton {
  flex: 1 1 160px;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 200ms ease, color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.cadeau-bouton--plein {
  border: 0;
  background: var(--cadeau-brun);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(94, 58, 36, 0.3);
}
.cadeau-bouton--plein:hover {
  background: var(--cadeau-or);
  color: var(--cadeau-nuit);
  transform: translateY(-2px);
}
.cadeau-bouton--bord {
  border: 1.5px solid rgba(94, 58, 36, 0.3);
  background: transparent;
  color: var(--cadeau-brun);
}
.cadeau-bouton--bord:hover { border-color: var(--cadeau-brun); }

/* Le texte arrive après la carte */
.cadeau-corps > * { animation: cadeau-monte 520ms var(--cadeau-doux) both; }
.cadeau-corps > :nth-child(1) { animation-delay: 420ms; }
.cadeau-corps > :nth-child(2) { animation-delay: 500ms; }
.cadeau-corps > :nth-child(3) { animation-delay: 580ms; }
.cadeau-corps > :nth-child(4) { animation-delay: 660ms; }
.cadeau-corps > :nth-child(5) { animation-delay: 740ms; }

/* === Mouvements === */
@keyframes cadeau-entree {
  from { opacity: 0; transform: translateY(32px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}
@keyframes cadeau-sortie {
  to { opacity: 0; transform: translateY(16px) scale(0.97); }
}
@keyframes cadeau-voile { from { opacity: 0; } to { opacity: 1; } }
@keyframes cadeau-voile-sortie { to { opacity: 0; } }

@keyframes cadeau-halo-entree {
  from { opacity: 0; transform: translateY(90px) scale(0.5) rotate(-120deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes cadeau-tourne { to { transform: rotate(360deg); } }

@keyframes cadeau-vol {
  0%   { opacity: 0; transform: translateY(90px) rotateX(35deg) rotateY(-45deg) rotateZ(-20deg) scale(0.6); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes cadeau-flotte {
  from { transform: translateY(0) rotate(0deg); }
  to   { transform: translateY(-8px) rotate(1.5deg); }
}
@keyframes cadeau-reflet {
  0%, 55% { transform: translateX(-70%); }
  100%    { transform: translateX(70%); }
}
@keyframes cadeau-noeud {
  from { opacity: 0; transform: scale(0) rotate(-30deg); }
  to   { opacity: 1; transform: none; }
}
@keyframes cadeau-etincelle {
  0%, 100% { opacity: 0; transform: scale(0.4) rotate(0deg); }
  50%      { opacity: 1; transform: scale(1) rotate(45deg); }
}
@keyframes cadeau-monte {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: none; }
}

/* Petit téléphone : la scène se resserre */
@media (max-width: 380px) {
  .cadeau-scene { height: 265px; }
  .cadeau-halo { width: 150px; height: 150px; margin-left: -75px; }
  .cadeau-corps { padding: 4px 20px 22px; }
}

/* Écran bas (téléphone couché) */
@media (max-height: 640px) {
  .cadeau-scene { height: 245px; padding-bottom: 12px; }
  .cadeau-halo { width: 130px; height: 130px; margin-left: -65px; top: 2px; }
}

/* Mouvement réduit : tout est posé, rien ne bouge */
@media (prefers-reduced-motion: reduce) {
  .cadeau,
  .cadeau::backdrop,
  .cadeau *,
  .cadeau *::before,
  .cadeau *::after {
    animation: none !important;
    transition: none !important;
  }
  .cadeau-etincelle { opacity: 0.8; }
}
