/* ============ RESET + BASE ============ */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
body {
  margin: 0;
  font-family: var(--f-texte);
  font-size: var(--fs-base);
  line-height: 1.62;
  color: var(--texte);
  background: var(--bg);
  /* `clip` et non `hidden` : `hidden` transforme <body> en conteneur de
     défilement, ce qui casse tous les `position: sticky` de la visite guidée. */
  overflow-x: clip;
  transition: background-color .7s var(--ease-doux), color .7s var(--ease-doux);
}
/* height:auto est indispensable : sans lui, un <img> avec des attributs
   width/height se retrouve écrasé dès qu'il est contraint en largeur. */
img, svg, video { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; color: inherit; }

h1, h2, h3, h4, .titre {
  font-family: var(--f-titre);
  font-weight: 400;
  letter-spacing: .012em;
  line-height: .95;
  margin: 0 0 .4em;
  text-wrap: balance;
}
h1 { font-size: var(--fs-2xl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-lg); letter-spacing: .02em; }
p  { margin: 0 0 1em; }

.sur-titre {
  font-family: var(--f-texte);
  font-weight: 600;
  font-size: var(--fs-xs);
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 .7rem;
  display: flex; align-items: center; gap: .6rem;
}
.sur-titre::before {
  content: ""; width: 26px; height: 2px; background: var(--accent-vif); border-radius: 2px;
}

.contenu { width: min(100% - 2.4rem, var(--largeur)); margin-inline: auto; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}

/* ============ ACCESSIBILITÉ ============ */
:focus-visible {
  outline: 3px solid var(--c-orange);
  outline-offset: 3px;
  border-radius: 4px;
}
.skip-lien {
  position: fixed; top: -100px; left: 12px; z-index: 999;
  background: var(--c-vert); color: #fff; padding: .7rem 1.1rem;
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
  transition: top .2s;
}
.skip-lien:focus { top: 12px; }

/* ============ BOUTONS ============ */
.btn {
  --btn-bg: var(--c-vert);
  --btn-fg: #fff;
  display: inline-flex; align-items: center; gap: .6rem;
  padding: .85rem 1.5rem;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 0; border-radius: var(--r-pill);
  font-weight: 600; font-size: var(--fs-sm); letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  transition: transform .25s var(--ease-doux), box-shadow .25s var(--ease-doux), background-color .25s;
  box-shadow: var(--ombre-1);
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); }
.btn:active { transform: translateY(0); }
.btn .fl { transition: transform .25s var(--ease-doux); }
.btn:hover .fl { transform: translateX(4px); }
.btn--or     { --btn-bg: var(--c-orange); --btn-fg: #2c2408; }
.btn--anis   { --btn-bg: var(--c-anis);   --btn-fg: #2b3005; }
.btn--fantome{ --btn-bg: transparent; --btn-fg: var(--texte); box-shadow: inset 0 0 0 1.5px var(--trait); }
.btn--fantome:hover { box-shadow: inset 0 0 0 1.5px var(--accent); }
.btn--sm { padding: .55rem 1.05rem; font-size: var(--fs-xs); }

/* ============ CARTES ============ */
.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  box-shadow: var(--ombre-1);
  transition: transform .3s var(--ease-doux), box-shadow .3s var(--ease-doux), border-color .3s;
}
a.carte { text-decoration: none; display: block; }
a.carte:hover { transform: translateY(-4px); box-shadow: var(--ombre-2); border-color: var(--accent); }

/* ============ APPARITION AU SCROLL ============ */
.reveal { opacity: 0; transform: translateY(26px); }
.reveal.vu {
  opacity: 1; transform: none;
  transition: opacity .7s var(--ease-doux), transform .7s var(--ease-doux);
}
.reveal.d1 { transition-delay: .08s; }
.reveal.d2 { transition-delay: .16s; }
.reveal.d3 { transition-delay: .24s; }
.reveal.d4 { transition-delay: .32s; }
.reveal.d5 { transition-delay: .40s; }

/* ============ VUES (routeur) ============ */
.vue { display: none; }
.vue.actif { display: block; }
.vue--portail.actif { display: grid; }

/* Une vue masquée l'est doublement : classe ET attribut. Aucun résidu
   d'une autre vue ne peut rester à l'écran. */
.vue[hidden] { display: none !important; }

/* Le rideau ne fait que passer par-dessus le changement, déjà effectué. */
#rideau {
  position: fixed; inset: 0; z-index: 900; pointer-events: none;
  background: linear-gradient(120deg, var(--c-vert), var(--c-vert-950) 60%);
  transform: translateY(101%);
}
#rideau.balaye { animation: rideauBalaye .5s cubic-bezier(.5,0,.2,1); }
@keyframes rideauBalaye {
  0%   { transform: translateY(101%); }
  38%  { transform: translateY(0); }
  100% { transform: translateY(-101%); }
}
