/* lote-carte.css — lot E, développeur M : habillage des cartes mentales des fiches de cours (cours-*).
   Dessin seul : aucune position de nœud, aucun texte, aucun lien, aucun gestionnaire modifié.
   Chargé par une ligne balisée « lotE-M:debut carte » avant </head>. Si ce fichier manque, la fiche reste comme avant. */

/* ---------- 1. Cases (cartes de la carte mentale) ---------- */
.node{transform-origin:0 0}
.node[data-id]{border-radius:14px;border-color:var(--c);border-color:color-mix(in srgb,var(--c) 62%,var(--line));
  box-shadow:0 1px 2px rgba(24,35,43,.10),0 10px 26px -10px rgba(24,35,43,.30);
  transition:box-shadow .18s ease,border-color .18s ease,transform .18s ease}
/* liseré de la couleur de la branche en tête de case (dégradé de fond : aucune dimension ne change) */
.node[data-id] .nt{border-radius:12.5px 12.5px 0 0;background:linear-gradient(var(--c),var(--c)) top/100% 4px no-repeat,var(--t);padding-top:10px;padding-bottom:5px;border-bottom-color:color-mix(in srgb,var(--c) 22%,var(--line))}
#world.far .node[data-id] .nt{border-radius:12.5px;padding-top:13px;padding-bottom:11px}
.node[data-id] .go{transition:transform .18s ease;transform-origin:0 50%}
.node[data-id]:hover{border-color:var(--c);box-shadow:0 2px 4px rgba(24,35,43,.10),0 18px 36px -12px rgba(24,35,43,.38)}
.node[data-id]:hover .go,.node[data-id]:focus-visible .go{transform:translateX(4px)}
/* focus clavier : anneau de la couleur de la branche, détaché de la case par un filet « papier » */
.node:focus-visible{outline:3px solid var(--c,var(--cB));outline-offset:4px;box-shadow:0 0 0 4px var(--paper),var(--shadow)}
/* case sélectionnée (fiche ouverte) : anneau détaché */
.node[data-id].sel{border-color:var(--c);box-shadow:0 0 0 3px var(--paper),0 0 0 7px var(--c),0 14px 34px -10px rgba(24,35,43,.4)}
/* case déjà ouverte : petite pastille cochée dans l'angle (posée par lote-carte.js, classe lote-vu) */
.node[data-id].lote-vu::after{content:"";position:absolute;right:-9px;top:-9px;width:24px;height:24px;border-radius:50%;
  background:var(--c) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.6 3.6 7.4-8' fill='none' stroke='%23fff' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/100% no-repeat;
  box-shadow:0 0 0 2.5px var(--surface),0 2px 6px rgba(24,35,43,.3);pointer-events:none}
#world.far .node[data-id].lote-vu::after{width:34px;height:34px;right:-13px;top:-13px}

/* ---------- 2. Têtes de branche ---------- */
.hub{background:linear-gradient(180deg,var(--c),color-mix(in srgb,var(--c) 86%,#000));border-color:color-mix(in srgb,var(--c) 80%,#000);
  box-shadow:inset 0 1.5px 0 rgba(255,255,255,.28),0 2px 3px rgba(24,35,43,.14),0 14px 26px -12px var(--c);
  transition:box-shadow .18s ease,transform .18s ease}
.hub:hover{box-shadow:inset 0 1.5px 0 rgba(255,255,255,.28),0 3px 5px rgba(24,35,43,.16),0 20px 32px -12px var(--c)}
.hub:focus-visible{box-shadow:inset 0 1.5px 0 rgba(255,255,255,.28),0 0 0 4px var(--paper)}
/* petite icône de thème (posée par lote-carte.js quand le sens du titre est clair) : pastille à cheval sur le bord gauche */
.lote-hi{position:absolute;left:-30px;top:50%;width:54px;height:54px;margin-top:-27px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:var(--surface);color:var(--c);border:2.5px solid var(--c);box-shadow:0 3px 8px rgba(24,35,43,.22);pointer-events:none}
.lote-hi svg{display:block;width:34px;height:34px}

/* ---------- 3. Nœud central : bleu nuit et or, médaillon du chapitre ---------- */
.node.core{background:radial-gradient(120% 130% at 50% 0,#1c2f47 0,#0f1d29 62%);border-color:#e3b93c;color:#fff;
  --cA:#6aa5ff;--cB:#ff8c5a;--cC:#5cc77a;--cD:#a993ff;--cE:#3bc9db;--cF:#f06595;
  box-shadow:inset 0 0 0 5px #0f1d29,inset 0 0 0 6px rgba(255,211,77,.34),0 3px 6px rgba(15,29,41,.22),0 26px 46px -18px rgba(15,29,41,.6)}
.node.core h2{color:#fff}
.node.core p{color:#c6d2dc}
.node.core.lote-m{padding-top:58px}
.lote-med{position:absolute;left:50%;top:-56px;width:104px;height:104px;margin-left:-52px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:radial-gradient(circle at 50% 32%,#22364f,#0f1d29 70%);border:2.5px solid #e3b93c;
  box-shadow:inset 0 0 0 4px #0f1d29,inset 0 0 0 5px rgba(255,211,77,.4),0 8px 18px -6px rgba(15,29,41,.55);pointer-events:none}
.lote-med svg{display:block;width:62px;height:62px}

/* ---------- 4. Branches (liens) ---------- */
#links path{stroke-linejoin:round}
#links path[stroke-width="10"]{stroke-width:9;opacity:.9}
#links path[stroke-width="4"]{stroke-width:3.4;opacity:.72}

/* ---------- 5. Mode révision : la formule masquée se signale comme cliquable ---------- */
body.rev .node .f{cursor:pointer;border-radius:8px;background:color-mix(in srgb,var(--c) 14%,transparent)}
body.rev .node .f.show{cursor:inherit;background:transparent;transition:filter .2s,background-color .3s}

/* ---------- 6. Aide et niveau de zoom, plus discrets ---------- */
.hint{font-size:12.5px;line-height:1.35;padding:7px 12px 7px 14px;border-radius:12px;border-left:3px solid #e3b93c;
  background:var(--surface);background:color-mix(in srgb,var(--surface) 86%,transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  box-shadow:0 4px 14px -6px rgba(24,35,43,.28);max-width:min(380px,calc(100% - 32px));transition:opacity .5s ease}
.hint.lote-bas{opacity:.62}
.hint.lote-bas:hover{opacity:1}
/* le niveau de zoom sort de dessous les boutons flottants du coin bas droit */
.zoomtag{right:max(100px,calc(84px + env(safe-area-inset-right,0px)));background:color-mix(in srgb,var(--surface) 86%,transparent);-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);font-size:11.5px;padding:2px 9px}

/* ---------- 7. Tiroir (fiche détaillée) ---------- */
#drawer{box-shadow:none}
#drawer.open{box-shadow:-22px 0 50px -18px rgba(8,16,24,.42)}
.dh{background:linear-gradient(90deg,color-mix(in srgb,var(--c) 10%,var(--t)),var(--t) 60%)}
#dClose{border-radius:50%}
@media (max-width:640px){#drawer.open{box-shadow:0 -18px 44px -14px rgba(8,16,24,.45)}}

/* ---------- 8. Mode sombre ---------- */
:root[data-theme="dark"] .node[data-id]{box-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 28px -10px rgba(0,0,0,.7)}
:root[data-theme="dark"] .node[data-id]:hover{box-shadow:0 2px 4px rgba(0,0,0,.4),0 20px 38px -12px rgba(0,0,0,.8)}
:root[data-theme="dark"] .node[data-id].sel{box-shadow:0 0 0 3px var(--paper),0 0 0 7px var(--c),0 14px 34px -10px rgba(0,0,0,.8)}
:root[data-theme="dark"] .hub{background:linear-gradient(180deg,color-mix(in srgb,var(--c) 86%,#fff),var(--c));border-color:color-mix(in srgb,var(--c) 86%,#fff);box-shadow:inset 0 1.5px 0 rgba(255,255,255,.35),0 12px 26px -12px rgba(0,0,0,.8)}
:root[data-theme="dark"] .node[data-id].lote-vu::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.6 3.6 7.4-8' fill='none' stroke='%230e1519' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
:root[data-theme="dark"] .node.core{box-shadow:inset 0 0 0 5px #0f1d29,inset 0 0 0 6px rgba(255,211,77,.34),0 0 0 1px rgba(255,211,77,.12),0 26px 46px -18px rgba(0,0,0,.9)}
:root[data-theme="dark"] #drawer.open{box-shadow:-22px 0 50px -14px rgba(0,0,0,.8)}
@media (prefers-color-scheme:dark){
  :root:not([data-theme="light"]) .node[data-id]{box-shadow:0 1px 2px rgba(0,0,0,.4),0 12px 28px -10px rgba(0,0,0,.7)}
  :root:not([data-theme="light"]) .node[data-id]:hover{box-shadow:0 2px 4px rgba(0,0,0,.4),0 20px 38px -12px rgba(0,0,0,.8)}
  :root:not([data-theme="light"]) .node[data-id].sel{box-shadow:0 0 0 3px var(--paper),0 0 0 7px var(--c),0 14px 34px -10px rgba(0,0,0,.8)}
  :root:not([data-theme="light"]) .hub{background:linear-gradient(180deg,color-mix(in srgb,var(--c) 86%,#fff),var(--c));border-color:color-mix(in srgb,var(--c) 86%,#fff);box-shadow:inset 0 1.5px 0 rgba(255,255,255,.35),0 12px 26px -12px rgba(0,0,0,.8)}
  :root:not([data-theme="light"]) .node[data-id].lote-vu::after{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6.5 12.5l3.6 3.6 7.4-8' fill='none' stroke='%230e1519' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E")}
  :root:not([data-theme="light"]) .node.core{box-shadow:inset 0 0 0 5px #0f1d29,inset 0 0 0 6px rgba(255,211,77,.34),0 0 0 1px rgba(255,211,77,.12),0 26px 46px -18px rgba(0,0,0,.9)}
  :root:not([data-theme="light"]) #drawer.open{box-shadow:-22px 0 50px -14px rgba(0,0,0,.8)}
}

/* ---------- 9. Animations : une seule fois, jamais de boucle, coupées si l'élève a demandé moins de mouvement ---------- */
@media (prefers-reduced-motion:no-preference){
  /* apparition de la carte : le centre, les branches qui se tracent, puis les cases (« backwards » : rien ne reste après la fin) */
  .node{animation:lote-case .5s cubic-bezier(.2,.8,.3,1) backwards}
  .node.core{animation-delay:.05s}
  .node.hub{animation-delay:.34s}
  .node[data-id]{animation-delay:.62s}
  .node[data-id]:nth-child(3n){animation-delay:.7s}
  .node[data-id]:nth-child(3n+1){animation-delay:.78s}
  .lote-med{animation:lote-med .6s cubic-bezier(.2,.9,.3,1.25) .2s backwards}
  #links path{animation:lote-lien 2.6s linear backwards}
  #links path[stroke-width="4"]{animation-delay:.4s}
  #drawer{transition:transform .38s cubic-bezier(.22,.9,.24,1),box-shadow .38s ease}
  #dClose{transition:transform .2s ease}
  #dClose:hover{transform:rotate(90deg)}
  /* ouverture du tiroir : le contenu de la fiche monte en léger décalé (translation seule : aucune largeur mesurée ne change) */
  #drawer.open .db>*{animation:lote-fiche .36s ease-out backwards}
  #drawer.open .db>*:nth-child(1){animation-delay:.08s}
  #drawer.open .db>*:nth-child(2){animation-delay:.13s}
  #drawer.open .db>*:nth-child(3){animation-delay:.18s}
  #drawer.open .db>*:nth-child(4){animation-delay:.23s}
  #drawer.open .db>*:nth-child(n+5){animation-delay:.28s}
  #drawer.open .dh h3{animation:lote-titre .3s ease-out backwards}
}
@media (prefers-reduced-motion:reduce){
  .node[data-id],.hub,.node[data-id] .go,.hint{transition:none}
  .node[data-id]:hover .go,.node[data-id]:focus-visible .go{transform:none}
}
@keyframes lote-case{from{opacity:0;scale:.84}}
@keyframes lote-med{from{opacity:0;scale:.5}}
@keyframes lote-lien{from{stroke-dasharray:3600;stroke-dashoffset:3600}to{stroke-dasharray:3600;stroke-dashoffset:0}}
@keyframes lote-fiche{from{opacity:0;transform:translateY(12px)}}
@keyframes lote-titre{from{opacity:0;transform:translateX(10px)}}

/* ---------- 10. Impression : aucune animation en cours de route ---------- */
@media print{.node,.lote-med,#links path,#drawer.open .db>*,#drawer.open .dh h3{animation:none!important}}
