/* Visite 3D du cabinet : la scène est fixe derrière la page, les cartes défilent par-dessus. */
body.visite { background: #e9e4d8; overflow-x: hidden; }
#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; z-index: 0; opacity: 0; transition: opacity 1.2s ease; }
.pret #scene { opacity: 1; }
/* film précalculé : les images (.v-film) au-dessus de l'écran dessiné par three.js (#scene) ; les deux toiles ont la
   proportion du film et couvrent la fenêtre, posées au pixel près par visite.js (poserFilm) */
/* sous le film, la toile de l'écran est sombre comme la coque : un reste de trou (dalle vue par la tranche, sans WebGL)
   reste noir ; elle apparaît après le film (l'écran « s'allume ») pour ne pas assombrir le fondu d'entrée */
.film #scene { inset: auto; background: #161b1a; transition-delay: 1s; }
.v-film { position: fixed; z-index: 0; display: block; pointer-events: none; opacity: 0; transition: opacity 1.2s ease; }
.pret .v-film { opacity: 1; }
/* grain de film : bruit fin qui saute d'une place à l'autre, à peine visible */
.v-grain { position: fixed; inset: -10%; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay; background-size: 128px 128px; animation: v-grain .6s steps(1) infinite; }
@keyframes v-grain { 0% { transform: translate(0, 0); } 17% { transform: translate(-5%, 3%); } 33% { transform: translate(4%, -6%); } 50% { transform: translate(-7%, -2%); } 67% { transform: translate(6%, 5%); } 83% { transform: translate(-2%, 7%); } }

.v-entete { position: fixed; top: 0; left: 0; right: 0; z-index: 3; display: flex; align-items: center; gap: 1rem; padding: .9rem clamp(1rem, 3vw, 2rem);
  background: linear-gradient(to bottom, color-mix(in srgb, #f4f3ee 85%, transparent), transparent); }
.v-entete .marque { color: #1b2624; }
.v-lien { margin-left: auto; color: #1b2624; font-weight: 650; font-size: .95rem; text-decoration: none; padding: .45rem .8rem; border-radius: var(--r-full); }
.v-lien:hover { background: color-mix(in srgb, #fffefb 70%, transparent); }

main { position: relative; z-index: 2; pointer-events: none; } /* seules les cartes captent la souris : le reste va à la scène (objets cliquables) */
.v-etape { min-height: 120vh; display: flex; align-items: center; padding: 6rem clamp(1rem, 5vw, 4.5rem); pointer-events: none; }
.v-etape:first-child { min-height: 100vh; }
.v-gauche { justify-content: flex-start; }
.v-droite { justify-content: flex-end; }
.v-centre { justify-content: center; text-align: center; }

/* cartes : fond clair translucide, lisibles quel que soit le décor derrière */
.v-carte { pointer-events: auto; max-width: 25rem; padding: 1.5rem 1.6rem 1.6rem; border-radius: var(--r-xl); color: #1b2624;
  background: color-mix(in srgb, #fffefb 82%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border: 1px solid color-mix(in srgb, #ffffff 70%, transparent); box-shadow: 0 30px 70px -30px #1b262466;
  opacity: 0; transform: translateY(24px); transition: opacity .7s var(--ease), transform .7s var(--ease); }
.v-carte.vue { opacity: 1; transform: none; }
.v-carte h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); letter-spacing: -.04em; margin: .9rem 0 .8rem; }
.v-carte h2 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); letter-spacing: -.03em; margin-bottom: .6rem; }
.v-carte p { color: #3d4846; }
.v-carte .surtitre { color: #0d6e66; }
.v-titre { max-width: 34rem; }
.v-titre .actions { justify-content: center; }

.v-indice { display: inline-flex; flex-direction: column; align-items: center; gap: .5rem; margin-top: 1.4rem; font-size: .85rem; font-weight: 650; color: #0d6e66; }
.v-indice span { width: 22px; height: 34px; border: 2px solid currentColor; border-radius: 12px; position: relative; }
.v-indice span::after { content: ''; position: absolute; left: 50%; top: 6px; width: 4px; height: 7px; margin-left: -2px; border-radius: 2px; background: currentColor; animation: v-molette 1.6s infinite; }
@keyframes v-molette { 0% { transform: translateY(0); opacity: 1; } 70% { transform: translateY(10px); opacity: 0; } 100% { opacity: 0; } }

.v-micro { margin-top: 1.1rem; }
.v-actions-voix .v-micro { margin-top: 0; }
.v-actions-voix .bouton { display: inline-flex; align-items: center; gap: .45rem; }
.v-note-voix { color: #55615e; }
.v-micro svg { width: 18px; height: 18px; }
.v-micro[aria-pressed="true"] { background: #0d6e66; color: #fff; }
.v-note { font-size: .86rem; margin-top: .6rem; }

/* points de progression */
.v-points { position: fixed; right: clamp(.6rem, 2vw, 1.4rem); top: 50%; transform: translateY(-50%); z-index: 3; display: grid; gap: .7rem; }
.v-points a { display: block; width: 11px; height: 11px; border-radius: 50%; border: 2px solid #0d6e66; background: transparent; transition: transform .3s, background .3s; }
.v-points a.actif { background: #0d6e66; transform: scale(1.35); }

/* sans WebGL : message et lien vers le site classique */
.v-sans-3d { display: none; }
.sans-3d #scene, .sans-3d .v-points { display: none; }
.sans-3d .v-sans-3d { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: center; position: fixed; bottom: 1rem; left: 1rem; right: 1rem; z-index: 4;
  padding: 1rem; border-radius: var(--r-lg); background: #fffefb; box-shadow: var(--sh-3); }
.sans-3d .v-carte { opacity: 1; transform: none; }

@media (max-width: 720px) {
  .v-lien { display: none; }
  .v-entete .bouton { margin-left: auto; }
  .v-etape { align-items: flex-end; padding: 5rem 1rem 2.5rem; }
  .v-gauche, .v-droite { justify-content: center; }
  .v-carte { max-width: none; padding: 1.2rem 1.25rem 1.3rem; }
  .v-points { display: none; }
}
/* écran en hauteur plus large qu'un téléphone (tablette) : même mise en page, la carte en bas */
@media (min-width: 721px) and (max-aspect-ratio: 4/5) {
  .v-etape { align-items: flex-end; padding: 5rem clamp(1.5rem, 6vw, 3rem) 3rem; }
  .v-gauche, .v-droite { justify-content: center; }
  .v-carte { max-width: 34rem; }
  .v-credits { display: none; }
}
/* téléphone à l'horizontale : peu de hauteur, cartes plus compactes */
@media (min-width: 721px) and (max-height: 520px) {
  .v-entete { padding-block: .5rem; }
  .v-etape { padding: 3.6rem clamp(1rem, 4vw, 3rem) 1rem; }
  .v-carte { max-width: 21rem; padding: .9rem 1.1rem 1rem; }
  .v-carte h1, #v-attente h1 { font-size: 1.5rem; margin: .4rem 0 .3rem; }
  .v-carte h2 { font-size: 1.2rem; margin-bottom: .35rem; }
  .v-carte p { font-size: .86rem; line-height: 1.45; }
  .v-carte .actions { margin-top: .6rem; }
  .v-indice, .v-credits { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  #scene, .v-film, .v-carte { transition: none; }
  .v-grain { display: none; }
  .v-indice span::after { animation: none; }
}

/* chargement des meubles */
.v-chargement { position: fixed; inset: 0; z-index: 5; display: grid; place-content: center; gap: .9rem; text-align: center; background: #efeae0; color: #1b2624; font-weight: 650; transition: opacity .8s ease, visibility .8s; }
.v-barre { width: min(260px, 70vw); height: 4px; border-radius: 4px; background: #dcd5c6; overflow: hidden; }
.v-barre span { display: block; height: 100%; width: 0; background: #0d6e66; transition: width .3s ease; }
.pret .v-chargement { opacity: 0; visibility: hidden; }
.sans-3d .v-chargement { display: none; }
.v-carte .actions { margin-top: 1.1rem; gap: .6rem; }
.v-centre .v-carte .actions { justify-content: center; }
body.cliquable { cursor: pointer; }
.v-credits { position: fixed; left: 1rem; bottom: .6rem; z-index: 3; margin: 0; font-size: .75rem; color: #55615e; }
.v-credits a { color: inherit; }
@media (max-width: 720px) { .v-credits { display: none; } }
/* accueil de la visite : la carte en bas, la salle d'attente visible au-dessus */
#v-attente .v-carte { padding: 1.2rem 1.5rem 1.3rem; }
#v-attente h1 { font-size: clamp(1.8rem, 3.6vw, 2.5rem); margin: .6rem 0 .5rem; }
/* fin de la visite : la carte en bas, le cabinet visible au-dessus */
#v-fin { align-items: flex-end; padding-bottom: 2.5rem; }

/* scène cuite et film : vignettage en CSS (aucun calcul dans la 3D) */
.cuit body.visite::after, .film body.visite::after { content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(30, 22, 12, 0.2) 100%); }

/* Lenis (défilement lissé) : il gère lui-même la douceur */
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* bouton son de l'en-tête : rond et discret, coupé par défaut */
.v-son { flex: none; display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; cursor: pointer; color: #1b2624;
  background: color-mix(in srgb, #fffefb 60%, transparent); border: 1px solid color-mix(in srgb, #1b2624 16%, transparent); transition: background .15s, color .15s, border-color .15s; }
.v-son:hover { background: color-mix(in srgb, #fffefb 85%, transparent); }
.v-son svg { width: 22px; height: 20px; }
.v-son .v-son-ouvert, .v-son[aria-pressed="true"] .v-son-coupe { display: none; }
.v-son[aria-pressed="true"] .v-son-ouvert { display: block; }
.v-son[aria-pressed="true"] { color: #0d6e66; border-color: color-mix(in srgb, #0d6e66 45%, transparent); background: color-mix(in srgb, #dcefec 80%, transparent); }
@media (max-width: 720px) {
  .v-entete .v-son { margin-left: auto; }
  .v-entete .v-son ~ .bouton { margin-left: 0; }
}
