/* Zeyna Benbrahim — le socle commun à toutes les pages.
   Les règles derrière ces choix : docs/DA-site.md */

:root {
  /* la base : le livre */
  --lin: #e6c3b0;          /* la toile de lin de la couverture */
  --papier: #f3ece3;       /* le papier mat, un peu chaud */
  --papier-clair: #faf6f0;
  --brique: #8b2a1a;       /* la dorure, l'encre */
  --encre: #241510;        /* le « noir » : un brun très profond */
  --sepia: #6b5245;
  --flash: #e8262d;        /* LA couleur pop : boutons, soleil, point de l'heure. Jamais en aplat de fond. */

  /* la teinte vivante : prise dans la photo regardée, fondue dans le papier (JS) */
  --teinte: var(--papier);

  --f-titre: "Arimo", "Helvetica Neue", Arial, sans-serif;
  --f-texte: "Instrument Serif", "Times New Roman", serif;
  --f-main: "Reenie Beanie", cursive;
  --f-mono: "DM Mono", ui-monospace, monospace;

  --g: clamp(16px, 2.2vw, 32px);   /* gouttière */
  --haut: 56px;
  --doux: cubic-bezier(.2, .7, .1, 1);
  --ombre-tirage: 0 1px 1px rgba(36,21,16,.12), 0 8px 18px -6px rgba(36,21,16,.28), 0 30px 60px -30px rgba(36,21,16,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--teinte); color: var(--encre);
  font: 400 clamp(18px, 1.3vw, 22px)/1.35 var(--f-texte);
  transition: background-color 1.2s var(--doux);
  overflow: hidden;                         /* pas de défilement vertical : chaque page est une scène */
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; user-select: none; -webkit-user-drag: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
::selection { background: var(--brique); color: var(--papier); }
:focus-visible { outline: 1.5px solid var(--flash); outline-offset: 3px; }

.mono { font: 400 11.5px/1.45 var(--f-mono); letter-spacing: .06em; text-transform: uppercase; }
.main { font-family: var(--f-main); font-weight: 400; }
.titre { font-family: var(--f-titre); font-weight: 400; text-transform: uppercase; letter-spacing: -.025em; line-height: .86; color: var(--brique); }
.cache { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ── Matière : grain de pellicule + vignette, par-dessus tout ── */
.grain { position: fixed; inset: -50%; z-index: 300; pointer-events: none; opacity: .11; mix-blend-mode: multiply;
  background: url("../assets/grain.svg"); animation: grain 1.2s steps(6) infinite; }
@keyframes grain { 0%{transform:translate(0,0)} 20%{transform:translate(-3%,2%)} 40%{transform:translate(2%,-3%)} 60%{transform:translate(-2%,-1%)} 80%{transform:translate(3%,3%)} }
.vignette { position: fixed; inset: 0; z-index: 299; pointer-events: none; box-shadow: inset 0 0 18vmin rgba(36,21,16,.16); }
.sombre .grain { mix-blend-mode: screen; opacity: .07; }
.sombre .vignette { box-shadow: inset 0 0 24vmin rgba(0,0,0,.6); }

/* ── Bandeau défilant ───────────────────────────────────── */
.bandeau { position: fixed; inset: 0 0 auto; z-index: 60; height: 28px; overflow: hidden; background: var(--encre); color: var(--papier); display: flex; align-items: center; }
.bandeau__piste { display: flex; gap: 3.5rem; white-space: nowrap; animation: defile 46s linear infinite; padding-left: 3.5rem; }
.bandeau__piste b { color: var(--flash); font-weight: 400; }
.bandeau:hover .bandeau__piste { animation-play-state: paused; }
@keyframes defile { to { transform: translateX(-50%); } }

/* ── En-tête ─────────────────────────────────────────────── */
.tete { position: fixed; inset: 28px 0 auto; z-index: 50; height: var(--haut); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 0 var(--g); pointer-events: none; }
.tete > * { pointer-events: auto; }
.tete__gauche { justify-self: start; display: flex; gap: 20px; align-items: center; }
.tete__heure { display: flex; gap: .8em; align-items: center; }
.tete__heure i { width: 6px; height: 6px; border-radius: 50%; background: var(--flash); animation: pouls 2.4s infinite; }
@keyframes pouls { 50% { opacity: .2; } }
.tete__droite { justify-self: end; display: flex; gap: 8px; align-items: center; }
.logo-main { font: 400 40px/1 var(--f-main); color: var(--brique); display: inline-block; transform: translateY(3px); transition: color .4s, transform .5s var(--doux); }
.logo-main:hover { color: var(--flash); transform: translateY(3px) rotate(-4deg); }

/* le menu en phrase, la capsule qui glisse sous le mot (Kit + Bisou) */
.menu { position: relative; display: flex; padding: 4px; border-radius: 999px;
  background: color-mix(in srgb, var(--papier-clair) 50%, transparent);
  backdrop-filter: blur(16px) saturate(1.2); -webkit-backdrop-filter: blur(16px) saturate(1.2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--encre) 9%, transparent), 0 6px 24px -12px rgba(36,21,16,.3); }
.menu a { position: relative; z-index: 1; padding: 6px 15px; font-size: 18px; white-space: nowrap; transition: color .3s; }
.menu a::after { content: ","; }
.menu a:last-of-type::after { content: "."; }
.menu a[aria-current="page"] { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.menu a:hover { color: var(--brique); }
.menu__capsule { position: absolute; z-index: 0; top: 4px; bottom: 4px; left: 0; width: 0; border-radius: 999px; background: var(--papier-clair); opacity: 0;
  transition: transform .5s var(--doux), width .5s var(--doux), opacity .3s; box-shadow: 0 1px 8px rgba(36,21,16,.1); }
.menu:hover .menu__capsule { opacity: 1; }
.sombre .menu { background: rgba(20,10,8,.45); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); color: var(--papier); }
.sombre .menu__capsule { background: rgba(255,255,255,.1); }
.sombre .menu a:hover { color: #fff; }
.sombre .logo-main { color: var(--papier); }

.rond { height: 38px; min-width: 38px; padding: 0 14px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--papier-clair); box-shadow: 0 1px 10px rgba(36,21,16,.1); transition: transform .3s var(--doux); }
.rond:hover { transform: scale(1.06); }
.rond--encre { background: var(--encre); color: var(--papier); }
.sombre .rond { background: rgba(255,255,255,.1); color: var(--papier); backdrop-filter: blur(10px); }
.sac__nb { font-family: var(--f-mono); font-size: 12px; }
.sac__nb.pop { animation: pop .5s var(--doux); }
@keyframes pop { 40% { transform: scale(1.9); color: var(--flash); } }
.burger { display: none; }

/* ── Boutons : éditoriaux, pas des bonbons ──────────────── */
.bouton { --bg: var(--flash); --fg: var(--papier-clair);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .7em;
  height: 50px; padding: 0 26px; border-radius: 3px; background: var(--bg); color: var(--fg);
  font: 400 12px/1 var(--f-mono); letter-spacing: .09em; text-transform: uppercase; overflow: hidden; isolation: isolate;
  transition: transform .4s var(--doux), box-shadow .4s; box-shadow: 0 10px 24px -14px color-mix(in srgb, var(--bg) 90%, black); }
.bouton::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.28) 50%, transparent 65%); transform: translateX(-120%); transition: transform .9s var(--doux); }
.bouton:hover { transform: translateY(-2px); }
.bouton:hover::before { transform: translateX(120%); }
.bouton:active { transform: scale(.98); }
.bouton--encre { --bg: var(--encre); }
.bouton--clair { --bg: var(--papier-clair); --fg: var(--encre); }
.bouton--ligne { --bg: transparent; --fg: currentColor; box-shadow: inset 0 0 0 1px currentColor; }
.bouton--large { width: 100%; }
.fleche { display: inline-block; transition: transform .4s var(--doux); }
.bouton:hover .fleche, a:hover > .fleche { transform: translateX(4px); }
.bouton.charge { pointer-events: none; color: transparent; }
.bouton.charge::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--fg); box-shadow: -12px 0 var(--fg), 12px 0 var(--fg); animation: points .7s infinite alternate; }
@keyframes points { from { box-shadow: -12px -4px var(--fg), 12px 4px var(--fg); transform: translateY(4px); } to { box-shadow: -12px 4px var(--fg), 12px -4px var(--fg); transform: translateY(-4px); } }
.lien { border-bottom: 1px solid currentColor; padding-bottom: 1px; transition: color .3s; }
.lien:hover { color: var(--flash); }

/* ── L'arche ─────────────────────────────────────────────── */
.arche { display: inline-block; width: .58em; height: 1em; }
.arche path, .arche line { fill: none; stroke: currentColor; stroke-width: 6; vector-effect: non-scaling-stroke; }
.arche .soleil { stroke: var(--flash); }

/* ── Un tirage photo : bord blanc, ombre portée, papier ─── */
.tirage { position: relative; background: var(--papier-clair); padding: max(7px, .75vw) max(7px, .75vw) max(22px, 2.3vw); box-shadow: var(--ombre-tirage); }
.tirage img { width: 100%; height: 100%; object-fit: cover; }
.tirage::after { content: ""; position: absolute; inset: 0; background: url("../assets/papier.svg"); mix-blend-mode: multiply; opacity: .5; pointer-events: none; }
.scotch { position: absolute; z-index: 2; width: 34%; height: 9%; top: -4%; left: 33%; background: rgba(240,230,210,.62); box-shadow: 0 1px 2px rgba(0,0,0,.08); transform: rotate(-4deg); }

/* ── La scène horizontale (scene.js) ────────────────────── */
.scene { position: fixed; inset: 0; overflow: hidden; touch-action: none; }
.piste { position: absolute; inset: 0 auto 0 0; display: flex; height: 100%; will-change: transform; }
.panneau { position: relative; flex: none; width: 100vw; height: 100%; padding: calc(28px + var(--haut) + 28px) var(--g) 86px; }
.panneau--large { width: 170vw; }
[data-prof] { will-change: transform; }
.revele { opacity: 0; transform: translateY(26px); transition: opacity 1.1s var(--doux), transform 1.1s var(--doux); }
.vu .revele { opacity: 1; transform: none; }
.vu .revele:nth-child(2) { transition-delay: .08s; } .vu .revele:nth-child(3) { transition-delay: .16s; } .vu .revele:nth-child(4) { transition-delay: .24s; } .vu .revele:nth-child(5) { transition-delay: .32s; }

/* le compteur de la pellicule + la barre de progression */
.compteur { position: fixed; z-index: 45; left: var(--g); right: var(--g); bottom: 22px; display: flex; align-items: center; gap: 18px; pointer-events: none; }
.compteur > * { pointer-events: auto; }
.compteur__barre { flex: 1; height: 1px; background: color-mix(in srgb, var(--encre) 18%, transparent); position: relative; }
.compteur__barre i { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--encre); }
.compteur__barre b { position: absolute; top: -3px; width: 7px; height: 7px; margin-left: -3px; border-radius: 50%; background: var(--flash); left: 0; }
.compteur__chapitres { display: flex; gap: 14px; }
.compteur__chapitres button { opacity: .4; transition: opacity .3s; }
.compteur__chapitres button.actif, .compteur__chapitres button:hover { opacity: 1; }
.compteur__aide { opacity: .55; }
.sombre .compteur { color: var(--papier); }
.sombre .compteur__barre { background: rgba(255,255,255,.18); }
.sombre .compteur__barre i { background: var(--papier); }

/* ── Intro : l'arche se dessine, la signature s'écrit ───── */
.intro { position: fixed; inset: 0; z-index: 400; background: var(--lin); display: grid; place-items: center; color: var(--brique); transition: clip-path 1.1s var(--doux) .1s; clip-path: inset(0 0 0 0); }
.intro::before { content: ""; position: absolute; inset: 0; background: url("../assets/lin.svg"); opacity: .6; mix-blend-mode: multiply; }
.intro.part { clip-path: inset(0 0 100% 0); }
.intro__coeur { position: relative; display: grid; justify-items: center; gap: 14px; }
.intro svg { width: 64px; height: 111px; }
.intro svg * { fill: none; stroke: var(--brique); stroke-width: 3; stroke-dasharray: 600; stroke-dashoffset: 600; animation: trace 1.4s var(--doux) forwards; }
.intro svg .soleil { stroke: var(--flash); animation-delay: .7s; }
@keyframes trace { to { stroke-dashoffset: 0; } }
.intro__nom { font: 400 64px/1 var(--f-main); clip-path: inset(0 100% 0 0); animation: ecrit 1.1s steps(18) .9s forwards; }
@keyframes ecrit { to { clip-path: inset(0 0 0 0); } }

/* ── La bulle : une photo qui parle ─────────────────────── */
.bulle { position: fixed; z-index: 70; left: 0; top: 0; pointer-events: none; max-width: 340px; opacity: 0; transition: opacity .35s; will-change: transform; }
.bulle.on { opacity: 1; }
.bulle__mot { display: inline-block; padding: 3px 8px; background: var(--encre); color: var(--papier); margin-bottom: 8px; }
.bulle__mot::before { content: "● "; color: var(--flash); }
.bulle__pensee { font: 400 clamp(30px, 2.7vw, 44px)/.95 var(--f-main); color: var(--brique); text-shadow: 0 0 14px var(--papier), 0 0 2px var(--papier); }
.bulle__pensee.apparait { animation: monte .5s var(--doux); }
@keyframes monte { from { opacity: 0; transform: translateY(8px) rotate(-2deg); } }
.sombre .bulle__pensee { color: var(--papier); text-shadow: 0 2px 16px rgba(0,0,0,.7); }

/* ── Le sac : il pop, le reste se floute (Kit) ──────────── */
.voile { position: fixed; inset: 0; z-index: 80; background: color-mix(in srgb, var(--encre) 12%, transparent);
  backdrop-filter: blur(16px) saturate(.9); -webkit-backdrop-filter: blur(16px) saturate(.9); opacity: 0; pointer-events: none; transition: opacity .5s var(--doux); }
.voile.on { opacity: 1; pointer-events: auto; }
.tiroir { position: fixed; z-index: 90; top: 14px; right: 14px; bottom: 14px; width: min(450px, calc(100vw - 28px)); background: var(--papier-clair); border-radius: 6px; padding: 28px;
  display: flex; flex-direction: column; gap: 18px; box-shadow: 0 40px 90px -20px rgba(36,21,16,.5); transform: translateX(calc(100% + 40px)) rotate(2deg); transition: transform .7s var(--doux); overflow-y: auto; color: var(--encre); }
.tiroir::before { content: ""; position: absolute; inset: 0; background: url("../assets/papier.svg"); mix-blend-mode: multiply; opacity: .45; pointer-events: none; border-radius: inherit; }
.tiroir.on { transform: none; }
.tiroir > * { position: relative; }
.tiroir__fermer { position: absolute !important; top: 18px; right: 18px; }
.ligne { display: grid; grid-template-columns: 58px 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px dashed color-mix(in srgb, var(--encre) 28%, transparent); }
.ligne__img { width: 58px; aspect-ratio: 235/311; border-radius: 1px 3px 3px 1px; background: var(--lin) url("../assets/lin.svg"); color: var(--brique); display: grid; place-items: center; font: 400 8px/1 var(--f-titre); text-align: center; box-shadow: 2px 3px 8px rgba(36,21,16,.25); }
.ligne__img--fonds { background: var(--encre); color: var(--flash); font: 400 26px/1 var(--f-main); }
.ligne__prix { font-family: var(--f-mono); font-size: 13px; }
.tiroir__total { display: flex; justify-content: space-between; align-items: baseline; font: 400 28px/1 var(--f-titre); text-transform: uppercase; letter-spacing: -.02em; margin-top: auto; }
.tiroir__part { font-family: var(--f-main); font-size: 28px; color: var(--brique); line-height: 1; }
.tiroir__vide { text-align: center; margin: auto 0; display: grid; gap: 18px; justify-items: center; }
.repartition { display: flex; height: 34px; overflow: hidden; font: 400 10.5px var(--f-mono); text-transform: uppercase; letter-spacing: .05em; border-radius: 2px; }
.repartition > div { display: flex; align-items: center; padding: 0 10px; white-space: nowrap; overflow: hidden; transition: flex-grow .7s var(--doux), opacity .4s; }
.repartition__livre { background: var(--lin) url("../assets/lin.svg"); color: var(--brique); }
.repartition__fonds { background: var(--encre); color: var(--papier); }
.repartition__fonds::before { content: "●"; color: var(--flash); margin-right: 6px; }

/* ── La fenêtre « liste d'attente » ──────────────────────── */
.modale { position: fixed; z-index: 90; left: 50%; top: 50%; width: min(500px, calc(100vw - 28px)); background: var(--papier-clair); border-radius: 6px; padding: 36px 32px 28px; text-align: center; color: var(--encre);
  box-shadow: 0 40px 90px -20px rgba(36,21,16,.5); transform: translate(-50%, -44%) rotate(-1.5deg) scale(.95); opacity: 0; pointer-events: none; transition: .6s var(--doux); }
.modale::before { content: ""; position: absolute; inset: 0; background: url("../assets/papier.svg"); mix-blend-mode: multiply; opacity: .45; pointer-events: none; }
.modale.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.modale > * { position: relative; }
.modale .arche { width: 32px; height: 56px; color: var(--brique); margin-bottom: 10px; }
.modale h2 { font: 400 clamp(32px, 4vw, 42px)/.95 var(--f-titre); text-transform: uppercase; letter-spacing: -.02em; color: var(--brique); }
.modale p { margin: 12px auto 20px; max-width: 34ch; }
.champ { display: flex; align-items: center; border-bottom: 1px solid color-mix(in srgb, currentColor 30%, transparent); padding: 0 2px; transition: border-color .3s; text-align: left; }
.champ:focus-within { border-color: var(--flash); }
.champ span { font-family: var(--f-mono); font-size: 14px; opacity: .65; padding-right: 10px; white-space: nowrap; }
.champ input, .champ select, .champ textarea { flex: 1; min-width: 0; height: 50px; border: 0; background: none; font: 400 17px var(--f-mono); padding: 0 4px; color: inherit; outline: none; }
.champ--texte input { font: 400 21px var(--f-texte); }
.modale form { display: grid; gap: 6px; }
.modale form .bouton { margin-top: 14px; }
.modale__petit { font-size: 15px; opacity: .65; margin: 14px 0 0 !important; }
.modale__erreur { color: var(--flash); font-size: 16px; min-height: 1.3em; }
.modale__fermer { position: absolute !important; top: 14px; right: 14px; }

/* ── Visionneuse ─────────────────────────────────────────── */
.visio { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 6vh 6vw; opacity: 0; pointer-events: none; transition: opacity .45s; background: color-mix(in srgb, var(--encre) 30%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); cursor: zoom-out; }
.visio.on { opacity: 1; pointer-events: auto; }
.visio figure { display: grid; justify-items: center; transform: scale(.94) rotate(-1deg); transition: transform .6s var(--doux); }
.visio.on figure { transform: none; }
.visio img { max-height: 76svh; max-width: 86vw; width: auto; background: var(--papier-clair); padding: 12px 12px 36px; box-shadow: var(--ombre-tirage); }
.visio__pensee { margin-top: 18px; font: 400 clamp(32px, 3vw, 50px)/1 var(--f-main); color: var(--papier-clair); text-align: center; text-shadow: 0 2px 20px rgba(0,0,0,.4); }

/* ── Petits écrans ───────────────────────────────────────── */
@media (max-width: 900px) {
  body { font-size: 18px; }
  .tete { grid-template-columns: 1fr auto; }
  .tete__heure { display: none; }
  .menu { position: fixed; inset: auto 14px 70px; flex-direction: column; border-radius: 6px; padding: 10px; background: var(--papier-clair); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .45s var(--doux); }
  .sombre .menu { background: #1d110d; }
  .menu.ouvert { transform: none; opacity: 1; pointer-events: auto; }
  .menu a { font-size: 32px; padding: 8px 14px; }
  .menu__capsule { display: none; }
  .burger { display: inline-flex; }
  .panneau { padding: calc(28px + var(--haut) + 18px) var(--g) 70px; }
  .panneau--large { width: 300vw; }
  .bulle { display: none; }
  .compteur__chapitres { display: none; }
  .compteur { bottom: 10px; }
  .compteur__aide { display: none; }
  .panneau { padding-bottom: 40px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
