/* Cartes vivantes (demande du propriétaire, 28/09/2026 : « fais vivre aussi les cartes »). Lot SÉPARÉ du lot ambiances.
   Le temps travaille la carte : un mouvement très lent, jamais une retouche. Aucun filtre, aucune couleur changée,
   aucun recadrage des documents : seules les propriétés `translate` / `scale` bougent, et elles composent avec les
   `transform` des moteurs existants (palazzo, cabinet, atlas) au lieu de les remplacer. Vitesse liée à --tc-air-drift
   (lot ambiances) ; arrêt en pause de scène, effets météo suspendus, dialogue ouvert, mouvement réduit, contraste.
   Rien ne s'applique sans body.tc-direction-20260928[data-tc-atmosphere]. `:not(#tc-cartes)` passe la couche palazzo. */

@media (prefers-reduced-motion: no-preference) and (not (prefers-contrast: more)) and (not (forced-colors: active)) {
  /* 1. La carte de fond de l'ouverture dérive, comme un relevé qu'on parcourt (déjà plus grande que la scène : inset -6 %). */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .tc-scene > .tc-cartography {
    animation: tc-carte-fond 120s ease-in-out infinite alternate;
  }
  /* 2. La gravure glisse dans sa fenêtre : on lit la ville, du Duomo vers l'Arno (La Maison, fenêtre d'architecte). */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .pe-opening .pe-sheet:first-child img {
    animation: tc-carte-lecture 80s ease-in-out infinite alternate;
  }
  /* 3. Le panorama d'Italia : l'Arno coule très lentement d'un bord à l'autre. */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .ip-opening .ip-arch img {
    scale: 1.06;
    animation: tc-carte-courant 95s ease-in-out infinite alternate;
  }
  /* 4. La loupe « Lecture rapprochée » se promène sur le détail, au repos quand on la survole (le zoom existant reprend la main). */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .gi-fragment::before {
    animation: tc-carte-loupe 70s ease-in-out infinite alternate;
  }
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .gi-detail:hover .gi-fragment::before { animation-play-state: paused; }

  /* Vitesse selon l'air : plus mobile par vent choisi, plus lente la nuit. Amplitudes bornées, toujours imperceptibles d'un regard. */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) { --tc-carte-amplitude: calc(.55 + var(--tc-air-drift, .3) * .9); }

  /* Arrêts : pause de scène, effets météo suspendus, dialogue ouvert (zoom d'une planche). */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes):has(.tc-scene[data-motion="paused"], .tc-climate .cl-settings [aria-pressed="true"], dialog[open]) :is(.tc-scene > .tc-cartography, .pe-opening .pe-sheet:first-child img, .ip-opening .ip-arch img),
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes):has(.tc-scene[data-motion="paused"], .tc-climate .cl-settings [aria-pressed="true"], dialog[open]) .gi-fragment::before {
    animation-play-state: paused;
  }
}

@keyframes tc-carte-fond {
  from { translate: calc(var(--tc-carte-amplitude, 1) * -1.6%) calc(var(--tc-carte-amplitude, 1) * -.9%); scale: 1.02; }
  to { translate: calc(var(--tc-carte-amplitude, 1) * 1.6%) calc(var(--tc-carte-amplitude, 1) * 1%); scale: 1.05; }
}
@keyframes tc-carte-lecture {
  from { translate: calc(var(--tc-carte-amplitude, 1) * 26px) calc(var(--tc-carte-amplitude, 1) * 18px); }
  to { translate: calc(var(--tc-carte-amplitude, 1) * -26px) calc(var(--tc-carte-amplitude, 1) * -30px); }
}
@keyframes tc-carte-courant {
  from { translate: calc(var(--tc-carte-amplitude, 1) * 1.9%) 0; }
  to { translate: calc(var(--tc-carte-amplitude, 1) * -1.9%) 0; }
}
@keyframes tc-carte-loupe {
  from { translate: calc(var(--tc-carte-amplitude, 1) * -2.5%) calc(var(--tc-carte-amplitude, 1) * 1.2%); scale: 1.05; }
  to { translate: calc(var(--tc-carte-amplitude, 1) * 2.5%) calc(var(--tc-carte-amplitude, 1) * -1.2%); scale: 1.05; }
}

/* ——— Lot CARTES (29/09/2026) : relief, profondeur légère, itinéraire dessiné une fois, pause hors champ. Couches SVG inline
   et dégradés CSS créées par patrimoine-cartes.mjs (.cv-relief, .cv-voile) : aucune image, aucune retouche des documents.
   Au-dessus du voile de lecture ::after (z 2) mais sous les textes et la planche (z 3, plus loin dans le DOM) ; un masque
   les atténue sur la colonne de texte et les efface sur la zone des cartouches (bas droit ; bas entier sur mobile). */
.tc-inner.tc-atlas.tc-drama .tc-scene>:is(.cv-relief,.cv-voile):not(#cv) { position:absolute; inset:0; z-index:3; max-width:none; pointer-events:none; color:#f4f0e8; }
.tc-scene>.cv-relief:not(#cv) { opacity:.72; mask-image:linear-gradient(90deg,#0005,#0006 38%,#000 60%),radial-gradient(ellipse 34% 24% at 80% 91%,transparent 52%,#000 100%); mask-composite:intersect; -webkit-mask-composite:source-in; }
.tc-scene>.cv-voile:not(#cv) { background:radial-gradient(ellipse 60% 55% at 70% 32%,#f4f0e816,transparent 72%); }
.cv-carte { display:block; width:100%; height:100%; overflow:visible; }
.cv-carte #cv-hachure path { stroke:currentColor; stroke-width:.6; }
.cv-hachures { opacity:.1; }
.cv-courbes path { fill:none; stroke:currentColor; stroke-width:1; stroke-linejoin:round; vector-effect:non-scaling-stroke; opacity:calc(.23 - var(--cv-k,1)*.018); }
/* Itinéraire stylisé : un seul tracé (pathLength 1), dessiné à l'entrée dans le champ, puis conservé. Les étapes paraissent à sa suite. */
.cv-trace { fill:none; stroke:currentColor; stroke-width:1.1; stroke-linecap:round; stroke-dasharray:1; stroke-dashoffset:1; opacity:.7; vector-effect:non-scaling-stroke; }
.cv-etape { opacity:0; }
.cv-etape .cv-halo { fill:none; stroke:currentColor; stroke-width:.7; opacity:.55; }
.cv-etape circle:not(.cv-halo) { fill:currentColor; }
.cv-nom { font:500 10.5px/1 var(--tc-sans,sans-serif); letter-spacing:.16em; text-transform:uppercase; fill:currentColor; opacity:.85; }
.cv-relief[data-cv-trace="fait"] .cv-trace { animation:cv-tracer 7s cubic-bezier(.35,.05,.2,1) forwards; }
.cv-relief[data-cv-trace="fait"] .cv-etape { animation:cv-paraitre 1.4s ease forwards; animation-delay:calc(.6s + var(--cv-i,0)*2.6s); }
@keyframes cv-tracer { from { stroke-dashoffset:1; } to { stroke-dashoffset:0; } }
@keyframes cv-paraitre { from { opacity:0; } to { opacity:1; } }
/* Profondeur légère : le relief et le voile glissent en sens contraires, de quelques pixels, au survol (pointeur fin) et au défilement. */
@media (prefers-reduced-motion: no-preference) and (not (prefers-contrast: more)) and (not (forced-colors: active)) {
  .tc-scene>.cv-relief:not(#cv) { translate:calc(var(--cv-x,0)*6px - var(--cv-s,0)*5px) calc(var(--cv-y,0)*5px + var(--cv-s,0)*12px); transition:translate 1.1s cubic-bezier(.2,.7,.2,1); }
  .tc-scene>.cv-voile:not(#cv) { translate:calc(var(--cv-x,0)*-4px) calc(var(--cv-y,0)*-3px - var(--cv-s,0)*6px); transition:translate 1.3s cubic-bezier(.2,.7,.2,1); }
  /* Hors champ : la caméra lente existante et le tracé s'arrêtent (phase conservée), ils reprennent sans à-coup au retour. */
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .tc-scene[data-cv-champ="hors"]>.tc-cartography,
  body.tc-direction-20260928[data-tc-atmosphere]:not(#tc-cartes) .tc-scene[data-cv-champ="hors"] :is(.pe-opening .pe-sheet:first-child img,.ip-opening .ip-arch img,.cv-trace,.cv-etape) { animation-play-state:paused; }
  body[data-tc-cine-paused="true"]:not(#tc-cartes) :is(.cv-trace,.cv-etape),
  body:not(#tc-cartes):has(.tc-scene[data-motion="paused"]) :is(.cv-trace,.cv-etape) { animation-play-state:paused; }
}
/* Écrans étroits : textes sur toute la largeur, cartouche en bas ; le relief se retire vers la droite et s'efface sous le cartouche, sans libellés. */
@media (max-width:700px) { .tc-scene>.cv-relief:not(#cv) { opacity:.45; mask-image:linear-gradient(90deg,transparent 28%,#0008 56%,#000 76%),linear-gradient(180deg,#000 74%,transparent 88%); } .cv-nom { display:none; } }
/* Mouvement réduit, contraste renforcé : relief statique, itinéraire complet d'emblée, aucun glissement. */
@media (prefers-reduced-motion: reduce), (prefers-contrast: more) {
  .tc-scene>:is(.cv-relief,.cv-voile):not(#cv) { translate:none; transition:none; }
  .cv-trace, .cv-relief[data-cv-trace="fait"] .cv-trace { animation:none; stroke-dashoffset:0; }
  .cv-etape, .cv-relief[data-cv-trace="fait"] .cv-etape { animation:none; opacity:1; }
}
@media (forced-colors: active), print { .tc-scene>:is(.cv-relief,.cv-voile):not(#cv) { display:none; } }
