/* Pages « schémas » (corps.html, immunite.html, nerf.html, reproduction.html, evolution.html), moteur js/carte.js.
   Même présentation que la page de la cellule (css/cellule.css), dont les règles utiles sont reprises ici :
   les deux feuilles sont indépendantes, on peut retoucher l'une sans toucher l'autre. */

/* ---- En-tête : fil d'Ariane des échelles ---- */

.fil ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 14px; }
.fil li { display: flex; align-items: center; gap: 6px; }
.fil li + li::before { content: '›'; color: var(--eteint); }
.fil button {
  min-height: 44px; padding: 0 10px; border-radius: 999px; border: 0; background: transparent; color: var(--accent);
  font-size: 14px; cursor: pointer;
}
.fil button:hover { color: var(--accent-clair); text-decoration: underline; }
.fil button[aria-current] { background: var(--accent); color: var(--accent-texte); font-weight: 600; padding: 0 14px; text-decoration: none; }

/* ---- Mise en page : scène à gauche, panneau des vidéos à droite (dessous quand la place manque) ---- */

.carte-page { display: flex; flex-wrap: wrap; align-items: flex-start; max-width: 1640px; margin: 0 auto; }
.carte-principal { flex: 999 1 640px; min-width: 0; padding: 20px; }
.panneau-videos {
  flex: 1 1 340px; min-width: 0; max-width: 100%; padding: 20px 20px 28px;
  display: flex; flex-direction: column; gap: 14px;
}

.zone-scene { position: relative; outline: none; }
.scene {
  position: relative; width: 100%; aspect-ratio: 16 / 10; border-radius: 20px; overflow: hidden;
  background: radial-gradient(ellipse 62% 75% at 50% 50%, #16382b 0%, #050f0b 100%);
  border: 1px solid rgba(116, 198, 157, 0.2); touch-action: pan-x pan-y;
}
.scene:focus-visible { outline: 3px solid var(--ambre); outline-offset: 3px; }
.calques { position: absolute; inset: 0; }
.calque, .calque-sortant { position: absolute; inset: 0; }
.calque-sortant { pointer-events: none; }
.scene-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.legende-scene { margin: 12px 4px 0; font-size: 14px; color: var(--pale); }
.aide { margin: 4px 4px 0; font-size: 13px; color: var(--doux); }

/* ---- Repères vidéo ---- */

.repere {
  position: absolute; z-index: 2; display: flex; align-items: center; gap: 10px; min-height: 44px;
  padding: 7px 16px 7px 7px; border-radius: 999px; background: rgba(8, 26, 19, 0.92); border: 1.5px solid var(--accent);
  color: var(--texte); white-space: nowrap; text-align: left; font-size: 14px; cursor: pointer;
  transform: translate(var(--dx, 0px), var(--dy, 0px));
}
.repere-gauche { transform: translate(calc(-100% + var(--dx, 0px)), var(--dy, 0px)); }
.repere:hover { background: var(--surface-2); }
.repere-icone {
  flex: 0 0 30px; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-texte);
  display: flex; align-items: center; justify-content: center;
}
.repere-icone svg { margin-left: 2px; }
.repere-textes { display: flex; flex-direction: column; line-height: 1.2; font-weight: 500; }
.repere-info { font-size: 12px; font-weight: 400; color: var(--doux); }
.repere-mention .repere-info { color: #ffd8a8; }
.repere-cible { animation: pulsation 0.85s ease-in-out 3; }
@keyframes pulsation {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 183, 3, 0.55); }
  50% { box-shadow: 0 0 0 14px rgba(255, 183, 3, 0.15); }
}

/* Vidéo en préparation : repère grisé, non cliquable, avec une info-bulle */
.repere-bientot {
  border: 1.5px dashed #8aa597; background: rgba(8, 26, 19, 0.88); color: #c3d6cc; cursor: help;
}
.repere-bientot:hover { background: rgba(8, 26, 19, 0.95); }
.repere-bientot .repere-icone { background: #4b6358; color: #e6f2ec; }
.repere-bientot .repere-icone svg { margin-left: 0; }
.repere-bientot .repere-info { color: #b3c7bd; font-style: italic; }
.bulle {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 4; display: none; width: max-content; max-width: 260px;
  padding: 8px 12px; border-radius: 10px; background: #0f2a20; border: 1px solid #8aa597; color: var(--texte);
  font-size: 13px; font-style: normal; font-weight: 400; line-height: 1.35; white-space: normal; text-align: left; pointer-events: none;
}
.repere-gauche .bulle { left: auto; right: 0; }
.repere-bientot:hover .bulle, .repere-bientot:focus-visible .bulle, .repere-bientot.bulle-ouverte .bulle { display: block; }

/* Loupes (zoom vers une échelle plus fine) et liens vers une vue voisine */
.cible-zoom {
  position: absolute; z-index: 1; display: flex; align-items: center; gap: 8px;
  padding: 0; border: 0; background: none; color: var(--texte); cursor: zoom-in;
}
.cible-bas { flex-direction: column; transform: translate(-50%, -28px); }
.cible-haut { flex-direction: column-reverse; transform: translate(-50%, calc(-100% + 28px)); }
.cible-droite { flex-direction: row; transform: translate(-28px, -50%); }
.cible-gauche { flex-direction: row-reverse; transform: translate(calc(-100% + 28px), -50%); }
.cible-vue { cursor: pointer; }
.cible-icone {
  flex: 0 0 auto; width: 56px; height: 56px; border-radius: 50%; background: rgba(8, 26, 19, 0.85); border: 2px solid #bfe6d2; color: #bfe6d2;
  display: flex; align-items: center; justify-content: center; transition: border-color 0.15s, color 0.15s;
}
.cible-vue .cible-icone { border-style: dashed; }
.cible-zoom:hover .cible-icone { border-color: var(--ambre); color: var(--ambre); }
.cible-texte { padding: 6px 12px; border-radius: 10px; background: rgba(8, 26, 19, 0.88); font-size: 14px; font-weight: 500; white-space: nowrap; }
.cible-zoom:focus-visible { outline: none; }
.cible-zoom:focus-visible .cible-icone { outline: 3px solid var(--ambre); outline-offset: 2px; }
.cible-signal .cible-icone { animation: signal-loupe 0.7s ease-in-out 3; }
@keyframes signal-loupe {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 183, 3, 0.6); border-color: #bfe6d2; }
  50% { box-shadow: 0 0 0 12px rgba(255, 183, 3, 0.12); border-color: var(--ambre); }
}

/* ---- Outils posés sur la scène (grand écran) ---- */

.outils-scene { position: absolute; inset: 0; pointer-events: none; }
.outils-scene > * { position: absolute; pointer-events: auto; }

.calques-choix {
  left: 16px; bottom: 16px; z-index: 3; display: flex; flex-wrap: wrap; gap: 6px; padding: 6px; border-radius: 14px;
  background: rgba(8, 26, 19, 0.9); border: 1px solid rgba(116, 198, 157, 0.3); max-width: calc(100% - 220px);
}
.calques-choix button {
  min-height: 44px; display: inline-flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 10px;
  border: 1.5px solid rgba(159, 194, 177, 0.5); background: transparent; color: var(--doux); font-size: 14px; cursor: pointer;
}
.calques-choix button:hover { color: var(--texte); border-color: var(--accent); }
.calques-choix button[aria-pressed="true"] { color: var(--texte); border-color: var(--accent); background: rgba(116, 198, 157, 0.12); }
.calque-case {
  width: 18px; height: 18px; border-radius: 5px; border: 1.5px solid currentColor; display: flex; align-items: center; justify-content: center;
}
.calque-case svg { opacity: 0; }
.calques-choix button[aria-pressed="true"] .calque-case { background: var(--accent); border-color: var(--accent); color: var(--accent-texte); }
.calques-choix button[aria-pressed="true"] .calque-case svg { opacity: 1; }
.calque-pastille { width: 22px; height: 6px; border-radius: 3px; }

.mini-carte {
  right: 16px; top: 16px; width: 168px; height: 105px; border-radius: 12px; overflow: hidden;
  background: rgba(8, 26, 19, 0.9); border: 1px solid rgba(116, 198, 157, 0.3); pointer-events: none !important;
}

.zooms { right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.bouton-carre {
  width: 44px; height: 44px; border-radius: 12px; border: 1px solid rgba(116, 198, 157, 0.35); background: rgba(8, 26, 19, 0.92);
  color: var(--texte); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.bouton-carre:hover:not(:disabled) { border-color: var(--accent); }
.bouton-carre:disabled { opacity: 0.4; cursor: default; }

/* ---- Scène étroite (moins de 820 px) : outils sous la scène, repères réduits à leur icône ---- */

.zone-scene.etroite .scene { border-radius: 14px; }
.zone-scene.etroite .outils-scene {
  position: static; display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; margin-top: 10px; pointer-events: auto;
}
.zone-scene.etroite .outils-scene > * { position: static; transform: none; }
.zone-scene.etroite .calques-choix { order: -1; flex: 1 1 100%; max-width: none; }
.zone-scene.etroite .calques-choix button { flex: 1 1 auto; }
.zone-scene.etroite .zooms { order: 1; flex-direction: row; }
.zone-scene.etroite .mini-carte { order: 1; width: 120px; height: 75px; margin-left: auto; }
.zone-scene.etroite .repere { padding: 6px; gap: 0; }
.zone-scene.etroite .repere-icone { flex-basis: 32px; width: 32px; height: 32px; }
.zone-scene.etroite .repere-textes, .zone-scene.etroite .cible-texte {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}
.zone-scene.etroite .cible-zoom { transform: translate(-50%, -50%); }
.zone-scene.etroite .cible-icone { width: 44px; height: 44px; }
.zone-scene.etroite .cible-icone svg { width: 22px; height: 22px; }
.zone-scene.etroite .bulle { max-width: 200px; }
.zone-scene.etroite .scene-svg .etiquettes { font-size: 32px; }
.zone-scene.etroite .scene-svg .etiquettes-petites { font-size: 26px; }
.zone-scene.etroite .scene-svg .barre-echelle text { font-size: 32px; }

/* ---- Panneau des vidéos ---- */

.onglets { display: flex; gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface); }
.onglets [role="tab"] {
  flex: 1 1 0; min-height: 44px; padding: 0 8px; border-radius: 10px; border: 0; background: transparent;
  color: var(--doux); font-size: 14px; cursor: pointer;
}
.onglets [role="tab"][aria-selected="true"] { background: var(--surface-3); color: var(--texte); font-weight: 600; }
.panneau-onglet { display: flex; flex-direction: column; gap: 12px; }
.panneau-onglet[hidden] { display: none; }
.parcours-intro, .message-vide { margin: 0; color: var(--doux); font-size: 14px; }

.liste-videos { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ligne-video { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; }
.liste-parcours { counter-reset: parcours; }
.liste-parcours > .ligne-video { counter-increment: parcours; }
.liste-parcours > .ligne-video::before {
  content: counter(parcours); flex: 0 0 26px; align-self: center; text-align: center; color: var(--doux); font-size: 14px; font-weight: 600;
}
.carte-mini {
  flex: 1 1 200px; min-width: 0; display: flex; gap: 12px; padding: 10px; border-radius: 14px; text-align: left;
  background: var(--surface-2); border: 1px solid var(--bord); color: var(--texte); cursor: pointer;
}
.carte-mini:hover { border-color: var(--accent); }
.carte-mini-image { position: relative; flex: 0 0 112px; height: 63px; border-radius: 8px; overflow: hidden; background: var(--surface-3); }
.carte-mini-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carte-mini-lire {
  position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%;
  background: rgba(116, 198, 157, 0.92); color: var(--accent-texte); display: flex; align-items: center; justify-content: center;
}
.carte-mini-textes { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.carte-mini-titre { font-size: 15px; font-weight: 600; line-height: 1.25; }
.carte-mini-info { font-size: 12px; color: var(--doux); }
.pastille {
  align-self: flex-start; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--ambre); color: #0b2219;
}
.pastille-mention { background: #ffd8a8; }
.pastille-bientot { background: #4b6358; color: #e6f2ec; }
.carte-prevue { cursor: default; border-style: dashed; border-color: #6f8a7d; background: var(--surface); color: #c3d6cc; }
.carte-prevue:hover { border-color: #6f8a7d; }
.carte-mini-vide { background: repeating-linear-gradient(135deg, #12302a 0 8px, #0f2a20 8px 16px); }
.carte-prevue .carte-mini-lire { background: #4b6358; color: #e6f2ec; }
.bouton-situer-mini {
  flex: 0 0 44px; min-height: 44px; border-radius: 12px; border: 1px solid var(--bord); background: var(--surface); color: var(--doux); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.bouton-situer-mini:hover { color: var(--ambre); border-color: var(--ambre); }

/* Variante d'une vidéo (version primaire, version collège), sous la vidéo principale dans le parcours */
.variantes { list-style: none; margin: 0 0 0 34px; padding: 0; flex: 1 1 100%; display: flex; flex-direction: column; gap: 6px; }
.variante { display: flex; gap: 8px; }
.bouton-variante {
  flex: 1 1 auto; min-width: 0; min-height: 44px; display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px 12px;
  border-radius: 10px; border: 1px dashed var(--bord-fort); background: var(--surface); color: var(--texte); text-align: left; font-size: 14px; cursor: pointer;
}
.bouton-variante:hover { border-color: var(--accent); }
.bouton-variante[aria-disabled="true"] { cursor: default; color: #c3d6cc; }
.bouton-variante[aria-disabled="true"]:hover { border-color: var(--bord-fort); }
.variante-mention { font-size: 12px; color: #ffd8a8; font-weight: 600; }
.variante-titre { font-size: 13px; }
.variante .bouton-situer-mini { flex-basis: 44px; }

.lignes-zoom, .moments, .puces { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lignes-zoom button, .moments button {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 12px; padding: 6px 12px; border-radius: 10px; border: 0;
  background: var(--surface); color: var(--texte); font-size: 14px; text-align: left; cursor: pointer;
}
.lignes-zoom button { justify-content: space-between; }
.lignes-zoom button:hover, .moments button:hover { background: var(--surface-2); }
.lignes-zoom .lieu { color: var(--doux); font-size: 12px; white-space: nowrap; }
.moments .temps { color: var(--ambre); font-variant-numeric: tabular-nums; min-width: 2.6em; }
.puces { flex-direction: row; flex-wrap: wrap; font-size: 13px; }
.puces li { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--bord-fort); }

.chapitres-videos { display: flex; flex-direction: column; gap: 6px; }
.chapitres-video { border-radius: 12px; background: var(--surface); border: 1px solid var(--bord); }
.chapitres-video summary {
  min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 6px 12px; cursor: pointer; font-size: 14px; list-style: none;
}
.chapitres-video summary::-webkit-details-marker { display: none; }
.chapitres-video summary::before {
  content: ''; flex: 0 0 auto; width: 8px; height: 8px; border-right: 2px solid var(--doux); border-bottom: 2px solid var(--doux);
  transform: rotate(-45deg); transition: transform 0.15s;
}
.chapitres-video[open] summary::before { transform: rotate(45deg); }
.chapitres-video .moments { padding: 0 6px 8px; gap: 4px; }
.chapitres-video .moments button { background: var(--surface-2); }
.chapitres-video .moments button:hover { background: var(--surface-3); }

.schema-bloc {
  display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; background: var(--surface);
  border: 1px solid rgba(255, 183, 3, 0.4);
}
.schema-bloc img { flex: 0 0 96px; width: 96px; height: 54px; border-radius: 8px; object-fit: cover; border: 1px solid var(--bord); }
.schema-textes { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.schema-titre { font-size: 14px; font-weight: 600; }
.schema-info { font-size: 12px; color: var(--doux); }
.schema-liens { display: flex; flex-wrap: wrap; gap: 6px; }
.lien-schema {
  min-height: 44px; display: inline-flex; align-items: center; gap: 6px; padding: 0 10px; border-radius: 8px;
  border: 1px solid var(--bord-fort); color: var(--texte); text-decoration: none; font-size: 13px;
}
.lien-schema:hover { background: var(--surface-2); color: var(--texte); }

/* Autres pages « schémas » */
.autres-cartes { margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--bord); }
.autres-cartes ul { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.autres-cartes a {
  min-height: 44px; display: inline-flex; align-items: center; padding: 0 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--bord); color: var(--texte); text-decoration: none; font-size: 14px;
}
.autres-cartes a:hover { border-color: var(--accent); color: var(--texte); }

@media (max-width: 860px) {
  .carte-principal { padding: 12px 12px 0; }
  .panneau-videos { padding: 16px 12px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .repere-cible { animation: none; outline: 3px solid var(--ambre); outline-offset: 3px; }
  .cible-signal .cible-icone { animation: none; border-color: var(--ambre); }
}
