/* ==========================================================
   Joyeux anniversaire Amanda — styles
   ========================================================== */

:root {
  --night: #0f0b09;
  --beige: #F3E8D8;
  --beige-light: #FBF6EE;
  --beige-deep: #E9DAC5;
  --cream: #FFF9F1;
  --cocoa: #4B3428;
  --terracotta: #D8735A;
  --terracotta-deep: #C25E46;
  --blush: #F0AAA2;

  --font-display: "Fredoka", ui-rounded, "Segoe UI", system-ui, sans-serif;
  --font-script: "Pacifico", "Brush Script MT", cursive;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;

  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  background: var(--night);
  color: var(--cocoa);
  font-family: var(--font-display);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 1.2s ease;
}
body.is-lit { background-color: var(--beige); }

button { font: inherit; color: inherit; -webkit-user-select: none; user-select: none; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Les fonds : la nuit, puis le jour qui se lève depuis les bougies ---------- */

.backdrop { position: fixed; inset: 0; pointer-events: none; }

.backdrop--night {
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 55%), #2c2119 0, #1b1410 24%, #0e0a08 62%, #090605 100%);
}

.backdrop--day {
  background: radial-gradient(ellipse 85% 75% at 50% 42%, var(--beige-light) 0%, var(--beige) 55%, var(--beige-deep) 100%);
  -webkit-mask-image: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), #000 var(--r0, 0px), transparent var(--r1, 0px));
          mask-image: radial-gradient(circle at var(--lx, 50%) var(--ly, 50%), #000 var(--r0, 0px), transparent var(--r1, 0px));
}
.backdrop--day.is-full { -webkit-mask-image: none; mask-image: none; }

/* léger grain de papier */
.backdrop--day::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .4 0 0 0 0 .3 0 0 0 0 .2 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .6;
  mix-blend-mode: multiply;
}

/* ---------- Guirlande lumineuse en haut de l'écran ---------- */

.lights {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 90px;
  z-index: 2;
  pointer-events: none;
  opacity: 0;
  transition: opacity .9s ease;
}
.is-lit .lights { opacity: 1; }
.lights svg { display: block; overflow: visible; }
.lights__wire { fill: none; stroke: #6B5444; stroke-width: 1.4; stroke-opacity: .5; }
.bulb__cap { fill: #85705F; }
.bulb__glass { fill: #E6DACA; transition: fill .35s ease var(--d); }
.bulb__glow { opacity: 0; transition: opacity .5s ease var(--d); }
.is-lit .bulb__glass { fill: #FFE6A3; }
.is-lit .bulb__glow {
  opacity: 1;
  animation: twinkle var(--t) ease-in-out calc(var(--d) + var(--o)) infinite alternate;
}
@keyframes twinkle { from { opacity: 1; } to { opacity: .4; } }

/* ---------- La scène ---------- */

.stage {
  position: relative;
  z-index: 3;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(.25rem, 1.4vh, 1rem);
  gap: clamp(.25rem, 1.4svh, 1rem);
  padding: clamp(52px, 8vh, 84px) 16px max(20px, env(safe-area-inset-bottom));
  padding-top: clamp(52px, 8svh, 84px);
  overflow: hidden;
  overflow: clip;
}

/* ---------- Titre : banderole + prénom ---------- */

.headline {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 0;
  font-weight: 400;
  visibility: hidden;
}
.headline.is-shown { visibility: visible; }

.banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: min(calc(100vw - 12px), 980px);
}

.garland { position: relative; flex: none; }

.garland__cord {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
.garland__cord path {
  fill: none;
  stroke: #8A6D5A;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}
.garland__cord circle {
  fill: #B08D6E;
  transform-box: fill-box;
  transform-origin: center;
  scale: 0;
}
.headline.is-shown .garland__cord path { animation: draw-cord .8s ease-out forwards; }
.headline.is-shown .garland__cord circle { animation: pop .45s var(--spring) forwards; }
.headline.is-settled .garland__cord path { animation: none; stroke-dashoffset: 0; }
.headline.is-settled .garland__cord circle { animation: none; scale: 1; }
@keyframes draw-cord { to { stroke-dashoffset: 0; } }
@keyframes pop { to { scale: 1; } }

.flag { position: absolute; transform-origin: 50% 0; }

.flag__cloth {
  display: flex;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding-top: 13%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .22), rgba(255, 255, 255, 0) 40%, rgba(0, 0, 0, .07)),
    var(--c);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  box-shadow: inset 0 3px 0 rgba(75, 52, 40, .12);
  transform-origin: 50% 0;
  transform: perspective(400px) rotateX(-90deg);
}
.flag__letter {
  font: 600 calc(var(--fw) * .52) / 1 var(--font-display);
  color: var(--cocoa);
}
.headline.is-shown .flag__cloth {
  animation:
    flag-unfold .75s var(--spring) calc(var(--i) * 45ms + 250ms) both,
    flag-sway 3.4s ease-in-out calc(var(--i) * -.41s) infinite alternate;
}
.headline.is-settled .flag__cloth {
  transform: none;
  animation: flag-sway 3.4s ease-in-out calc(var(--i) * -.41s) infinite alternate;
}
@keyframes flag-unfold {
  from { transform: perspective(400px) rotateX(-90deg); }
  to { transform: perspective(400px) rotateX(0deg); }
}
@keyframes flag-sway {
  from { rotate: -2.5deg; }
  to { rotate: 2.5deg; }
}

.name {
  display: block;
  margin-top: -.15em;
  padding: 0 .35em .05em;
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(2.4rem, min(1.4rem + 8vw, 11vh), 5.8rem);
  font-size: clamp(2.4rem, min(1.4rem + 8vw, 11svh), 5.8rem);
  line-height: 1.25;
  color: var(--terracotta-deep);
  text-shadow: .04em .045em 0 var(--blush);
  clip-path: inset(-40% 100% -40% -10%);
}
.headline.is-shown .name { animation: write 1.4s cubic-bezier(.65, 0, .35, 1) .9s both; }
@keyframes write {
  from { clip-path: inset(-40% 100% -40% -10%); }
  to { clip-path: inset(-40% -10% -40% -10%); }
}

/* ---------- Le gâteau ---------- */

.cake {
  position: relative;
  display: block;
  flex: none;
  width: clamp(150px, min(68vw, 34vh), 310px);
  width: clamp(150px, min(68vw, 34svh), 310px);
  aspect-ratio: 320 / 360;
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
}
.cake:focus-visible { outline: 2px dashed rgba(216, 115, 90, .7); outline-offset: 6px; }
.is-dark .cake:focus-visible { outline-color: rgba(243, 232, 216, .45); }
.is-dark .cake { animation: breathe 3.6s ease-in-out infinite; }
.cake.is-bump { animation: bump .35s ease; }
@keyframes breathe { 50% { scale: 1.025; } }
@keyframes bump { 40% { scale: .96; } }

.cake svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cake__art {
  filter: brightness(.3) saturate(.55);
  transition: filter 1.8s ease;
}
.is-dark .cake:hover .cake__art { filter: brightness(.42) saturate(.62); transition-duration: .4s; }
.is-lit .cake__art { filter: none; }

.cake__halo {
  position: absolute;
  left: 50%;
  top: 36%;
  width: 150%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 200, 120, .45), rgba(255, 200, 120, 0));
  opacity: .14;
  pointer-events: none;
  transition: opacity 1.4s ease;
}
.is-lit .cake__halo { opacity: 1; }

.cake__warmth { opacity: 0; transition: opacity 1.4s ease; }
.is-lit .cake__warmth { opacity: 1; }

.candle-fx__flame {
  transform-box: fill-box;
  transform-origin: 50% 90%;
  transform: scale(0);
  opacity: 0;
  transition: transform .5s var(--spring), opacity .15s ease;
}
.candle-fx.is-lit .candle-fx__flame { transform: scale(1); opacity: 1; }

.candle-fx__dance { transform-box: fill-box; transform-origin: 50% 100%; }
.candle-fx.is-lit .candle-fx__dance { animation: flicker var(--fd, 1.1s) ease-in-out infinite alternate; }
@keyframes flicker {
  0% { transform: scale(1, 1) skewX(0deg); }
  30% { transform: scale(.94, 1.07) skewX(2.5deg); }
  60% { transform: scale(1.04, .95) skewX(-2deg); }
  100% { transform: scale(.97, 1.04) skewX(1.5deg); }
}

.candle-fx__glow {
  transform-box: fill-box;
  transform-origin: center;
  opacity: 0;
  transition: opacity .6s ease;
}
.candle-fx.is-lit .candle-fx__glow { opacity: 1; animation: glow 2.2s ease-in-out infinite alternate; }
@keyframes glow {
  from { transform: scale(.9); }
  to { transform: scale(1.12); }
}

/* ---------- Le cadeau ---------- */

.gift-slot {
  position: relative;
  display: grid;
  justify-items: center;
  align-items: start;
  width: 100%;
  height: clamp(110px, 19vh, 165px);
  height: clamp(110px, 19svh, 165px);
  margin-top: -8px;
}

.hint {
  position: absolute;
  top: 18px;
  left: 50%;
  translate: -50% 0;
  margin: 0;
  font: 600 clamp(1.35rem, 1.1rem + .8vw, 1.7rem) / 1 var(--font-hand);
  color: var(--beige);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
}
.show-hint .hint { animation: hint-in 1.4s ease forwards, hint-breathe 2.6s ease-in-out 1.4s infinite alternate; }
.is-lighting .hint,
.is-lit .hint { animation: none; opacity: 0; }
@keyframes hint-in {
  from { opacity: 0; translate: -50% 8px; }
  to { opacity: .7; translate: -50% 0; }
}
@keyframes hint-breathe {
  from { opacity: .7; }
  to { opacity: .35; }
}
.hint__touch { display: none; }
@media (hover: none) and (pointer: coarse) {
  .hint__mouse { display: none; }
  .hint__touch { display: inline; }
}

.gift {
  position: relative;
  isolation: isolate;
  width: clamp(96px, min(27vw, 16vh), 140px);
  width: clamp(96px, min(27vw, 16svh), 140px);
  aspect-ratio: 160 / 170;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  visibility: hidden;
  opacity: 0;
  transform: translateY(24px) scale(.3);
  transition: opacity .3s ease, transform .8s var(--spring), visibility 0s linear .8s;
}
.gift.is-shown {
  visibility: visible;
  opacity: 1;
  transform: none;
  transition: opacity .3s ease, transform .8s var(--spring), visibility 0s;
}
.gift:focus-visible { outline: 2px dashed rgba(216, 115, 90, .7); outline-offset: 6px; }

.gift__art {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 95%;
  transition: translate .25s ease;
}
.gift.is-shown:not(.is-open) .gift__art { animation: wiggle 2.8s ease-in-out 1.6s infinite; }
.gift:not(.is-open):hover .gift__art { translate: 0 -4px; }
.gift.is-shaking .gift__art { animation: shake .5s ease-in-out; }
@keyframes wiggle {
  0%, 62%, 100% { rotate: 0deg; }
  68% { rotate: -7deg; }
  74% { rotate: 6deg; }
  80% { rotate: -4deg; }
  86% { rotate: 3deg; }
  92% { rotate: -1deg; }
}
@keyframes shake {
  0%, 100% { rotate: 0deg; }
  15% { rotate: -9deg; }
  30% { rotate: 8deg; }
  45% { rotate: -7deg; }
  60% { rotate: 6deg; }
  75% { rotate: -3deg; }
  90% { rotate: 2deg; }
}

.gift__label { font: 700 22px var(--font-hand); fill: var(--cocoa); }

.gift__tag { transition: opacity .4s ease; }
.gift.is-open .gift__tag { opacity: 0; }

.gift__lid {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transition: transform .8s cubic-bezier(.2, .8, .25, 1), opacity .5s ease .35s;
}
.gift.is-open .gift__lid { transform: translate(-8px, -95px) rotate(-26deg); opacity: 0; }

.gift__rays {
  position: absolute;
  left: 50%;
  top: 46%;
  z-index: -1;
  width: 200%;
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 140, .6) 0deg 8deg, rgba(255, 214, 140, 0) 8deg 22.5deg);
  -webkit-mask-image: radial-gradient(closest-side, #000 20%, transparent 75%);
          mask-image: radial-gradient(closest-side, #000 20%, transparent 75%);
  opacity: 0;
  scale: 0;
  pointer-events: none;
  transition: scale .9s cubic-bezier(.2, .9, .3, 1.15), opacity .5s ease;
}
.gift.is-open .gift__rays { opacity: 1; scale: 1; animation: spin 16s linear infinite; }
@keyframes spin { to { rotate: 360deg; } }

/* ---------- Confettis et sushis ---------- */

.fx {
  position: fixed;
  inset: 0;
  z-index: 20;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- La carte « soirée sushi » ---------- */

/* le voile passe sous les sushis, la carte au-dessus */
.voucher-backdrop {
  position: fixed;
  inset: 0;
  z-index: 15;
  background: rgba(75, 52, 40, .3);
  -webkit-backdrop-filter: blur(3px);
          backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .45s ease;
}
.voucher-backdrop.is-open { opacity: 1; }

.voucher {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 16px;
  pointer-events: none;
}

.voucher__card {
  position: relative;
  pointer-events: auto;
  width: min(100%, 420px);
  filter: drop-shadow(0 22px 30px rgba(75, 52, 40, .35));
  opacity: 0;
  transform: translateY(30vh) scale(.4) rotate(-8deg);
  transition: transform .8s cubic-bezier(.3, 1.35, .5, 1), opacity .3s ease;
}
.voucher.is-open .voucher__card { opacity: 1; transform: none; }

.voucher__ticket {
  --cut: clamp(108px, 18vh, 148px);
  --notch: 13px;
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px);
  overflow: auto;
  border-radius: 22px;
  background: var(--cream);
  -webkit-mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), transparent calc(var(--notch) - .5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), transparent calc(var(--notch) - .5px), #000 var(--notch)) right / 51% 100% no-repeat;
          mask:
    radial-gradient(circle var(--notch) at 0 var(--cut), transparent calc(var(--notch) - .5px), #000 var(--notch)) left / 51% 100% no-repeat,
    radial-gradient(circle var(--notch) at 100% var(--cut), transparent calc(var(--notch) - .5px), #000 var(--notch)) right / 51% 100% no-repeat;
}

.voucher__beach { display: block; width: 100%; height: var(--cut); }

.voucher__body {
  margin: 0 20px;
  padding: 20px 6px 26px;
  border-top: 2px dashed rgba(75, 52, 40, .2);
  text-align: center;
}

.voucher__title {
  margin: 0 0 .55rem;
  font: 600 clamp(1.3rem, 1.05rem + 1.4vw, 1.75rem) / 1.25 var(--font-display);
  color: var(--cocoa);
  text-wrap: balance;
}

.voucher__note {
  margin: 0;
  font: 700 clamp(1.55rem, 1.25rem + 1.6vw, 2.1rem) / 1.1 var(--font-hand);
  color: var(--terracotta-deep);
  rotate: -2deg;
  text-wrap: balance;
}

.voucher__close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0 0 2px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 249, 241, .85);
  box-shadow: 0 2px 8px rgba(75, 52, 40, .15);
  color: var(--cocoa);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.voucher__close:focus-visible { outline: 2px solid var(--terracotta); outline-offset: 2px; }

.noscript {
  position: fixed;
  inset: auto 0 24px;
  z-index: 40;
  margin: 0;
  text-align: center;
  font: 600 1.4rem var(--font-hand);
  color: var(--beige);
}

/* ---------- Moins d'animations si l'appareil le demande ---------- */

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