/* ==========================================================================
   Accueil — « Une app. Toute la nuit. » (#app-night.anx)
   Une réservation vécue de 20 h à minuit : la section est épinglée pendant le
   défilement, chaque palier change l'écran du téléphone, l'heure géante en fond,
   la notification et l'ambiance. Piloté par js/home-night.js.
   ========================================================================== */
#app-night {
  --anx-text: #f5f4f1;
  --anx-muted: rgba(245, 244, 241, 0.62);
  --anx-faint: rgba(245, 244, 241, 0.4);
  --anx-line: rgba(245, 244, 241, 0.12);
  --anx-gold: #c6a66a;
  --anx-gold-hi: #e8d5a8;
  --anx-ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --anx-c1: rgba(198, 166, 106, 0.22);
  --anx-c2: rgba(120, 70, 200, 0.12);
  position: relative;
  height: calc(100svh + var(--anx-steps, 6) * 65svh);
  margin: 0;
  padding: 0;
  background: #050505;
  color: var(--anx-text);
  text-align: left;
}
#app-night[data-step="1"] { --anx-c1: rgba(198, 166, 106, 0.2); --anx-c2: rgba(220, 70, 90, 0.12); }
#app-night[data-step="2"] { --anx-c1: rgba(232, 180, 90, 0.2); --anx-c2: rgba(60, 120, 220, 0.12); }
#app-night[data-step="3"] { --anx-c1: rgba(198, 166, 106, 0.26); --anx-c2: rgba(150, 60, 200, 0.12); }
#app-night[data-step="4"] { --anx-c1: rgba(127, 207, 154, 0.16); --anx-c2: rgba(198, 166, 106, 0.16); }
#app-night[data-step="5"] { --anx-c1: rgba(127, 207, 154, 0.22); --anx-c2: rgba(198, 166, 106, 0.12); }

.anx-sticky { position: sticky; top: 0; height: 100svh; overflow: hidden; display: flex; align-items: center; }

/* Ambiance */
.anx-ambient { position: absolute; inset: 0; pointer-events: none; }
.anx-ambient i { position: absolute; border-radius: 50%; transition: background 1.2s var(--anx-ease); will-change: transform; }
.anx-ambient i:nth-child(1) { width: 60vw; height: 60vw; right: -10vw; top: -10vw; background: radial-gradient(closest-side, var(--anx-c1), transparent); animation: anxDrift 18s ease-in-out infinite alternate; }
.anx-ambient i:nth-child(2) { width: 50vw; height: 50vw; left: -15vw; bottom: -20vw; background: radial-gradient(closest-side, var(--anx-c2), transparent); animation: anxDrift 22s ease-in-out infinite alternate-reverse; }
@keyframes anxDrift { to { transform: translate(-6vw, 4vw) scale(1.08); } }

/* Heure géante en fond */
.anx-clock { position: absolute; inset: 0; display: grid; place-items: center end; padding-right: 2vw; pointer-events: none; }
.anx-clock span {
  font: 800 clamp(120px, 24vw, 380px) / 1 Rubik, Montserrat, sans-serif;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(245, 244, 241, 0.07);
  transition: -webkit-text-stroke-color 0.8s;
}
#app-night[data-step="5"] .anx-clock span { -webkit-text-stroke-color: rgba(198, 166, 106, 0.16); }

.anx-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 3rem);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(30px, 5vw, 80px);
  align-items: center;
}

/* Colonne texte */
.anx-copy { min-width: 0; }
.anx-kicker { display: inline-flex; align-items: center; gap: 10px; margin: 0 0 18px; color: var(--anx-gold-hi); font-size: 11.5px; font-weight: 800; letter-spacing: 0.2em; text-transform: uppercase; }
.anx-kicker i { width: 26px; height: 2px; border-radius: 2px; background: var(--anx-gold); }
#app-night .anx-title { margin: 0; font: 800 clamp(38px, 5.4vw, 76px) / 0.92 Rubik, Montserrat, sans-serif; letter-spacing: -0.035em; text-transform: uppercase; color: var(--anx-text); }
#app-night .anx-accent { display: block; font-family: "Instrument Serif", Georgia, serif; font-style: italic; font-weight: 400; font-size: 1.12em; letter-spacing: -0.01em; text-transform: none; color: var(--anx-gold); }
#app-night .anx-sub { margin: 18px 0 28px; max-width: 440px; color: var(--anx-muted); font-size: 15.5px; line-height: 1.6; }

.anx-steps { position: relative; margin: 0; padding: 0 0 0 22px; list-style: none; }
.anx-steps::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 10px; width: 2px; border-radius: 2px; background: var(--anx-line); }
.anx-steps::after { content: ""; position: absolute; left: 4px; top: 10px; width: 2px; height: calc((100% - 20px) * var(--anx-p, 0)); border-radius: 2px; background: linear-gradient(180deg, var(--anx-gold), var(--anx-gold-hi)); box-shadow: 0 0 12px rgba(198, 166, 106, 0.6); }
.anx-step { position: relative; }
.anx-step::before { content: ""; position: absolute; left: -22px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: #050505; box-shadow: inset 0 0 0 2px rgba(245, 244, 241, 0.25); transition: box-shadow 0.4s, background 0.4s; z-index: 1; }
.anx-step.is-done::before, .anx-step.is-on::before { background: var(--anx-gold); box-shadow: 0 0 0 4px rgba(198, 166, 106, 0.18); }
.anx-step-btn { display: flex; align-items: baseline; gap: 14px; width: 100%; padding: 8px 0; border: 0; background: none; color: var(--anx-faint); font: inherit; text-align: left; cursor: pointer; transition: color 0.3s; }
.anx-step-btn:hover { color: var(--anx-text); }
.anx-step-time { font: 700 13px ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: 0.04em; color: inherit; min-width: 44px; }
.anx-step-label { font-size: 13px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; }
.anx-step.is-on .anx-step-btn { color: var(--anx-gold-hi); }
#app-night .anx-step-body h3 { margin: 2px 0 6px 58px; color: var(--anx-text); font: 800 22px/1.15 Montserrat, sans-serif; letter-spacing: -0.01em; }
#app-night .anx-step-body p { margin: 0 0 12px 58px; max-width: 420px; color: var(--anx-muted); font-size: 14.5px; line-height: 1.6; }
.anx-step-body { max-height: 0; overflow: hidden; opacity: 0; transition: max-height 0.5s var(--anx-ease), opacity 0.4s; }
.anx-step.is-on .anx-step-body { max-height: 180px; opacity: 1; }
.anx-cta { display: inline-flex; align-items: center; gap: 10px; height: 50px; margin-top: 26px; padding: 0 24px; border-radius: 999px; background: linear-gradient(180deg, #e2c68e, #c6a66a 55%, #b08f55); box-shadow: 0 10px 34px rgba(198, 166, 106, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5); color: #160f03 !important; font-size: 14px; font-weight: 800; text-decoration: none !important; transition: transform 0.3s var(--anx-ease); }
.anx-cta:hover { transform: translateY(-2px); }
.anx-cta svg { width: 16px; height: 16px; }

/* Téléphone */
.anx-stage { position: relative; display: grid; place-items: center; min-height: 0; }
.anx-halo { position: absolute; width: 80%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(closest-side, var(--anx-c1), transparent); transition: background 1s; }
.anx-phone {
  --h: min(70svh, 640px);
  position: relative;
  width: calc(var(--h) * 270 / 560);
  height: var(--h);
  transform: perspective(1400px) rotateY(calc(-10deg + var(--anx-local, 0) * 14deg)) rotateX(4deg);
  left: 0;
  transition: left 0.8s var(--anx-ease);
  will-change: transform;
}
/* Ombre portée statique (un filtre sur l'élément qui tourne serait recalculé à chaque image) */
.anx-stage::after { content: ""; position: absolute; z-index: -1; left: 50%; bottom: 2%; width: 46%; height: 9%; border-radius: 50%; background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), transparent); transform: translateX(-50%); pointer-events: none; }
/* Écrans avec une fenêtre qui déborde (plan de salle, QR) : on recentre l'ensemble */
#app-night[data-step="2"] .anx-phone,
#app-night[data-step="4"] .anx-phone,
#app-night[data-step="5"] .anx-phone { left: calc(var(--h) * -0.11); }
.anx-screen {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: calc(var(--h) * var(--w) / 560);
  max-width: none;
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.6s var(--anx-ease), transform 0.8s var(--anx-ease);
}
.anx-screen.is-on { opacity: 1; transform: none; }

/* Dans le téléphone : heure de la barre d'état synchronisée, notification iOS, doigt qui touche */
.anx-status {
  position: absolute;
  z-index: 2;
  left: 8.5%;
  top: 3.2%;
  width: 17%;
  height: 3.4%;
  display: grid;
  place-items: center start;
  padding-left: 2.5%;
  border-radius: 6px;
  background: #121212;
  color: #fff;
  font: 600 calc(var(--h) * 0.0235) / 1 -apple-system, "SF Pro Text", Montserrat, sans-serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  transition: background 0.4s;
}
#app-night[data-step="1"] .anx-status { background: #1a0b0b; }
#app-night[data-step="3"] .anx-status { background: #2e2d25; }

.anx-notif {
  position: absolute;
  z-index: 4;
  top: 6.5%;
  left: 50%;
  display: flex;
  align-items: center;
  gap: calc(var(--h) * 0.016);
  width: 92%;
  padding: calc(var(--h) * 0.016) calc(var(--h) * 0.02) calc(var(--h) * 0.016) calc(var(--h) * 0.016);
  border-radius: calc(var(--h) * 0.035);
  background: rgba(40, 40, 40, 0.82);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.1), 0 14px 40px rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  transform: translateX(-50%);
  animation: anxDrop 3.6s var(--anx-ease) both;
}
.anx-notif.is-bump { animation: anxDrop 3.6s var(--anx-ease) both; }
/* Sort de la Dynamic Island, reste lisible, puis remonte un peu pour laisser voir l'écran */
@keyframes anxDrop {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(0.6); }
  12% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  80% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0.92; transform: translate(-50%, -8%) scale(0.97); }
}
.anx-notif img { width: calc(var(--h) * 0.05); height: calc(var(--h) * 0.05); border-radius: 22%; flex: none; }
.anx-notif-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.anx-notif-head { display: flex; justify-content: space-between; gap: 8px; }
.anx-notif-head b { color: rgba(245, 244, 241, 0.55); font-size: calc(var(--h) * 0.016); font-weight: 800; letter-spacing: 0.06em; }
.anx-notif-head small { color: rgba(245, 244, 241, 0.55); font-size: calc(var(--h) * 0.016); }
.anx-notif-stack { display: grid; }
.anx-notif-txt { grid-area: 1 / 1; color: #fff; font-size: calc(var(--h) * 0.02); font-weight: 700; line-height: 1.3; opacity: 0; transition: opacity 0.3s; }
.anx-notif-txt.is-on { opacity: 1; }

/* Doigt : se pose sur l'élément à toucher, appuie, onde, recommence */
.anx-tap {
  position: absolute;
  z-index: 3;
  left: var(--tx, 50%);
  top: var(--ty, 50%);
  width: calc(var(--h) * 0.07);
  height: calc(var(--h) * 0.07);
  margin: calc(var(--h) * -0.035) 0 0 calc(var(--h) * -0.035);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.7), 0 6px 20px rgba(0, 0, 0, 0.4);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
  pointer-events: none;
  opacity: 0;
  transition: left 0.9s var(--anx-ease), top 0.9s var(--anx-ease);
}
.anx-tap i { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 2px rgba(232, 213, 168, 0.9); opacity: 0; }
#app-night.is-tapping .anx-tap { animation: anxPress 2.6s ease-in-out 0.9s infinite; }
#app-night.is-tapping .anx-tap i { animation: anxRipple 2.6s ease-out 0.9s infinite; }
@keyframes anxPress {
  0% { opacity: 0; transform: scale(1.25); }
  15% { opacity: 1; transform: scale(1); }
  25% { transform: scale(0.78); }
  35% { transform: scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: scale(1); }
}
@keyframes anxRipple {
  0%, 24% { opacity: 0; transform: scale(1); }
  26% { opacity: 1; transform: scale(1); }
  60%, 100% { opacity: 0; transform: scale(2.6); }
}
/* L'écran « s'allume » à chaque changement */
.anx-phone::after { content: ""; position: absolute; inset: 1.5% 3.5%; z-index: 1; border-radius: 12%/6%; background: radial-gradient(circle at var(--tx, 50%) var(--ty, 50%), rgba(255, 255, 255, 0.18), transparent 45%); opacity: 0; pointer-events: none; }
#app-night.is-flash .anx-phone::after { animation: anxFlash 0.9s ease-out; }
@keyframes anxFlash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* Arrivée : balayage du QR puis « Bienvenue » */
.anx-scan { position: absolute; z-index: 3; left: 80%; top: 57.5%; width: 45%; height: 21.5%; border-radius: 8px; box-shadow: 0 0 0 2px rgba(127, 207, 154, 0.7), 0 0 40px rgba(127, 207, 154, 0.35); overflow: hidden; opacity: 0; pointer-events: none; transition: opacity 0.4s; }
.anx-scan i { position: absolute; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, transparent, #7fcf9a, transparent); box-shadow: 0 0 24px 6px rgba(127, 207, 154, 0.45); animation: anxScan 1.8s ease-in-out infinite alternate; }
@keyframes anxScan { from { top: 4%; } to { top: 94%; } }
.anx-welcome { position: absolute; z-index: 4; left: 50%; bottom: 14%; display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 10px; border-radius: 999px; background: rgba(18, 40, 26, 0.9); box-shadow: 0 0 0 1px rgba(127, 207, 154, 0.4), 0 20px 50px rgba(0, 0, 0, 0.6); color: #d9f5e2; font-size: 15px; white-space: nowrap; opacity: 0; transform: translate(-50%, 16px) scale(0.9); transition: opacity 0.5s 0.6s, transform 0.6s 0.6s var(--anx-ease); }
.anx-welcome span { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #7fcf9a; color: #0b2414; }
.anx-welcome svg { width: 16px; height: 16px; }
#app-night[data-step="5"] .anx-scan { opacity: 1; }
#app-night[data-step="5"] .anx-welcome { opacity: 1; transform: translate(-50%, 0) scale(1); }

/* Barre de progression globale */
.anx-rail { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(245, 244, 241, 0.06); }
.anx-rail i { display: block; width: calc(var(--anx-p, 0) * 100%); height: 100%; background: linear-gradient(90deg, var(--anx-gold), var(--anx-gold-hi)); }

.anx-mobile-step { display: none; }

/* Mobile : téléphone au centre, texte de l'étape en dessous */
@media (max-width: 900px) {
  .anx-phone { transform: none; will-change: auto; }
  /* Mobile : ambiance en dégradé fixe, heure géante pleine (le contour coûte cher à peindre) */
  .anx-ambient { display: none; }
  .anx-sticky { background: radial-gradient(90% 60% at 80% 10%, var(--anx-c1), transparent 70%), radial-gradient(80% 50% at 10% 100%, var(--anx-c2), transparent 70%); transition: background 0.8s; }
  .anx-clock span { color: rgba(245, 244, 241, 0.045); -webkit-text-stroke: 0; }
  #app-night[data-step="5"] .anx-clock span { color: rgba(198, 166, 106, 0.09); }
  .anx-notif { -webkit-backdrop-filter: none; backdrop-filter: none; background: rgba(38, 38, 38, 0.96); }
  .anx-tap { -webkit-backdrop-filter: none; backdrop-filter: none; }
  #app-night { height: calc(100svh + var(--anx-steps, 6) * 55svh); }
  .anx-inner { grid-template-columns: 1fr; gap: 0; height: 100%; padding-top: 5rem; padding-bottom: 6.5rem; grid-template-rows: auto 1fr; }
  .anx-copy { text-align: center; }
  .anx-kicker { margin-bottom: 10px; }
  #app-night .anx-title { font-size: clamp(30px, 9vw, 44px); }
  #app-night .anx-sub, .anx-steps, .anx-cta { display: none; }
  .anx-clock { place-items: start center; padding: 0; }
  .anx-clock span { margin-top: 26svh; font-size: 36vw; }
  .anx-stage { align-self: stretch; grid-template-rows: 1fr auto; gap: 12px; padding-top: 14px; }
  .anx-phone { --h: min(48svh, 440px); }
  .anx-mobile-step { display: block; text-align: center; min-height: 92px; }
  .anx-mobile-step b { display: block; margin-bottom: 2px; color: var(--anx-gold-hi); font: 700 12px ui-monospace, Menlo, monospace; letter-spacing: 0.08em; }
  .anx-mobile-step strong { display: block; color: var(--anx-text); font-size: 19px; font-weight: 800; }
  .anx-mobile-step span { display: block; max-width: 340px; margin: 4px auto 0; color: var(--anx-muted); font-size: 13.5px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  .anx-ambient i, .anx-scan i, .anx-notif, .anx-tap, .anx-tap i { animation: none !important; }
  .anx-phone { transform: none; }
}
