/* ==========================================================================
   Anissa & Hugo — landing page temporaire
   Calques : .scene--bg (z0) → .countdown (z1) → .scene--fg (z2) → .shade (z3) → UI (z4)
   ========================================================================== */

@font-face {
  font-family: "Gloock";
  src: url("../fonts/gloock-digits.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
  unicode-range: U+0030-0039;
}
@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --night: #0a1626;
  --panel: #161b30;
  --field: #232940;
  --field-line: rgba(215, 223, 233, .14);
  --ink: #edf0f5;
  --ink-soft: rgba(237, 240, 245, .78);
  --ink-mute: rgba(237, 240, 245, .56);
  --sand: #d7dfe9;           /* couleur du logotype */
  --error: #ffb4ab;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);
  --sans: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: "Gloock", "Didot", "Bodoni 72", Georgia, serif;
  --H: 1vh;
}
@supports (height: 1dvh) { :root { --H: 1dvh; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--night); }
body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img {
  display: block; max-width: 100%;
  -webkit-user-select: none; user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;
}
/* Images décoratives et logotypes : ni sélectionnables, ni déplaçables, ni « enregistrables » au toucher long */
.scene, .brand, .brand__logo, .panel__logo {
  -webkit-user-select: none; user-select: none;
  pointer-events: none;
}
button, input { font: inherit; color: inherit; }
a { color: inherit; }

::selection { background: rgba(215, 223, 233, .88); color: #0a1626; }

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

:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; }

/* --------------------------------------------------------------------------
   Page & géométrie de la scène
   La dune (sommet à x = 50,98 %, y = 46,32 % de l'image) est placée de façon
   à ce que son sommet tombe toujours à --peak × hauteur de page, quel que soit
   le format d'écran. Les deux calques partagent exactement la même géométrie.
   -------------------------------------------------------------------------- */
.page {
  --ph: max(calc(100 * var(--H)), 340px);       /* hauteur utile */
  --scene-h: 1.13;                               /* hauteur scène / page */
  --peak: calc(.4632 * var(--scene-h));          /* position du sommet */
  --gutter: clamp(16px, 4vw, 64px);
  position: relative;
  height: var(--ph);
  overflow: hidden;
  background: var(--night);
}

.scene {
  --w: max(100vw, calc(var(--scene-h) * var(--ph) * 1.77778));
  position: absolute;
  width: var(--w);
  aspect-ratio: 16 / 9;
  left: clamp(calc(100vw - var(--w)), calc(50vw - .5098 * var(--w)), 0px);
  top: min(0px, calc(var(--peak) * var(--ph) - .26055 * var(--w)));
  pointer-events: none;
  transform-origin: 50.98% 46.32%;
}
.scene picture, .scene img { width: 100%; height: 100%; }
.scene--bg { z-index: 0; }
.scene--fg { z-index: 2; }

/* Voile : assombrit légèrement la scène et garantit le contraste du texte bas */
.shade {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background:
    linear-gradient(to top, rgba(7, 12, 24, .62) 0%, rgba(7, 12, 24, .34) 26%, rgba(7, 12, 24, 0) 52%),
    rgba(6, 12, 24, .16);
}

/* main ne crée pas de contexte d'empilement : ses enfants s'intercalent entre les calques */
.stage { display: block; }

/* --------------------------------------------------------------------------
   Logotype
   -------------------------------------------------------------------------- */
.brand {
  position: absolute; z-index: 4; left: 0; right: 0;
  top: max(calc(env(safe-area-inset-top) + 16px), calc(var(--ph) * .055));
  display: flex; justify-content: center;
}
.brand__logo {
  width: auto;
  opacity: .75;
  height: clamp(44px, calc(var(--ph) * .085), 92px);
}

/* --------------------------------------------------------------------------
   Compte à rebours
   --n : nombre total de chiffres ; --m : chiffres de l'unité la plus longue ;
   --u : nombre d'unités (mis à jour par main.js)
   -------------------------------------------------------------------------- */
.countdown {
  --n: 9; --m: 4; --u: 3;
  --cell: .66em;                                  /* largeur fixe d'un chiffre (Gloock « 0 » = 0,657 em) */
  --side: clamp(28px, 10vw, 200px);               /* marge latérale minimale du compteur */
  --gap: .42em;                                   /* espace entre unités */
  --a: .06;                                       /* recouvrement par la dune */
  --anchor: calc(var(--ph) * (var(--peak) + var(--a))); /* bas des chiffres */
  --fs: min(
    calc((100vw - 2 * var(--side)) / (var(--n) * .66 + (var(--u) - 1) * .42)),
    calc(var(--ph) * .28)
  );
  position: absolute; z-index: 1; left: 0; right: 0;
  bottom: calc(var(--ph) - var(--anchor));
  display: flex; justify-content: center;
  pointer-events: none;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
}
.countdown__units {
  display: flex; align-items: flex-end; justify-content: center;
  gap: calc(var(--fs) * .42);
  font-size: var(--fs);
}
.unit {
  display: flex; flex-direction: column; align-items: center;
}
.unit__label {
  font-family: var(--sans);
  font-size: max(12px, calc(var(--fs) * .13));
  font-weight: 250;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: rgba(215, 223, 233, .36);
  margin-bottom: calc(var(--fs) * .17);
  white-space: nowrap;
}
.unit__value {
  display: flex;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1em;
  line-height: .79;               /* boîte = hauteur des chiffres Gloock (0,77 em) */
  color: rgba(215, 223, 233, .4);
  font-kerning: none;
}

/* Chaque chiffre est une cellule fixe ; l'ancien et le nouveau glyphe s'y superposent */
.d { display: grid; width: var(--cell); }
.g {
  grid-area: 1 / 1;
  text-align: center;
  transition:
    opacity 1.1s var(--ease),
    transform 1.3s var(--ease),
    filter 1.1s var(--ease);
}
.g--in  { opacity: 0; transform: translateY(.14em); filter: blur(.035em); }
.g--out {
  opacity: 0; transform: translateY(-.14em); filter: blur(.035em);
  transition-duration: .8s, 1s, .8s;
}

/* --------------------------------------------------------------------------
   Texte d'accompagnement + bouton
   -------------------------------------------------------------------------- */
.intro {
  position: absolute; z-index: 4; left: 0; right: 0;
  bottom: max(calc(env(safe-area-inset-bottom) + 20px), calc(var(--ph) * .065));
  display: flex; flex-direction: column; align-items: center;
  gap: clamp(14px, calc(var(--ph) * .028), 24px);
  padding: 0 var(--gutter);
  text-align: center;
}
.intro__text {
  margin: 0;
  max-width: 34em;
  font-size: clamp(13px, .45vw + 10.5px, 16px);
  font-weight: 400;
  line-height: 1.6;
  color: rgba(237, 240, 245, .66);
  text-wrap: balance;
}

.pill {
  appearance: none; cursor: pointer;
  min-height: 44px;
  padding: 0 clamp(20px, 2vw, 28px);
  border-radius: 999px;
  border: 1px solid rgba(237, 240, 245, .14);
  background: rgba(237, 240, 245, .1);
  -webkit-backdrop-filter: blur(14px) saturate(120%);
  backdrop-filter: blur(14px) saturate(120%);
  color: rgba(237, 240, 245, .92);
  font-size: 13.5px; font-weight: 500; letter-spacing: .01em;
  transition: background-color .35s var(--ease), border-color .35s var(--ease), transform .35s var(--ease);
}
.pill:hover { background: rgba(237, 240, 245, .18); border-color: rgba(237, 240, 245, .26); color: var(--ink); }
.pill:active { transform: scale(.98); }

.noscript { position: fixed; z-index: 10; bottom: 16px; left: 0; right: 0; text-align: center; margin: 0; }

/* --------------------------------------------------------------------------
   Composition verticale (smartphones, tablettes en portrait, fenêtres plus
   hautes que larges) : unités empilées, dune abaissée pour libérer le ciel.
   -------------------------------------------------------------------------- */
@media (max-aspect-ratio: 1/1) {
  .page { --scene-h: 1.26; }
  .countdown {
    --a: .012;
    --side: clamp(24px, 7vw, 120px);
    --label: clamp(11px, calc(var(--ph) * .016), 22px);
    --label-gap: calc(var(--label) * .55);
    /* Hauteur disponible entre le logo et le sommet de la dune, répartie entre les unités */
    --fs: min(
      calc((100vw - 2 * var(--side)) / (var(--m) * .66)),
      calc((var(--ph) * (var(--peak) + var(--a) - .14) - var(--u) * (var(--label) + var(--label-gap))) / (var(--u) * .89 - .1)),
      240px
    );
  }
  .countdown__units { flex-direction: column; align-items: center; gap: calc(var(--fs) * .1); }
  .unit__label { font-size: var(--label); margin-bottom: var(--label-gap); }
  .brand { top: max(calc(env(safe-area-inset-top) + 16px), calc(var(--ph) * .04)); }
  .brand__logo { height: clamp(42px, calc(var(--ph) * .06), 80px); }
  .intro__text { max-width: 30em; }
}

/* Écrans très bas (smartphones à l'horizontale) */
@media (min-aspect-ratio: 1/1) and (max-height: 500px) {
  .brand__logo { height: 38px; }
  .brand { top: max(env(safe-area-inset-top), 12px); }
  .countdown { --a: .045; --fs: min(calc((100vw - 2 * var(--side)) / (var(--n) * .66 + (var(--u) - 1) * .42)), calc(var(--ph) * .26)); }
  .intro { gap: 10px; bottom: max(env(safe-area-inset-bottom), 14px); }
  .intro__text { font-size: 12.5px; max-width: 46em; line-height: 1.5; }
}

/* --------------------------------------------------------------------------
   Animations d'entrée (uniquement si JS actif)
   -------------------------------------------------------------------------- */
.js .scene { opacity: 0; transform: scale(1.04); }
.js .brand, .js .intro { opacity: 0; transform: translateY(10px); }
.js .countdown__units { opacity: 0; transform: translateY(8%); }

.js.is-ready .scene {
  opacity: 1; transform: none;
  transition: opacity 1.4s var(--ease), transform 2.4s var(--ease);
}
.js.is-ready .countdown__units {
  opacity: 1; transform: none;
  transition: opacity 1.4s var(--ease) .45s, transform 1.9s var(--ease) .45s;
}
.js.is-ready .brand {
  opacity: 1; transform: none;
  transition: opacity 1s var(--ease) .2s, transform 1.2s var(--ease) .2s;
}
.js.is-ready .intro {
  opacity: 1; transform: none;
  transition: opacity 1s var(--ease) .9s, transform 1.2s var(--ease) .9s;
}

/* --------------------------------------------------------------------------
   Panneau d'inscription (dialog)
   -------------------------------------------------------------------------- */
.panel {
  position: fixed;
  inset: 0 0 0 auto;
  margin: 0;
  width: clamp(380px, 40vw, 600px);
  max-width: 100vw;
  height: 100%;
  max-height: none;
  padding: 0;
  border: 0;
  background: var(--panel);
  color: var(--ink);
  box-shadow: -40px 0 80px rgba(0, 0, 0, .35);
  transform: translateX(100%);
  transition: transform .75s var(--ease);
  overflow: hidden;
}
.panel.is-open { transform: none; }
.panel::backdrop {
  background: rgba(4, 8, 18, 0);
  transition: background-color .6s var(--ease), backdrop-filter .6s var(--ease);
}
.panel.is-open::backdrop {
  background: rgba(4, 8, 18, .5);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}

.panel__inner {
  position: relative;
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex; flex-direction: column; align-items: center;
  padding:
    max(calc(env(safe-area-inset-top) + 64px), 10vh)
    clamp(24px, 4vw, 64px)
    max(calc(env(safe-area-inset-bottom) + 20px), 28px);
}
.panel__close {
  position: absolute;
  top: max(calc(env(safe-area-inset-top) + 12px), 18px);
  right: max(calc(env(safe-area-inset-right) + 12px), 18px);
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink-mute);
  cursor: pointer;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.panel__close:hover { background: rgba(237, 240, 245, .08); color: var(--ink); }

.panel__body {
  width: 100%; max-width: 360px;
  margin: auto 0;
  text-align: center;
}
.panel__logo { width: 88px; height: auto; margin: 0 auto 28px; opacity: .9; }
.panel__view { transition: opacity .45s var(--ease), transform .45s var(--ease); }
.panel__view.is-leaving { opacity: 0; transform: translateY(-6px); }
.panel__view.is-entering { opacity: 0; transform: translateY(6px); }

.panel__title {
  margin: 0 0 10px;
  font-size: 22px; font-weight: 600; letter-spacing: -.005em; line-height: 1.3;
}
.panel__title:focus { outline: none; }
.panel__lead {
  margin: 0 0 32px;
  font-size: 14.5px; line-height: 1.6;
  color: rgba(237, 240, 245, .66);
}

.form { text-align: left; }
.field { margin-bottom: 14px; }
.field__label {
  display: block; margin-bottom: 8px;
  font-size: 12.5px; font-weight: 500; color: rgba(237, 240, 245, .6);
}
.field__input {
  display: block; width: 100%;
  height: 50px; padding: 0 16px;
  border: 1px solid var(--field-line);
  border-radius: 10px;
  background: var(--field);
  color: var(--ink);
  font-size: 12px;                      /* ≥ 16 px : pas de zoom auto sur iOS */
  transition: border-color .3s var(--ease), box-shadow .3s var(--ease), background-color .3s var(--ease);
}
.field__input::placeholder { color: rgba(237, 240, 245, .38); }
.field__input:hover { border-color: rgba(215, 223, 233, .26); }
.field__input:focus { outline: none; border-color: rgba(215, 223, 233, .55); box-shadow: 0 0 0 3px rgba(215, 223, 233, .14); }
.field__input[aria-invalid="true"] { border-color: rgba(255, 180, 171, .7); }
.field__input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px rgba(255, 180, 171, .18); }
.field__msg {
  margin: 0; min-height: 0;
  font-size: 13px; line-height: 1.45; color: var(--error);
  opacity: 0; transform: translateY(-3px);
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.field__msg.is-visible { margin-top: 8px; opacity: 1; transform: none; }

.hp { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.btn {
  position: relative;
  appearance: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 50px; padding: 0 20px;
  border: 0; border-radius: 10px;
  background: #e6e8ed; color: #161b30;
  font-size: 14.5px; font-weight: 600;
  transition: background-color .3s var(--ease), transform .3s var(--ease), opacity .3s var(--ease);
}
.btn:hover { background: #ffffff; }
.btn:active { transform: scale(.99); }
.btn[aria-busy="true"] { cursor: progress; }
.btn[aria-busy="true"] .btn__label { opacity: 0; }
.btn__label { transition: opacity .25s var(--ease); }
.btn__spinner {
  position: absolute; width: 18px; height: 18px;
  border-radius: 50%;
  border: 1.5px solid rgba(22, 27, 48, .25);
  border-top-color: #161b30;
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.btn[aria-busy="true"] .btn__spinner { opacity: 1; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.btn--ghost {
  background: transparent; color: var(--ink);
  border: 1px solid rgba(237, 240, 245, .24);
}
.btn--ghost:hover { background: rgba(237, 240, 245, .08); }

.form__note {
  margin: 16px 0 0;
  font-size: 12px; line-height: 1.55;
  color: rgba(237, 240, 245, .52);
  text-align: center;
}

.panel__footer {
  margin-top: 40px;
  text-align: center;
  font-size: 11.5px; line-height: 1.6; letter-spacing: .02em;
  color: rgba(237, 240, 245, .5);
}
.panel__footer p { margin: 0; }

/* Mobile : panneau plein écran qui monte depuis le bas */
@media (max-width: 640px) {
  .panel {
    inset: 0;
    width: 100%; height: 100%;
    transform: translateY(100%);
    box-shadow: none;
    transition: transform .6s var(--ease);
  }
  .panel__inner { padding-top: max(calc(env(safe-area-inset-top) + 72px), 12vh); }
  .panel__logo { width: 72px; margin-bottom: 24px; }
}

/* --------------------------------------------------------------------------
   Préférence « réduire les animations »
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: .01ms !important;
    transition-delay: 0s !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
  .btn[aria-busy="true"] .btn__spinner { animation: spin 1.6s linear infinite !important; }
  .js .scene, .js .brand, .js .intro, .js .countdown__units, .g { transform: none !important; filter: none !important; }
  .panel, .panel.is-open { transform: none; }
  .panel:not(.is-open) { opacity: 0; }
}
