/* =====================================================================
   Visual Memories — haut de page « Lumière d'or » (assets/js/vm-lumiere.js)
   Photo pleine page posée comme une affiche de cinéma (visages à l'opposé
   du texte, fondu ivoire côté texte), poussière d'or et arche en WebGL,
   traversée de l'arche au défilement jusqu'à « L'approche ».
   Typographie et entrée des textes : style.css (section 9).
   Calques : photo/vidéo (0) · canvas (1) · flou (2) · voile (3) · textes (4).
   ===================================================================== */

/* ---------- Deux écrans : la scène, puis la traversée au défilement ---------- */
.hero { position: relative; color: var(--encre); }
.js .hero { height: 190vh; height: 190svh; }
.hero__stage {
  --hero-bg: var(--ivoire);
  position: sticky; top: 0;
  height: 100vh; height: 100svh; min-height: 560px;
  overflow: hidden;
  background: var(--hero-bg);
}

/* La photo (LCP) et la vidéo éventuelle : cadrage calculé par vm-lumiere.js */
.hero__media { position: absolute; inset: 0; z-index: 0; }
.hero__photo, .hero__video {
  position: absolute; left: 0; top: 0;
  width: 100%; height: 100%; max-width: none;
  object-fit: cover; object-position: 50% 38%;
}
/* La photo s'affiche dès qu'elle est chargée (LCP), sous l'intro qui se fond en elle ; à l'arrivée, elle recule à peine */
.js .hero__photo { transform: scale(1.045); transition: transform 2.4s var(--ease); }
.js .hero.is-ready .hero__photo { transform: none; }
.hero__photo.is-missing { visibility: hidden; }
.hero__video { opacity: 0; transition: opacity 1.4s var(--ease-out); }
.hero__media.has-video .hero__video { opacity: 1; }

/* Arche en SVG (sans WebGL) : un filet d'or qui se trace, les pieds s'effacent */
.hero__arch {
  position: absolute; display: none; overflow: visible; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 100%); mask-image: linear-gradient(180deg, #000 55%, transparent 100%);
}
.hero.no-gl .hero__arch { display: block; }
.hero__arch path {
  fill: none; stroke: #CDAA6C; stroke-width: 1.2; vector-effect: non-scaling-stroke;
  stroke-dasharray: var(--len, 4000); stroke-dashoffset: var(--len, 4000);
  filter: drop-shadow(0 0 3px rgba(236, 200, 130, .55));
}
.hero.no-gl.is-ready .hero__arch path { stroke-dashoffset: 0; transition: stroke-dashoffset 2.6s var(--ease-inout) 1s; }
.hero-nuit .hero__arch path { stroke: #E3C489; }

/* Canvas WebGL : apparaît en fondu sur la photo, au même cadrage */
.hero__gl { position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%; opacity: 0; transition: opacity 1.2s var(--ease-out); }
.hero__gl.is-on { opacity: 1; }

/* Léger flou sous le texte (sans WebGL ; le WebGL défocalise lui-même la photo) */
.hero__blur {
  position: absolute; inset: 0; z-index: 2; display: none; pointer-events: none;
  -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px);
  -webkit-mask-image: var(--blur-mask); mask-image: var(--blur-mask);
}
.hero.no-gl .hero__blur { display: block; }

/* Voile de lisibilité : couleur et intensité calculées selon la photo (repli : voile ivoire standard) */
.hero__veil {
  position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: linear-gradient(90deg, rgba(251, 248, 242, .88) 0%, rgba(251, 248, 242, .88) 28%, rgba(251, 248, 242, .55) 46%, rgba(251, 248, 242, .15) 60%, rgba(251, 248, 242, 0) 72%);
}
.js .hero__veil { opacity: 0; transition: opacity 1.4s var(--ease-out); }
.js .hero.is-ready .hero__veil { opacity: 1; }

/* Sortie de la traversée sans WebGL : l'image se fond dans l'ivoire */
.hero__stage::after { content: ""; position: absolute; inset: 0; z-index: 3; background: var(--ivoire); opacity: var(--exit, 0); pointer-events: none; }

/* ---------- Textes : à gauche (ou à droite), à côté du sujet ---------- */
.hero__inner {
  z-index: 4; height: 100%;
  display: flex; align-items: center;
  padding-top: calc(var(--header-h) + 2vh); padding-bottom: 7vh;
}
.hero__content { width: fit-content; max-width: min(100%, 40rem); } /* en rem : la colonne grandit avec la police du titre */
.hero.is-flip .hero__content { margin-left: auto; }
/* « Défiler » : dans la colonne du texte, jamais sur le sujet */
.hero__scroll { z-index: 4; left: max(var(--gutter), calc((100% - var(--maxw)) / 2)); align-items: flex-start; transform: none; }
.hero.is-flip .hero__scroll { left: auto; right: max(var(--gutter), calc((100% - var(--maxw)) / 2)); align-items: flex-end; }
.js .hero__scroll { transform: translate3d(0, 18px, 0); }
.js .hero.is-ready .hero__scroll { transform: none; }
.hero__scroll > * { opacity: var(--cue, 1); transition: opacity .5s var(--ease-out); }
/* « Activer le son » (vidéo d'ambiance, si proposé dans l'admin) : petit, côté image, en bas */
.hero__sound {
  position: absolute; z-index: 5; bottom: 26px; right: max(var(--gutter), calc((100% - var(--maxw)) / 2));
  display: inline-flex; align-items: center; gap: .6rem; min-height: 44px; padding: 0 1.1rem;
  border: 1px solid rgba(169, 134, 79, .42); border-radius: 999px;
  background: rgba(251, 248, 242, .5); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--encre); font: 500 var(--fs-label)/1 var(--ff-sans); letter-spacing: var(--track); text-transform: uppercase;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  opacity: 0; visibility: hidden; transform: translate3d(0, 8px, 0);
  transition: opacity .9s var(--ease-out), transform .9s var(--ease-out), visibility 0s .9s, background-color .3s, border-color .3s;
}
.hero__sound.is-on { opacity: var(--cue, 1); visibility: visible; transform: none; transition: opacity .9s var(--ease-out) .8s, transform .9s var(--ease-out) .8s, visibility 0s, background-color .3s, border-color .3s; }
.hero__sound:hover { border-color: var(--or); background: rgba(251, 248, 242, .78); }
.hero__sound:focus-visible { outline: 2px solid var(--or-focus); outline-offset: 3px; }
/* muette : haut-parleur barré ; son activé : ondes */
.hero__sound .hero__sound-wave, .hero__sound.is-unmuted .hero__sound-x { display: none; }
.hero__sound.is-unmuted .hero__sound-wave { display: inline; }
.hero.is-flip .hero__sound { right: auto; left: max(var(--gutter), calc((100% - var(--maxw)) / 2)); }
.hero-nuit .hero__sound { color: var(--ivoire); background: rgba(23, 19, 16, .32); border-color: rgba(227, 203, 156, .5); }
.hero-nuit .hero__sound:hover { background: rgba(23, 19, 16, .5); border-color: #E3CB9C; }
/* la réponse « Votre date est-elle libre ? » prend sa place */
.hero:has(.hero__inner .dispo__answer:not([hidden])) .hero__scroll { visibility: hidden; transition: visibility 0s .5s; }
.hero:has(.hero__inner .dispo__answer:not([hidden])) .hero__scroll > * { opacity: 0; }

/* La traversée débouche sur « L'approche », qui monte déjà pendant que l'image se fond dans l'ivoire :
   la section recouvre la fin de la traversée (--ov), son haut est transparent puis ivoire,
   et sa lueur rosée est descendue pour ne pas être coupée par son bord. */
@media (prefers-reduced-motion: no-preference) {
  .js .hero + .approach {
    --ov: 30vh;
    margin-top: calc(-1 * var(--ov));
    background:
      radial-gradient(44vw 36vh at 92% calc(var(--ov) + 32vh), rgba(242, 228, 220, .55), rgba(242, 228, 220, 0) 70%),
      linear-gradient(180deg, rgba(251, 248, 242, 0) 0, var(--ivoire) var(--ov));
  }
  @supports (height: 1svh) { .js .hero + .approach { --ov: 30svh; } }
}

/* ---------- Ambiance « nuit » (photo sombre) : textes ivoire, voile d'encre ---------- */
.hero-nuit .hero__eyebrow { color: #E3CB9C; }
.hero-nuit .hero__title { color: var(--ivoire); }
.hero-nuit .hero__title em { color: #E6CB98; }
.hero-nuit .hero__text { color: rgba(251, 248, 242, .84); }
.hero-nuit .hero .btn--solid { color: var(--encre); background: var(--ivoire); border-color: var(--ivoire); --btn-fill: #E6CB98; }
.hero-nuit .hero .link-line { color: var(--ivoire); }
.hero-nuit .hero .dispo__label { color: var(--ivoire); }
.hero-nuit .hero .dispo .datepick__btn { color: var(--ivoire); border-bottom-color: rgba(227, 203, 156, .55); }
.hero-nuit .hero .dispo .datepick__btn.is-empty .datepick__value, .hero-nuit .hero .dispo .datepick__icon { color: #E3CB9C; }
.hero-nuit .hero .dispo__answer:not(.is-sheet) .dispo__lead { color: var(--ivoire); }
.hero-nuit .hero .dispo__answer:not(.is-sheet) .dispo__sub { color: rgba(251, 248, 242, .8); }
.hero-nuit .hero .dispo__answer:not(.is-sheet) .dispo__cta { color: #E3CB9C; }
.hero-nuit .hero__scroll { color: rgba(251, 248, 242, .8); }
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .js.hero-nuit .hero.is-ready .hero__title em {
    background-image: linear-gradient(100deg, #E6CB98 0%, #E6CB98 40%, #FFF3D6 50%, #E6CB98 60%, #E6CB98 100%);
  }
}
/* En-tête posé sur la photo sombre (jusqu'à ce qu'il retrouve son fond ivoire) */
.hero-nuit:not(.menu-open) .header:not(.is-solid) { color: var(--ivoire); }
.hero-nuit:not(.menu-open) .header:not(.is-solid) .nav__ig { color: var(--ivoire); }
.hero-nuit:not(.menu-open) .header:not(.is-solid) .nav__link.is-active { color: #E3CB9C; }
.hero-nuit:not(.menu-open) .header:not(.is-solid) .nav__link--cta { border-color: rgba(227, 203, 156, .8); }
.hero-nuit:not(.menu-open) .header:not(.is-solid) .header__logo { background: url("../logo/vm-monogram-ivory.svg") center / contain no-repeat; }
.hero-nuit:not(.menu-open) .header:not(.is-solid) .header__logo img { opacity: 0; }
.header__logo img { transition: opacity .6s; }

/* ---------- Téléphone et tablette : la photo en haut, les textes en bas sur le voile ---------- */
@media (max-width: 900px) {
  .js .hero { height: 175vh; height: 175svh; }
  .hero__inner { align-items: flex-end; padding-top: var(--header-h); padding-bottom: max(22px, 3svh); text-align: center; }
  .hero__content { width: 100%; max-width: none; margin: 0 auto !important; }
  /* textes calés en bas : la place du module de date (affiché par vm-dispo.js) est réservée, rien ne bouge */
  .js .hero__foot:has(> .dispo[hidden]) { padding-bottom: calc(.9rem + 44px); }
  .hero__veil { background: linear-gradient(0deg, rgba(251, 248, 242, .9) 0%, rgba(251, 248, 242, .9) 40%, rgba(251, 248, 242, .55) 55%, rgba(251, 248, 242, 0) 70%); }
  /* le texte occupe le bas : le bouton du son se pose en haut, sous l'en-tête, côté droit */
  .hero__sound, .hero.is-flip .hero__sound { top: calc(var(--header-h) + 6px); bottom: auto; left: auto; right: var(--gutter); padding: 0 .9rem; gap: .5rem; letter-spacing: .2em; }
}
@media (prefers-reduced-motion: no-preference) and (max-width: 900px) {
  .js .hero + .approach { --ov: 32vh; }
  @supports (height: 1svh) { .js .hero + .approach { --ov: 32svh; } }
}
@media (max-width: 600px) {
  .js .hero__foot:has(> .dispo[hidden]) { padding-bottom: calc(.3rem + 44px); }
  .hero-nuit .hero .dispo .datepick__btn { border: 1px solid rgba(227, 203, 156, .55); }
}

/* ---------- Mouvement réduit : une image fixe, sans traversée ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .hero { height: auto; }
  .js .hero__photo { opacity: 1; transform: none; }
  .hero__gl, .hero__veil, .hero__photo { transition: none !important; }
}

/* Si main.js n'a pas pu se charger : la photo et le voile s'affichent quand même */
.vm-fallback .hero__photo, .vm-fallback .hero__veil { opacity: 1 !important; transform: none !important; }

@media print {
  .js .hero { height: auto; }
  .hero__stage { position: relative; height: auto; min-height: 0; }
  .hero__media, .hero__gl, .hero__veil, .hero__blur, .hero__stage::after { display: none !important; }
}
