/* Page Histoire : livre dont les pages se tournent au défilement, et poussière de lumière
   argentée dans l'en-tête.
   Le livre n'existe qu'une fois la classe .hl-on posée par fx-histoire.js (écran large,
   mouvement autorisé). Sans JavaScript, en mouvement réduit ou sur téléphone, la page
   garde sa frise d'origine, simplement passée à l'argent. */

/* ── Frise d'origine : accents argent (repli sans livre) ── */
.hist-timeline .hist-dot {
  background:#c9d3e0;
  box-shadow:0 0 0 5px rgba(201,211,224,0.14);
}
.hist-timeline .hist-carte-annee { color:#d9e4f0; opacity:1; }
.hist-timeline .hist-carte:hover { border-color:rgba(201,211,224,0.32); }
/* Téléphone : le point était décalé à gauche de la ligne, on les aligne. */
@media (max-width:768px) {
  .hist-timeline .hist-dot-wrap { padding-left:13px; }
}

/* ── En-tête : poussière de lumière ── */
.fxh-motes {
  position:absolute; inset:0; width:100%; height:100%;
  z-index:1; pointer-events:none; display:block;
  opacity:0; transition:opacity 1.6s ease;
}
.fxh-motes.is-ready { opacity:1; }

/* ── Livre ── */
.hist-timeline.hl-on { padding:0; }
.hist-timeline.hl-on .hist-timeline-inner { display:none; }

.hl-track { position:relative; }
.hl-scene {
  position:sticky; top:0; height:100vh; height:100svh;
  display:flex; flex-direction:column; align-items:center; justify-content:center;
  padding:112px 24px 18px; box-sizing:border-box;
  /* Dimensions d'une page : tout le livre se déduit de ces deux valeurs. */
  --ph:min(calc(100svh - 236px), 640px);
  --pw:min(calc(var(--ph) * 0.76), calc(46vw - 24px), 500px);
}
/* Halo très doux derrière le livre, comme une lumière de plateau. */
.hl-scene::before {
  content:''; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(ellipse 60% 55% at 50% 52%, rgba(150,180,220,0.10), rgba(150,180,220,0) 70%);
}

.hl-stage {
  position:relative;
  width:calc(var(--pw) * 2); height:var(--ph);
  perspective:2400px; perspective-origin:50% 12%;
  margin:10px 0 0;
}
.hl-book {
  position:absolute; inset:0;
  transform-style:preserve-3d;
  transform-origin:50% 60%;
  will-change:transform;
}

/* Ombre portée du livre sur la scène. */
.hl-shadow {
  position:absolute; left:0; top:4%; width:calc(100% + 12px); height:100%;
  transform:translateZ(-30px) scaleX(0.5);
  background:radial-gradient(ellipse 70% 60% at 50% 60%, rgba(0,0,0,0.55), rgba(0,0,0,0) 72%);
  filter:blur(18px); pointer-events:none;
  transform-origin:100% 50%;
  will-change:transform;
}

/* Toile bleu nuit des plats : trame fine en deux sens et reflet en biais. */
.hl-board,
.hl-cover .hl-face {
  background-color:#0d1b3a;
  background-image:
    linear-gradient(115deg, rgba(170,195,230,0.10) 0%, rgba(170,195,230,0) 38%, rgba(0,0,0,0.18) 100%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.028) 0 1px, rgba(255,255,255,0) 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,0.11) 0 1px, rgba(0,0,0,0) 1px 3px);
}
.hl-board {
  position:absolute; left:50%; top:-10px;
  width:calc(var(--pw) + 12px); height:calc(100% + 20px);
  border-radius:2px 5px 5px 2px;
  box-shadow:0 30px 60px -20px rgba(0,0,0,0.6), inset 0 0 0 1px rgba(160,180,210,0.10);
  transform:translateZ(0);
}
/* Bloc des pages vu par la tranche : quelques filets ivoire décalés sous la page du dessus. */
.hl-block {
  position:absolute; top:3px; height:calc(100% - 1px); width:var(--pw);
  background:
    repeating-linear-gradient(0deg, #e4dfd3 0 1px, #f3efe6 1px 2px);
  border-radius:0 2px 2px 0;
  box-shadow:inset 0 0 0 1px rgba(60,50,30,0.10);
  pointer-events:none;
}
.hl-block-r { left:calc(50% + 3px); }
.hl-block-l { left:calc(50% - var(--pw) - 3px); border-radius:2px 0 0 2px; opacity:0; transition:opacity .25s linear; }
.hl-block-l.is-on { opacity:1; }

/* Feuillet : charnière sur la reliure, recto et verso dos à dos. */
.hl-leaf {
  position:absolute; left:50%; top:0;
  width:var(--pw); height:100%;
  transform-origin:0 50%;
  transform-style:preserve-3d;
  will-change:transform;
}
.hl-face {
  position:absolute; inset:0; overflow:hidden;
  -webkit-backface-visibility:hidden; backface-visibility:hidden;
  box-sizing:border-box;
}
.hl-verso { transform:rotateY(180deg); }

/* Papier ivoire : grain très fin (bruit SVG en ligne) et creux de la reliure. */
.hl-paper,
.hl-leaf:not(.hl-cover) .hl-face {
  background-color:#f2eee5;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .3 0 0 0 0 .22 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hl-leaf:not(.hl-cover) .hl-recto { border-radius:0 3px 3px 0; }
.hl-leaf:not(.hl-cover) .hl-verso { border-radius:3px 0 0 3px; }
.hl-face::before {
  content:''; position:absolute; top:0; bottom:0; width:16%; pointer-events:none; z-index:2;
}
.hl-recto::before { left:0;  background:linear-gradient(90deg,  rgba(60,45,20,0.20), rgba(60,45,20,0.06) 30%, rgba(60,45,20,0) 100%); }
.hl-verso::before { right:0; background:linear-gradient(270deg, rgba(60,45,20,0.20), rgba(60,45,20,0.06) 30%, rgba(60,45,20,0) 100%); }
.hl-cover .hl-face::before { display:none; }

/* Lumière sur la page qui tourne : bande d'ombre et de reflet qui glisse (courbure suggérée). */
.hl-fx {
  position:absolute; top:0; bottom:0; left:0; width:200%; z-index:3; pointer-events:none;
  opacity:0; will-change:transform, opacity;
}
.hl-recto .hl-fx {
  background:linear-gradient(90deg,
    rgba(20,25,40,0.26) 0%, rgba(20,25,40,0.08) 24%, rgba(255,255,255,0.16) 42%,
    rgba(255,255,255,0.04) 56%, rgba(20,25,40,0.08) 74%, rgba(20,25,40,0.24) 100%);
}
.hl-verso .hl-fx {
  left:auto; right:0;
  background:linear-gradient(270deg,
    rgba(20,25,40,0.26) 0%, rgba(20,25,40,0.08) 24%, rgba(255,255,255,0.16) 42%,
    rgba(255,255,255,0.04) 56%, rgba(20,25,40,0.08) 74%, rgba(20,25,40,0.24) 100%);
}
/* Ombre que la page en mouvement porte sur celle du dessous. */
.hl-cast {
  position:absolute; top:0; bottom:0; width:100%; z-index:3; pointer-events:none;
  opacity:0; will-change:transform, opacity;
}
.hl-recto .hl-cast { left:0; transform-origin:0 50%;
  background:linear-gradient(90deg, rgba(10,15,30,0.42), rgba(10,15,30,0.16) 45%, rgba(10,15,30,0)); }
.hl-verso .hl-cast { right:0; transform-origin:100% 50%;
  background:linear-gradient(270deg, rgba(10,15,30,0.42), rgba(10,15,30,0.16) 45%, rgba(10,15,30,0)); }

/* ── Couverture ── */
.hl-cover { top:-10px; height:calc(100% + 20px); width:calc(var(--pw) + 12px); }
.hl-cover .hl-recto { border-radius:2px 5px 5px 2px; box-shadow:inset 0 0 0 1px rgba(160,180,210,0.12); }
.hl-cover .hl-verso { border-radius:5px 2px 2px 5px; }
/* Filet argent en retrait et sillon de la charnière. */
.hl-cover .hl-recto::after {
  content:''; position:absolute; inset:26px 26px 26px 40px;
  border:1px solid rgba(205,215,230,0.30);
  box-shadow:0 1px 0 rgba(0,0,0,0.35), inset 0 1px 0 rgba(0,0,0,0.35);
  pointer-events:none;
}
.hl-groove {
  position:absolute; top:0; bottom:0; left:16px; width:6px; pointer-events:none;
  background:linear-gradient(90deg, rgba(0,0,0,0.35), rgba(160,185,220,0.10) 60%, rgba(0,0,0,0));
}
/* Monogramme en relief : lumière en haut à gauche, ombre en bas à droite. */
.hl-mono {
  position:absolute; left:50%; top:44%; width:42%; height:auto;
  transform:translate(-45%, -50%);
  opacity:0.92;
  filter:drop-shadow(-1px -1px 0 rgba(255,255,255,0.22)) drop-shadow(1px 2px 1px rgba(0,0,0,0.65));
}
/* Garde collée à l'intérieur du plat, encadrée par la toile. */
.hl-paste { position:absolute; inset:10px 0 10px 12px; border-radius:2px; overflow:hidden; }
.hl-paste::before {
  content:''; position:absolute; top:0; bottom:0; right:0; width:16%; pointer-events:none; z-index:2;
  background:linear-gradient(270deg, rgba(60,45,20,0.20), rgba(60,45,20,0.06) 30%, rgba(60,45,20,0) 100%);
}

/* ── Mise en page des pages ── */
.hl-pg { position:absolute; inset:0; display:flex; flex-direction:column; }
.hl-run {
  font-family:'DM Sans',sans-serif; font-size:11px; letter-spacing:0.14em;
  color:#8b8f98; line-height:1; padding-top:7%; text-align:center;
}
.hl-folio-l .hl-run { padding-left:6%; }

/* Page de gauche : la photographie de l'étape, en planche. */
.hl-plate {
  flex:1; display:flex; flex-direction:column; justify-content:center;
  padding:4% 12% 16% 11%;
}
.hl-cap {
  font-family:'DM Sans',sans-serif; font-size:12px !important; line-height:1.5 !important; color:#7d8290 !important;
  margin-top:20px; letter-spacing:0.01em;
}
.hist-timeline.hl-on .hl-plate .hist-visuel { width:100%; padding:0; margin:0; }
.hist-timeline.hl-on .hl-plate .hist-visuel img {
  width:100%; height:auto; aspect-ratio:3/2; object-fit:cover;
  border:0; outline:1px solid rgba(40,35,25,0.18); outline-offset:6px;
  box-shadow:none; filter:saturate(0.96) contrast(1.02);
}

/* Page de droite : année, titre, texte, à l'encre bleu nuit. */
.hl-text { flex:1; display:flex; align-items:center; padding:4% 12% 14% 12%; }
.hist-timeline.hl-on .hl-text .hist-carte {
  background:none; border:0; padding:0; transition:none;
}
.hist-timeline.hl-on .hl-text .hist-carte:hover { background:none; }
.hist-timeline.hl-on .hl-text .hist-carte::after { display:none; }
.hist-timeline.hl-on .hl-text .hist-carte-annee {
  font-size:clamp(52px, calc(var(--pw) * 0.17), 84px); color:#1d3360; opacity:1;
  letter-spacing:-0.01em; margin-bottom:22px; line-height:0.9;
}
.hist-timeline.hl-on .hl-text .hist-carte-annee::after {
  content:''; display:block; width:38px; height:1px; margin-top:22px;
  background:linear-gradient(90deg, #8e9bb0, rgba(142,155,176,0));
}
.hist-timeline.hl-on .hl-text .hist-carte-titre {
  font-size:clamp(22px, calc(var(--pw) * 0.056), 29px); color:#111a2d; font-weight:400; margin-bottom:14px;
}
.hist-timeline.hl-on .hl-text .hist-carte-texte {
  /* !important : le socle (design.css) impose taille et couleur à tous les paragraphes. */
  font-size:clamp(13.5px, calc(var(--pw) * 0.032), 15.5px) !important; color:#3b4353 !important;
  line-height:1.75 !important; font-weight:400 !important;
}
.hist-timeline.hl-on .hl-text .hist-carte,
.hist-timeline.hl-on .hl-plate .hist-visuel { opacity:1; transform:none; }

/* ── Repère de progression et liens d'étape ── */
.hl-nav {
  position:relative; z-index:2;
  display:flex; align-items:center; justify-content:center; gap:28px;
  margin-top:34px; width:min(100%, 980px);
  font-family:'DM Sans',sans-serif;
}
.hl-step {
  appearance:none; background:none; border:0; cursor:pointer;
  display:inline-flex; align-items:center; gap:8px;
  font:inherit; font-size:13px; color:#b8cde0; padding:8px 4px; white-space:nowrap;
  transition:color .2s ease, opacity .2s ease;
}
.hl-step svg { width:14px; height:14px; }
.hl-step:hover { color:#fff; }
.hl-step[disabled] { opacity:0.3; cursor:default; }
.hl-step[disabled]:hover { color:#b8cde0; }
.hl-years { position:relative; list-style:none; margin:0; padding:0 0 10px; display:flex; gap:clamp(14px, 2.6vw, 34px); }
.hl-years li { margin:0; padding:0; }
.hl-years::before,
.hl-bar {
  content:''; position:absolute; left:0; right:0; bottom:0; height:1px;
}
.hl-years::before { background:rgba(184,205,224,0.18); }
.hl-bar {
  background:linear-gradient(90deg, rgba(220,232,245,0.25), #e8f1fb);
  transform-origin:0 50%; transform:scaleX(0); will-change:transform;
}
.hl-year {
  appearance:none; background:none; border:0; cursor:pointer; padding:6px 2px;
  font-family:'DM Sans',sans-serif; font-size:13px; letter-spacing:0.04em;
  color:rgba(184,205,224,0.50); font-variant-numeric:tabular-nums;
  transition:color .35s ease;
}
.hl-year:hover { color:#dbe7f3; }
.hl-year[aria-current="step"] { color:#fff; }
.hl-step:focus-visible,
.hl-year:focus-visible { outline:1px solid #cfe0f2; outline-offset:4px; border-radius:2px; color:#fff; }

/* Écran bas (portable à 768 px de haut) : on resserre. */
@media (max-height:780px) {
  .hl-scene { padding-top:116px; --ph:min(calc(100svh - 232px), 640px); }
  .hl-nav { margin-top:24px; }
}

@media (prefers-reduced-motion: reduce) {
  .fxh-motes { display:none; }
}

/* Le livre se feuillette aussi au clic (12.10.2026). */
.hl-book.hl-clickable{cursor:pointer}

/* La grille des 9 certificats est carrée : on la montre entière au lieu de la recadrer en 3:2. */
.hist-timeline.hl-on .hl-plate .hist-visuel img[src*="amc-9-grid"]{aspect-ratio:1/1;width:72%;margin:0 auto;display:block;object-fit:contain}
/* Tablette : annees sur leur propre ligne, boutons dessous, rien ne sort de l ecran. */
@media (max-width:900px) {
  .hl-nav { flex-wrap:wrap; justify-content:space-between; row-gap:6px; gap:12px; width:min(100%, 640px); }
  .hl-years { order:-1; flex:1 1 100%; }
}
