/* ==========================================================
   Archig — styles communs
   Les maquettes Paper sont reproduites à leur taille réelle
   (1440 px de large) puis mises à l'échelle par js/site.js.
   ========================================================== */

:root {
  --main-purple: #A0A3FE;
  --purple-degrade: #BABEFF;
  --violet-fonce: #5F63DC;
  --lavande: #E2E3F6;
  --encre: #000000;
  --gris-texte: #4A4B66;

  --font-titre: "Alumni Sans Inline One", system-ui, sans-serif;
  --font-main: "Walter Turncoat", system-ui, sans-serif;
  --font-texte: "Space Grotesk", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  overflow-x: hidden;
  background: #FFFFFF;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.fond-lavande {
  background: var(--lavande);
}

a {
  color: inherit;
  text-decoration: none;
}

a:focus-visible {
  outline: 3px solid var(--violet-fonce);
  outline-offset: 4px;
}

/* ---------- Scène mise à l'échelle ---------- */

html {
  scroll-behavior: smooth;
}

/* overflow: clip (et pas hidden) pour que les ancres #projets
   fassent défiler la fenêtre et non la scène. */
.scene {
  position: relative;
  margin: 0 auto;
  overflow: clip;
}

.artboard {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  overflow: clip;
  overflow-wrap: anywhere;
}

.abs {
  position: absolute;
}

/* ---------- Barre de retour (hors mise à l'échelle) ---------- */

.barre-retour {
  display: flex;
  align-items: center;
  padding: 10px 24px;
}

.bouton-retour {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: var(--main-purple);
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 16px;
  font-weight: 600;
  line-height: 20px;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bouton-retour:hover {
  background: var(--purple-degrade);
  transform: translateY(-2px);
  box-shadow: 4px 4px 0 var(--violet-fonce);
}

/* ---------- Visionneuse plein écran (js/visionneuse.js) ---------- */

img.agrandissable {
  cursor: zoom-in;
}

img.agrandissable:focus-visible {
  outline: 3px solid var(--violet-fonce);
  outline-offset: 3px;
}

html.visionneuse-ouverte {
  overflow: hidden;
}

.visionneuse {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 64px 24px 48px;
  background: rgba(19, 16, 40, 0.92);
  cursor: zoom-out;
}

.visionneuse[hidden] {
  display: none;
}

.visionneuse-cadre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
}

.visionneuse-image {
  display: block;
  width: auto;
  height: auto;
  max-width: min(94vw, 1800px);
  max-height: calc(100vh - 170px);
  border-radius: 12px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.7);
  transform-origin: 50% 50%;
}

.visionneuse-image[hidden],
.visionneuse-legende[hidden] {
  display: none;
}

/* La vidéo remplit l'écran (16:9) au lieu de rester à sa taille d'origine */
video.visionneuse-image {
  width: min(94vw, calc((100vh - 170px) * 16 / 9));
  background: #000000;
  cursor: auto;
}

.visionneuse-legende {
  max-width: 760px;
  color: #E2E3F6;
  font-family: var(--font-texte);
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}

.visionneuse-fermer {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
  font-family: var(--font-texte);
  font-size: 30px;
  line-height: 48px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.visionneuse-fermer:hover {
  background: var(--main-purple);
  color: var(--encre);
}

.visionneuse-fermer:focus-visible {
  outline: 3px solid var(--main-purple);
  outline-offset: 3px;
}

.visionneuse-aide {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  margin: 0;
  color: rgba(226, 227, 246, 0.6);
  font-family: var(--font-texte);
  font-size: 13px;
  text-align: center;
}

@media (hover: none) {
  .visionneuse-aide {
    display: none;
  }
}

/* ---------- Message « bientôt disponible » ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  z-index: 100;
  padding: 14px 26px;
  border-radius: 999px;
  background: var(--violet-fonce);
  color: #FFFFFF;
  font-family: var(--font-texte);
  font-size: 16px;
  font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(70, 72, 160, 0.6);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ==========================================================
   Accueil
   ========================================================== */

.accueil {
  width: 1440px;
  height: 900px;
  background: #FFFFFF;
}

.bandeau {
  left: 0;
  top: 0;
  width: 1454px;
  height: 101px;
  background: #B9C4FF;
}

.logo {
  left: 57px;
  top: 20px;
  color: var(--encre);
  font-family: system-ui, sans-serif;
  font-size: 47px;
  font-weight: 500;
  line-height: 58px;
}

.lien-nav {
  top: 37px;
  color: var(--encre);
  font-family: system-ui, sans-serif;
  font-size: 25px;
  font-weight: 500;
  line-height: 30px;
  transition: color 0.2s ease;
}

.lien-nav:hover {
  color: var(--violet-fonce);
}

.bouton-contact {
  left: 1102px;
  top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 267px;
  height: 63px;
  background: #D9DDFF;
  color: var(--encre);
  font-family: system-ui, sans-serif;
  font-size: 25px;
  font-weight: 500;
  line-height: 30px;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.bouton-contact:hover {
  background: var(--main-purple);
  transform: translateY(-2px);
}

/* Sur ordinateur, tout tient sur un écran : le titre et la présentation à gauche,
   les projets à droite (colonne de gauche : x 64 → 800 ; de droite : x 856 → 1376) */

.creer-des-jeux {
  left: 72px;
  top: 160px;
  color: var(--encre);
  font-family: var(--font-main);
  font-size: 64px;
  line-height: 76px;
  white-space: nowrap;
}

.vague {
  left: 572px;
  top: 184px;
}

.game-design {
  left: 64px;
  top: 232px;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 150px;
  letter-spacing: 0.02em;
  line-height: 140px;
  white-space: nowrap;
}

.presentation-titre {
  left: 72px;
  top: 430px;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 76px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.presentation-texte {
  left: 72px;
  top: 522px;
  width: 700px;
  color: var(--purple-degrade);
  font-family: var(--font-titre);
  font-size: 44px;
  letter-spacing: 0.01em;
  line-height: 54px;
}

.presentation-texte br {
  display: none;
}

.projets-titre {
  left: 856px;
  top: 150px;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 76px;
  letter-spacing: -0.01em;
  line-height: 1;
}

.degrade-bas {
  left: 0;
  top: 520px;
  width: 1440px;
  height: 380px;
  background-image: linear-gradient(180deg, rgba(239, 241, 255, 0) 0%, var(--lavande) 100%);
}

.carte-projet {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--main-purple);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.carte-projet:hover {
  transform: translateY(-8px);
  box-shadow: 0 24px 40px -20px rgba(70, 72, 160, 0.6);
}

.carte-jeux {
  left: 856px;
  top: 250px;
  width: 520px;
  height: 290px;
}

.carte-sites {
  left: 856px;
  top: 564px;
  width: 520px;
  height: 290px;
}

.carte-texte {
  color: transparent;
  font-family: var(--font-titre);
  letter-spacing: -0.01em;
  line-height: 1;
  white-space: nowrap;
  -webkit-background-clip: text;
  background-clip: text;
}

.carte-jeux .carte-texte {
  font-size: 112px;
  background-image: linear-gradient(180deg, var(--purple-degrade) 0%, #FFFFFF 48.24%);
}

.carte-sites .carte-texte {
  font-size: 104px;
  background-image: linear-gradient(180deg, var(--purple-degrade) 0%, #FFFFFF 55.27%);
}

/* ==========================================================
   Bibliothèques
   ========================================================== */

.bibliotheque {
  width: 1440px;
  height: 1045px;
  background: #FFFFFF;
}

.etagere {
  left: 138px;
  top: 0;
  width: 1164px;
  height: 1045px;
  background: var(--lavande);
}

.bibliotheque-titre {
  left: 186px;
  top: 0;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 110px;
  letter-spacing: 0.5em;
  line-height: 164px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.bibliotheque-titre:hover {
  color: var(--violet-fonce);
}

.tranche {
  width: 65px;
  height: 400px;
  background: var(--main-purple);
}

a.tranche {
  transition: transform 0.25s ease, background-color 0.25s ease, box-shadow 0.25s ease;
}

a.tranche:hover {
  transform: translateY(-14px);
  background: var(--violet-fonce);
  box-shadow: 0 18px 24px -14px rgba(70, 72, 160, 0.7);
}

.tranche-titre {
  position: absolute;
  left: 0;
  top: 0;
  color: #FFFFFF;
  font-family: var(--font-titre);
  font-size: 48px;
  line-height: 41px;
  white-space: nowrap;
  transform-origin: 0 0;
}

/* ==========================================================
   Animation : le livre sort de l'étagère et s'ouvre
   (pilotée par js/livre-anim.js — tailles en px de maquette,
   mises à l'échelle par .anim-echelle)
   ========================================================== */

.anim-scene {
  position: fixed;
  inset: 0;
  z-index: 200;
  perspective: 2400px;
  pointer-events: none;
}

.anim-fond {
  position: absolute;
  inset: 0;
  background: var(--lavande);
}

.anim-tranche {
  position: fixed;
  transform-origin: 50% 50%;
  will-change: transform;
}

.anim-echelle {
  position: fixed;
  transform-origin: 0 0;
  transform-style: preserve-3d;
}

.anim-livre {
  position: absolute;
  left: 0;
  top: 0;
  width: 1324px;
  height: 924px;
  transform-origin: 993px 462px;
  transform-style: preserve-3d;
  will-change: transform;
}

.anim-dos,
.anim-couverture {
  position: absolute;
  left: 662px;
  top: 0;
  width: 662px;
  height: 924px;
}

.anim-dos {
  border-radius: 4px 22px 22px 4px;
  background: var(--violet-fonce);
  box-shadow: 0 30px 60px -20px rgba(70, 72, 160, 0.5);
}

.anim-couverture {
  transform-origin: 0 50%;
  transform-style: preserve-3d;
  will-change: transform;
}

.anim-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
  box-shadow: 0 30px 60px -20px rgba(70, 72, 160, 0.5);
}

.anim-avant {
  border-radius: 4px 22px 22px 4px;
  background-color: var(--main-purple);
  background-image: linear-gradient(90deg, rgba(40, 42, 120, 0.28) 0px, rgba(40, 42, 120, 0) 56px);
}

.anim-arriere {
  border-radius: 22px 4px 4px 22px;
  background: var(--violet-fonce);
  transform: rotateY(180deg);
}

.anim-avant-tome {
  position: absolute;
  left: 72px;
  top: 72px;
  color: #FFFFFF;
  font-family: var(--font-main);
  font-size: 26px;
  line-height: 32px;
}

.anim-avant-drapeau {
  position: absolute;
  right: 72px;
  top: 64px;
}

.anim-avant-titre {
  position: absolute;
  left: 72px;
  bottom: 96px;
  color: #FFFFFF;
  font-family: var(--font-titre);
  font-size: 112px;
  line-height: 98px;
  white-space: nowrap;
}

.anim-page {
  position: absolute;
  top: 22px;
  width: 640px;
  height: 880px;
  background-color: #FFFFFF;
}

.anim-page-droite {
  left: 0;
  border-radius: 4px 14px 14px 4px;
  background-image: linear-gradient(90deg, rgba(160, 163, 254, 0.35) 0%, rgba(160, 163, 254, 0.08) 5%, rgba(160, 163, 254, 0) 12%);
}

.anim-page-gauche {
  left: 22px;
  border-radius: 14px 4px 4px 14px;
  background-image: linear-gradient(270deg, rgba(160, 163, 254, 0.35) 0%, rgba(160, 163, 254, 0.08) 5%, rgba(160, 163, 254, 0) 12%);
}

/* Arrivée sur la page du livre après l'animation :
   le contenu des pages apparaît en fondu */
html.arrivee-livre .page > * {
  animation: apparition-page 0.6s ease 0.05s both;
}

@keyframes apparition-page {
  from {
    opacity: 0;
  }
}

/* ==========================================================
   Livre ouvert — Conquest of my Story
   ========================================================== */

/* Le livre occupe presque toute la scène : petites marges autour.
   Si tu changes ces valeurs, mets aussi à jour SCENE_L, SCENE_H,
   LIVRE_X et LIVRE_Y en haut de js/livre-anim.js. */
.livre-scene {
  width: 1372px;
  height: 984px;
  background: var(--lavande);
}

.livre {
  left: 24px;
  top: 16px;
  width: 1324px;
  height: 924px;
  border-radius: 22px;
  background: var(--violet-fonce);
  box-shadow: 0 24px 40px -18px rgba(70, 72, 160, 0.5);
}

.page {
  top: 22px;
  width: 640px;
  height: 880px;
  background-color: #FFFFFF;
}

.page-gauche {
  left: 22px;
  border-radius: 14px 4px 4px 14px;
  background-image: linear-gradient(270deg, rgba(160, 163, 254, 0.35) 0%, rgba(160, 163, 254, 0.08) 5%, rgba(160, 163, 254, 0) 12%);
}

.page-droite {
  left: 662px;
  border-radius: 4px 14px 14px 4px;
  background-image: linear-gradient(90deg, rgba(160, 163, 254, 0.35) 0%, rgba(160, 163, 254, 0.08) 5%, rgba(160, 163, 254, 0) 12%);
}

.livre-entete {
  left: 72px;
  top: 64px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  width: 504px;
}

.livre-tome {
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 20px;
  line-height: 26px;
}

.livre-annee {
  color: #6A6B8F;
  font-family: var(--font-texte);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.livre-titre {
  left: 72px;
  top: 118px;
  margin: 0;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 100px;
  font-weight: 400;
  line-height: 88px;
  white-space: nowrap;
}

.livre-image {
  left: 53px;
  top: 312px;
  width: 541px;
  height: 306px;
  border-radius: 54px;
  object-fit: cover;
}

/* Illustration dessinée (livres sans capture d'écran) */
.livre-illu {
  overflow: hidden;
}

.livre-illu svg {
  display: block;
}

/* Chapitres pas encore écrits (jeu en développement) */
.chapitre-a-venir {
  opacity: 0.4;
}

.chapitre-a-venir:hover {
  transform: none;
}

.note-chantier {
  margin: 0;
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 22px;
  line-height: 28px;
  transform: rotate(-3deg);
}

/* Bande-annonce en couverture + vignettes des zones */
video.livre-image {
  display: block;
  background: #000000;
}

/* Bouton « Activer le son » posé sur la bande-annonce */
.bouton-son {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: rgba(19, 16, 40, 0.78);
  color: #FFFFFF;
  font-family: var(--font-texte);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.bouton-son:hover {
  background: var(--violet-fonce);
  transform: translateY(-2px);
}

.bouton-son:focus-visible {
  outline: 3px solid var(--main-purple);
  outline-offset: 3px;
}

.bouton-son .onde,
.bouton-son[aria-pressed="false"] .onde {
  display: none;
}

.bouton-son[aria-pressed="true"] .onde {
  display: inline;
}

.bouton-son[aria-pressed="true"] .barre {
  display: none;
}

.livre-vignettes {
  display: flex;
  gap: 10px;
}

.livre-vignettes .chap-figure {
  width: 100px;
  gap: 5px;
}

.livre-vignettes .chap-figure img {
  height: 56px;
  border-radius: 8px;
}

.livre-vignettes figcaption {
  font-size: 12px;
  line-height: 15px;
  text-align: center;
}

.numero-page {
  bottom: 36px;
  color: var(--violet-fonce);
  font-family: var(--font-texte);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.sommaire-entete {
  left: 64px;
  top: 64px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 504px;
}

.sommaire-titre {
  margin: 0;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 72px;
  font-weight: 400;
  line-height: 68px;
}

.sommaire-intro {
  width: 430px;
  margin: 0;
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 17px;
  line-height: 26px;
}

.chapitres {
  left: 64px;
  top: 272px;
  width: 504px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chapitre {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  padding: 16px 0;
  transition: transform 0.2s ease;
}

.chapitre:hover {
  transform: translateX(6px);
}

.chapitre:hover .chapitre-nom {
  color: var(--violet-fonce);
}

.chapitre-numero {
  flex-shrink: 0;
  width: 52px;
  color: var(--violet-fonce);
  font-family: var(--font-titre);
  font-size: 34px;
  line-height: 30px;
}

.chapitre-nom {
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 20px;
  font-weight: 600;
  line-height: 26px;
  white-space: nowrap;
  transition: color 0.2s ease;
}

.chapitre-points {
  flex-grow: 1;
  height: 6px;
  border-bottom: 2px dotted var(--main-purple);
}

.chapitre-page {
  flex-shrink: 0;
  width: 32px;
  color: var(--gris-texte);
  font-family: var(--font-texte);
  font-size: 16px;
  font-weight: 500;
  line-height: 20px;
  text-align: right;
}

/* ---------- Doubles pages (sommaire + chapitres) ---------- */

.double[hidden] {
  display: none;
}

/* Feuille qui se tourne (js/livre-pages.js) */
.livre {
  perspective: 2600px;
}

.feuille {
  position: absolute;
  top: 22px;
  z-index: 5;
  width: 640px;
  height: 880px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.feuille-face {
  position: absolute;
  inset: 0;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.feuille-face > .page {
  left: 0;
  top: 0;
}

.feuille-dos {
  transform: rotateY(180deg);
}

.feuille-ombre {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(70, 72, 160, 0.18), rgba(70, 72, 160, 0));
  opacity: 0;
  pointer-events: none;
}

/* Pages qu'on peut attraper pour tourner (souris ou doigt) */
.livre {
  touch-action: pan-y;
}

.page.tournable {
  cursor: grab;
}

.livre.glisse,
.livre.glisse * {
  cursor: grabbing;
  -webkit-user-select: none;
  user-select: none;
}

/* Coin corné : petit au repos, plus grand au survol de la page */
.page.tournable::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 26px;
  height: 26px;
  pointer-events: none;
  transition: width 0.25s ease, height 0.25s ease;
}

.page-droite.tournable::after {
  right: 0;
  border-bottom-right-radius: 14px;
  background: linear-gradient(315deg, var(--violet-fonce) 0 50%, #E7E8FB 50%, #FFFFFF 100%);
  box-shadow: -3px -3px 6px rgba(70, 72, 160, 0.15);
}

.page-gauche.tournable::after {
  left: 0;
  border-bottom-left-radius: 14px;
  background: linear-gradient(45deg, var(--violet-fonce) 0 50%, #E7E8FB 50%, #FFFFFF 100%);
  box-shadow: 3px -3px 6px rgba(70, 72, 160, 0.15);
}

.page.tournable:hover::after {
  width: 52px;
  height: 52px;
}

.livre.glisse .page.tournable::after {
  width: 0;
  height: 0;
}

/* Contenu d'une page de chapitre : mise en page en flux */
.chap {
  position: absolute;
  top: 64px;
  bottom: 84px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  width: 504px;
}

.chap > * {
  flex-shrink: 0;
}

.page-gauche .chap {
  left: 72px;
}

.page-droite .chap {
  left: 64px;
}

.chap-fil {
  display: flex;
  gap: 8px;
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 19px;
  line-height: 24px;
}

.chap-fil a {
  border-bottom: 1.5px solid currentColor;
}

.chap-fil a:hover {
  color: var(--encre);
}

/* Les titres reçoivent le focus après un tournage de page (lecteurs d'écran),
   mais ce ne sont pas des boutons : pas de cadre de focus */
.chap-titre:focus,
.sommaire-titre:focus {
  outline: none;
}

.chap-titre {
  margin: 0;
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 68px;
  font-weight: 400;
  line-height: 62px;
}

.chap-bloc {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chap-sous-titre {
  margin: 0;
  color: var(--violet-fonce);
  font-family: var(--font-texte);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 18px;
  text-transform: uppercase;
}

.chap-texte {
  margin: 0;
  color: #1E1E2E;
  font-family: var(--font-texte);
  font-size: 16px;
  line-height: 25px;
}

.chap-texte strong {
  font-weight: 600;
}

.chap-citation {
  margin: 0;
  padding-left: 16px;
  border-left: 3px solid var(--main-purple);
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 18px;
  line-height: 27px;
}

.chap-lien {
  color: var(--violet-fonce);
  border-bottom: 1.5px solid currentColor;
}

/* Listes en lignes alignées (fiche, zones, classes) */
.chap-lignes {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1.5px solid var(--purple-degrade);
}

.chap-ligne {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1.5px solid var(--purple-degrade);
  font-family: var(--font-texte);
  font-size: 15px;
  line-height: 21px;
}

.chap-ligne-cle {
  flex-shrink: 0;
  width: 118px;
  color: var(--violet-fonce);
  font-weight: 600;
}

.chap-ligne-valeur {
  flex-grow: 1;
  color: #1E1E2E;
}

.chap-ligne-fin {
  flex-shrink: 0;
  width: 70px;
  color: var(--gris-texte);
  font-size: 13px;
  text-align: right;
}

.chap-lignes.serrees .chap-ligne {
  padding: 6px 0;
}

.chap-lignes.serrees .chap-ligne-cle {
  width: 170px;
  color: #1E1E2E;
}

.chap-lignes.serrees .chap-ligne-valeur {
  color: var(--gris-texte);
}

/* Listes numérotées */
.chap-principes {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chap-principe {
  display: flex;
  gap: 14px;
}

.chap-principe-num {
  flex-shrink: 0;
  width: 28px;
  color: var(--violet-fonce);
  font-family: var(--font-titre);
  font-size: 30px;
  line-height: 26px;
}

/* Chiffres clés */
.chap-chiffres {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.chap-chiffre {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 160px;
  padding: 12px 14px;
  background: #F3F3FD;
}

.chap-chiffre-valeur {
  color: var(--main-purple);
  font-family: var(--font-titre);
  font-size: 50px;
  line-height: 46px;
}

.chap-chiffre-label {
  color: var(--gris-texte);
  font-family: var(--font-texte);
  font-size: 13px;
  line-height: 17px;
}

/* Étapes du processus */
.chap-etapes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chap-etape {
  padding: 6px 12px;
  background: var(--lavande);
  color: var(--encre);
  font-family: var(--font-texte);
  font-size: 14px;
  font-weight: 500;
  line-height: 18px;
}

.chap-etape span {
  color: var(--violet-fonce);
  font-weight: 600;
}

/* Extrait de code */
.chap-code {
  margin: 0;
  padding: 14px 16px;
  background: #1A1530;
  color: #E2E3F6;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 13px;
  line-height: 20px;
  white-space: pre;
}

.chap-code b {
  color: var(--main-purple);
  font-weight: 400;
}

/* Images pixel art */
.chap-images {
  display: flex;
  gap: 12px;
}

.chap-figure {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
}

.chap-figure img {
  display: block;
  width: 100%;
  border-radius: 12px;
  object-fit: cover;
  image-rendering: pixelated;
  background: #C8B49F;
}

.chap-figure figcaption {
  color: var(--gris-texte);
  font-family: var(--font-texte);
  font-size: 13px;
  line-height: 17px;
}

.chap-figure figcaption strong {
  color: var(--encre);
  font-weight: 600;
}

/* Captures d'écran (pas de pixel art : rendu lissé) */
.chap-figure.capture img {
  border-radius: 10px;
  image-rendering: auto;
  background: #0D0F15;
}

/* Parcours en étapes fléchées */
.chap-flux {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chap-flux .chap-etape + .chap-etape::before {
  content: "→ ";
  color: var(--violet-fonce);
  font-weight: 600;
}

/* Nuancier */
.chap-couleurs {
  display: flex;
  gap: 8px;
}

.chap-couleur {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 77px;
  color: var(--gris-texte);
  font-family: var(--font-texte);
  font-size: 12px;
  line-height: 15px;
}

.chap-couleur span:first-child {
  height: 40px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

/* Navigation entre les doubles pages */
.chap-nav {
  bottom: 36px;
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 18px;
  line-height: 24px;
  transition: transform 0.2s ease;
}

.page-gauche .chap-nav {
  right: 56px;
}

.page-gauche .chap-nav:hover {
  transform: translateX(-6px);
}

.page-droite .chap-nav {
  left: 64px;
}

.page-droite .chap-nav:hover {
  transform: translateX(6px);
}

.bouton-jouer {
  left: 229px;
  top: 666px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 169px;
  height: 49px;
  background: var(--main-purple);
  color: var(--encre);
  font-family: var(--font-titre);
  font-size: 40px;
  line-height: 48px;
  transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.bouton-jouer:hover {
  background: var(--purple-degrade);
  transform: translateY(-3px);
  box-shadow: 4px 4px 0 var(--violet-fonce);
}

.retour {
  left: 64px;
  bottom: 44px;
  color: var(--violet-fonce);
  font-family: var(--font-main);
  font-size: 18px;
  line-height: 24px;
  transition: transform 0.2s ease;
}

.retour:hover {
  transform: translateX(-6px);
}

/* ==========================================================
   Ordinateur : bouton retour posé dans la marge
   (js/site.js ajoute .superposee quand la marge est assez large :
   le livre ou la bibliothèque gagnent alors toute la hauteur)
   ========================================================== */

.barre-retour.superposee {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
}

/* ==========================================================
   Téléphone, tablette en portrait et écrans très bas
   Les maquettes ne sont plus réduites : les pages deviennent
   une mise en page qui défile, en texte taille réelle.
   (même condition que MOBILE dans js/site.js, livre-pages.js, livre-anim.js)
   ========================================================== */

@media (max-width: 820px), (max-height: 500px) {

  /* ---------- Commun ---------- */

  .scene {
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible;
  }

  .artboard {
    position: static;
    width: auto;
    height: auto;
    transform: none !important;
    overflow: visible;
  }

  /* Les éléments placés au pixel près sur ordinateur reprennent leur place dans le flux */
  .artboard .abs {
    position: static !important;
    inset: auto !important;
  }

  .barre-retour {
    position: sticky;
    top: 0;
    z-index: 60;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.92);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }

  .fond-lavande .barre-retour {
    background: rgba(226, 227, 246, 0.92);
  }

  .toast {
    bottom: 20px;
    max-width: calc(100vw - 32px);
    text-align: center;
  }

  /* ---------- Accueil ---------- */

  .accueil {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 0 20px 56px;
    background: linear-gradient(180deg, #FFFFFF 45%, var(--main-purple) 100%);
  }

  .accueil .bandeau,
  .accueil .vague,
  .accueil .degrade-bas {
    display: none;
  }

  .accueil header {
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 -20px;
    padding: 12px 20px;
    background: #B9C4FF;
  }

  .accueil nav {
    display: flex;
    align-items: center;
    gap: 14px;
  }

  .logo {
    font-size: 28px;
    line-height: 34px;
  }

  .lien-nav {
    font-size: 15px;
    line-height: 20px;
  }

  .bouton-contact {
    width: auto;
    height: auto;
    padding: 9px 14px;
    font-size: 15px;
    line-height: 20px;
  }

  .creer-des-jeux {
    width: auto;
    margin-top: 40px !important;
    font-size: 34px;
    line-height: 42px;
  }

  .game-design {
    width: auto;
    padding-left: 0;
    font-size: 76px;
    line-height: 70px;
  }

  .presentation-titre {
    margin-top: 44px !important;
    font-size: 48px;
  }

  .presentation-texte {
    width: auto;
    margin-top: 12px !important;
    font-size: 30px;
    line-height: 36px;
  }

  .presentation-texte br {
    display: none;
  }

  .projets-titre {
    margin-top: 48px !important;
    font-size: 46px;
    scroll-margin-top: 80px;
  }

  .carte-projet {
    display: flex;
    align-items: center;
    justify-content: center;
    width: auto;
    height: 190px;
    margin-top: 16px;
  }

  .carte-jeux {
    order: 1;
  }

  .carte-sites {
    order: 2;
  }

  .carte-projet .carte-texte {
    position: static;
    font-size: 76px;
    line-height: 1;
  }

  /* ---------- Bibliothèques : une seule étagère, des livres debout ---------- */

  .bibliotheque {
    display: flex;
    flex-wrap: wrap;
    align-content: flex-start;
    align-items: flex-end;
    justify-content: center;
    gap: 12px;
    min-height: calc(100vh - 60px);
    padding: 28px 20px 48px;
    background: var(--lavande);
  }

  .bibliotheque .etagere {
    display: none;
  }

  /* Les livres vides : on n'en garde que trois sur l'étagère */
  .bibliotheque div.tranche {
    display: none;
  }

  .bibliotheque div.tranche:nth-of-type(-n+4) {
    display: block;
  }

  .bibliotheque h1 {
    flex-basis: 100%;
    margin-bottom: 18px !important;
    text-align: center;
  }

  .bibliotheque-titre {
    display: block;
    font-size: 52px;
    letter-spacing: 0.12em;
    line-height: 1.1;
    white-space: normal;
  }

  .bibliotheque .tranche {
    width: 50px;
    height: 300px;
  }

  a.tranche {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  a.tranche:hover,
  a.tranche:active {
    transform: translateY(-12px);
  }

  /* Titre vertical, à lire de bas en haut comme sur ordinateur */
  .tranche-titre {
    position: static;
    width: auto !important;
    transform: rotate(180deg) !important;
    transform-origin: 50% 50%;
    writing-mode: vertical-rl;
    font-size: 30px;
    line-height: 1;
    white-space: nowrap;
  }

  /* La planche de l'étagère, sous les livres */
  .bibliotheque::after {
    content: "";
    flex-basis: 100%;
    max-width: 420px;
    height: 14px;
    margin-top: -12px;
    border-radius: 4px;
    background: var(--violet-fonce);
    box-shadow: 0 10px 18px -10px rgba(70, 72, 160, 0.7);
  }

  /* ---------- Livres : une page sous l'autre ---------- */

  .livre-scene {
    width: auto;
    height: auto;
    padding: 8px 0 32px;
  }

  .livre {
    width: calc(100% - 24px);
    max-width: 720px;
    height: auto;
    margin: 0 auto;
    padding: 10px;
    border-radius: 18px;
    box-shadow: 0 16px 30px -18px rgba(70, 72, 160, 0.6);
    perspective: none;
  }

  .livre .page {
    display: flex;
    flex-direction: column;
    width: auto;
    height: auto;
    padding: 26px 20px 22px;
    border-radius: 12px;
    background-image: none;
  }

  .livre .page + .page {
    margin-top: 10px;
  }

  /* Toutes les doubles pages à la suite : on défile du sommaire jusqu'à la dernière page */
  .livre .double[hidden] {
    display: block;
  }

  .livre .double + .double {
    margin-top: 10px;
  }

  .livre .double {
    scroll-margin-top: 66px;
  }

  .page.tournable {
    cursor: auto;
  }

  .page.tournable::after,
  .feuille {
    display: none;
  }

  /* Couverture intérieure et sommaire */
  .livre-entete {
    width: auto;
  }

  .livre-titre {
    margin-top: 16px;
    font-size: 58px;
    line-height: 52px;
    white-space: normal;
  }

  .livre-image {
    width: 100% !important;
    height: auto !important;
    margin-top: 18px;
    border-radius: 20px;
    aspect-ratio: 16 / 9;
  }

  .livre-illu svg {
    width: 100%;
    height: auto;
  }

  .bouton-son {
    position: relative !important;
    z-index: 2;
    align-self: flex-end;
    margin: -50px 12px 0 0;
  }

  .livre-vignettes {
    flex-wrap: wrap;
    gap: 12px 10px;
    margin-top: 46px; /* le bouton « Son » chevauche le bas de la vidéo : ~30 px d'écart visible */
  }

  .livre-vignettes figcaption {
    font-size: 13px;
  }

  /* Plein écran sur téléphone : l'image prend toute la largeur */
  .visionneuse {
    padding: 64px 0 40px;
  }

  .visionneuse-image {
    max-width: 100vw;
    border-radius: 0;
  }

  video.visionneuse-image {
    width: 100vw;
  }

  .visionneuse-legende {
    padding: 0 16px;
    font-size: 15px;
  }

  .livre .livre-vignettes .chap-figure {
    width: calc((100% - 10px) / 2) !important;
  }

  .livre-vignettes .chap-figure img {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .numero-page {
    align-self: center;
    margin-top: 20px;
  }

  .sommaire-entete {
    width: auto;
    gap: 10px;
  }

  .sommaire-titre {
    font-size: 52px;
    line-height: 50px;
  }

  .sommaire-intro {
    width: auto;
    font-size: 16px;
    line-height: 25px;
  }

  .chapitres {
    width: auto;
    margin-top: 14px;
  }

  .chapitre {
    gap: 10px;
    padding: 13px 0;
  }

  .chapitre-numero {
    width: 40px;
    font-size: 30px;
  }

  .chapitre-nom {
    font-size: 17px;
    line-height: 23px;
    white-space: normal;
  }

  .chapitre-points {
    min-width: 12px;
  }

  .bouton-jouer {
    align-self: center;
    width: auto;
    height: auto;
    margin-top: 26px;
    padding: 6px 24px;
    font-size: 36px;
  }

  .retour {
    align-self: flex-start;
    margin-top: 22px;
  }

  .note-chantier {
    align-self: flex-start;
    margin-top: 18px;
  }

  /* Chapitres */
  .chap {
    position: static;
    width: auto;
    gap: 20px;
  }

  .chap-titre {
    font-size: 46px;
    line-height: 44px;
  }

  .chap-images {
    flex-wrap: wrap;
    gap: 10px;
  }

  .livre .chap-figure {
    width: auto !important;
  }

  /* Images des chapitres : une par ligne, en pleine largeur */
  .chap-images {
    flex-direction: column;
    gap: 16px;
  }

  .chap-images > .chap-figure {
    width: 100% !important;
  }

  .chap-figure figcaption {
    font-size: 14px;
    line-height: 19px;
  }

  /* Pas de mot coupé en plein milieu */
  .livre {
    overflow-wrap: break-word;
  }

  .chap-figure img {
    height: auto !important;
  }

  .chap-chiffre {
    width: calc(50% - 6px);
  }

  .chap-couleurs {
    flex-wrap: wrap;
  }

  .chap-couleur {
    width: calc((100% - 16px) / 3);
  }

  .chap-code {
    overflow-x: auto;
    font-size: 12px;
  }

  .chap-ligne-cle {
    width: 100px;
  }

  .chap-lignes.serrees .chap-ligne-cle {
    width: 40%;
  }

  .chap-lignes.serrees .chap-ligne {
    gap: 8px;
  }

  .chap-ligne-fin {
    width: 58px;
  }

  .chap-nav {
    margin-top: 20px;
    font-size: 19px;
  }

  .page-gauche .chap-nav {
    align-self: flex-start;
  }

  .page-droite .chap-nav {
    align-self: flex-end;
  }
}
