/* ==========================================================================
   Cédric Le Calvé — version animée
   Fichier : styles/motion.css
   (styles/main.css reste en place : il sert encore à la page admin)
   ========================================================================== */

/* Polices (hébergées dans public/fonts, licence SIL Open Font License) */
@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../public/fonts/eb-garamond-latin-wght-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "EB Garamond";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("../public/fonts/eb-garamond-latin-ext-wght-normal.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("../public/fonts/eb-garamond-latin-wght-italic.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "EB Garamond";
  font-style: italic;
  font-weight: 400 800;
  font-display: swap;
  src: url("../public/fonts/eb-garamond-latin-ext-wght-italic.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Playwrite FR Trad";
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url("../public/fonts/playwrite-fr-trad-latin-300-normal.woff2") format("woff2");
}

/* Propriétés animables (rotation des livres 3D, ouverture de la couverture) */
@property --ry { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --rx { syntax: "<number>"; inherits: true; initial-value: 0; }
@property --open { syntax: "<number>"; inherits: true; initial-value: 0; }

:root {
  /* Palette reprise du site d'origine + l'encre et la marge du cahier d'écolier */
  --paper: #f6efe5;
  --paper-hi: #fbf7f0;
  --paper-lo: #e9dece;
  --ink: #1f1a17;
  --ink-2: #3c2f28;
  --muted: #6d6157;
  --kraft: #b89e82;
  --blue: #2a3f94;          /* encre bleue des écoliers */
  --red: #c9393a;           /* marge rouge du cahier Séyès */
  --gold: #e2b65f;
  --night: #15110e;
  --night-2: #211a15;
  --on-night: #f3eadf;
  --on-night-muted: #a8998b;
  --line: rgba(54, 41, 33, 0.16);
  --line-night: rgba(243, 234, 223, 0.14);

  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --hand: "Playwrite FR Trad", "Segoe Script", "Apple Chancery", cursive;

  --gutter: clamp(18px, 4vw, 56px);
  --mx: clamp(64px, 8.5vw, 140px);   /* bord gauche du texte, juste après la marge rouge */
  --header-h: 78px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-io: cubic-bezier(0.76, 0, 0.24, 1);

  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background-color: var(--paper);
  /* grain de papier */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .25 0 0 0 0 .18 0 0 0 .075 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

@supports (overflow: clip) {
  body {
    overflow-x: clip;
  }
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

::selection {
  background: var(--blue);
  color: var(--paper-hi);
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 4px;
  border-radius: 3px;
}

.library :focus-visible,
.site-footer :focus-visible,
html.on-night .site-header :focus-visible {
  outline-color: var(--on-night);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: -80px;
  left: 16px;
  z-index: 300;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper-hi);
  text-decoration: none;
  transition: top 0.3s var(--ease);
}

.skip-link:focus {
  top: 14px;
}

body.menu-open,
html.is-loading body {
  overflow: hidden;
}

/* Lenis (défilement fluide) */
html.lenis,
html.lenis body {
  height: auto;
}

.lenis:not(.lenis-autoToggle).lenis-stopped {
  overflow: clip;
}

.lenis.lenis-smooth iframe {
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Écran de chargement : la page qui tourne
   -------------------------------------------------------------------------- */
.loader {
  display: none;
}

html.motion .loader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: block;
  perspective: max(2600px, 210vw);
  perspective-origin: 0% 50%;
  pointer-events: none;
}

html.motion.loader-off .loader {
  display: none;
}

.loader__cast {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(31, 26, 23, 0.45), rgba(31, 26, 23, 0.08) 70%);
  opacity: 0;
}

.loader__page {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background-color: var(--paper-hi);
  background-image:
    linear-gradient(to right, rgba(120, 132, 196, 0.1) 1px, transparent 1px),
    repeating-linear-gradient(to bottom, transparent 0 7px, rgba(120, 132, 196, 0.1) 7px 8px),
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(120, 132, 196, 0.28) 31px 32px);
  background-size: 32px 32px, auto, auto;
  transform-origin: 0% 50%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 30px 0 60px rgba(31, 26, 23, 0.18);
}

.loader__page::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--mx) - 28px);
  width: 2px;
  background: var(--red);
  opacity: 0.75;
}

.loader__inner {
  position: relative;
  text-align: center;
}

.loader__sign {
  font-family: var(--hand);
  font-weight: 300;
  font-size: clamp(2.1rem, 6.4vw, 5.2rem);
  line-height: 1.6;
  color: var(--blue);
}

.loader__sign span {
  display: inline-block;
  padding: 0 0.15em;
  clip-path: inset(-30% 100% -30% 0%);
}

.loader__bar {
  width: min(260px, 52vw);
  height: 1px;
  margin: 18px auto 0;
  background: var(--line);
}

.loader__bar span {
  display: block;
  height: 100%;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: left center;
}

.loader__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(31, 26, 23, 0), rgba(31, 26, 23, 0.4));
  opacity: 0;
}

/* --------------------------------------------------------------------------
   La marge rouge du cahier = barre de progression de lecture
   -------------------------------------------------------------------------- */
.margin-rule {
  position: fixed;
  top: 0;
  bottom: 0;
  left: calc(var(--mx) - 28px);
  z-index: 40;
  width: 1px;
  background: rgba(201, 57, 58, 0.25);
  pointer-events: none;
}

.margin-rule span {
  position: absolute;
  inset: 0;
  background: var(--red);
  transform: scaleY(var(--progress, 0));
  transform-origin: top center;
}

/* Barres de progression : mises à jour à chaque image du défilement,
   on les confie à la carte graphique (pas besoin de redessiner la page) */
html.motion .margin-rule span,
html.motion .library__progress span {
  will-change: transform;
}

/* --------------------------------------------------------------------------
   En-tête
   -------------------------------------------------------------------------- */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
  padding: 0 var(--gutter) 0 var(--mx);
  color: var(--ink);
  transition:
    transform 0.7s var(--ease),
    background-color 0.45s ease,
    color 0.45s ease,
    box-shadow 0.45s ease;
}

.site-header.is-scrolled {
  background-color: rgba(246, 239, 229, 0.86);
  box-shadow: 0 1px 0 var(--line);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.site-header.is-hidden {
  transform: translateY(-105%);
}

html.on-night .site-header {
  color: var(--on-night);
}

html.on-night .site-header.is-scrolled {
  background-color: rgba(21, 17, 14, 0.78);
  box-shadow: 0 1px 0 var(--line-night);
}

/* Sur téléphone et tablette, le flou derrière l'en-tête coûte cher à chaque
   image du défilement : un fond presque opaque donne le même rendu, sans effort */
@media (hover: none), (pointer: coarse) {
  .site-header.is-scrolled {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: rgba(246, 239, 229, 0.97);
  }

  html.on-night .site-header.is-scrolled {
    background-color: rgba(21, 17, 14, 0.95);
  }
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  line-height: 1.1;
}

/* le logo : trois livres aux initiales C · L · C */
.brand__logo {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 9px;
  box-shadow: 0 0 0 1px rgba(243, 234, 223, 0.08);
}

.brand__text {
  display: flex;
  flex-direction: column;
}

.brand__name {
  font-size: 1.4rem;
  font-weight: 500;
  letter-spacing: -0.005em;
}

.brand__role {
  font-size: 0.98rem;
  font-style: italic;
  opacity: 0.68;
}

.site-nav ul {
  display: flex;
  gap: clamp(20px, 2.8vw, 44px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a,
.footer__nav a {
  position: relative;
  display: inline-block;
  padding: 6px 0;
  font-size: 1.15rem;
  text-decoration: none;
}

.site-nav a::after,
.footer__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 3px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.55s var(--ease);
}

.site-nav a:hover::after,
.site-nav a[aria-current="true"]::after,
.footer__nav a:hover::after {
  transform: scaleX(1);
  transform-origin: left center;
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 4px 0 14px;
  border: 0;
  background: none;
  cursor: pointer;
  font-size: 1.1rem;
}

.menu-toggle__lines {
  position: relative;
  display: block;
  width: 26px;
  height: 12px;
}

.menu-toggle__lines i {
  position: absolute;
  left: 0;
  right: 0;
  height: 1.5px;
  background: currentColor;
  transition: transform 0.5s var(--ease), top 0.5s var(--ease);
}

.menu-toggle__lines i:first-child {
  top: 0;
}

.menu-toggle__lines i:last-child {
  top: 10px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__lines i:first-child {
  top: 5px;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__lines i:last-child {
  top: 5px;
  transform: rotate(-45deg);
}

.menu-panel {
  position: fixed;
  inset: 0;
  z-index: 55;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--header-h) + 24px) var(--gutter) 32px;
  background-color: var(--paper-hi);
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(120, 132, 196, 0.2) 31px 32px);
  color: var(--ink);
}

.menu-panel[hidden] {
  display: none;
}

.menu-panel ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

.menu-panel li {
  overflow: hidden;
}

.menu-panel a {
  display: inline-block;
  padding: 4px 0;
  font-size: clamp(2.6rem, 12vw, 4rem);
  line-height: 1.15;
  text-decoration: none;
}

.menu-panel__credit {
  font-family: var(--hand);
  font-weight: 300;
  font-size: 0.95rem;
  color: var(--blue);
}

html.menu-open .site-header {
  color: var(--ink);
  background-color: transparent;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* --------------------------------------------------------------------------
   Boutons : l'encre monte dans le papier
   -------------------------------------------------------------------------- */
.btn {
  position: relative;
  z-index: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 54px;
  padding: 0 1.7em;
  overflow: hidden;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.5s var(--ease), border-color 0.5s var(--ease);
}

.btn::before {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: -1;
  border-radius: 40% 40% 0 0 / 30% 30% 0 0;
  background: var(--ink);
  transform: translateY(102%);
  transition: transform 0.65s var(--ease), border-radius 0.65s var(--ease);
}

.btn:hover::before,
.btn:focus-visible::before {
  border-radius: 0;
  transform: translateY(0);
}

.btn--ink {
  background: var(--ink);
  color: var(--paper-hi);
}

.btn--ink::before {
  background: var(--blue);
}

.btn--ink:hover,
.btn--ink:focus-visible {
  border-color: var(--blue);
}

.btn--line:hover,
.btn--line:focus-visible {
  color: var(--paper-hi);
}

/* --------------------------------------------------------------------------
   Annotations à la main (encre bleue)
   -------------------------------------------------------------------------- */
.hand {
  font-family: var(--hand);
  font-weight: 300;
  font-size: clamp(0.88rem, 1.05vw, 1.05rem);
  line-height: 1.95;
  color: var(--blue);
}

/* Flèches du haut de page : tracées par motion.js (calque au-dessus de la photo et des livres) */
.hero__arrows {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.hero__arrows path {
  fill: none;
  stroke: var(--blue);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
  align-items: center;
  gap: clamp(24px, 4vw, 72px);
  min-height: 100vh;
  min-height: 100svh;
  padding: calc(var(--header-h) + 3vh) var(--gutter) 13vh var(--mx);
  overflow: hidden;
}

@supports (overflow: clip) {
  .hero {
    overflow: clip;
  }
}

.hero__kicker {
  display: inline-block;
  font-size: 1.15rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.11em;
  color: var(--muted);
}

.hero__title {
  margin: 0.16em 0 0.32em;
  font-size: clamp(4.2rem, 11.2vw, 11.6rem);
  font-weight: 500;
  line-height: 0.86;
  letter-spacing: -0.028em;
}

.hero__line {
  display: block;
  white-space: nowrap;
}

.hero__line + .hero__line {
  padding-left: 0.52em;
}

.hero__tagline {
  max-width: 21em;
  margin-bottom: 2.1rem;
  font-size: clamp(1.4rem, 2.05vw, 1.95rem);
  font-style: italic;
  line-height: 1.28;
  color: var(--ink-2);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero__visual {
  position: relative;
  height: min(76vh, 720px);
  min-height: 520px;
}

.hero__portrait {
  position: absolute;
  top: 3%;
  left: 2%;
  width: min(21vw, 330px);
  margin: 0;
  aspect-ratio: 764 / 841;
  background: var(--paper-lo);
  box-shadow: 0 34px 60px -26px rgba(31, 26, 23, 0.55), 0 2px 6px rgba(31, 26, 23, 0.12);
  transform: rotate(-2deg);
}

.hero__portrait-frame {
  position: absolute;
  inset: 0;
  overflow: hidden;
}

.hero__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tape {
  position: absolute;
  z-index: 2;
  width: 92px;
  height: 26px;
  background: rgba(232, 218, 190, 0.78);
  box-shadow: 0 1px 2px rgba(31, 26, 23, 0.12);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
  mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px));
}

.tape--a {
  top: -11px;
  left: 14%;
  transform: rotate(-7deg);
}

.tape--b {
  right: 10%;
  bottom: -10px;
  transform: rotate(5deg);
}

.hand--portrait {
  position: absolute;
  top: 8%;
  left: calc(min(21vw, 330px) + 11%);
  width: 10.5em;
  transform: rotate(-3deg);
}

.hero__books {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 56%;
}

.hand--books {
  position: absolute;
  right: 1%;
  bottom: 60%;
  transform: rotate(-4deg);
}

.hero__scroll {
  position: absolute;
  left: var(--mx);
  bottom: 4vh;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 1.05rem;
  font-style: italic;
  color: var(--muted);
  text-decoration: none;
}

.hero__scroll i {
  position: relative;
  display: block;
  width: 1px;
  height: 46px;
  overflow: hidden;
  background: var(--line);
}

.hero__scroll i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--ink);
  animation: scroll-cue 2.4s var(--ease-io) infinite;
}

@keyframes scroll-cue {
  0% {
    transform: translateY(-100%);
  }

  55% {
    transform: translateY(0);
  }

  100% {
    transform: translateY(100%);
  }
}

/* Texte découpé (lettres) */
.split {
  display: inline;
}

.w {
  display: inline-block;
  margin: -0.14em -0.03em -0.2em;
  padding: 0.14em 0.03em 0.2em;
  overflow: hidden;
  vertical-align: top;
}

.c {
  display: inline-block;
}

/* --------------------------------------------------------------------------
   Livre 3D (composant commun)
   -------------------------------------------------------------------------- */
.book3d {
  --h: 420px;
  --ar: 0.64;
  --dr: 0.07;
  --w: calc(var(--h) * var(--ar));
  --d: calc(var(--h) * var(--dr));
  --spine-bg: #3c2f28;
  --spine-fg: #f6efe5;
  position: relative;
  display: block;
  width: var(--w);
  height: var(--h);
  transform-style: preserve-3d;
  transform: rotateX(calc(var(--rx) * 1deg)) rotateY(calc(var(--ry) * 1deg));
}

.book3d .face {
  position: absolute;
  display: block;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.book3d__cover {
  position: absolute;
  inset: 0;
  display: block;
  transform-style: preserve-3d;
  transform-origin: 0% 50%;
  transform: translateZ(calc(var(--d) / 2)) rotateY(calc(var(--open) * 1deg));
}

.face--front {
  inset: 0;
  border-radius: 0 2px 2px 0;
  background: var(--spine-bg);
  transform: translateZ(1px);
}

.face--front img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}

.face--front::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 3.5%;
  width: 2.6%;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.24), rgba(255, 255, 255, 0.2) 55%, rgba(0, 0, 0, 0));
  pointer-events: none;
}

.face__sheen {
  position: absolute;
  inset: -30% -60%;
  background: linear-gradient(100deg, transparent 41%, rgba(255, 255, 255, 0.42) 50%, transparent 59%);
  mix-blend-mode: soft-light;
  transform: translateX(calc(var(--ry) * -0.5%));
  pointer-events: none;
}

.face__shade {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: #0d0907;
  opacity: 0;
  pointer-events: none;
}

.face--front > .face__shade {
  opacity: calc(0.62 - 0.62 * cos(calc(var(--ry) * 1deg)));
}

.book3d .face--inside {
  inset: 0;
  background: #f1e7d5 linear-gradient(-90deg, rgba(0, 0, 0, 0.13), transparent 14%);
  transform: rotateY(180deg) translateZ(1px);
}

/* Livre ouvert, page de gauche : l'accroche de l'éditeur, puis le début du résumé */
.inside__inner {
  position: absolute;
  inset: 9% 14% 8% 10%;
  display: block;
  overflow: hidden;
  color: #2a221c;
  font-size: calc(var(--h) * 0.03 * var(--fs, 1));
  line-height: 1.45;
}

.inside__text,
.page__text {
  display: block;
  text-align: left;
  -webkit-hyphens: auto;
  hyphens: auto;
}

.pg {
  display: block;
  margin-bottom: 0.6em;
}

.pg--hook {
  margin-bottom: 0.75em;
  font-style: italic;
  color: #4a3b31;
}

.pg--hook b {
  font-style: normal;
  font-weight: 600;
  color: #2a221c;
}

/* fin des accroches : un petit trait rouge avant le résumé */
.pg--hook + .pg:not(.pg--hook)::before {
  content: "";
  display: block;
  width: 2.4em;
  height: 1px;
  margin: 0.2em 0 0.9em;
  background: var(--red);
}

.face--page {
  top: 1.2%;
  bottom: 1.2%;
  left: 0;
  right: 1%;
  background: #fbf6ec linear-gradient(90deg, rgba(0, 0, 0, 0.12), transparent 10%);
  transform: translateZ(calc(var(--d) / 2 - 1px));
}

.page__inner {
  position: absolute;
  inset: 9% 11% 8% 13%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: #2a221c;
  font-size: calc(var(--h) * 0.03 * var(--fs, 1));
  line-height: 1.45;
  text-align: center;
}

.page__author {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  color: #6d6157;
}

.page__title {
  margin: 0.45em 0 0.2em;
  font-size: 1.9em;
  font-style: italic;
  line-height: 1.05;
}

.page__rule {
  width: 2.4em;
  height: 1px;
  margin: 0.8em auto 1.2em;
  background: var(--red);
}

.page__pub {
  margin-top: auto;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  color: #8a7d70;
}

.face--back {
  inset: 0;
  background: var(--spine-bg);
  color: var(--spine-fg);
  transform: rotateY(180deg) translateZ(calc(var(--d) / 2));
}

.face--back > .face__shade {
  opacity: calc(0.62 + 0.62 * cos(calc(var(--ry) * 1deg)));
}

.back__inner {
  position: absolute;
  inset: 11% 12% 8%;
  display: flex;
  flex-direction: column;
  font-size: calc(var(--h) * 0.029);
  line-height: 1.55;
}

.back__title {
  margin-bottom: 0.8em;
  font-size: 1.35em;
  line-height: 1.1;
}

.back__desc {
  font-style: italic;
  opacity: 0.88;
}

.back__foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-top: auto;
}

.back__pub {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
}

.back__code {
  width: 32%;
  aspect-ratio: 2 / 1.15;
  border: 0.25em solid #fbf7f0;
  background: #fbf7f0 repeating-linear-gradient(90deg, #1b1714 0 1px, transparent 1px 3px, #1b1714 3px 5px, transparent 5px 6px, #1b1714 6px 7px, transparent 7px 10px);
}

.book3d .face--spine {
  top: 0;
  left: calc(50% - var(--d) / 2);
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--d);
  height: 100%;
  background: var(--spine-bg);
  color: var(--spine-fg);
  transform: rotateY(-90deg) translateZ(calc(var(--w) / 2));
}

.face--spine::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.28), rgba(255, 255, 255, 0.1) 45%, rgba(0, 0, 0, 0.22));
}

.face--spine > .face__shade {
  opacity: calc(0.52 - 0.45 * max(0, sin(calc(var(--ry) * 1deg))));
}

.spine__text {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.6em;
  font-size: max(5px, calc(var(--d) * 0.38));
  line-height: 1;
  white-space: nowrap;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.spine__text b {
  font-weight: 600;
  letter-spacing: 0.02em;
}

.spine__text span {
  font-variant-caps: all-small-caps;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

.face--edge {
  top: 1.2%;
  left: calc(50% - var(--d) / 2);
  width: calc(var(--d) - 2px);
  height: 97.6%;
  background: #efe6d6 repeating-linear-gradient(90deg, rgba(120, 98, 72, 0.17) 0 1px, transparent 1px 3px);
  transform: rotateY(90deg) translateZ(calc(var(--w) / 2 - 2px));
}

.face--edge > .face__shade {
  opacity: calc(0.5 - 0.38 * max(0, sin(calc(var(--ry) * -1deg))));
}

.face--top,
.face--bottom {
  top: calc(50% - var(--d) / 2);
  left: 0;
  width: calc(100% - 2px);
  height: calc(var(--d) - 2px);
  background: #efe6d6 repeating-linear-gradient(0deg, rgba(120, 98, 72, 0.17) 0 1px, transparent 1px 3px);
}

.face--top {
  transform: rotateX(90deg) translateZ(calc(var(--h) / 2 - 2px));
}

.face--bottom {
  transform: rotateX(-90deg) translateZ(calc(var(--h) / 2 - 2px));
}

/* Livres "à la une" du hero */
.feat {
  position: absolute;
  bottom: 0;
  display: block;
  color: inherit;
  text-decoration: none;
  outline-offset: 12px;
}

.feat__float {
  display: block;
  perspective: 1000px;
}

.feat__shadow {
  position: absolute;
  left: 50%;
  bottom: -30px;
  width: 135%;
  height: 34px;
  margin-left: -67.5%;
  background: radial-gradient(closest-side, rgba(31, 26, 23, 0.45), rgba(31, 26, 23, 0));
  pointer-events: none;
}

/* Les trois livres flottent doucement (animation jouée par la carte graphique,
   seulement quand le haut de page est visible) */
@keyframes feat-float-a {
  to { transform: translateY(-10px) rotate(-1.4deg); }
}

@keyframes feat-float-b {
  to { transform: translateY(-14px) rotate(1.2deg); }
}

@keyframes feat-float-c {
  to { transform: translateY(-18px) rotate(-1.4deg); }
}

@keyframes feat-shadow {
  to { transform: scale(0.82); opacity: 0.6; }
}

html.motion .hero.is-live .feat__float,
html.motion .hero.is-live .feat__shadow {
  animation: feat-float-a 2.6s ease-in-out infinite alternate;
}

html.motion .hero.is-live .feat--2 .feat__float {
  animation-name: feat-float-b;
  animation-duration: 3.05s;
  animation-delay: 0.35s;
}

html.motion .hero.is-live .feat--3 .feat__float {
  animation-name: feat-float-c;
  animation-duration: 3.5s;
  animation-delay: 0.7s;
}

html.motion .hero.is-live .feat__shadow {
  animation-name: feat-shadow;
}

html.motion .hero.is-live .feat--2 .feat__shadow {
  animation-duration: 3.05s;
  animation-delay: 0.35s;
}

html.motion .hero.is-live .feat--3 .feat__shadow {
  animation-duration: 3.5s;
  animation-delay: 0.7s;
}

.book3d--feat {
  --h: clamp(150px, 15.5vw, 262px);
  --rx: -6;
}

.feat--1 {
  left: 2%;
  bottom: 9%;
  z-index: 1;
}

.feat--2 {
  left: 35%;
  bottom: 0;
  z-index: 3;
}

.feat--3 {
  left: 66%;
  bottom: 14%;
  z-index: 2;
}

.feat--1 .book3d {
  --ry: 34;
}

.feat--2 .book3d {
  --ry: -16;
}

.feat--3 .book3d {
  --ry: -34;
}

/* --------------------------------------------------------------------------
   Présentation (texte qui passe du crayon à l'encre)
   -------------------------------------------------------------------------- */
.manifesto {
  padding: clamp(90px, 17vh, 190px) var(--gutter) clamp(90px, 16vh, 180px) var(--mx);
}

.manifesto__text {
  max-width: 24em;
  font-size: clamp(1.75rem, 3.45vw, 3.15rem);
  line-height: 1.22;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

/* --------------------------------------------------------------------------
   Sections
   -------------------------------------------------------------------------- */
.section {
  position: relative;
  padding: clamp(90px, 14vh, 170px) var(--gutter) clamp(90px, 13vh, 150px) var(--mx);
}

.section__head {
  display: grid;
  gap: 14px;
  max-width: 1180px;
  margin-bottom: clamp(44px, 8vh, 90px);
}

.section__title {
  font-size: clamp(2.7rem, 5.6vw, 5.3rem);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.018em;
}

.section__intro {
  max-width: 34em;
  font-size: 1.28rem;
  line-height: 1.55;
  color: var(--muted);
}

.section__hand {
  transform: rotate(-2deg);
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   Actualités : l'agenda sur papier Séyès
   -------------------------------------------------------------------------- */
.news {
  background-image:
    linear-gradient(to right, rgba(120, 132, 196, 0.07) 1px, transparent 1px),
    repeating-linear-gradient(to bottom, transparent 0 7px, rgba(120, 132, 196, 0.07) 7px 8px),
    repeating-linear-gradient(to bottom, transparent 0 31px, rgba(120, 132, 196, 0.2) 31px 32px);
  background-size: 32px 32px, auto, auto;
}

.agenda {
  max-width: 1120px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.event {
  position: relative;
  display: grid;
  grid-template-columns: minmax(150px, 11rem) minmax(0, 1fr);
  gap: clamp(20px, 4vw, 64px);
  padding: 38px 0 40px;
}

.event__rule {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: var(--line);
  transform-origin: left center;
}

.agenda .event:first-child::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--line);
}

.event__date {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.event__day-wrap {
  display: block;
  overflow: hidden;
}

.event__day {
  display: block;
  font-size: clamp(3.4rem, 5vw, 4.6rem);
  font-weight: 500;
  line-height: 0.92;
  font-variant-numeric: lining-nums;
}

.event__month {
  padding-top: 0.5em;
  font-size: 1.12rem;
  font-style: italic;
  line-height: 1.25;
  color: var(--muted);
}

.event__status {
  margin-bottom: 0.35em;
  font-size: 1.08rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.11em;
  color: var(--muted);
}

.event--upcoming .event__status {
  color: var(--red);
}

.event__title {
  max-width: 24em;
  margin-bottom: 0.45em;
  font-size: clamp(1.55rem, 2.45vw, 2.15rem);
  font-weight: 500;
  line-height: 1.15;
}

.event__text {
  max-width: 38em;
  color: var(--ink-2);
}

.event__gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.event__gallery img {
  width: min(220px, 42vw);
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 3px;
  box-shadow: 0 16px 30px -18px rgba(31, 26, 23, 0.5);
}

.event--past .event__day,
.event--past .event__title {
  color: var(--ink-2);
}

.agenda__empty {
  max-width: 34em;
  font-size: 1.3rem;
  font-style: italic;
  color: var(--muted);
}

/* --------------------------------------------------------------------------
   À propos
   -------------------------------------------------------------------------- */
.about__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: clamp(36px, 6vw, 110px);
  align-items: start;
  max-width: 1280px;
}

.about__portrait {
  position: relative;
  margin: 18px 0 0;
  transform: rotate(-1.4deg);
}

.about__portrait-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 764 / 841;
  background: var(--paper-lo);
  box-shadow: 0 40px 70px -34px rgba(31, 26, 23, 0.6), 0 2px 6px rgba(31, 26, 23, 0.12);
}

.about__portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* La photo se « développe » : un voile couleur papier ancien s'efface */
.about__portrait-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(250, 238, 214, 0.55), rgba(196, 160, 112, 0.35)),
    #eadbc2;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.6s cubic-bezier(0.25, 0.6, 0.3, 1);
}

html.motion .about__portrait-frame.is-undeveloped::after {
  opacity: 0.94;
  transition: none;
}

.about__portrait .tape--a {
  top: -12px;
  left: 38%;
}

.about__portrait .hand {
  margin-top: 22px;
  text-align: right;
  transform: rotate(-2deg);
}

.about__body .section__title {
  margin-bottom: 0.55em;
}

.about__bio {
  max-width: 33em;
  margin-bottom: 1.3em;
  font-size: clamp(1.3rem, 1.65vw, 1.5rem);
  line-height: 1.55;
}

.about__numbers {
  max-width: 33em;
  padding-left: 18px;
  border-left: 2px solid var(--red);
  font-size: 1.2rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--ink-2);
}

.num {
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--ink);
}

.about__cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 36px clamp(28px, 4vw, 64px);
  margin-top: clamp(40px, 6vh, 64px);
}

.about__col h3 {
  margin-bottom: 18px;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.2;
}

.facts,
.links {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.facts li {
  position: relative;
  padding-left: 38px;
  line-height: 1.4;
}

.facts svg {
  position: absolute;
  top: -0.05em;
  left: 0;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--red);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-size: 1.2rem;
  text-decoration: none;
}

.link__icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background-color 0.45s var(--ease), color 0.45s var(--ease), border-color 0.45s var(--ease), transform 0.6s var(--ease);
}

.link__icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.link__icon--facebook svg {
  fill: currentColor;
  stroke: none;
}

.link__text {
  background: linear-gradient(currentColor, currentColor) left bottom / 0% 1px no-repeat;
  transition: background-size 0.55s var(--ease);
}

.link:hover .link__icon,
.link:focus-visible .link__icon {
  border-color: var(--ink);
  background-color: var(--ink);
  color: var(--paper-hi);
  transform: rotate(-8deg);
}

.link:hover .link__text,
.link:focus-visible .link__text {
  background-size: 100% 1px;
}

/* « Ils en parlent » : articles et interviews */
.press {
  margin-top: clamp(44px, 7vh, 72px);
}

.press h3 {
  margin-bottom: 12px;
  font-size: 1.55rem;
  font-weight: 500;
  line-height: 1.2;
}

.press__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.press__item {
  --rule: 1;
  position: relative;
}

.press__item::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: var(--line);
  transform: scaleX(var(--rule));
  transform-origin: left center;
}

.press__link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 22px;
  padding: 15px 0 16px;
  color: inherit;
  text-decoration: none;
}

.press__meta {
  font-size: 1.02rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.press__title {
  grid-column: 1;
  font-size: 1.24rem;
  font-style: italic;
  line-height: 1.32;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.45s var(--ease);
}

.press__arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--muted);
  transition: transform 0.6s var(--ease), color 0.45s var(--ease);
}

.press__link:hover .press__title,
.press__link:focus-visible .press__title {
  text-decoration-color: currentColor;
}

.press__link:hover .press__arrow,
.press__link:focus-visible .press__arrow {
  color: var(--red);
  transform: translate(3px, -3px);
}

/* --------------------------------------------------------------------------
   Parcours éditorial : l'étagère
   -------------------------------------------------------------------------- */
.shelf-block {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  align-items: end;
  gap: 40px clamp(32px, 5vw, 90px);
  max-width: 1280px;
  margin-top: clamp(90px, 15vh, 170px);
}

.shelf-block__text {
  padding-bottom: 60px;
}

.shelf-block__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 22px;
  margin-bottom: 30px;
}

.shelf-block__head h3 {
  font-size: clamp(2rem, 3.4vw, 3rem);
  font-weight: 500;
  line-height: 1.05;
}

.shelf-block__note {
  max-width: 36em;
  margin-bottom: 26px;
  color: var(--muted);
}

.shelf-wrap {
  --shelf-h: clamp(170px, 21vw, 300px);
  width: fit-content;
  max-width: 100%;
}

.shelf {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: clamp(4px, 0.8vw, 10px);
  min-height: calc(var(--shelf-h) * 1.06 + 30px);
  margin: 0;
  padding: 30px clamp(18px, 4vw, 64px) 0;
  list-style: none;
}

.shelf__plank {
  position: relative;
  height: 16px;
  border-radius: 2px;
  background: linear-gradient(#b0916c, #8a6c4d 55%, #6f553c);
  box-shadow: 0 22px 34px -16px rgba(31, 26, 23, 0.55);
  transform-origin: left center;
}

.shelf__years {
  display: flex;
  gap: clamp(4px, 0.8vw, 10px);
  margin: 0;
  padding: 14px clamp(18px, 4vw, 64px) 0;
  list-style: none;
}

.shelf__years li {
  flex: none;
  width: calc(var(--shelf-h) * var(--wr, 0.17));
  font-size: 1rem;
  font-style: italic;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
  color: var(--muted);
}

.spine {
  --sw: calc(var(--shelf-h) * var(--wr, 0.17));
  --sh: calc(var(--shelf-h) * var(--hr, 1));
  --spine-bg: #3c2f28;
  --spine-fg: #f6efe5;
  position: relative;
  flex: none;
  width: var(--sw);
}

.spine__link {
  display: block;
  color: inherit;
  text-decoration: none;
  perspective: 900px;
  outline-offset: 6px;
}

.spine__obj {
  position: relative;
  display: block;
  width: var(--sw);
  height: var(--sh);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  transition: transform 0.8s var(--ease);
}

.spine__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2px 2px 1px 1px;
  background: var(--spine-bg);
  color: var(--spine-fg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.spine__face::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.3), rgba(255, 255, 255, 0.12) 42%, rgba(0, 0, 0, 0.25)),
    linear-gradient(to bottom, transparent 7%, rgba(255, 255, 255, 0.16) 7% 8%, transparent 8% 92%, rgba(255, 255, 255, 0.16) 92% 93%, transparent 93%);
}

.spine__face .spine__text {
  font-size: clamp(9px, calc(var(--sw) * 0.3), 13px);
}

.spine__cover {
  position: absolute;
  top: 0;
  right: 100%;
  width: calc(var(--sh) * var(--ar, 0.64));
  height: 100%;
  overflow: hidden;
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.spine__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.spine__link:hover .spine__obj,
.spine__link:focus-visible .spine__obj {
  transform: translateY(-16px) translateZ(40px) rotateY(58deg);
}

/* --------------------------------------------------------------------------
   Livres : la bibliothèque de nuit
   -------------------------------------------------------------------------- */
.library {
  position: relative;
  color: var(--on-night);
}

.library__ink {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 210vh;
  overflow: hidden;
  background: var(--night);
  pointer-events: none;
}

/* Avec les animations : la nuit tombe comme une tache d'encre qui s'étale.
   Le disque est agrandi (transformation peu coûteuse) ; son bord doux
   reste beau même agrandi. */
.library__ink i {
  display: none;
}

html.motion .library__ink {
  background: transparent;
}

html.motion .library__ink i {
  position: absolute;
  top: 0;
  left: 50%;
  display: block;
  width: 44vmax;
  height: 44vmax;
  margin: -22vmax 0 0 -22vmax;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--night) 94%, rgba(21, 17, 14, 0));
  transform: scale(0);
  will-change: transform;
}

.library .pin-spacer {
  background: var(--night);
}

.library__head {
  position: relative;
  z-index: 1;
  padding: clamp(110px, 18vh, 200px) var(--gutter) clamp(30px, 6vh, 70px) var(--mx);
}

.library__head .section__intro {
  color: var(--on-night-muted);
}

.library__head .section__hand {
  color: #9fb3ff;
}

.library__stage {
  position: relative;
  z-index: 1;
  height: 100vh;
  height: 100svh;
  overflow: hidden;
  background: var(--night);
}

.library__light,
.library__dust,
.library__glow,
.library__year {
  position: absolute;
  pointer-events: none;
}

.library__light {
  inset: 0;
  background: radial-gradient(48% 78% at var(--focus-x, 30%) -14%, rgba(255, 233, 200, 0.14), rgba(255, 233, 200, 0) 68%);
  -webkit-mask: linear-gradient(to bottom, transparent, #000 22%);
  mask: linear-gradient(to bottom, transparent, #000 22%);
}

.library__dust {
  inset: 0;
  width: 100%;
  height: 100%;
}

.library__glow {
  top: 54%;
  left: var(--focus-x, 30%);
  width: min(92vh, 64vw);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

.library__glow i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(var(--g, 184, 158, 130), 0.5), rgba(var(--g, 184, 158, 130), 0.14) 48%, rgba(var(--g, 184, 158, 130), 0) 72%);
  opacity: 0;
}

.library__year {
  right: -0.6vw;
  bottom: 9vh;
  overflow: hidden;
  font-size: clamp(8rem, 23vw, 23rem);
  font-weight: 500;
  line-height: 0.8;
  letter-spacing: -0.045em;
  font-variant-numeric: lining-nums;
  color: transparent;
  -webkit-text-stroke: 1px rgba(243, 234, 223, 0.13);
}

.library__year span {
  display: block;
  padding: 0.04em 0;
}

.library__books {
  position: absolute;
  inset: 0;
}

.lib-book {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(24px, 4vw, 70px);
  padding: var(--header-h) var(--gutter) 120px var(--mx);
  perspective: 1500px;
  visibility: hidden;
}

.lib-book__object {
  position: relative;
  display: grid;
  place-items: center;
  height: 100%;
  min-height: 0;
  touch-action: pan-y;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.lib-book__object.is-dragging {
  cursor: grabbing;
}

.lib-book__shift {
  position: relative;
  display: block;
}

.lib-book__float {
  position: relative;
  z-index: 1;
  display: block;
  perspective: 1700px;
}

.book3d--lib {
  --h: clamp(270px, min(56vh, 33vw), 470px);
  --rx: -6;
  --ry: 28;
}

.book-shadow {
  position: absolute;
  left: 50%;
  bottom: -46px;
  width: 150%;
  height: 46px;
  margin-left: -75%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0));
  pointer-events: none;
  transition: width 1.2s var(--ease), margin-left 1.2s var(--ease);
}

.lib-book.is-open .book-shadow {
  width: 290%;
  margin-left: -195%;
}

/* Le livre présenté flotte doucement (animation jouée par la carte graphique) */
@keyframes lib-float {
  to { transform: translateY(-16px) rotate(0.7deg); }
}

@keyframes lib-shadow {
  to { transform: scale(0.8); opacity: 0.55; }
}

html.motion .lib-book.is-floating .lib-book__float {
  animation: lib-float 2.8s ease-in-out infinite alternate;
}

html.motion .lib-book.is-floating .book-shadow {
  animation: lib-shadow 2.8s ease-in-out infinite alternate;
}

.lib-book__info {
  position: relative;
  max-width: 32rem;
}

.lib-book__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 1.12rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  color: var(--on-night-muted);
}

.lib-book__meta i {
  display: block;
  width: 34px;
  height: 1px;
  background: currentColor;
}

.lib-book__title {
  margin: 0.24em 0 0.42em;
  font-size: clamp(2.5rem, 4.9vw, 4.7rem);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: -0.018em;
}

.lib-book__desc {
  max-width: 29em;
  margin-bottom: 1.15em;
  font-size: 1.32rem;
  font-style: italic;
  line-height: 1.5;
  color: rgba(243, 234, 223, 0.84);
}

.rating {
  margin-bottom: 1.8em;
  font-size: 1.06rem;
  color: var(--on-night-muted);
}

.rating__main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.rating__value {
  font-variant-numeric: lining-nums;
  color: var(--on-night);
}

.rating__sources {
  margin-top: 5px;
  font-size: 0.96rem;
  font-variant-numeric: lining-nums;
}

.rating__sources a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(243, 234, 223, 0.28);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.35s ease, text-decoration-color 0.35s ease;
}

.rating__sources a:hover,
.rating__sources a:focus-visible {
  color: var(--on-night);
  text-decoration-color: currentColor;
}

.rating__sources span span,
.rating__sources a span {
  opacity: 0.85; /* contraste suffisant sur le fond nuit (WCAG AA) */
}

.rating__sep {
  margin: 0 0.55em;
  opacity: 0.45;
}

.stars {
  position: relative;
  display: inline-block;
  font-size: 1.12rem;
  line-height: 1;
  letter-spacing: 0.14em;
  color: rgba(243, 234, 223, 0.2);
  white-space: nowrap;
}

.stars__fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  overflow: hidden;
  color: var(--gold);
}

.lib-book__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

/* Lien vers la page du livre (résumé, fiche complète) */
.lib-book__page {
  display: inline-block;
  margin-top: 18px;
  font-size: 1.08rem;
  font-style: italic;
  color: var(--on-night-muted);
  text-decoration: underline;
  text-decoration-color: rgba(243, 234, 223, 0.3);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: color 0.35s ease, text-decoration-color 0.35s ease;
}

.lib-book__page:hover,
.lib-book__page:focus-visible {
  color: var(--on-night);
  text-decoration-color: currentColor;
}

.library .btn {
  border-color: rgba(243, 234, 223, 0.42);
  color: var(--on-night);
}

.library .btn::before {
  background: var(--on-night);
}

.library .btn:hover,
.library .btn:focus-visible {
  border-color: var(--on-night);
  color: var(--night);
}

.library .btn--ink {
  border-color: var(--on-night);
  background: var(--on-night);
  color: var(--night);
}

.library .btn--ink::before {
  background: var(--gold);
}

.library .btn--ink:hover,
.library .btn--ink:focus-visible {
  border-color: var(--gold);
}

.library__nav {
  position: absolute;
  left: var(--mx);
  right: var(--gutter);
  bottom: 34px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 16px;
}

.lib-arrow {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  padding: 0;
  border: 1px solid rgba(243, 234, 223, 0.32);
  border-radius: 50%;
  background: transparent;
  color: var(--on-night);
  cursor: pointer;
  transition: background-color 0.4s var(--ease), color 0.4s var(--ease), border-color 0.4s var(--ease);
}

.lib-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lib-arrow:hover,
.lib-arrow:focus-visible {
  border-color: var(--on-night);
  background: var(--on-night);
  color: var(--night);
}

.lib-arrow:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.library__count {
  display: flex;
  align-items: baseline;
  gap: 0.3em;
  min-width: 4.6em;
  font-size: 1.2rem;
  font-variant-numeric: lining-nums tabular-nums;
  color: var(--on-night-muted);
}

.library__count .cur-wrap {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}

.library__count .cur {
  display: inline-block;
  color: var(--on-night);
}

.library__mini {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 64px;
  margin: 0 0 0 auto;
  padding: 0;
  list-style: none;
}

/* les petits dos de livres : plus grands, avec le titre au survol */
.mini {
  position: relative;
  display: block;
  width: 18px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 2px 2px 1px 1px;
  background:
    linear-gradient(to bottom, transparent 10%, rgba(226, 182, 95, 0.55) 10% 13%, transparent 13% 87%, rgba(226, 182, 95, 0.55) 87% 90%, transparent 90%),
    var(--spine-bg, var(--kraft));
  box-shadow: inset 2px 0 3px rgba(0, 0, 0, 0.3), inset -2px 0 3px rgba(0, 0, 0, 0.25);
  opacity: 0.5;
  cursor: pointer;
  transition: height 0.6s var(--ease), opacity 0.4s ease, transform 0.4s var(--ease);
}

.mini:hover,
.mini:focus-visible {
  opacity: 0.9;
  transform: translateY(-4px);
}

.mini.is-active {
  height: 58px;
  opacity: 1;
}

.mini::after {
  content: attr(data-title);
  position: absolute;
  bottom: calc(100% + 12px);
  left: 50%;
  padding: 4px 11px 5px;
  border-radius: 3px;
  background: var(--on-night);
  color: var(--night);
  font-size: 0.98rem;
  font-style: italic;
  line-height: 1.3;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 6px);
  transition: opacity 0.3s ease, transform 0.4s var(--ease);
}

.library__mini li:nth-last-child(-n + 3) .mini::after {
  left: auto;
  right: -4px;
  transform: translate(0, 6px);
}

.mini:hover::after,
.mini:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.library__mini li:nth-last-child(-n + 3) .mini:hover::after,
.library__mini li:nth-last-child(-n + 3) .mini:focus-visible::after {
  transform: translate(0, 0);
}

.library__hint {
  position: absolute;
  left: 25%;
  bottom: 104px;
  z-index: 3;
  font-family: var(--hand);
  font-weight: 300;
  font-size: 0.95rem;
  line-height: 1.8;
  text-align: center;
  color: #9fb3ff;
  transform: translateX(-50%) rotate(-2deg);
  pointer-events: none;
}

.library__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 4;
  height: 2px;
  background: rgba(243, 234, 223, 0.08);
}

.library__progress span {
  display: block;
  height: 100%;
  background: rgba(243, 234, 223, 0.4);
  transform: scaleX(0);
  transform-origin: left center;
}

/* --------------------------------------------------------------------------
   La bibliothèque : tous les livres debout sur l'étagère
   -------------------------------------------------------------------------- */
.bookcase {
  --bh: clamp(190px, 16.5vw, 268px); /* hauteur d'un livre sur le rayon */
  --wood: #5b3d27;
  --wood-hi: #7d5739;
  --wood-lo: #2c1d12;
  position: relative;
  z-index: 1;
  padding: clamp(100px, 16vh, 170px) var(--gutter) clamp(90px, 14vh, 150px) var(--mx);
  overflow: hidden;
  overflow: clip;
  background: var(--night);
}

.bookcase::before {
  /* halo chaud derrière le meuble */
  content: "";
  position: absolute;
  left: 8%;
  top: 30%;
  width: min(900px, 70vw);
  aspect-ratio: 1.6;
  background: radial-gradient(closest-side, rgba(255, 214, 150, 0.08), rgba(255, 214, 150, 0));
  pointer-events: none;
}

.bookcase__head {
  position: relative;
  max-width: 44rem;
  margin-bottom: clamp(44px, 7vh, 70px);
}

.bookcase__hand {
  display: inline-block;
  margin-bottom: 10px;
  color: #9fb3ff;
}

.bookcase__title.section__title {
  margin-bottom: 0.4em;
  font-size: clamp(2.3rem, 4.2vw, 3.9rem);
}

.bookcase__intro {
  max-width: 33em;
  font-size: clamp(1.15rem, 1.4vw, 1.3rem);
  line-height: 1.55;
  color: var(--on-night-muted);
}

.bookcase__room {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(36px, 5vw, 84px);
  max-width: 1320px;
}

/* Le meuble */
.bookcase__cabinet {
  position: relative;
  padding: 14px 14px 40px;
  border-radius: 5px 5px 3px 3px;
  background:
    repeating-linear-gradient(92deg, rgba(0, 0, 0, 0) 0 9px, rgba(0, 0, 0, 0.06) 9px 11px, rgba(255, 230, 200, 0.03) 11px 17px),
    linear-gradient(90deg, var(--wood-lo), var(--wood) 5%, var(--wood-hi) 50%, var(--wood) 95%, var(--wood-lo));
  box-shadow:
    0 60px 90px -40px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 220, 180, 0.2);
}

.bookcase__cabinet::before {
  /* corniche */
  content: "";
  position: absolute;
  left: -12px;
  right: -12px;
  top: -16px;
  height: 18px;
  border-radius: 4px 4px 2px 2px;
  background: linear-gradient(#946846, #634229 55%, #3b281a);
  box-shadow: 0 8px 14px -8px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 225, 190, 0.25);
}

.bookcase__cabinet::after {
  /* socle */
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  bottom: -14px;
  height: 16px;
  border-radius: 0 0 3px 3px;
  background: linear-gradient(#4b3322, #24170e);
}

.bookcase__cell {
  position: relative;
  border-radius: 2px;
  background:
    linear-gradient(to bottom, rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0) 24%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.016) 0 3px, rgba(0, 0, 0, 0.035) 3px 8px),
    #23170e;
  box-shadow: inset 10px 0 16px -10px rgba(0, 0, 0, 0.85), inset -10px 0 16px -10px rgba(0, 0, 0, 0.85);
}

.bookcase__cell + .bookcase__cell {
  margin-top: 16px;
}

.bookcase__cell::after {
  /* chant de la tablette, sous chaque case */
  content: "";
  position: absolute;
  left: -2px;
  right: -2px;
  bottom: -16px;
  height: 16px;
  background: linear-gradient(#93694a, #6b4a30 60%, #4a3220);
  box-shadow: inset 0 1px 0 rgba(255, 228, 196, 0.28), 0 8px 12px -6px rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.bookcase__cell--top {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: calc(var(--bh) * 0.66);
  padding: 0 7%;
}

.bookcase__cell--books {
  height: calc(var(--bh) * 1.17);
  padding: 0 5%;
}

/* Décor : portrait encadré, cahiers, encrier */
.bc-frame {
  display: block;
  width: calc(var(--bh) * 0.36);
  padding: calc(var(--bh) * 0.026);
  background: linear-gradient(135deg, #c39556, #7a5530 45%, #b0814a);
  box-shadow: 0 14px 20px -10px rgba(0, 0, 0, 0.9), inset 0 0 0 1px rgba(255, 232, 196, 0.3);
  transform: rotate(-4deg);
  transform-origin: 50% 100%;
}

.bc-frame img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 528;
  object-fit: cover;
  filter: sepia(0.22) brightness(0.92);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.4);
}

.bc-stack {
  display: grid;
  width: calc(var(--bh) * 0.48);
}

.bc-stack i {
  display: block;
  height: calc(var(--bh) * 0.055);
  border-radius: 2px 3px 3px 2px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.25), rgba(255, 255, 255, 0.1) 8%, rgba(0, 0, 0, 0) 14%),
    var(--c, #7c3f24);
  box-shadow: 0 2px 3px rgba(0, 0, 0, 0.5);
}

.bc-stack i:nth-child(1) {
  --c: #355d7a;
  width: 88%;
  margin-left: 9%;
}

.bc-stack i:nth-child(2) {
  --c: #b89e82;
  width: 96%;
}

.bc-stack i:nth-child(3) {
  --c: #7c3f24;
  width: 100%;
  margin-left: 2%;
}

.bc-ink {
  width: calc(var(--bh) * 0.3);
  height: auto;
  overflow: visible;
}

.bc-ink__quill {
  fill: #eee4d4;
}

.bc-ink__rib {
  fill: none;
  stroke: #b9a88f;
  stroke-width: 1.2;
}

.bc-ink__neck {
  fill: #31465f;
}

.bc-ink__jar {
  fill: #1c2a3b;
}

.bc-ink__shine {
  fill: rgba(255, 255, 255, 0.16);
}

/* Les livres debout */
.bookcase__books {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: clamp(3px, 0.4vw, 6px);
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.bookcase__books::after {
  /* serre-livres en laiton */
  content: "";
  flex: none;
  width: calc(var(--bh) * 0.045);
  height: calc(var(--bh) * 0.52);
  margin-left: calc(var(--bh) * 0.03);
  border-radius: 2px 2px 0 0;
  background: linear-gradient(90deg, #8a6838, #e0bd78 45%, #7d5d31);
  box-shadow: -4px 0 8px -2px rgba(0, 0, 0, 0.6);
  translate: var(--end-shift, 0px) 0;
  transition: translate 0.85s var(--ease);
}

.bc-item {
  --bw: calc(var(--bh) * var(--wr, 0.17));
  --bhh: calc(var(--bh) * var(--hr, 0.96));
  --spine-bg: #3c2f28;
  --spine-fg: #f6efe5;
  position: relative;
  flex: none;
  width: var(--bw);
  /* les voisins s'écartent du livre choisi (décalage calculé par motion.js) */
  transition: translate 0.85s var(--ease);
}

.bc-item::after {
  /* ombre du livre sur la tablette */
  content: "";
  position: absolute;
  left: -12%;
  right: -12%;
  bottom: -3px;
  height: 8px;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0));
  pointer-events: none;
}

.bc-item.is-active {
  z-index: 2;
}

/* le premier livre de la rangée est penché contre son voisin */
.bc-item:first-child {
  margin-right: calc(var(--bh) * 0.045);
}

.bc-book {
  position: relative;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
  perspective: 1000px;
  outline-offset: 6px;
  transform-origin: 100% 100%;
  transition: transform 0.7s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.bc-item:first-child .bc-book {
  transform: rotate(5deg);
}

.bc-item.is-active:first-child .bc-book,
.bc-item:first-child .bc-book:hover {
  transform: none;
}

.bc-book__obj {
  position: relative;
  display: block;
  width: var(--bw);
  height: var(--bhh);
  transform-origin: 50% 100%;
  transform-style: preserve-3d;
  transition: transform 0.85s var(--ease);
}

.bc-book__spine {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 2px 2px 1px 1px;
  background: var(--spine-bg);
  color: var(--spine-fg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bc-book__spine::before {
  /* arrondi du dos et filets dorés */
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.34), rgba(255, 255, 255, 0.13) 42%, rgba(0, 0, 0, 0.28)),
    linear-gradient(to bottom, transparent 6%, rgba(226, 182, 95, 0.6) 6% 6.7%, transparent 6.7% 8.1%, rgba(226, 182, 95, 0.6) 8.1% 8.8%, transparent 8.8% 91.2%, rgba(226, 182, 95, 0.6) 91.2% 91.9%, transparent 91.9% 93.3%, rgba(226, 182, 95, 0.6) 93.3% 94%, transparent 94%);
}

.bc-book__spine .spine__text {
  font-size: clamp(9px, calc(var(--bw) * 0.3), 14px);
}

.bc-book__cover {
  position: absolute;
  top: 0;
  right: 100%;
  width: calc(var(--bhh) * var(--ar, 0.64));
  height: 100%;
  overflow: hidden;
  border-radius: 1px 3px 3px 1px;
  background: var(--spine-bg);
  transform-origin: 100% 50%;
  transform: rotateY(-90deg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.bc-book__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* les livres de la moitié gauche montrent leur couverture vers la droite
   (elle s'ouvre toujours vers le centre de l'étagère) */
.bc-item.is-right .bc-book__cover {
  left: 100%;
  right: auto;
  transform-origin: 0% 50%;
  transform: rotateY(90deg);
}

/* au survol, le livre se soulève et laisse deviner sa couverture */
.bc-book:hover .bc-book__obj,
.bc-book:focus-visible .bc-book__obj {
  transform: translateY(-12px) rotateY(16deg);
}

.bc-item.is-right .bc-book:hover .bc-book__obj,
.bc-item.is-right .bc-book:focus-visible .bc-book__obj {
  transform: translateY(-12px) rotateY(-16deg);
}

/* le livre choisi sort du rayon et pivote pour montrer sa couverture */
.bc-item.is-active .bc-book__obj,
.bc-item.is-active .bc-book:hover .bc-book__obj,
.bc-item.is-active .bc-book:focus-visible .bc-book__obj {
  transform: translateY(-20px) translateZ(70px) rotateY(62deg);
}

.bc-item.is-right.is-active .bc-book__obj,
.bc-item.is-right.is-active .bc-book:hover .bc-book__obj,
.bc-item.is-right.is-active .bc-book:focus-visible .bc-book__obj {
  transform: translateY(-20px) translateZ(70px) rotateY(-62deg);
}

html .bookcase.is-arriving .bc-item.is-active .bc-book .bc-book__obj {
  transform: none;
}

/* La lampe : la lumière suit le livre choisi, le reste du rayon dans la pénombre */
.bookcase__light {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 2px;
  pointer-events: none;
}

.bookcase__lamp {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 0;
}

html.motion .bookcase__lamp {
  will-change: transform;
}

html:not(.motion) .bookcase__lamp {
  transition: transform 0.9s var(--ease);
}

.bookcase__lamp::before {
  content: "";
  position: absolute;
  top: -35%;
  bottom: -5%;
  left: calc(var(--bh) * -0.95);
  width: calc(var(--bh) * 1.9);
  background: radial-gradient(closest-side, rgba(255, 222, 166, 0.24), rgba(255, 222, 166, 0.08) 52%, rgba(255, 222, 166, 0));
}

.bookcase__lamp::after {
  content: "";
  position: absolute;
  top: -10%;
  bottom: -10%;
  left: -1100px;
  width: 2200px;
  background: radial-gradient(calc(var(--bh) * 0.8) 115% at 50% 58%, rgba(9, 6, 4, 0) 38%, rgba(9, 6, 4, 0.5) 100%);
}

.bookcase__plate {
  position: absolute;
  left: 50%;
  bottom: 9px;
  padding: 2px 14px 3px;
  border-radius: 2px;
  background: linear-gradient(#e6c47f, #b48a48 55%, #8f6a32);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 245, 220, 0.6);
  color: #3a2814;
  font-size: 0.8rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  line-height: 1.3;
  white-space: nowrap;
  transform: translateX(-50%);
}

/* Navigation sous le meuble */
.bookcase__nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
  margin-top: 38px;
}

.bookcase__nav .lib-arrow[aria-disabled="true"] {
  opacity: 0.3;
  cursor: default;
}

.bookcase__count {
  min-width: 3.6em;
  font-size: 1.2rem;
  font-variant-numeric: lining-nums tabular-nums;
  text-align: center;
  color: var(--on-night-muted);
}

.bookcase__count .cur {
  color: var(--on-night);
}

.bookcase__tip {
  font-family: var(--hand);
  font-weight: 300;
  font-size: 0.9rem;
  line-height: 1.8;
  color: #9fb3ff;
}

.bookcase__tip--touch {
  display: none;
}

@media (hover: none), (pointer: coarse) {
  .bookcase__tip--keys {
    display: none;
  }

  .bookcase__tip--touch {
    display: inline;
  }
}

/* La fiche du livre choisi */
.bookcase__detail {
  position: relative;
  min-height: calc(var(--bh) * 1.45);
  touch-action: pan-y;
}

.bc-detail__inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 2.4vw, 36px);
}

.bc-detail__cover {
  width: clamp(112px, 10vw, 158px);
  aspect-ratio: var(--ar, 0.64);
  overflow: hidden;
  border-radius: 2px 4px 4px 2px;
  background: var(--spine-bg, #3c2f28);
  box-shadow: 0 30px 44px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.bc-detail__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bc-detail__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.05rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  color: var(--on-night-muted);
}

.bc-detail__meta i {
  display: block;
  width: 28px;
  height: 1px;
  background: currentColor;
}

.bc-detail__title {
  margin: 0.2em 0 0.38em;
  font-size: clamp(1.9rem, 2.7vw, 2.7rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.012em;
}

.bc-detail__text {
  display: -webkit-box;
  max-width: 30em;
  margin-bottom: 0.9em;
  overflow: hidden;
  font-size: 1.13rem;
  line-height: 1.5;
  color: rgba(243, 234, 223, 0.84);
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}

.bc-detail__rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin-bottom: 1.3em;
  font-size: 1rem;
  font-variant-numeric: lining-nums;
  color: var(--on-night-muted);
}

.bc-detail__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.bc-detail__actions .btn {
  min-height: 50px;
  padding: 0 1.3em;
  font-size: 1.08rem;
}

/* Sans JavaScript : les livres sont de simples liens vers leurs pages */
html.no-js .bookcase__nav,
html.no-js .bookcase__light {
  display: none;
}

/* --------------------------------------------------------------------------
   Pied de page
   -------------------------------------------------------------------------- */
.site-footer {
  position: relative;
  padding: clamp(100px, 16vh, 180px) var(--gutter) 36px var(--mx);
  background: var(--night);
  color: var(--on-night);
}

.footer__hand {
  display: inline-block;
  margin-bottom: clamp(40px, 8vh, 90px);
  font-family: var(--hand);
  font-weight: 300;
  font-size: clamp(2.8rem, 9vw, 8.4rem);
  line-height: 1.5;
  color: #9fb3ff;
}

.footer__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) repeat(2, minmax(0, 1fr));
  gap: 36px;
  max-width: 1180px;
  padding-top: 40px;
  border-top: 1px solid var(--line-night);
}

.footer__name {
  font-size: 1.6rem;
  font-weight: 500;
  line-height: 1.2;
}

.footer__role {
  font-style: italic;
  color: var(--on-night-muted);
}

.footer__nav ul,
.footer__social {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__social .link {
  font-size: 1.15rem;
}

.footer__social .link__icon {
  width: 38px;
  height: 38px;
  border-color: var(--line-night);
}

.footer__social .link:hover .link__icon,
.footer__social .link:focus-visible .link__icon {
  border-color: var(--on-night);
  background-color: var(--on-night);
  color: var(--night);
}

/* Liste des livres (liens vers leurs pages) */
.footer__books {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 22px;
  max-width: 1180px;
  margin-top: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--line-night);
}

.footer__label {
  font-size: 1.04rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.12em;
  color: var(--on-night-muted);
}

.footer__books ul {
  display: flex;
  flex-wrap: wrap;
  row-gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer__books li + li::before {
  content: "·";
  margin: 0 0.65em;
  color: var(--on-night-muted);
}

.footer__books a,
.footer__legal a {
  font-style: italic;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  transition: text-decoration-color 0.35s ease, color 0.35s ease;
}

.footer__books a:hover,
.footer__books a:focus-visible,
.footer__legal a:hover,
.footer__legal a:focus-visible {
  text-decoration-color: currentColor;
}

.footer__legal a {
  color: var(--on-night);
}

.footer__bottom {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  max-width: 1180px;
  margin-top: clamp(60px, 10vh, 110px);
  font-size: 1.05rem;
  color: var(--on-night-muted);
}

.footer__credit {
  font-family: var(--hand);
  font-weight: 300;
  font-size: 0.98rem;
  color: var(--on-night);
}

.smile {
  display: inline-block;
  transition: transform 0.6s var(--ease);
}

.footer__credit:hover .smile {
  transform: rotate(90deg) scale(1.25);
}

.to-top {
  position: relative;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--on-night);
  cursor: pointer;
}

.to-top .ring-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.to-top circle {
  fill: none;
  stroke-width: 1.4;
}

.to-top .ring-bg {
  stroke: var(--line-night);
}

.to-top .ring {
  stroke: var(--on-night);
  stroke-dasharray: 163.4;
  stroke-dashoffset: calc(163.4 - 163.4 * var(--progress, 0));
}

.to-top .arrow {
  position: relative;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.5s var(--ease);
}

.to-top:hover .arrow {
  transform: translateY(-4px);
}

/* Étiquette qui suit la souris sur les livres */
.cursor-label {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--paper-hi);
  color: var(--ink);
  font-size: 1.05rem;
  font-style: italic;
  line-height: 1.1;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.45);
}

/* --------------------------------------------------------------------------
   Version sans animation (mouvement réduit, ou si les scripts d'animation
   ne chargent pas) : tout reste lisible et utilisable
   -------------------------------------------------------------------------- */
html:not(.motion) .library__stage {
  height: auto;
  overflow: visible;
}

html:not(.motion) .library__books {
  position: static;
  display: grid;
  gap: clamp(60px, 10vh, 110px);
  padding: 40px 0 120px;
}

html:not(.motion) .lib-book {
  position: relative;
  inset: auto;
  padding: 0 var(--gutter) 0 var(--mx);
  visibility: visible;
}

html:not(.motion) .lib-book__object {
  height: auto;
  padding: 40px 0 70px;
  cursor: pointer;
}

html:not(.motion) .library__nav,
html:not(.motion) .library__hint,
html:not(.motion) .library__progress,
html:not(.motion) .library__year,
html:not(.motion) .library__glow,
html:not(.motion) .library__dust,
html:not(.motion) .library__light {
  display: none;
}

html:not(.motion) .book3d {
  transition: --ry 0.9s var(--ease), --rx 0.9s var(--ease), --open 1.2s var(--ease);
}

/* Sans JavaScript : le bouton « Ouvrir le livre » ne servirait à rien,
   et l'en-tête reste en haut de page (il ne peut pas changer de couleur la nuit) */
html.no-js .js-open {
  display: none;
}

html.no-js .site-header {
  position: absolute;
}

/* --------------------------------------------------------------------------
   Passage d'une page à l'autre (Chrome, Edge, Safari récents ; ailleurs,
   la page change simplement comme avant) : l'ancienne page s'efface en
   montant, la nouvelle arrive ; le nom reste en place, la couverture du
   livre choisi vole jusqu'à sa page.
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  @view-transition {
    navigation: auto;
  }
}

::view-transition-old(root) {
  animation: vt-out 0.3s cubic-bezier(0.4, 0, 1, 1) both;
}

::view-transition-new(root) {
  animation: vt-in 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

::view-transition-group(livre-cover) {
  animation-duration: 0.8s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

::view-transition-group(marque) {
  animation-duration: 0.6s;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes vt-out {
  to {
    opacity: 0;
    transform: translateY(-12px);
  }
}

@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
}

.brand {
  view-transition-name: marque;
}

html:not(.motion) .lib-book.is-open .book3d {
  --open: -158;
  --ry: 4;
}

html:not(.motion) .lib-book.is-open .lib-book__shift {
  transform: translateX(calc(var(--open-shift, 140px)));
  transition: transform 1.2s var(--ease);
}

html:not(.motion) .lib-book__shift {
  transition: transform 1.2s var(--ease);
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1180px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 40px;
    padding-bottom: 14vh;
  }

  .hero__visual {
    width: min(100%, 680px);
    height: clamp(430px, 92vw, 640px);
    min-height: 0;
  }

  .hero__portrait {
    width: min(46%, 320px);
  }

  .hand--portrait {
    left: calc(min(46%, 320px) + 10%);
  }

  .book3d--feat {
    --h: clamp(130px, 25vw, 240px);
  }

  .hero__scroll {
    display: none;
  }

  .about__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .about__portrait {
    width: min(78%, 440px);
  }

  .shelf-block {
    grid-template-columns: minmax(0, 1fr);
  }

  .shelf-block__text {
    padding-bottom: 0;
  }

  /* Bibliothèque : le meuble en grand, la fiche du livre en dessous */
  .bookcase {
    --bh: clamp(190px, 25vw, 250px);
  }

  .bookcase__room {
    grid-template-columns: minmax(0, 1fr);
    gap: 40px;
  }

  .bookcase__left {
    width: min(100%, 760px);
  }

  .bookcase__detail {
    max-width: 760px;
    min-height: 0;
  }
}

@media (max-width: 860px) {
  .brand {
    gap: 10px;
  }

  .brand__logo {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }

  :root {
    --mx: var(--gutter);
    --header-h: 66px;
  }

  .margin-rule,
  .site-nav,
  .brand__role,
  .library__mini,
  .library__hint {
    display: none;
  }

  .menu-toggle {
    display: inline-flex;
  }

  .hero__title {
    font-size: clamp(3.6rem, 18.5vw, 7rem);
  }

  .hero__line + .hero__line {
    padding-left: 0.35em;
  }

  .about__cols {
    grid-template-columns: minmax(0, 1fr);
  }

  .event {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 30px 0 32px;
  }

  .footer__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .shelf {
    min-height: 230px;
    padding: 30px 10px 0;
  }

  .shelf__years {
    padding: 12px 10px 0;
  }

  .shelf__years li {
    font-size: 0.85rem;
  }

  .spine__face .spine__text span {
    display: none;
  }

  .hero__kicker {
    letter-spacing: 0.06em;
  }

  /* Bibliothèque : livre en haut, texte en bas */
  .lib-book {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    align-items: stretch;
    gap: 6px;
    padding: calc(var(--header-h) + 4px) var(--gutter) 96px;
  }

  .book3d--lib {
    --h: min(31svh, 58vw);
  }

  .book-shadow {
    bottom: -32px;
    height: 32px;
  }

  .lib-book__meta {
    font-size: 1rem;
  }

  .lib-book__title {
    margin: 0.18em 0 0.3em;
    font-size: clamp(2rem, 8.6vw, 2.9rem);
  }

  .lib-book__desc {
    display: -webkit-box;
    margin-bottom: 0.8em;
    overflow: hidden;
    font-size: 1.06rem;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
  }

  .rating {
    margin-bottom: 1em;
    font-size: 0.98rem;
  }

  .rating__sources {
    margin-top: 2px;
    font-size: 0.9rem;
  }

  .lib-book__actions .btn {
    flex: 1 1 auto;
    min-height: 48px;
    padding: 0 1.1em;
    font-size: 1.05rem;
  }

  .lib-book__page {
    margin-top: 12px;
    font-size: 1rem;
  }

  .library__nav {
    left: var(--gutter);
    right: var(--gutter);
    bottom: 22px;
    justify-content: space-between;
  }

  .library__year {
    right: auto;
    left: 50%;
    top: 11vh;
    bottom: auto;
    font-size: 42vw;
    transform: translateX(-50%);
  }

  .library__glow {
    top: 32%;
    width: 110vw;
  }

  /* Bibliothèque : le meuble, puis la fiche du livre en dessous */
  .bookcase {
    --bh: min(37vw, 220px);
  }

  .bookcase__room {
    grid-template-columns: minmax(0, 1fr);
    gap: 34px;
  }

  .bookcase__cabinet {
    padding: 10px 10px 34px;
  }

  .bookcase__cell--books {
    padding: 0 3%;
  }

  .bookcase__cell--top {
    padding: 0 5%;
  }

  .bc-book__spine .spine__text span {
    display: none;
  }

  /* sur petit écran, le livre choisi avance un peu moins (il cache moins ses voisins) */
  .bc-item.is-active .bc-book__obj,
  .bc-item.is-active .bc-book:hover .bc-book__obj,
  .bc-item.is-active .bc-book:focus-visible .bc-book__obj {
    transform: translateY(-14px) translateZ(36px) rotateY(56deg);
  }

  .bc-item.is-right.is-active .bc-book__obj,
  .bc-item.is-right.is-active .bc-book:hover .bc-book__obj,
  .bc-item.is-right.is-active .bc-book:focus-visible .bc-book__obj {
    transform: translateY(-14px) translateZ(36px) rotateY(-56deg);
  }

  .bookcase__nav {
    justify-content: center;
    margin-top: 30px;
  }

  .bookcase__tip {
    flex-basis: 100%;
    text-align: center;
  }

  .bookcase__detail {
    min-height: 0;
  }

  /* couverture et titre côte à côte, puis le texte sur toute la largeur */
  .bc-detail__inner {
    grid-template-columns: 96px minmax(0, 1fr);
    grid-template-areas:
      "cover meta"
      "cover title"
      "text text"
      "rating rating"
      "actions actions";
    gap: 0 18px;
  }

  .bc-detail__body {
    display: contents;
  }

  .bc-detail__cover {
    grid-area: cover;
    width: 96px;
  }

  .bc-detail__meta {
    grid-area: meta;
    align-self: end;
  }

  .bc-detail__title {
    grid-area: title;
    align-self: start;
    font-size: clamp(1.7rem, 7.4vw, 2.2rem);
  }

  .bc-detail__text {
    grid-area: text;
    margin-top: 18px;
    font-size: 1.05rem;
    -webkit-line-clamp: 4;
  }

  .bc-detail__rating {
    grid-area: rating;
  }

  .bc-detail__actions {
    grid-area: actions;
  }

  .bc-detail__actions .btn {
    flex: 1 1 auto;
    min-height: 48px;
    padding: 0 1.1em;
    font-size: 1.04rem;
  }

  html:not(.motion) .lib-book {
    grid-template-rows: auto auto;
  }

  html:not(.motion) .lib-book__desc {
    display: block;
    -webkit-line-clamp: unset;
  }
}

@media (max-width: 860px) and (max-height: 700px) {
  .book3d--lib {
    --h: min(27svh, 52vw);
  }

  .rating {
    display: none;
  }

  html.motion .lib-book__page {
    display: none;
  }
}

@media (max-width: 520px) {
  body {
    font-size: 1.125rem;
  }

  .btn {
    min-height: 50px;
    padding: 0 1.35em;
    font-size: 1.08rem;
  }

  .hero__actions .btn {
    flex: 1 1 auto;
  }

  .hero__visual {
    height: clamp(400px, 112vw, 520px);
  }

  .hero__portrait {
    width: 52%;
  }

  .hand--portrait {
    top: 4%;
    left: 60%;
    width: auto;
    font-size: 0.8rem;
  }

  .hand--books {
    right: 2%;
    bottom: 62%;
    font-size: 0.82rem;
  }

  .book3d--feat {
    --h: clamp(118px, 33vw, 190px);
  }

  .feat--1 {
    left: 0;
  }

  .feat--2 {
    left: 33%;
  }

  .feat--3 {
    left: 64%;
  }

  .section__intro {
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
