:root {
  --bg: #f7f5f0;
  --bg-alt: #edeae2;
  --ink: #1d1b22;
  --muted: #5d5966;
  --line: rgba(29, 27, 34, 0.12);
  --card: #ffffff;
  --iris: linear-gradient(100deg, #3aa8e0, #8c6ff0 30%, #e46bb0 55%, #f0b04c 80%, #4cbf7a);
  --radius: 22px;
  --serif: "Fraunces", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* Thème clair ou sombre : par défaut celui du navigateur (color-scheme: light dark) ;
   le bouton de la barre du haut force data-theme="light" ou "dark" sur <html> et
   garde le choix dans un cookie. Les couleurs sombres passent par light-dark() ;
   les navigateurs qui ne le connaissent pas restent en clair. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
@supports (color: light-dark(#000, #fff)) {
  :root {
    --bg: light-dark(#f7f5f0, #121118);
    --bg-alt: light-dark(#edeae2, #1a1922);
    --ink: light-dark(#1d1b22, #f1eff5);
    --muted: light-dark(#5d5966, #a9a4b5);
    --line: light-dark(rgba(29, 27, 34, 0.12), rgba(241, 239, 245, 0.14));
    --card: light-dark(#ffffff, #1f1e28);
  }
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}

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

a { color: inherit; }

.wrap { width: min(1120px, 100% - 32px); margin-inline: auto; }
.center { text-align: center; }

.skip {
  position: absolute; left: -999px; top: 8px;
  background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 100;
}
.skip:focus { left: 8px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: fixed; inset: 0 0 auto; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px max(16px, (100% - 1120px) / 2);
}
/* Fond flouté sur un pseudo-élément : un backdrop-filter sur la barre elle-même
   enfermerait le menu plein écran (position: fixed) dans la hauteur de la barre. */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 1px 0 var(--line);
  opacity: 0; transition: opacity .3s;
}
.topbar.is-scrolled::before { opacity: 1; }
.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; font: 600 1.05rem var(--serif);
}
.topbar nav { display: flex; align-items: center; gap: clamp(12px, 3vw, 28px); }
.topbar nav a {
  text-decoration: none; font-size: .95rem; color: var(--muted);
  transition: color .2s;
}
.topbar nav a:hover { color: var(--ink); }

/* Menu déroulant des projets */
.menu-projets { position: relative; }
.menu-bouton {
  display: flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none;
  font: inherit; font-size: .95rem; color: var(--muted); cursor: pointer; transition: color .2s;
}
.menu-bouton:hover, .menu-bouton[aria-expanded="true"] { color: var(--ink); }
.menu-fleche { font-size: .7rem; transition: rotate .2s; }
.menu-bouton[aria-expanded="true"] .menu-fleche { rotate: 180deg; }
.menu-panneau {
  position: absolute; right: -12px; top: calc(100% + 12px); min-width: 250px;
  max-height: calc(100dvh - 80px); overflow-y: auto; overscroll-behavior: contain;
  padding: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .25);
  opacity: 0; visibility: hidden; translate: 0 -6px;
  transition: opacity .2s, translate .2s, visibility .2s;
}
/* Pont invisible entre le bouton et la liste pour garder le survol. */
.menu-panneau::before { content: ""; position: absolute; inset: -14px 0 auto; height: 14px; }
.menu-projets.is-open .menu-panneau { opacity: 1; visibility: visible; translate: 0 0; }
.menu-liste { list-style: none; margin: 0; padding: 0; }
.menu-entete { display: none; }
.topbar nav .menu-liste a {
  display: flex; align-items: baseline; gap: 12px; padding: 9px 12px; border-radius: 10px;
  color: var(--ink); white-space: nowrap;
}
.topbar nav .menu-liste a:hover, .topbar nav .menu-liste a:focus-visible {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.menu-num { font-size: .75rem; font-weight: 600; letter-spacing: .08em; color: var(--accent); }

/* Petits écrans : le menu occupe tout l'écran, avec un bouton pour le fermer. */
@media (max-width: 640px) {
  .menu-panneau {
    position: fixed; inset: 0; min-width: 0; max-height: none;
    padding: 14px 16px 24px; border: 0; border-radius: 0; box-shadow: none;
  }
  .menu-panneau::before { content: none; }
  .menu-entete {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 12px; font: 600 1.05rem var(--serif); color: var(--ink);
  }
  .menu-fermer {
    display: grid; place-items: center; width: 40px; height: 40px; padding: 0;
    border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink);
    cursor: pointer;
  }
  .menu-fermer svg { width: 20px; height: 20px; }
  .topbar nav .menu-liste a { padding: 13px 12px; font-size: 1.05rem; white-space: normal; }
  body:has(.menu-projets.is-open) { overflow: hidden; }
}

/* Bouton clair / sombre */
.theme-bouton {
  display: grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted);
  cursor: pointer; transition: color .2s, border-color .2s, rotate .4s;
}
.theme-bouton[hidden] { display: none; }
.theme-bouton:hover { color: var(--ink); border-color: var(--muted); rotate: 20deg; }
.theme-bouton svg { width: 18px; height: 18px; }
.theme-bouton .icone-soleil, .theme-bouton[data-actuel="dark"] .icone-lune { display: none; }
.theme-bouton[data-actuel="dark"] .icone-soleil { display: block; }

/* Petits écrans : le logo seul laisse la place au menu, au bouton de thème et aux langues. */
@media (max-width: 480px) {
  .brand span { display: none; }
}

/* Sélecteur de langue (pages traduites) */
.langues { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.topbar nav .langues a {
  padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; letter-spacing: .06em;
  color: var(--muted); transition: background .2s, color .2s;
}
.topbar nav .langues a:hover { color: var(--ink); }
.topbar nav .langues a[aria-current="page"] { background: var(--ink); color: var(--bg); }

/* ---------- Hero ---------- */
.hero {
  position: relative; min-height: min(100svh, 900px);
  display: grid; align-items: center;
  overflow: hidden;
}
/* Le canvas suit l'écran ; main.js n'y dessine que du haut de page jusqu'au début des insectes. */
#bulles { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.hero-inner { position: relative; padding: 120px 0 80px; pointer-events: none; }
.hero-inner a { pointer-events: auto; }
.kicker {
  margin: 0 0 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase;
  font-size: .8rem; color: var(--muted);
}
h1 {
  margin: 0; font: 800 clamp(2.6rem, 8vw, 5.6rem)/1.02 var(--serif);
  letter-spacing: -0.02em; max-width: 14ch;
}
.iris {
  background: var(--iris); background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: iris 8s ease-in-out infinite alternate;
}
@keyframes iris { to { background-position: 100% 0; } }
.lead { font-size: clamp(1.05rem, 2vw, 1.25rem); color: var(--muted); max-width: 52ch; margin: 24px 0 32px; }

.btn {
  display: inline-block; padding: 14px 26px; border-radius: 999px;
  background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 600;
  transition: transform .2s, box-shadow .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px -10px rgba(140, 111, 240, .6); }
.btn--ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--ink); }

.scroll-hint {
  position: absolute; left: 50%; bottom: 28px; width: 26px; height: 42px;
  margin-left: -13px; border: 2px solid var(--muted); border-radius: 14px;
}
.scroll-hint::after {
  content: ""; position: absolute; left: 50%; top: 8px; width: 4px; height: 8px;
  margin-left: -2px; border-radius: 2px; background: var(--muted);
  animation: scroll 1.8s ease-in-out infinite;
}
@keyframes scroll { 50% { transform: translateY(12px); opacity: .2; } }

/* ---------- Projets ---------- */
.section-title {
  font: 800 clamp(2rem, 5vw, 3.2rem)/1.1 var(--serif); margin: 0 0 8px; letter-spacing: -0.01em;
}
.projets { padding: 96px 0 40px; }
.projets .section-title { margin-bottom: 48px; }

.projet {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: clamp(28px, 5vw, 72px);
  align-items: center; margin-bottom: clamp(72px, 10vw, 128px);
  scroll-margin-top: 80px;
}
.projet--inverse .projet-media { order: 2; }

.projet-media {
  position: relative; border-radius: var(--radius); aspect-ratio: 4 / 3;
  background: var(--bg-alt);
  box-shadow: 0 30px 60px -30px color-mix(in srgb, var(--accent) 70%, transparent);
  transform: perspective(900px) rotateX(var(--rx, 0deg)) rotateY(var(--ry, 0deg));
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
  will-change: transform;
}
.projet-media > img:first-child {
  width: 100%; height: 100%; object-fit: cover; border-radius: inherit;
}
.projet-media--entier > img:first-child { object-fit: contain; }
.projet-media::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: radial-gradient(circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .25), transparent 45%);
  opacity: 0; transition: opacity .3s;
}
.projet-media:hover::after { opacity: 1; }
.projet-logo {
  position: absolute; right: -14px; bottom: -14px; width: 72px; height: 72px;
  border-radius: 50%; background: #fff; padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}

.projet-num {
  display: flex; align-items: center; gap: 14px; margin: 0 0 6px;
  font: 600 .9rem var(--sans); color: var(--accent); letter-spacing: .08em;
}
.statut {
  font-size: .75rem; font-weight: 600; letter-spacing: .04em;
  padding: 3px 10px; border-radius: 999px;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
}
.projet h3 { font: 800 clamp(1.8rem, 4vw, 2.6rem)/1.1 var(--serif); margin: 0 0 8px; }
.accroche { font: italic 400 1.2rem/1.4 var(--serif); margin: 0 0 16px; color: var(--muted); }
.tags { list-style: none; padding: 0; margin: 20px 0 24px; display: flex; flex-wrap: wrap; gap: 8px; }
.tags li {
  font-size: .8rem; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted);
}
.lien {
  display: inline-flex; gap: 6px; font-weight: 600; text-decoration: none;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat;
  padding-bottom: 2px; transition: background-size .3s;
}
.lien:hover { background-size: 100% 2px; }
.lien--bientot { color: var(--muted); font-weight: 500; }

/* ---------- Mosaïque de photos (projet Photographie) ---------- */
.galerie {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin: calc(clamp(72px, 10vw, 128px) * -0.5) 0 clamp(48px, 6vw, 80px);
}
.galerie-item { overflow: hidden; border-radius: 12px; aspect-ratio: 3 / 2; }
.galerie-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1), filter .4s;
  filter: saturate(.85);
}
.galerie-item:hover img { transform: scale(1.07); filter: saturate(1.1); }
.galerie { grid-auto-flow: dense; }
/* 2 grandes + 2 larges + 8 petites = 20 cases : la grille de 4 colonnes est pleine. */
.galerie-item:nth-child(1), .galerie-item:nth-child(8) { grid-column: span 2; grid-row: span 2; }
.galerie-item:nth-child(11), .galerie-item:nth-child(12) { grid-column: span 2; aspect-ratio: 3 / 1; }

/* ---------- Pied de page ---------- */
.footer { padding: 72px 0 48px; border-top: 1px solid var(--line); }
.footer-title { font: 800 clamp(1.5rem, 3vw, 2rem) var(--serif); margin: 0 0 8px; }
.footer p { color: var(--muted); }
.footer a { color: var(--ink); }
.small { font-size: .85rem; margin-top: 32px; }

/* ---------- Apparition au défilement ---------- */
.js .reveal {
  opacity: 0; transform: translateY(28px);
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
  transition-delay: calc(var(--d, 0) * 90ms);
}
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Page 404 ---------- */
.page-404 { min-height: 80svh; display: grid; place-content: center; text-align: center; padding: 120px 16px; }
.page-404 h1 { max-width: none; }

/* ---------- Petits écrans ---------- */
@media (max-width: 760px) {
  .projet { grid-template-columns: 1fr; }
  .projet--inverse .projet-media { order: 0; }
  .projet-logo { right: 12px; bottom: -20px; width: 60px; height: 60px; }
  .galerie { grid-template-columns: repeat(2, 1fr); }
  .galerie-item:nth-child(8), .galerie-item:nth-child(12) { grid-column: auto; grid-row: auto; aspect-ratio: 3 / 2; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Galerie d'un projet (insectes) ---------- */
.galerie-projet {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: calc(clamp(72px, 10vw, 128px) * -0.5) 0 clamp(72px, 10vw, 128px);
}
.galerie-projet-item {
  overflow: hidden; border-radius: 14px; aspect-ratio: 4 / 3; cursor: zoom-in;
  box-shadow: 0 20px 40px -28px color-mix(in srgb, var(--accent) 80%, transparent);
}
.galerie-projet-item.is-portrait { grid-row: span 2; aspect-ratio: auto; }
.galerie-projet-item img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .6s cubic-bezier(.2, .8, .2, 1);
}
.galerie-projet-item:hover img { transform: scale(1.06); }

/* ---------- Visionneuse ---------- */
.visionneuse {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0; background: transparent;
}
.visionneuse[open] { display: grid; place-items: center; }
.visionneuse::backdrop { background: rgba(10, 9, 14, .92); }
.visionneuse img { max-width: 94vw; max-height: 90vh; object-fit: contain; border-radius: 8px; }
.visionneuse-btn {
  position: absolute; width: 48px; height: 48px; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .12); color: #fff; font: 400 2rem/1 var(--sans); cursor: pointer;
}
.visionneuse-btn:hover { background: rgba(255, 255, 255, .25); }
.visionneuse-fermer { top: 16px; right: 16px; }
.visionneuse-prec { left: 16px; top: calc(50% - 24px); }
.visionneuse-suiv { right: 16px; top: calc(50% - 24px); }

/* ---------- Feuilles de monstera sur les bords des projets ---------- */
.projets-zone { position: relative; overflow: clip; }
.projets-zone > .projets { position: relative; z-index: 1; }
.monstera {
  --k: .8;
  --feuille-a: #2f8a50; --feuille-b: #1f6b3b; --feuille-c: #45a866;
  position: absolute; inset: 0; pointer-events: none;
}
.defs { position: absolute; }
/* Le pied de la tige (bas du SVG) est accroché au bord de la page, à la hauteur --y. */
.feuille {
  position: absolute; top: calc(var(--y) - var(--w) * var(--k) * 1.35);
  width: calc(var(--w) * var(--k)); height: auto; aspect-ratio: 200 / 270;
  margin-left: calc(var(--w) * var(--k) / -2);
  transform-origin: 50% 100%; rotate: var(--r);
  animation: balance var(--t) ease-in-out var(--d) infinite alternate;
}
.feuille--gauche { left: calc(var(--w) * var(--k) * -.45); }
.feuille--droite { left: calc(100% + var(--w) * var(--k) * .45); }
.feuille--a { color: var(--feuille-a); }
.feuille--b { color: var(--feuille-b); }
.feuille--c { color: var(--feuille-c); }
@keyframes balance {
  from { rotate: calc(var(--r) - 5deg); }
  to { rotate: calc(var(--r) + 5deg); }
}

/* ---------- Insectes autour de la collection ---------- */
.zone-bestioles { position: relative; }
.bestioles { position: absolute; inset: -40px -16px 0; pointer-events: none; z-index: 2; }
.bestiole {
  --elytres: #6e3b22; --carapace: #2a1910; --mandibule: #7a3f1f;
  position: absolute; height: auto;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .18));
}
.bestiole .elytres { fill: var(--elytres); }
.bestiole .tete { fill: var(--carapace); }
.bestiole .mandibule { fill: none; stroke: var(--mandibule); stroke-width: 4; stroke-linecap: round; }
.bestiole .antenne, .bestiole .patte {
  fill: none; stroke: var(--carapace); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round;
}
.bestiole .antenne { stroke-width: 1.6; }
.patte { animation: pas .45s ease-in-out infinite alternate; }
.patte.b { animation-delay: -.45s; }
.bestiole.arret .patte { animation-play-state: paused; }
@keyframes pas {
  from { rotate: -14deg; }
  to { rotate: 14deg; }
}

.lucane { width: 46px; }
.lucane--femelle { --elytres: #3c2519; --carapace: #24160f; --mandibule: #2a1910; width: 38px; }
.lucane--femelle .mandibule { stroke-width: 3.5; }
.carabe { --elytres: #2a2140; --carapace: #1b1626; --mandibule: #1b1626; width: 30px; }
.carabe .elytres { stroke: #8a5ce0; stroke-width: 2; }
.cetoine { --elytres: #48b85e; --carapace: #2f8a45; width: 26px; }
.cetoine .patte, .cetoine .antenne { stroke: #24402c; }
.coccinelle { --elytres: #d8261c; --carapace: #17110f; width: 24px; }
.coccinelle .points { fill: #17110f; }
.coccinelle .patte { stroke-width: 2.2; animation-duration: .3s; }
.coccinelle .patte.b { animation-delay: -.3s; }

.papillon { --carapace: #2a1d16; width: 52px; z-index: 1; filter: drop-shadow(0 10px 6px rgba(0, 0, 0, .15)); }
.papillon--bleu .aile { fill: #7d9cf2; stroke: #fff; stroke-width: 1.5; }
.papillon--orange .aile { fill: #ec7a2c; stroke: #2a1a12; stroke-width: 1.5; }
.papillon .ailes { transform-origin: 50px 44px; animation: battement .16s ease-in-out infinite alternate; }
.papillon--orange .ailes { animation-duration: .2s; }
@keyframes battement { to { scale: .25 1; } }

@supports (color: light-dark(#000, #fff)) {
  .monstera { --feuille-a: light-dark(#2f8a50, #2a7446); --feuille-b: light-dark(#1f6b3b, #1b5532); --feuille-c: light-dark(#45a866, #3b9058); }
  .lucane { --elytres: light-dark(#6e3b22, #94532f); --carapace: light-dark(#2a1910, #4a3021); --mandibule: light-dark(#7a3f1f, #a35a2e); }
  .lucane--femelle { --elytres: light-dark(#3c2519, #6a4330); --carapace: light-dark(#24160f, #45301f); --mandibule: light-dark(#2a1910, #4a3021); }
  .carabe { --elytres: light-dark(#2a2140, #3a2e5a); --carapace: light-dark(#1b1626, #4a3d66); }
}

@media (max-width: 1100px) {
  .monstera { --k: .6; }
}

@media (max-width: 760px) {
  .monstera { --k: .45; opacity: .5; }
  .galerie-projet { grid-template-columns: repeat(2, 1fr); gap: 8px; }
}

/* ---------- Étagère de jeux (page /games/ et aperçu de la page d'accueil) ---------- */
/* Tout est dimensionné en unités de conteneur (cqw) : l'étagère garde ses proportions
   en grand comme en miniature. Une case mesure 72 cm de large et 38 cm de haut, planche comprise. */
.etagere {
  --mur: #ebe4d8; --mur-ombre: #d6ccbb;
  --parquet: #c79e6c; --parquet-fonce: #a67b4b;
  --pothos-1: #3f8f3c; --pothos-2: #2c6e30; --pothos-3: #5aa94a;
  container-type: inline-size;
  position: relative; border-radius: var(--radius); overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 30%, rgba(255, 255, 255, .5), transparent),
    linear-gradient(var(--mur), var(--mur-ombre));
}
.etagere-scene { position: relative; z-index: 1; padding: 4cqw 3cqw 0; }
.etagere-cadre {
  --col: 3;
  --m: 1.3cqw;
  --w: calc((94cqw - (var(--col) + 1) * var(--m)) / var(--col));
  --cm: calc(var(--w) / 72);
  --h: calc(var(--cm) * 38);
  --planche: calc(var(--cm) * 3.2);
  --img: none;
  position: relative;
  display: grid; grid-template-columns: repeat(var(--col), var(--w)); column-gap: var(--m);
  padding: var(--planche) var(--m) 0;
}

/* Planches : dessus clair, chant veiné, cornière d'acier dessous. */
.etagere-cadre::before, .case::after {
  content: ""; position: absolute; z-index: 1; height: var(--planche);
  background:
    linear-gradient(rgba(255, 236, 205, .45), rgba(255, 236, 205, 0) 28%),
    repeating-linear-gradient(178deg, transparent 0 3px, rgba(70, 38, 14, .14) 3px 4px, transparent 4px 9px),
    linear-gradient(90deg, #8a5a32, #a9784a 22%, #93643a 47%, #b08050 71%, #8d5e35);
  border-bottom: calc(var(--cm) * .7) solid #1d1e21;
  box-shadow: 0 calc(var(--cm) * 1.4) calc(var(--cm) * 1.8) calc(var(--cm) * -.6) rgba(30, 20, 10, .4);
}
.etagere-cadre::before { top: 0; left: var(--m); right: var(--m); }
.case::after { left: 0; right: 0; bottom: 0; }

/* Montants en acier noir, boulonnés à chaque planche. */
.montant {
  position: absolute; z-index: 2; top: calc(var(--cm) * -1.2); bottom: calc(var(--cm) * -3);
  left: calc(var(--i) * (100% - var(--m)) / var(--col)); width: var(--m);
  border-radius: calc(var(--m) * .2);
  background:
    radial-gradient(circle at 50% calc(var(--m) / 2), #a8abb1 0 calc(var(--m) * .14), #17181b calc(var(--m) * .19), transparent calc(var(--m) * .25))
      0 calc(var(--cm) * 1.2 + var(--planche) / 2 - var(--m) / 2) / 100% var(--h) repeat-y,
    linear-gradient(90deg, #141518, #4d5057 28%, #2a2c30 52%, #17181b 80%, #34363b);
  box-shadow: calc(var(--cm) * .8) calc(var(--cm) * 1.2) calc(var(--cm) * 2) rgba(0, 0, 0, .25);
}
.montant--3 { left: auto; right: 0; }
.montant::after {
  content: ""; position: absolute; left: -25%; right: -25%; bottom: 0; height: calc(var(--cm) * 1.1);
  border-radius: 2px; background: #101113;
}

.case {
  position: relative; height: var(--h);
  display: flex; align-items: flex-end; justify-content: space-evenly;
  padding-bottom: var(--planche);
}
.pile {
  position: relative; z-index: 2;
  display: flex; flex-direction: column-reverse; align-items: center;
  width: calc(var(--cm) * 32);
}

/* Boîtes couchées : on voit la tranche, illustrée par un bandeau de la couverture BGG. */
.boite {
  position: relative; flex: none; display: flex; align-items: center;
  width: calc(min(var(--l), 33) * var(--cm)); height: calc(var(--e) * var(--cm));
  margin: 0; padding: 0 0 0 calc(var(--cm) * 1.2); border: 0; border-radius: calc(var(--cm) * .35);
  background: var(--img) center 28% / cover no-repeat, var(--c);
  color: #fff; font: 600 1rem/1 var(--sans); text-align: left; cursor: pointer;
  translate: calc(var(--dx) * var(--cm)) 0; rotate: calc(var(--r) * 1deg);
  box-shadow:
    inset 0 calc(var(--cm) * .25) 0 rgba(255, 255, 255, .3),
    inset 0 calc(var(--cm) * -.5) calc(var(--cm) * .8) rgba(0, 0, 0, .35),
    0 1px 1px rgba(0, 0, 0, .35);
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s, filter .3s, opacity .3s;
}
.boite::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(90deg, rgba(12, 9, 6, .66), rgba(12, 9, 6, .18) 62%, transparent);
}
.boite--texte::after { background: linear-gradient(rgba(255, 255, 255, .08), rgba(0, 0, 0, .2)); }
.boite-nom {
  position: relative; z-index: 1; max-width: 94%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: clamp(8px, calc(var(--e) * var(--cm) * .4), 15px); letter-spacing: .01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7);
}
.boite:hover, .boite:focus-visible, .boite.is-active {
  z-index: 3;
  transform: translateY(calc(var(--cm) * -.5)) scale(1.08);
  filter: brightness(1.08) saturate(1.1);
  box-shadow:
    inset 0 calc(var(--cm) * .25) 0 rgba(255, 255, 255, .3),
    0 calc(var(--cm) * 1.5) calc(var(--cm) * 2.5) rgba(0, 0, 0, .45);
}
.boite:focus-visible { outline: 2px solid #f0b04c; outline-offset: 2px; }
.boite.is-terne { filter: grayscale(1) brightness(.65); opacity: .4; }

/* Pothos : la liane qui pend du haut et le pot posé dans la dernière case. */
.liane, .plante svg { overflow: visible; pointer-events: none; }
.liane {
  position: absolute; z-index: 4; left: calc(var(--m) * .1); top: calc(var(--cm) * -1);
  width: calc(var(--cm) * 10); height: auto;
  transform-origin: 50% 0; animation: liane 7s ease-in-out infinite alternate;
}
@keyframes liane { from { rotate: -2.5deg; } to { rotate: 2.5deg; } }
.liane-tige { fill: none; stroke: #4c7a35; stroke-width: 1.6; stroke-linecap: round; }
.p1 { color: var(--pothos-1); }
.p2 { color: var(--pothos-2); }
.p3 { color: var(--pothos-3); }
.plante { position: relative; z-index: 3; width: calc(var(--cm) * 22); height: calc(var(--cm) * 28.6); }
.plante svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.pot { fill: #eeeae2; stroke: #c9c2b5; stroke-width: 1; }
.pot-bord { fill: #f7f4ee; stroke: #c9c2b5; stroke-width: 1; }

.sol {
  height: 5cqw;
  background:
    repeating-linear-gradient(90deg, transparent 0 9cqw, rgba(60, 35, 15, .18) 9cqw calc(9cqw + 1px)),
    linear-gradient(var(--parquet), var(--parquet-fonce));
  box-shadow: inset 0 8px 12px -8px rgba(0, 0, 0, .4);
}

/* Chute des boîtes quand l'étagère apparaît. */
.js .etagere:not(.is-pret) .boite, .js .etagere:not(.is-pret) .plante { opacity: 0; }
.etagere.is-pret .boite, .etagere.is-pret .plante {
  animation: chute .75s cubic-bezier(.3, .7, .4, 1.12) backwards;
  animation-delay: calc(var(--n) * 30ms);
}
@keyframes chute {
  from { opacity: 0; transform: translateY(calc(var(--cm) * -45)); }
  60% { opacity: 1; }
}

/* Petits écrans : les cases s'empilent sur une seule colonne. */
@container (max-width: 600px) {
  .etagere-cadre { --col: 1; --m: 3cqw; }
  .montant--1, .montant--2 { display: none; }
}

/* Aperçu de la page d'accueil */
.etagere--mini .etagere-cadre { --col: 3; --m: 1.3cqw; }
.etagere--mini .montant--1, .etagere--mini .montant--2 { display: block; }
.etagere--mini { border-radius: 0; background: none; }
.etagere--mini .boite { cursor: inherit; }
.etagere--mini .boite.is-active { transform: translateY(calc(var(--cm) * -.8)) scale(1.14); }
.js .etagere--mini:not(.is-pret) .boite { background-image: none; }
.etagere-apercu {
  position: absolute; inset: 0; display: grid; align-content: end;
  border-radius: inherit; overflow: hidden;
  background:
    radial-gradient(ellipse 70% 60% at 50% 30%, rgba(255, 255, 255, .5), transparent),
    linear-gradient(#ebe4d8, #d6ccbb);
}

/* Fiche BoardGameGeek */
.fiche {
  position: absolute; left: 0; top: 0; z-index: 10;
  width: min(350px, calc(100vw - 32px));
  padding: 16px 18px 14px; border-radius: 18px;
  background: var(--card); color: var(--ink); border: 1px solid var(--line);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .5);
  font-size: .9rem; line-height: 1.45;
  opacity: 0; visibility: hidden; transform: translateY(8px) scale(.98); pointer-events: none;
  transition: opacity .2s, transform .2s, visibility .2s, translate .25s cubic-bezier(.2, .8, .2, 1);
}
.fiche.is-visible { opacity: 1; visibility: visible; transform: none; }
.fiche.is-epinglee { pointer-events: auto; }
.fiche-tete { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; }
.fiche-tete img { width: 58px; height: 58px; object-fit: cover; border-radius: 10px; }
.fiche-titre { margin: 0; font: 700 1.12rem/1.2 var(--serif); }
.fiche-sous { margin: 3px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.3; }
.note-bgg {
  display: inline-grid; place-items: center; width: 2.6em; height: 2.9em;
  background: var(--n); color: #fff; font-weight: 700; font-size: .85rem;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.fiche .note-bgg { font-size: 1rem; }
.fiche-extension { margin: 10px 0 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.fiche-chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 12px 0; }
.fiche-chiffres div { padding: 6px 8px; border-radius: 10px; background: var(--bg-alt); }
.fiche-chiffres dt { font-size: .64rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fiche-chiffres dd { margin: 0; font-weight: 600; font-size: .92rem; white-space: nowrap; }
.fiche-chiffres small { display: block; font-weight: 400; font-size: .7rem; color: var(--muted); }
.fiche-desc { margin: 0 0 10px; font: italic 400 .98rem/1.4 var(--serif); }
.fiche-themes { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; }
.fiche-themes li { font-size: .72rem; padding: 2px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }
.fiche-themes .est-type { border-color: transparent; background: color-mix(in srgb, #3f8f8a 16%, transparent); color: var(--ink); }
.fiche-edition { margin: 0 0 10px; font-size: .8rem; color: var(--muted); }
.fiche-pied {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px;
  margin: 0; padding-top: 10px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted);
}
.fiche-pied a { font-weight: 600; color: var(--ink); }
.fiche-astuce { font-style: italic; }
.fiche.is-epinglee .fiche-astuce { display: none; }
.fiche-fermer {
  position: absolute; top: -12px; right: -12px; display: none; place-items: center;
  width: 32px; height: 32px; border: 0; border-radius: 50%;
  background: var(--ink); color: var(--bg); font: 400 1.3rem/1 var(--sans); cursor: pointer;
}
.fiche.is-epinglee .fiche-fermer { display: grid; }

/* Page de la collection */
.jeux-entete { padding: 130px 0 36px; }
.jeux-entete h1 { max-width: none; }
.jeux-chiffres { list-style: none; display: flex; flex-wrap: wrap; gap: 14px 40px; margin: 0; padding: 0; }
.jeux-chiffres li { font-size: .9rem; color: var(--muted); }
.jeux-chiffres strong { display: block; font: 800 2rem/1.1 var(--serif); color: var(--ink); }
.jeux-filtres { display: none; flex-wrap: wrap; align-items: center; gap: 12px 28px; margin-bottom: 18px; }
.js .jeux-filtres { display: flex; }
.filtre-groupe { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filtre-groupe > span, .filtre-groupe label span {
  margin-right: 4px; font-size: .75rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
}
.filtre {
  padding: 5px 13px; border: 1px solid var(--line); border-radius: 999px;
  background: transparent; color: var(--ink); font: 500 .85rem var(--sans); cursor: pointer;
  transition: background .2s, color .2s, border-color .2s;
}
.filtre:hover { border-color: var(--muted); }
.filtre[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.filtre-liste { padding: 5px 10px; }
/* Le fond transparent de la liste déroulante devient blanc sous Windows : couleurs du thème explicites. */
.filtre-liste option { background: var(--card); color: var(--ink); }
.filtre-bilan { display: flex; align-items: baseline; gap: 16px; margin-left: auto; }
.filtre-compte { margin: 0; font-size: .85rem; color: var(--muted); }
.filtre-effacer, .choix-lien {
  padding: 0; border: 0; background: none; color: var(--ink); cursor: pointer;
  font: 600 .85rem var(--sans); text-decoration: underline; text-underline-offset: 3px;
}
.jeux-raccourci { margin: 32px 0 0; }
.jeux-large { position: relative; width: min(1400px, 100% - 32px); margin-inline: auto; }
.jeux-liste { padding: 88px 0 40px; }
.jeux-source { color: var(--muted); margin: 0 0 24px; }
.tableau-defile { overflow-x: auto; }
.tableau-jeux { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tableau-jeux th, .tableau-jeux td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.tableau-jeux thead th { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tableau-jeux tbody th { font-weight: 600; white-space: normal; }
.tableau-jeux tbody th a { text-decoration: none; }
.tableau-jeux tbody th a:hover { text-decoration: underline; }
.tableau-jeux td:last-child, .tableau-jeux th:last-child { text-align: center; }
.tableau-detail { margin-left: 6px; font-size: .72rem; font-weight: 500; color: var(--muted); }
.jeux-retour { margin-top: 48px; }

/* Tri du tableau */
.tri {
  display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer;
  color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
}
.tri::after { content: "↕"; opacity: .35; }
th[aria-sort="ascending"] .tri::after { content: "↑"; opacity: 1; }
th[aria-sort="descending"] .tri::after { content: "↓"; opacity: 1; }
th[aria-sort] .tri { color: var(--ink); }

/* Questionnaire « Let the shelf choose » */
.choix { display: none; padding: 96px 0 0; scroll-margin-top: 70px; }
.js .choix { display: block; }
.choix-carte {
  --vert: #3f8f8a;
  display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.25fr); gap: clamp(24px, 5vw, 56px);
  padding: clamp(22px, 4vw, 48px); border-radius: var(--radius);
  background:
    radial-gradient(circle at 0 0, color-mix(in srgb, var(--vert) 14%, transparent), transparent 45%),
    var(--card);
  border: 1px solid var(--line); box-shadow: 0 30px 60px -40px rgba(0, 0, 0, .4);
}
.choix-intro p:last-child { color: var(--muted); }
.choix-progres { height: 4px; margin-bottom: 22px; border-radius: 4px; background: var(--bg-alt); overflow: hidden; }
.choix-progres span { display: block; width: 0; height: 100%; background: var(--iris); transition: width .4s cubic-bezier(.2, .8, .2, 1); }
.choix-question { min-width: 0; margin: 0; padding: 0; border: 0; }
.choix-question:not([hidden]), .choix-resultat:not([hidden]) { animation: apparait .35s ease; }
@keyframes apparait { from { opacity: 0; transform: translateX(14px); } }
.choix-question legend { margin-bottom: 16px; padding: 0; font: 700 1.55rem/1.2 var(--serif); outline: none; }
.choix-num { display: block; margin-bottom: 6px; font: 600 .75rem var(--sans); letter-spacing: .12em; color: var(--vert); }
.choix-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.choix-options--nombres { grid-template-columns: repeat(6, 1fr); }
.choix-options--univers { grid-template-columns: repeat(3, 1fr); }
.choix-option {
  padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.choix-option strong { display: block; font-weight: 600; line-height: 1.3; }
.choix-option span { display: block; margin-top: 2px; font-size: .84rem; line-height: 1.35; color: var(--muted); }
.choix-option:hover { border-color: var(--vert); transform: translateY(-2px); }
.choix-option[aria-pressed="true"] { border-color: var(--vert); background: color-mix(in srgb, var(--vert) 12%, var(--bg)); }
.choix-options--nombres .choix-option { text-align: center; font-size: 1.15rem; }
.choix-nav { display: flex; gap: 22px; margin-top: 18px; }
.choix-resultat:focus { outline: none; }
.choix-resume { margin: 0 0 6px; font-size: .75rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.choix-note { margin: 0 0 10px; font-size: .85rem; font-style: italic; color: var(--muted); }
.choix-vide { margin: 0; }
.choix-cartes { display: grid; gap: 12px; margin: 12px 0 0; padding: 0; list-style: none; }
.choix-carte-jeu {
  display: grid; grid-template-columns: 88px 1fr auto; gap: 16px; align-items: start;
  padding: 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg);
  animation: apparait .5s backwards; animation-delay: calc(var(--d) * 120ms);
}
.choix-carte-jeu:first-child { border-color: var(--vert); box-shadow: inset 0 0 0 1px var(--vert); }
.choix-carte-jeu img, .choix-sans-image { display: block; width: 88px; height: 88px; object-fit: cover; border-radius: 12px; }
.choix-rang { margin: 0; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--vert); }
.choix-carte-jeu h3 { margin: 2px 0 4px; font: 700 1.2rem/1.2 var(--serif); }
.choix-desc { margin: 0 0 8px; font-size: .88rem; line-height: 1.45; color: var(--muted); }
.choix-raisons { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; padding: 0; list-style: none; }
.choix-raisons li { padding: 2px 9px; border-radius: 999px; background: var(--bg-alt); font-size: .74rem; }
.choix-voir {
  padding: 6px 14px; border: 0; border-radius: 999px; background: var(--ink); color: var(--bg);
  font: 600 .8rem var(--sans); cursor: pointer; transition: transform .2s;
}
.choix-voir:hover { transform: translateY(-1px); }
.choix-autres { margin: 16px 0 0; font-size: .9rem; color: var(--muted); }
.choix-autres .choix-lien { font-size: .9rem; }

@supports (color: light-dark(#000, #fff)) {
  .etagere {
    --mur: light-dark(#ebe4d8, #2b2833); --mur-ombre: light-dark(#d6ccbb, #1e1c25);
    --parquet: light-dark(#c79e6c, #6f5336); --parquet-fonce: light-dark(#a67b4b, #553f28);
  }
  .etagere-apercu {
    background:
      radial-gradient(ellipse 70% 60% at 50% 30%, light-dark(rgba(255, 255, 255, .5), transparent), transparent),
      linear-gradient(light-dark(#ebe4d8, #2b2833), light-dark(#d6ccbb, #1e1c25));
  }
  .etagere .pot { fill: light-dark(#eeeae2, #d9d4ca); }
}

@media (max-width: 640px) {
  .fiche {
    position: fixed; left: 12px; right: 12px; top: auto; bottom: 12px; width: auto;
    max-height: 72vh; overflow-y: auto; translate: none !important;
  }
  .fiche-fermer { top: 10px; right: 10px; width: 28px; height: 28px; }
  .fiche-tete { padding-right: 34px; }
  .fiche-chiffres { grid-template-columns: repeat(2, 1fr); }
  .tableau-jeux tr > :nth-child(2), .tableau-jeux tr > :nth-child(3), .tableau-jeux tr > :nth-child(6) { display: none; }
  .choix-carte { grid-template-columns: 1fr; }
  .choix-options, .choix-options--univers { grid-template-columns: 1fr 1fr; }
  .choix-options--nombres { grid-template-columns: repeat(3, 1fr); }
  .choix-carte-jeu { grid-template-columns: 64px 1fr; }
  .choix-carte-jeu img, .choix-sans-image { width: 64px; height: 64px; }
  .choix-carte-jeu > .note-bgg { display: none; }
}
