:root {
  --orange: #fd6f4d;
  --orange-deep: #e5603f;
  --ember: #9a3420;
  --night: #2d1910;
  --ink: #141414;
  --cream: #fff4f1;
  --cream-dim: rgba(255, 244, 241, .62);
  --line: rgba(255, 244, 241, .28);
  --display: "Antonio", "Bricolage Grotesque", sans-serif;
  --body: "Bricolage Grotesque", system-ui, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font: 400 15px/1.5 var(--body);
  color: var(--cream);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
:focus-visible { outline: 2px solid var(--cream); outline-offset: 4px; border-radius: 6px; }

.snow { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.santa-layer { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 4; }

/* Cadre arrondi comme sur la maquette */
.frame {
  position: relative;
  margin: 24px;
  height: calc(100svh - 48px);
  border: 1px solid var(--line);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 34% 46% at 50% 62%, #ffb08f 0%, rgba(253, 111, 77, 0) 70%),
    radial-gradient(ellipse 62% 80% at 50% 55%, var(--orange) 0%, var(--orange-deep) 30%, var(--ember) 60%, rgba(45, 25, 16, 0) 88%),
    radial-gradient(ellipse 120% 90% at 50% 40%, var(--night) 30%, #0e0806 100%);
}
.frame::after { /* grain léger */
  content: "";
  position: absolute; inset: 0;
  pointer-events: none;
  opacity: .08;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Barre du haut */
.topbar {
  position: relative; z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28px 64px 0;
}
.prev {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 44px;
  padding: 0 16px 0 10px;
  border-radius: 999px;
  color: var(--cream-dim);
  transition: color .2s, background .2s;
}
.prev[hidden] { display: none; }
.prev:hover { color: var(--cream); background: rgba(255, 244, 241, .08); }
.prev svg { width: 18px; height: 18px; flex: none; transition: transform .25s cubic-bezier(.22, 1, .36, 1); }
.prev:hover svg { transform: translateX(-3px); }
.prev-text { display: grid; line-height: 1.25; }
.prev-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; }
.prev-title { font-size: 13px; color: var(--cream); opacity: 0; max-height: 0; overflow: hidden; transition: opacity .25s, max-height .25s; }
.prev:hover .prev-title, .prev:focus-visible .prev-title { opacity: 1; max-height: 20px; }
.bell { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; transition: background .2s; }
.bell:hover { background: rgba(255, 244, 241, .1); }
.bell svg { width: 20px; height: 20px; }

/* Scène */
.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr) auto;
  grid-template-areas:
    "title"
    "chest"
    "next";
  padding: 0 64px 32px;
  row-gap: 16px;
}

.headline {
  grid-area: title;
  position: relative; z-index: 1;
  margin: 2vh 0 0;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .26em;
  white-space: nowrap;
  font: 100 clamp(56px, min(11vw, 19svh), 250px)/.9 var(--display);
  letter-spacing: -.01em;
  text-transform: uppercase;
  color: var(--cream);
}

.headline span:last-child { font-weight: 220; }

/* Coffre : centré dans l'espace entre le titre et la case suivante */
.chest {
  grid-area: chest;
  position: relative; z-index: 2;
  align-self: center;
  justify-self: center;
  aspect-ratio: 1;
  height: 100%;
  max-height: 42vw;
  width: auto;
  display: grid;
  place-items: center;
  border-radius: 28px;
  transition: transform .5s cubic-bezier(.22, 1, .36, 1);
}
.chest:hover { transform: translateY(-6px) scale(1.015); }
.chest-glow {
  position: absolute; inset: -18%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 210, 170, .55), rgba(253, 111, 77, .25) 40%, transparent 70%);
  filter: blur(10px);
  animation: breathe 4s ease-in-out infinite;
}
/* Le fond du rendu est un studio sombre : le masque radial l'estompe en vignette
   autour du coffre pour qu'il se fonde dans la lueur de la page. */
.chest-video {
  position: relative;
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 50% 52%, #000 34%, rgba(0,0,0,.6) 52%, transparent 70%);
  mask-image: radial-gradient(circle at 50% 52%, #000 34%, rgba(0,0,0,.6) 52%, transparent 70%);
}
@keyframes breathe { 50% { opacity: .7; transform: scale(.94); } }


.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--night);
  font-weight: 600; font-size: 15px;
  transition: transform .2s, background .2s;
}
.cta:hover { background: #fff; transform: translateY(-1px); }
.cta:active { transform: scale(.97); }
.cta svg { width: 18px; height: 18px; }
.cta-full { width: 100%; }
.cta-ghost { margin-top: 10px; background: transparent; color: var(--cream); border: 1px solid var(--line); font-weight: 500; }
.cta-ghost:hover { background: rgba(255, 244, 241, .08); border-color: var(--cream-dim); transform: none; }
.cta-ghost[hidden] { display: none; }

/* Case suivante, à droite du coffre */
.next {
  grid-area: next;
  align-self: end;
  justify-self: center;
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 18px;
  text-align: left;
  padding: 10px 22px 10px 10px;
  border-radius: 999px;
  transition: background .3s;
}
.next:hover { background: rgba(255, 244, 241, .07); }
.next-ring { position: relative; width: 96px; height: 96px; flex: none; display: grid; place-items: center; }
.next-progress { position: absolute; inset: 0; transform: rotate(-90deg); }
.next-progress circle { stroke: rgba(255, 244, 241, .22); stroke-width: 1.5; }
.next-progress .next-progress-bar { stroke: var(--cream); stroke-dasharray: 351.86; stroke-dashoffset: 351.86; transition: stroke-dashoffset 1s linear; }
.next-num { font: 200 34px/1 var(--display); transition: opacity .3s, transform .3s; }
.next-lock {
  position: absolute;
  width: 36px; height: 36px; padding: 8px;
  border-radius: 50%;
  background: var(--cream); color: var(--night);
  stroke-width: 2;
  right: -4px; bottom: -4px;
  transition: transform .4s cubic-bezier(.16, 1, .3, 1);
}
.next:hover .next-lock { transform: rotate(-12deg) scale(1.1); }
.next-text { display: grid; gap: 2px; white-space: nowrap; }
.next-title { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.next-count { font-size: 13px; color: var(--cream-dim); font-variant-numeric: tabular-nums; }
.next-cta { margin-top: 6px; font-size: 14px; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: rgba(255, 244, 241, .4); }
.next:hover .next-cta { text-decoration-color: var(--cream); }

/* Modale d'inscription */
.subscribe {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 28px;
  color: var(--cream);
  background: radial-gradient(ellipse at 50% 0%, rgba(253, 111, 77, .45), transparent 60%), var(--night);
  box-shadow: 0 40px 100px rgba(0, 0, 0, .6);
}
.subscribe::backdrop { background: rgba(14, 8, 6, .7); backdrop-filter: blur(6px); }
.subscribe[open] { animation: rise .45s cubic-bezier(.22, 1, .36, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(24px) scale(.97); } }
.sub-form, .sub-done { position: relative; padding: 36px 32px 32px; }
.sub-close { position: absolute; top: 16px; right: 16px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.sub-close:hover { background: rgba(255, 244, 241, .1); }
.sub-close svg { width: 18px; height: 18px; }
.sub-eyebrow { margin: 0 0 8px; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--orange); }
.sub-title { margin: 0 0 10px; font: 200 44px/1 var(--display); text-transform: uppercase; }
.sub-text { margin: 0 0 24px; color: var(--cream-dim); text-wrap: pretty; }
.sub-field { display: grid; gap: 8px; margin-bottom: 16px; }
.sub-label { font-size: 13px; font-weight: 500; }
.sub-field input {
  min-height: 50px;
  padding: 0 16px;
  font: inherit; font-size: 16px;
  color: var(--cream);
  background: rgba(255, 244, 241, .06);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color .2s, background .2s;
}
.sub-field input::placeholder { color: rgba(255, 244, 241, .35); }
.sub-field input:focus { outline: none; border-color: var(--orange); background: rgba(255, 244, 241, .1); }
.sub-consent { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 20px; font-size: 13px; color: var(--cream-dim); cursor: pointer; }
.sub-consent input { margin-top: 2px; width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.sub-error { margin: -6px 0 16px; font-size: 13px; color: #ffb4a2; }
.cta[aria-busy="true"] { opacity: .6; pointer-events: none; }

/* Tablette */
@media (max-width: 1024px) {
  .topbar, .stage { padding-inline: 36px; }
  .chest { max-height: min(420px, 70vw); }
}

/* Mobile */
@media (max-width: 640px) {
  .prev-title { display: none; }
  .frame { margin: 10px; height: calc(100svh - 20px); border-radius: 24px; }
  .topbar { padding: 20px 20px 0; }
  .stage { padding: 0 20px 28px; row-gap: 20px; }
  .headline { flex-direction: column; align-items: center; font-size: min(22vw, 12svh); line-height: .9; margin-top: 12px; }
  .chest { max-height: 82vw; }
  .next { justify-self: stretch; padding: 12px; border: 1px solid var(--line); border-radius: 24px; background: rgba(45, 25, 16, .35); }
  .next-ring { width: 76px; height: 76px; }
  .next-num { font-size: 28px; }
  .sub-form, .sub-done { padding: 32px 22px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .snow { display: none; }
}

/* Entrée dans la case : le halo du coffre s'étend jusqu'à remplir l'écran */
.portal {
  position: fixed; inset: 0; z-index: 50;
  pointer-events: none;
  background: radial-gradient(circle at 50% 56%, #fff4f1 0, #ffd2aa 22%, #fd6f4d 70%, #8a2f1a 100%);
  clip-path: circle(0 at var(--px, 50%) var(--py, 55%));
  transition: clip-path .85s cubic-bezier(.65, 0, .35, 1);
}
body.entering .portal { clip-path: circle(150vmax at var(--px, 50%) var(--py, 55%)); }
body.entering .headline, body.entering .next, body.entering .topbar {
  opacity: 0; transition: opacity .5s ease;
}
