/* =========================================================
   L'OUVERTURE DE L'ACCUEIL
   Le timelapse de la mairie occupe l'écran, puis l'en-tête et la
   recherche montent par-dessus. La vidéo ne disparaît jamais : elle
   devient le fond du héros, exactement là où était la photo.
   ========================================================= */

.acc-ouverture {
  position: relative;
  height: 215svh;            /* la course de défilement de l'ouverture */
}
.acc-ouverture__fixe {
  position: sticky; top: 0;
  height: 100svh; min-height: 420px;
  overflow: hidden;
  background: #0d1a14;
  isolation: isolate;
}

.acc-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* Un léger rapprochement pendant la descente : piloté par le moteur. */
  transform-origin: 50% 54%;
  will-change: transform;
}
.acc-voile {
  position: absolute; inset: 0; z-index: 1;
  background:
    linear-gradient(180deg, rgba(8, 20, 15, .55) 0%, rgba(8, 20, 15, .1) 32%,
                            rgba(8, 20, 15, .35) 72%, rgba(8, 20, 15, .8) 100%);
  opacity: .55;
}

/* ---------- Plan 1 : la commune, en grand ---------- */
.acc-plan1 {
  position: absolute; inset: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center;
  /* Haut dans le ciel, pas au milieu de l'écran : le bâtiment occupe le
     bas du cadre, on ne vient pas se poser dessus. */
  justify-content: flex-start;
  padding-top: clamp(2.5rem, 11vh, 7rem);
  gap: .8rem; text-align: center; padding-inline: 1.5rem;
  color: #fff;
  will-change: opacity, transform;
}
.acc-plan1__logo {
  width: clamp(92px, 13vw, 150px); height: auto;
  border-radius: 20px;
  background: rgba(255, 255, 255, .94);
  padding: .6rem;
  box-shadow: 0 22px 50px -24px rgba(0, 0, 0, .9);
}
.acc-plan1__mot {
  margin: 0;
  font-family: var(--f-titre, inherit);
  font-size: clamp(1.6rem, 4.6vw, 3.2rem); line-height: 1;
  letter-spacing: .01em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .55);
}
.acc-plan1__defiler {
  position: absolute; bottom: clamp(1.4rem, 5vh, 3rem);
  margin: 0; display: flex; flex-direction: column; align-items: center; gap: .3rem;
  font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255, 255, 255, .85);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .8);
  animation: accDescend 2.4s ease-in-out infinite;
}
@keyframes accDescend {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(7px); }
}

/* ---------- Plan 2 : le héros, sur la même vidéo ---------- */
/* Le héros porte son propre voile : le ciel du timelapse est clair, et
   un titre blanc dessus devient illisible. Il arrive avec le texte. */
.acc-plan2::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background:
    radial-gradient(120% 90% at 50% 62%, rgba(8, 24, 18, .82), rgba(8, 24, 18, .2) 72%),
    linear-gradient(180deg, rgba(8, 24, 18, .5), rgba(8, 24, 18, .72));
}
.acc-plan2 {
  position: absolute; inset: 0; z-index: 4; isolation: isolate;
  display: flex; align-items: center;
  padding: clamp(4.5rem, 10vh, 7rem) 0 clamp(2rem, 6vh, 4rem);
  color: #fff;
  opacity: 0; visibility: hidden;
  will-change: opacity, transform;
}
.acc-plan2 .hero__in { width: 100%; }
.acc-plan2 h1 {
  color: #fff;
  text-shadow: 0 2px 24px rgba(0, 0, 0, .5);
}
.acc-plan2 .accroche { color: #e2eee8; text-shadow: 0 1px 12px rgba(0, 0, 0, .6); }

/* ---------- L'en-tête, qui n'apparaît qu'ensuite ---------- */
.vue--accueil .bandeau-alerte,
.vue--accueil .entete {
  transition: transform .45s var(--ease-doux, cubic-bezier(.4, 0, .2, 1)),
              opacity .35s ease;
}
.acc-attente .bandeau-alerte,
.acc-attente .entete {
  transform: translateY(-115%);
  opacity: 0;
  pointer-events: none;
}

/* Sans JavaScript, rien ne doit rester caché. */
.no-js .acc-plan1 { display: none; }
.no-js .acc-plan2 { opacity: 1; visibility: visible; }
.no-js .acc-ouverture { height: auto; }
.no-js .acc-ouverture__fixe { position: relative; }

@media (max-width: 760px) {
  .acc-ouverture { height: 195svh; }
  .acc-plan2 { align-items: flex-end; padding-bottom: 2.5rem; }
  .acc-plan1__defiler { bottom: 1.2rem; }
}

/* Mouvement réduit : pas de vidéo qui démarre seule, pas de va-et-vient.
   On montre l'affiche et on donne tout de suite le héros. */
@media (prefers-reduced-motion: reduce) {
  .acc-ouverture { height: 100svh; }
  .acc-plan1__defiler { animation: none; }
  .acc-video { transform: none !important; }
}


/* ═══ TÉLÉPHONE EN PAYSAGE ═══
   L'ouverture tient en hauteur réduite : on raccourcit la course et on
   resserre les deux plans, sinon le héros sort du cadre. */
@media (max-height: 460px) and (orientation: landscape) {
  .acc-ouverture { height: 170svh; }
  .acc-ouverture__fixe { min-height: 320px; }
  .acc-plan1 { padding-top: 1.2rem; gap: .4rem; }
  .acc-plan1__logo { width: 62px; }
  .acc-plan1__mot { font-size: 1.1rem; }
  .acc-plan1__defiler { bottom: .5rem; font-size: .6rem; }
  .acc-plan2 { align-items: center; padding: 3rem 0 1rem; }
  .acc-plan2 h1 { font-size: 1.5rem; }
  .acc-plan2 .accroche { display: none; }
}

/* ═══ GRANDS ÉCRANS ═══ */
@media (min-width: 1600px) {
  .acc-plan1__logo { width: 168px; }
  .acc-plan1__mot { font-size: 3.6rem; }
}
