/* Plans vivants : habillage générique « loft du labo » (table à dessin, mur de briques,
   badge d'accès, sol de béton, poutre, rayons de verrière).
   Porté de docs/maquettes/plans-vivants/plans-vivants.css.

   Règles de portage :
   - tout est préfixé `pv-` (classes) ou `--pv-` (variables) : cette feuille est chargée
     sur toutes les pages (app/[lang]/layout.tsx) et ne doit rien changer ailleurs ;
   - aucun sélecteur d'élément nu (pas de `.pv p`, `.pv h2`) : seules les classes pv-* agissent ;
   - la nuit suit le thème de l'appareil : `:root[data-theme="dark"]`, posé sur <html>
     par components/display-controls-context.tsx (la maquette disait `.pv.nuit`) ;
   - `.pv` (à poser sur le conteneur d'une page) ne porte que les variables ;
   - le spécifique à l'accueil vit dans app/[lang]/plans-vivants-accueil.css.
   Les polices : « Architects Daughter » n'est pas hébergée, le repli cursif du système sert. */

.pv {
  --pv-beton: #ece8e1;
  --pv-beton-2: #e2ddd4;
  --pv-papier: #f7f4ec;
  --pv-calque: rgba(250, 248, 242, 0.92);
  --pv-graphite: #2b3034;
  --pv-graphite-2: #4f565c;
  --pv-graphite-3: #6c7278;
  --pv-trait: #3a4046;
  --pv-grille: rgba(43, 48, 52, 0.07);
  --pv-grille-forte: rgba(43, 48, 52, 0.14);
  --pv-acier: #23282c;
  --pv-acier-2: #343b41;
  --pv-turquoise: #075f51;
  --pv-turquoise-vif: #0b8f7a;
  --pv-turquoise-doux: rgba(11, 143, 122, 0.12);
  --pv-on-turquoise: #f3fffc;
  --pv-soleil: rgba(255, 222, 168, 0.3);
  --pv-ombre: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 18px 40px -22px rgba(40, 32, 22, 0.45);
  --pv-ff-main: "Architects Daughter", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
}
:root[data-theme="dark"] .pv {
  --pv-beton: #171b1e;
  --pv-beton-2: #1d2226;
  --pv-papier: #1f262b;
  --pv-calque: rgba(28, 34, 38, 0.92);
  --pv-graphite: #e6e9eb;
  --pv-graphite-2: #b4bbc0;
  --pv-graphite-3: #8c959b;
  --pv-trait: #d6dee2;
  --pv-grille: rgba(214, 222, 226, 0.06);
  --pv-grille-forte: rgba(214, 222, 226, 0.12);
  --pv-turquoise: #2ee6c8;
  --pv-turquoise-vif: #2ee6c8;
  --pv-turquoise-doux: rgba(46, 230, 200, 0.12);
  --pv-on-turquoise: #0c1a18;
  --pv-soleil: rgba(150, 180, 230, 0.1);
  --pv-ombre: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 24px 50px -24px rgba(0, 0, 0, 0.8);
}

/* ---------- typo ---------- */
.pv .pv-label { font-family: var(--ff-mono, ui-monospace, monospace); font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--pv-graphite-2); }
.pv .pv-main { font-family: var(--pv-ff-main); color: var(--pv-graphite-2); }

/* ---------- rayons de la verrière, avec l'ombre des montants d'acier ---------- */
.pv .pv-rayons {
  position: absolute; top: -10%; left: -18%; width: 78%; height: 130%;
  background: repeating-linear-gradient(104deg,
    transparent 0 26px,
    var(--pv-soleil) 26px 118px,
    transparent 118px 132px,
    var(--pv-soleil) 132px 210px,
    transparent 210px 300px);
  -webkit-mask-image: linear-gradient(115deg, #000 10%, rgba(0, 0, 0, 0.55) 45%, transparent 80%);
          mask-image: linear-gradient(115deg, #000 10%, rgba(0, 0, 0, 0.55) 45%, transparent 80%);
  mix-blend-mode: screen; filter: blur(3px);
  animation: pv-balayage 16s ease-in-out infinite alternate;
  pointer-events: none;
}
@keyframes pv-balayage { from { transform: translateX(-6%) skewX(-10deg); opacity: 0.75; } to { transform: translateX(9%) skewX(-16deg); opacity: 1; } }
:root[data-theme="dark"] .pv .pv-rayons { opacity: 0.45; animation-duration: 30s; }

/* ---------- poussière dans la lumière ---------- */
.pv .pv-poussiere { position: absolute; inset: 0; pointer-events: none; }
.pv .pv-grain {
  position: absolute; width: 3px; height: 3px; border-radius: 50%;
  background: rgba(255, 240, 210, 0.9); box-shadow: 0 0 6px rgba(255, 230, 180, 0.9);
  opacity: 0; animation: pv-flotte var(--t, 9s) linear infinite; animation-delay: var(--d, 0s);
}
@keyframes pv-flotte {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 0.85; }
  60% { opacity: 0.6; }
  100% { transform: translate(var(--dx, 30px), -140px); opacity: 0; }
}
:root[data-theme="dark"] .pv .pv-grain { background: rgba(255, 196, 120, 0.8); box-shadow: 0 0 6px rgba(255, 170, 80, 0.9); }

/* ---------- néon qui grésille à l'arrivée, puis respire ---------- */
.pv .pv-neon-halo {
  position: absolute; left: var(--nx, 47%); top: var(--ny, 23%); width: 30%; height: 14%;
  transform: translate(-50%, -50%); border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 150, 70, 0.5), rgba(255, 120, 40, 0.16) 60%, transparent);
  mix-blend-mode: screen; pointer-events: none;
  animation: pv-gresille 2.4s steps(1, end) 0.5s 1 both, pv-respire 5s ease-in-out 3s infinite;
}
@keyframes pv-gresille {
  0% { opacity: 0; } 6% { opacity: 1; } 9% { opacity: 0.1; } 12% { opacity: 1; } 18% { opacity: 0.25; }
  21% { opacity: 1; } 46% { opacity: 0.55; } 48% { opacity: 1; } 100% { opacity: 1; }
}
@keyframes pv-respire { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }

/* ---------- lampes suspendues : le cône de lumière oscille ---------- */
.pv .pv-cone {
  position: absolute; top: var(--ly, 15%); left: var(--lx); width: 14%; height: 60%;
  transform-origin: 50% 0; translate: -50% 0;
  background: radial-gradient(60% 100% at 50% 0, rgba(255, 214, 150, 0.32), rgba(255, 200, 120, 0.08) 55%, transparent 75%);
  clip-path: polygon(44% 0, 56% 0, 100% 100%, 0 100%);
  mix-blend-mode: screen; pointer-events: none;
  animation: pv-oscille 6.5s ease-in-out infinite; animation-delay: var(--d, 0s);
  opacity: 0.5;
}
:root[data-theme="dark"] .pv .pv-cone { opacity: 1; background: radial-gradient(60% 100% at 50% 0, rgba(255, 190, 110, 0.5), rgba(255, 170, 80, 0.12) 55%, transparent 75%); }
@keyframes pv-oscille { 0%, 100% { rotate: -2.2deg; } 50% { rotate: 2.2deg; } }

/* ---------- papier calque, ruban adhésif ---------- */
.pv .pv-calque {
  position: relative; background: var(--pv-calque);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border: 1px solid var(--pv-grille-forte); border-radius: 2px; box-shadow: var(--pv-ombre);
}
.pv .pv-scotch::before, .pv .pv-scotch::after {
  content: ""; position: absolute; width: 74px; height: 22px; top: -11px;
  background: rgba(236, 222, 186, 0.78); border-left: 1px dashed rgba(0, 0, 0, 0.08); border-right: 1px dashed rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}
.pv .pv-scotch::before { left: 18px; rotate: -4deg; }
.pv .pv-scotch::after { right: 18px; rotate: 5deg; }
:root[data-theme="dark"] .pv .pv-scotch::before, :root[data-theme="dark"] .pv .pv-scotch::after { background: rgba(120, 110, 90, 0.55); }

/* ---------- table à dessin : la feuille quadrillée ---------- */
.pv .pv-feuille {
  position: relative; background-color: var(--pv-papier);
  background-image:
    linear-gradient(var(--pv-grille-forte) 1px, transparent 1px),
    linear-gradient(90deg, var(--pv-grille-forte) 1px, transparent 1px),
    linear-gradient(var(--pv-grille) 1px, transparent 1px),
    linear-gradient(90deg, var(--pv-grille) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  border: 1px solid var(--pv-grille-forte); border-radius: 2px; box-shadow: var(--pv-ombre);
}
/* règle graduée en tête de feuille */
.pv .pv-regle {
  position: absolute; left: 0; right: 0; top: 0; height: 22px; pointer-events: none;
  background:
    repeating-linear-gradient(90deg, var(--pv-graphite-3) 0 1px, transparent 1px 12px) 0 0 / auto 7px no-repeat,
    repeating-linear-gradient(90deg, var(--pv-graphite-2) 0 1px, transparent 1px 60px) 0 0 / auto 13px no-repeat,
    linear-gradient(180deg, rgba(222, 205, 160, 0.55), rgba(222, 205, 160, 0.25));
  border-bottom: 1px solid var(--pv-grille-forte);
}
:root[data-theme="dark"] .pv .pv-regle { background:
    repeating-linear-gradient(90deg, var(--pv-graphite-3) 0 1px, transparent 1px 12px) 0 0 / auto 7px no-repeat,
    repeating-linear-gradient(90deg, var(--pv-graphite-2) 0 1px, transparent 1px 60px) 0 0 / auto 13px no-repeat,
    linear-gradient(180deg, rgba(90, 100, 108, 0.4), rgba(90, 100, 108, 0.15)); }

/* ---------- le tracé au crayon (une seule fois, quand `.pv-vu` est posée) ---------- */
.pv .pv-dessin { overflow: visible; display: block; width: 100%; height: auto; }
.pv .pv-dessin .t { fill: none; stroke: var(--pv-trait); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; filter: url(#pv-crayon); }
.pv .pv-dessin .t.fin { stroke-width: 0.9; stroke: var(--pv-graphite-3); }
.pv .pv-dessin .cote { stroke: var(--pv-graphite-3); stroke-width: 0.8; fill: none; stroke-dasharray: 1; stroke-dashoffset: 1; }
.pv .pv-dessin .vie { opacity: 0; transform-box: fill-box; transform-origin: 50% 100%; }
.pv .pv-dessin .ecran { fill: var(--pv-turquoise-vif); }
.pv .pv-dessin .ecran-doux { fill: var(--pv-turquoise-doux); }
.pv .pv-dessin .papier { fill: var(--pv-papier); }

.pv .pv-vu .pv-dessin .t, .pv .pv-vu .pv-dessin .cote { animation: pv-tracer var(--dur, 1.6s) cubic-bezier(0.6, 0.1, 0.3, 1) forwards; animation-delay: var(--d, 0s); }
.pv .pv-vu .pv-dessin .vie { animation: pv-vivre 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards; animation-delay: var(--d, 2s); }
.pv .pv-vu .pv-dessin .pulse { animation: pv-vivre 0.9s cubic-bezier(0.2, 0.8, 0.2, 1) forwards, pv-battre 2.6s ease-in-out infinite; animation-delay: var(--d, 2.4s), calc(var(--d, 2.4s) + 1s); }
.pv .pv-vu .pv-dessin .flux { stroke-dasharray: 4 6; animation: pv-tracer 1s ease forwards, pv-couler 1.2s linear infinite; animation-delay: var(--d, 2s), calc(var(--d, 2s) + 1s); }
@keyframes pv-tracer { to { stroke-dashoffset: 0; } }
@keyframes pv-vivre { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pv-battre { 0%, 100% { opacity: 1; } 50% { opacity: 0.55; } }
@keyframes pv-couler { to { stroke-dashoffset: -20; } }

/* ---------- plaques d'état (laiton gravé) ---------- */
.pv .pv-plaque {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 2px;
  font: 600 11px var(--ff-mono, ui-monospace, monospace); letter-spacing: 0.12em; text-transform: uppercase;
  color: #3e2f16; background: linear-gradient(180deg, #e8cf8e, #c9a65a); border: 1px solid #9c7d3a;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 2px 4px rgba(0, 0, 0, 0.18);
}
.pv .pv-plaque::before, .pv .pv-plaque::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: #8a6b2c; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); }

/* ---------- mur de briques ---------- */
.pv .pv-mur {
  background-color: #8e4630;
  background-image:
    linear-gradient(rgba(214, 196, 170, 0.55) 2px, transparent 2px),
    linear-gradient(90deg, rgba(214, 196, 170, 0.5) 2px, transparent 2px),
    linear-gradient(90deg, rgba(214, 196, 170, 0.5) 2px, transparent 2px),
    radial-gradient(rgba(0, 0, 0, 0.08) 1px, transparent 1.5px);
  background-size: 64px 26px, 64px 52px, 64px 52px, 4px 4px;
  background-position: 0 0, 0 0, 32px 26px, 0 0;
  position: relative;
}
.pv .pv-mur::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(20, 16, 12, 0.25), rgba(20, 16, 12, 0.05) 30%, rgba(20, 16, 12, 0.35)); pointer-events: none; }
:root[data-theme="dark"] .pv .pv-mur { background-color: #4a271c; }
:root[data-theme="dark"] .pv .pv-mur::before { background: radial-gradient(60% 50% at 50% 0, rgba(255, 170, 80, 0.18), transparent 70%), linear-gradient(180deg, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.55)); }

/* plan punaisé sur le mur */
.pv .pv-plan { position: relative; padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 10px; transition: transform 0.35s ease, box-shadow 0.35s ease; }
.pv .pv-plan:hover { transform: translateY(-4px) rotate(0deg) !important; }
.pv .pv-punaise { position: absolute; top: -6px; left: 50%; translate: -50% 0; width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #f4f1ea, #9fa6ac 60%, #5b6268); box-shadow: 0 3px 4px rgba(0, 0, 0, 0.35); }

/* ---------- badge d'accès ---------- */
.pv .pv-badge {
  position: relative; border-radius: 14px; background: var(--pv-papier); border: 1px solid var(--pv-grille-forte);
  box-shadow: 0 30px 60px -30px rgba(30, 24, 18, 0.55), 0 1px 0 rgba(255, 255, 255, 0.5) inset; overflow: hidden;
}
.pv .pv-badge-tete { background: var(--pv-turquoise); color: var(--pv-on-turquoise); padding: 30px 24px 16px; display: flex; justify-content: space-between; align-items: center; font: 600 13px var(--ff-mono, ui-monospace, monospace); letter-spacing: 0.18em; }
.pv .pv-badge-trou { position: absolute; top: 10px; left: 50%; translate: -50% 0; width: 54px; height: 10px; border-radius: 6px; background: var(--pv-beton); box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.25); }
.pv .pv-lanyard { width: 26px; margin: 0 auto -6px; height: 90px; background: repeating-linear-gradient(180deg, var(--pv-turquoise) 0 10px, var(--pv-acier-2) 10px 13px); border-radius: 2px; }

/* ---------- sol de béton ---------- */
.pv .pv-sol { background: linear-gradient(180deg, var(--pv-beton-2), var(--pv-beton)); border-top: 1px solid var(--pv-grille-forte); }

/* ---------- sol de béton : le pied de page de l'accueil (déplacé ici de plans-vivants-accueil.css : vaut pour toute page `.pv`) ---------- */
.pv footer.foot-v3 {
  position: relative; background: linear-gradient(180deg, var(--pv-beton-2), var(--pv-beton));
  border-top: 1px solid var(--pv-grille-forte); color: var(--pv-graphite);
  box-shadow: 0 -18px 40px -28px var(--pv-ombre-sol, rgba(0, 0, 0, 0.35)) inset;
}
.pv .foot-v3::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image:
    linear-gradient(var(--pv-grille) 1px, transparent 1px),
    linear-gradient(90deg, var(--pv-grille) 1px, transparent 1px);
  background-size: 120px 120px;
}
.pv .foot-v3 > * { position: relative; }
.pv .foot-v3 a, .pv .foot-v3 p, .pv .foot-v3 h4 { color: inherit; }
.pv .foot-v3 a:hover, .pv .foot-v3 a:focus-visible { color: var(--pv-turquoise-vif); }

/* ---------- apparition unique (plans-vivants.js pose `pv-js` sur <html>, puis `pv-vu` à l'entrée dans l'écran) ---------- */
.pv-js .pv [data-pv-apparition] { opacity: 0; translate: 0 14px; transition: opacity 0.7s ease, translate 0.7s ease; transition-delay: var(--d, 0s); }
.pv-js .pv [data-pv-apparition].pv-vu { opacity: 1; translate: 0 0; }

/* ---------- table à dessin en décor d'un héros : feuille quadrillée avec sa règle, derrière le contenu ---------- */
.pv .pv-table {
  position: absolute; z-index: 0; pointer-events: none; rotate: 0.4deg;
  inset: clamp(76px, 10vh, 104px) clamp(12px, 3vw, 48px) clamp(12px, 3vh, 32px);
}
.pv .pv-table .pv-regle { border-radius: 2px 2px 0 0; }

/* ---------- scène du badge d'accès : cordon, badge, zones (le badge habille un appel existant) ---------- */
.pv .pv-badge-scene { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; }
.pv .pv-badge-scene .pv-lanyard { position: relative; z-index: 2; }
.pv .pv-badge-scene .pv-badge { width: min(100%, 560px); color: var(--pv-graphite); text-align: left; }
.pv .pv-badge-corps { padding: clamp(18px, 3vw, 28px); display: flex; flex-direction: column; gap: 14px; }
.pv .pv-zones { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pv .pv-zones li { display: inline-flex; align-items: center; gap: 8px; color: var(--pv-graphite-3); font-size: 13px; }
.pv .pv-zones li[data-coche] { color: var(--pv-graphite); font-weight: 600; }
.pv .pv-zone-case { width: 18px; height: 18px; border: 1.5px solid currentColor; border-radius: 3px; display: inline-grid; place-items: center; color: inherit; }
.pv .pv-zone-case svg { width: 12px; height: 12px; display: block; }
.pv .pv-zones li:not([data-coche]) .pv-zone-case svg { display: none; }
.pv .pv-zones li[data-coche] .pv-zone-case { background: var(--pv-turquoise); border-color: var(--pv-turquoise); color: var(--pv-on-turquoise); }

/* ---------- moins de mouvement demandé ---------- */
@media (prefers-reduced-motion: reduce) {
  .pv .pv-rayons, .pv .pv-grain, .pv .pv-cone, .pv .pv-neon-halo, .pv .pv-dessin * { animation: none !important; }
  .pv .pv-plan { transition: none; }
  .pv-js .pv [data-pv-apparition] { opacity: 1; translate: 0 0; transition: none; }
  .pv .pv-dessin .t, .pv .pv-dessin .cote { stroke-dashoffset: 0; }
  .pv .pv-dessin .vie { opacity: 1; }
  .pv .pv-grain { display: none; }
}
