/* ==========================================================================
   Bryan Tillou, système commun
   Tokens, base, en-tête, boutons, révélations, lightbox, pied de page.
   Voir DESIGN.md pour les règles.
   ========================================================================== */

@font-face {
  font-family: "Geist";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "Geist Mono";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
}

/* ---------- Tokens ---------- */
/* Direction « Apple neutre + mauve » (refonte 2026-10).
   Neutres inspirés d'apple.com (blanc, #f5f5f7, #1d1d1f, noir), une seule couleur
   d'accent : le mauve. Police système : SF Pro sur Apple, Geist ailleurs. */
:root {
  --font-display: "SF Pro Display", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI", system-ui, sans-serif;
  --font-text: "SF Pro Text", -apple-system, BlinkMacSystemFont, "Geist", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", ui-monospace, "Geist Mono", "Cascadia Mono", Consolas, monospace;

  --step--1: 0.8125rem;
  --step-0: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
  --step-1: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --step-2: clamp(1.375rem, 1.18rem + 0.9vw, 1.875rem);
  --step-3: clamp(1.75rem, 1.3rem + 2.1vw, 3rem);
  --step-4: clamp(2.5rem, 1.5rem + 4.4vw, 5rem);
  --step-5: clamp(3.5rem, 1.2rem + 9vw, 9rem);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;
  --space-10: 128px;
  --section-y: clamp(96px, 12vw, 180px);
  --gutter: clamp(20px, 4vw, 48px);
  --container: 1200px;
  --header-h: 52px;

  --radius-s: 8px;
  --radius-m: 18px;
  --radius-l: 28px;
  --radius-pill: 999px;

  /* Courbes proches des ressorts critiques d'Apple (amortissement 1). */
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1);
  --dur-press: 120ms;
  --dur-hover: 200ms;
  --dur-ui: 280ms;
  --dur-ui-exit: 200ms;
  --dur-reveal: 700ms;
  --dur-kinetic: 900ms;

  --z-sticky: 20;
  --z-header: 40;
  --z-menu: 50;
  --z-lightbox: 60;
  --z-skip: 70;

  /* Mauve : seule couleur d'accent. Les anciens noms de couleur restent
     définis pour la compatibilité, mais pointent vers des neutres. */
  --mauve: #a56fe3;
  --mauve-hover: #b887ec;
  --mauve-soft: #d5b9ef;
  --mauve-deep: #7c4dc7;
  --ultramarine: #8e8e93;
  --ultramarine-deep: #1d1d1f;
  --burgundy: #1d1d1f;
  --burgundy-light: #3a3a3c;
  --glacier: #e8e8ed;
  --silver: #f5f5f7;
  --teal: #8e8e93;
  --pink: var(--mauve-soft);

  --brand: var(--mauve);
  --brand-hover: var(--mauve-hover);
  --on-brand: #0b0a0d;
  --second: #8e8e93;
  --second-block: #161617;
  --on-second: #f5f5f7;
  --on-second-muted: rgb(245 245 247 / 0.72);
  --pop: var(--glacier);
  --on-pop: #1d1d1f;
  --on-burgundy: #f5f5f7;

  color-scheme: dark;
  --bg: #000000;
  --bg-2: #0b0b0c;
  --surface: #161617;
  --surface-2: #232325;
  --line: rgb(255 255 255 / 0.1);
  --line-strong: rgb(255 255 255 / 0.2);
  --text: #f5f5f7;
  --text-muted: #a1a1a6;
  --text-faint: #8e8e93;
  --accent: var(--brand);
  --accent-ink: #c4a0f0;
  --second-ink: #c4a0f0;
  --on-accent: var(--on-brand);
  --focus: #c4a0f0;
  --success: #6fd08c;
  --warning: #ffd60a;
  --danger: #ff6961;
  --info: var(--second-ink);
  --tint-brand: var(--bg);
  --tint-second: var(--bg);
  --tile: #161617;
  --shadow-1: 0 2px 8px rgb(0 0 0 / 0.3), 0 24px 60px -20px rgb(0 0 0 / 0.7);
  --shadow-2: 0 4px 12px rgb(0 0 0 / 0.35), 0 40px 100px -30px rgb(0 0 0 / 0.8);
  --header-bg: rgb(22 22 23 / 0.72);
  --scrim: rgb(0 0 0 / 0.6);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --brand: #7c4dc7;
    --brand-hover: #6a3cb5;
    --on-brand: #ffffff;
    --bg: #ffffff;
    --bg-2: #f5f5f7;
    --surface: #f5f5f7;
    --surface-2: #e8e8ed;
    --line: rgb(0 0 0 / 0.08);
    --line-strong: rgb(0 0 0 / 0.18);
    --text: #1d1d1f;
    --text-muted: #6e6e73;
    --text-faint: #6e6e73;
    --accent-ink: #6e3fb8;
    --second-ink: #6e3fb8;
    --focus: #7c4dc7;
    --success: #1f7a3d;
    --warning: #8a5a00;
    --danger: #c4161c;
    --tile: #f5f5f7;
    --shadow-1: 0 2px 8px rgb(0 0 0 / 0.05), 0 24px 60px -24px rgb(0 0 0 / 0.18);
    --shadow-2: 0 4px 12px rgb(0 0 0 / 0.06), 0 40px 100px -30px rgb(0 0 0 / 0.25);
    --header-bg: rgb(255 255 255 / 0.72);
    --scrim: rgb(0 0 0 / 0.35);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --brand: #7c4dc7;
  --brand-hover: #6a3cb5;
  --on-brand: #ffffff;
  --bg: #ffffff;
  --bg-2: #f5f5f7;
  --surface: #f5f5f7;
  --surface-2: #e8e8ed;
  --line: rgb(0 0 0 / 0.08);
  --line-strong: rgb(0 0 0 / 0.18);
  --text: #1d1d1f;
  --text-muted: #6e6e73;
  --text-faint: #6e6e73;
  --accent-ink: #6e3fb8;
  --second-ink: #6e3fb8;
  --focus: #7c4dc7;
  --success: #1f7a3d;
  --warning: #8a5a00;
  --danger: #c4161c;
  --tile: #f5f5f7;
  --shadow-1: 0 2px 8px rgb(0 0 0 / 0.05), 0 24px 60px -24px rgb(0 0 0 / 0.18);
  --shadow-2: 0 4px 12px rgb(0 0 0 / 0.06), 0 40px 100px -30px rgb(0 0 0 / 0.25);
  --header-bg: rgb(255 255 255 / 0.72);
  --scrim: rgb(0 0 0 / 0.35);
}

/* Couleurs de projet neutralisées : le mauve partout (les attributs style
   des pages gardent leurs anciennes valeurs, !important les remplace). */
[style*="--p:"],
[style*="--p :"] {
  --p: var(--brand) !important;
  --p-ink-dark: #c4a0f0 !important;
  --p-ink-light: #6e3fb8 !important;
  --p-on: var(--on-brand) !important;
}

/* Couleur de projet : --p (fond, barres), --p-ink (texte lisible selon le thème). */
body,
.project-card,
.story {
  --p-ink: var(--p-ink-dark, var(--accent-ink));
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) body,
  :root:not([data-theme="dark"]) .project-card,
  :root:not([data-theme="dark"]) .story {
    --p-ink: var(--p-ink-light, var(--accent-ink));
  }
}
:root[data-theme="light"] body,
:root[data-theme="light"] .project-card,
:root[data-theme="light"] .story {
  --p-ink: var(--p-ink-light, var(--accent-ink));
}

/* ---------- Base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 24px);
}
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-text);
  font-size: var(--step-0);
  line-height: 1.55;
  letter-spacing: -0.01em;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
  overflow-x: clip;
}
img,
video,
svg,
iframe {
  display: block;
  max-width: 100%;
}
img,
video {
  height: auto;
}
h1,
h2,
h3,
h4,
p,
ul,
ol,
dl,
dd,
figure,
blockquote {
  margin: 0;
}
ul[role="list"],
ol[role="list"] {
  list-style: none;
  padding: 0;
}
h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
p,
li,
dd {
  text-wrap: pretty;
}
a {
  color: inherit;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button {
  cursor: pointer;
}
code,
kbd,
pre,
samp {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
::selection {
  background: var(--accent);
  color: var(--on-accent);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}
[hidden] {
  display: none !important;
}

.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;
  left: var(--gutter);
  top: 8px;
  z-index: var(--z-skip);
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
  text-decoration: none;
  transform: translateY(-150%);
  transition: transform var(--dur-ui) var(--ease-out);
}
.skip-link:focus-visible {
  transform: none;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: currentColor;
}

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + var(--gutter) * 2);
  margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right));
}
.grid-12 {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--space-5);
}
.section {
  padding-block: var(--section-y);
}
.section-title {
  font-size: var(--step-4);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.04;
}
.section-head {
  margin-bottom: clamp(48px, 8vw, 112px);
}
.section-lede {
  margin-top: var(--space-5);
  max-width: 52ch;
  color: var(--text-muted);
  font-size: var(--step-2);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.3;
}
.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--step-0);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--accent-ink);
}
.mono {
  font-family: var(--font-text);
  font-weight: 600;
}
.muted {
  color: var(--text-muted);
}

/* ---------- Links & buttons ---------- */
.link {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--dur-hover) ease, text-decoration-color var(--dur-hover) ease;
}
@media (hover: hover) and (pointer: fine) {
  .link:hover {
    color: var(--accent-ink);
    text-decoration-color: currentColor;
  }
}

.btn {
  --btn-h: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--btn-h);
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-family: var(--font-text);
  font-size: 1.0625rem;
  font-weight: 500;
  letter-spacing: -0.015em;
  line-height: 1;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-hover) ease,
    border-color var(--dur-hover) ease,
    color var(--dur-hover) ease;
}
.btn .icon {
  transition: transform var(--dur-hover) var(--ease-out);
}
.btn:active {
  transform: scale(0.97);
}
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}
.btn--primary {
  background: var(--accent);
  color: var(--on-accent);
}
.btn--ghost {
  border-color: var(--accent-ink);
  color: var(--accent-ink);
  background: transparent;
}
/* Sur aplat bordeaux : contour argenté ou plein glacier. */
.btn--ink {
  border-color: rgb(246 243 247 / 0.42);
  color: var(--on-burgundy);
  background: transparent;
}
.btn--ink-solid {
  background: var(--glacier);
  color: #0d0b12;
}
/* Bouton secondaire neutre (CV), anciennement bordeaux. */
.btn--burgundy {
  background: var(--surface-2);
  color: var(--text);
}
@media (hover: hover) and (pointer: fine) {
  .btn--ink:hover {
    border-color: var(--on-burgundy);
    background: rgb(246 243 247 / 0.1);
  }
  .btn--ink-solid:hover {
    background: var(--silver);
  }
  .btn--burgundy:hover {
    background: color-mix(in srgb, var(--text) 14%, var(--surface-2));
  }
}
/* Lien d'action façon « En savoir plus › » d'apple.com. */
.btn--text {
  padding-inline: 4px;
  background: transparent;
  color: var(--accent-ink);
}
@media (hover: hover) and (pointer: fine) {
  .btn--text:hover {
    text-decoration: underline;
    text-underline-offset: 0.2em;
  }
}
.btn--small {
  --btn-h: 44px;
  padding: 0 16px;
  font-size: 0.875rem;
}
.btn--danger {
  border-color: color-mix(in srgb, var(--danger) 60%, transparent);
  color: var(--danger);
  background: transparent;
}
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover {
    background: var(--brand-hover);
  }
  .btn--ghost:hover {
    background: color-mix(in srgb, var(--accent-ink) 10%, transparent);
  }
  .btn--danger:hover {
    border-color: var(--danger);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
  }
  .btn:hover .icon--nudge-r {
    transform: translateX(3px);
  }
  .btn:hover .icon--nudge-ur {
    transform: translate(2px, -2px);
  }
  .btn:hover .icon--nudge-d {
    transform: translateY(3px);
  }
  .btn:hover .icon--nudge-l {
    transform: translateX(-3px);
  }
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 10px;
  border: 0;
  border-radius: var(--radius-pill);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  white-space: nowrap;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: 0;
  list-style: none;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 22%, transparent);
}

/* ---------- Header ---------- */
.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: var(--z-header);
  padding-top: env(safe-area-inset-top);
}
/* Le verre apparaît dès qu'on quitte le haut de page ; le contenu défile dessous. */
.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
  opacity: 0;
  transition: opacity var(--dur-ui) var(--ease-out);
  pointer-events: none;
}
.site-header[data-scrolled="true"]::before {
  opacity: 1;
}
@media (prefers-reduced-transparency: reduce) {
  .site-header::before {
    background: var(--surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
.header-bar {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  margin-right: auto;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.02em;
  text-decoration: none;
  white-space: nowrap;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0;
  transition: transform var(--dur-ui) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .brand:hover .brand-mark {
    transform: rotate(-8deg);
  }
}
.nav {
  position: relative;
}
.nav-list {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.nav-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-muted);
  text-decoration: none;
  white-space: nowrap;
  transition:
    color var(--dur-hover) ease,
    background-color var(--dur-hover) ease;
}
.nav-link[aria-current="page"],
.nav-link[aria-current="location"],
.nav-link.is-active {
  color: var(--text);
}
@media (hover: hover) and (pointer: fine) {
  .nav-link:hover {
    color: var(--text);
  }
}
.nav-link:active {
  color: var(--text);
}
.nav-indicator {
  position: absolute;
  left: 0;
  bottom: 6px;
  width: 100px;
  height: 2px;
  border-radius: 2px;
  background: var(--brand);
  transform-origin: 0 50%;
  transform: translateX(var(--x, 0)) scaleX(var(--s, 0));
  opacity: 0;
  pointer-events: none;
}
.nav-indicator.is-ready {
  transition:
    transform var(--dur-ui) var(--ease-in-out),
    opacity var(--dur-hover) ease;
}
.nav-indicator.is-visible {
  opacity: 1;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.search-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  padding: 0 6px 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.875rem;
  white-space: nowrap;
  transition:
    transform var(--dur-press) var(--ease-out),
    border-color var(--dur-hover) ease,
    color var(--dur-hover) ease;
}
.search-trigger .icon {
  width: 16px;
  height: 16px;
  color: var(--text);
}
.search-trigger:active {
  transform: scale(0.97);
}
@media (hover: hover) and (pointer: fine) {
  .search-trigger:hover {
    background: var(--surface-2);
    color: var(--text);
  }
}
.kbd {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 7px;
  border: 0;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-muted);
  font-family: var(--font-text);
  font-size: 0.75rem;
  line-height: 1;
}
.btn .kbd {
  margin-left: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-hover) ease,
    border-color var(--dur-hover) ease;
}
.icon-btn:active {
  transform: scale(0.94);
}
@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    background: var(--surface-2);
    border-color: var(--line-strong);
  }
}
.theme-toggle .icon,
.menu-action .icon {
  width: 18px;
  height: 18px;
}
.icon-sun {
  display: none;
}
:root[data-theme="dark"] .icon-sun,
:root:not([data-theme]) .icon-sun {
  display: block;
}
:root[data-theme="dark"] .icon-moon,
:root:not([data-theme]) .icon-moon {
  display: none;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme]) .icon-sun {
    display: none;
  }
  :root:not([data-theme]) .icon-moon {
    display: block;
  }
}

.menu-toggle {
  display: none;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 16px 0 12px;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 650;
  font-size: 0.9375rem;
  transition: transform var(--dur-press) var(--ease-out);
}
.menu-toggle .icon {
  width: 18px;
  height: 18px;
}
.menu-toggle:active {
  transform: scale(0.96);
}
.search-icon-btn {
  display: none;
}

@media (max-width: 1239px) {
  .search-trigger .kbd,
  .search-trigger-label {
    display: none;
  }
  .search-trigger {
    width: 44px;
    padding: 0;
    justify-content: center;
  }
}
@media (max-width: 1079px) {
  .nav,
  .nav-cv,
  .search-trigger,
  .header-actions .theme-toggle {
    display: none;
  }
  .search-icon-btn {
    display: inline-grid;
  }
  .menu-toggle {
    display: inline-flex;
  }
}
@media (max-width: 359px) {
  .brand-name {
    display: none;
  }
}

/* ---------- Mobile menu ---------- */
/* Feuille plein écran qui s'ouvre depuis le bouton « Menu » (coin supérieur droit). */
.menu {
  position: fixed;
  inset: 0;
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 8px) max(var(--gutter), env(safe-area-inset-right))
    calc(env(safe-area-inset-bottom) + 20px) max(var(--gutter), env(safe-area-inset-left));
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
  visibility: hidden;
  clip-path: inset(0 0 100% 55% round 24px);
  transition:
    clip-path 200ms var(--ease-out),
    visibility 0s linear 200ms;
}
.menu[data-open="true"] {
  visibility: visible;
  clip-path: inset(0 0 0 0 round 0);
  transition:
    clip-path 360ms var(--ease-drawer),
    visibility 0s;
}
.menu::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--brand);
}
.menu-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
}
.menu-list {
  display: flex;
  flex-direction: column;
  margin: var(--space-5) 0 0;
  padding: 0;
  list-style: none;
}
.menu-list a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 60px;
  padding: 4px 0 4px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 8vw, 2.75rem);
  font-weight: 650;
  letter-spacing: -0.03em;
  line-height: 1.1;
  text-decoration: none;
  transition:
    color var(--dur-hover) ease,
    padding-left var(--dur-ui) var(--ease-out);
}
.menu-list a .icon {
  width: 22px;
  height: 22px;
  color: var(--text-muted);
}
.menu-list a[aria-current],
.menu-list a.is-active {
  padding-left: 16px;
  color: var(--accent-ink);
}
.menu-list a[aria-current]::before,
.menu-list a.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 4px;
  border-radius: 4px;
  background: var(--brand);
}
.menu-list a:active {
  background: var(--tint-brand);
}
.menu-list li {
  opacity: 0;
  transform: translateY(10px);
}
.menu[data-open="true"] .menu-list li {
  opacity: 1;
  transform: none;
  transition:
    opacity 320ms var(--ease-out),
    transform 320ms var(--ease-out);
  transition-delay: calc(80ms + var(--i, 0) * 35ms);
}
.menu-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
  margin-top: auto;
  padding-top: var(--space-6);
}
.menu-action {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 56px;
  padding: 0 var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: left;
  text-decoration: none;
  transition: transform var(--dur-press) var(--ease-out);
}
.menu-action:active {
  transform: scale(0.97);
  background: var(--surface-2);
}
.menu-action:first-child {
  background: var(--brand);
  border-color: transparent;
  color: var(--on-brand);
}
.menu-action .check-icon,
[data-copied="true"] .copy-icon {
  display: none;
}
[data-copied="true"] .check-icon {
  display: block;
  color: var(--success);
}
@media (prefers-reduced-motion: reduce) {
  .menu,
  .menu[data-open="true"] {
    clip-path: none;
    opacity: 0;
    transition:
      opacity 160ms ease,
      visibility 0s linear 160ms;
  }
  .menu[data-open="true"] {
    opacity: 1;
    transition: opacity 160ms ease;
  }
  .menu-list li {
    transform: none !important;
  }
}
html:has(body[data-menu-state="open"]),
body[data-menu-state="open"],
html:has(dialog.palette[open]) {
  overflow: hidden;
}

/* ---------- Palette de commandes ---------- */
.palette {
  width: min(680px, calc(100vw - 24px));
  max-width: none;
  max-height: min(640px, calc(100dvh - 96px));
  margin: max(10vh, 72px) auto auto;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.palette::backdrop {
  background: var(--scrim);
}
.palette[data-state="open"] {
  animation: palette-in 200ms var(--ease-out);
}
.palette[data-state="open"]::backdrop {
  animation: palette-fade 200ms var(--ease-out);
}
.palette[data-state="closing"] {
  animation: palette-out 140ms var(--ease-out) forwards;
}
.palette[data-state="closing"]::backdrop {
  animation: palette-fade 140ms var(--ease-out) reverse forwards;
}
@keyframes palette-in {
  from {
    opacity: 0;
    transform: scale(0.96) translateY(-8px);
  }
}
@keyframes palette-out {
  to {
    opacity: 0;
    transform: scale(0.97) translateY(-6px);
  }
}
@keyframes palette-fade {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .palette[data-state="open"],
  .palette[data-state="closing"] {
    animation-name: palette-fade-only;
  }
  @keyframes palette-fade-only {
    from {
      opacity: 0;
    }
  }
}
.palette-inner {
  display: flex;
  flex-direction: column;
  max-height: inherit;
}
.palette-head {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--line);
}
.palette-head > .icon {
  width: 20px;
  height: 20px;
  color: var(--accent-ink);
}
.palette-input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 1.0625rem;
  outline: none;
}
.palette-input::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.palette-input::-webkit-search-cancel-button {
  display: none;
}
.palette-head:focus-within {
  box-shadow: inset 0 -2px 0 var(--brand);
}
.palette-clear {
  width: 36px;
  height: 36px;
  border: 0;
}
.palette-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.palette-scopes {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.palette-list {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--space-2);
  scroll-padding: var(--space-6) 0 var(--space-2);
}
.palette-group + .palette-group {
  margin-top: var(--space-2);
}
.palette-group-label {
  padding: var(--space-3) var(--space-3) var(--space-2);
  color: var(--text-muted);
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.75rem;
}
.palette-option {
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 52px;
  padding: 8px var(--space-3);
  border-radius: 10px;
  cursor: pointer;
  scroll-margin: 8px;
}
.palette-option[aria-selected="true"] {
  background: var(--tint-brand);
  box-shadow: inset 3px 0 0 var(--brand);
}
@media (hover: hover) and (pointer: fine) {
  .palette-option:hover:not([aria-selected="true"]) {
    background: var(--surface-2);
  }
}
.palette-glyph {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--p, var(--second)) 20%, var(--surface));
  color: var(--p-ink, var(--second-ink));
}
.palette-glyph .icon {
  width: 18px;
  height: 18px;
}
.palette-text {
  min-width: 0;
}
.palette-title {
  overflow: hidden;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.palette-sub {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.palette-kind {
  color: var(--text-muted);
  font-family: var(--font-text);
  font-weight: 600;
  font-size: 0.6875rem;
  white-space: nowrap;
}
.palette mark {
  padding: 0 1px;
  border-radius: 3px;
  background: var(--pop);
  color: var(--on-pop);
}
.palette-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}
.palette-empty strong {
  display: block;
  margin-bottom: var(--space-2);
  color: var(--text);
  font-size: 1.0625rem;
}
.palette-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
  margin-top: var(--space-4);
}
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition:
    transform var(--dur-press) var(--ease-out),
    background-color var(--dur-hover) ease,
    border-color var(--dur-hover) ease;
}
.chip-btn:active {
  transform: scale(0.96);
}
@media (hover: hover) and (pointer: fine) {
  .chip-btn:hover {
    border-color: var(--brand);
    background: var(--tint-brand);
  }
}
.palette-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.75rem;
}
.palette-foot span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.palette-skeleton {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-2);
}
.palette-skeleton span {
  height: 52px;
  border-radius: 10px;
  background: linear-gradient(90deg, var(--surface-2) 0 30%, color-mix(in srgb, var(--surface-2) 60%, var(--surface)) 50%, var(--surface-2) 70%);
  background-size: 300% 100%;
  animation: shimmer 1.1s linear infinite;
}
@keyframes shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .palette-skeleton span {
    animation: none;
  }
}
@media (max-width: 639px) {
  .palette {
    width: 100vw;
    max-height: calc(100dvh - env(safe-area-inset-top) - 12px);
    height: calc(100dvh - env(safe-area-inset-top) - 12px);
    margin: auto 0 0;
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
  }
  .palette-inner {
    height: 100%;
  }
  .palette-foot {
    display: none;
  }
  .palette-list {
    padding-bottom: calc(env(safe-area-inset-bottom) + 12px);
  }
  .palette-input {
    font-size: 1rem;
  }
}

/* ---------- Retour en haut ---------- */
.to-top {
  position: fixed;
  right: max(var(--gutter), env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  z-index: var(--z-sticky);
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: var(--radius-pill);
  background: var(--on-brand);
  color: var(--brand);
  border: 1px solid rgb(165 111 227 / 0.5);
  box-shadow: var(--shadow-1);
  opacity: 0;
  transform: translateY(12px) scale(0.95);
  pointer-events: none;
  transition:
    opacity var(--dur-ui-exit) var(--ease-out),
    transform var(--dur-ui-exit) var(--ease-out);
}
.to-top[data-visible="true"] {
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition:
    opacity var(--dur-ui) var(--ease-out),
    transform var(--dur-ui) var(--ease-out);
}
.to-top:active {
  transform: scale(0.94);
}
.to-top .icon {
  width: 20px;
  height: 20px;
}

/* ---------- Reveal system ---------- */
@media (prefers-reduced-motion: no-preference) {
  .js [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition:
      opacity var(--dur-reveal) var(--ease-out),
      transform var(--dur-reveal) var(--ease-out);
    transition-delay: calc(var(--i, 0) * 60ms);
  }
  .js [data-reveal="wipe"] {
    opacity: 1;
    transform: none;
    clip-path: inset(100% 0 0 0);
    transition: clip-path 900ms var(--ease-in-out);
    transition-delay: calc(var(--i, 0) * 60ms);
  }
  .js [data-reveal="wipe"] > img:not([data-frame]) {
    transform: scale(1.08);
    transition: transform 1200ms var(--ease-out);
  }
  .js [data-reveal="line"] {
    opacity: 1;
    transform: none;
    clip-path: inset(0 100% 0 0);
    transition: clip-path 900ms var(--ease-in-out);
  }
  .js [data-reveal].is-in {
    opacity: 1;
    transform: none;
  }
  .js [data-reveal="wipe"].is-in,
  .js [data-reveal="line"].is-in {
    clip-path: inset(0 0 0 0);
  }
  .js [data-reveal="wipe"].is-in > img:not([data-frame]) {
    transform: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .js [data-reveal] {
    opacity: 0;
    transition: opacity 240ms ease;
  }
  .js [data-reveal].is-in {
    opacity: 1;
  }
}

/* Avec Motion (assets/js/motion.js) : les ressorts remplacent les transitions CSS.
   Sans Motion, le système CSS ci-dessus reste le repli. */
.has-motion [data-reveal],
.has-motion [data-reveal] > img {
  transition: none !important;
}

/* Barre de lecture (scroll-driven, amélioration progressive) */
.read-progress {
  position: fixed;
  inset: 0 0 auto;
  height: 2px;
  z-index: calc(var(--z-header) + 1);
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  pointer-events: none;
}
@supports (animation-timeline: scroll()) {
  .read-progress {
    animation: read-progress linear both;
    animation-timeline: scroll(root);
  }
}
@supports not (animation-timeline: scroll()) {
  .read-progress {
    display: none;
  }
}
@keyframes read-progress {
  to {
    transform: scaleX(1);
  }
}

/* ---------- Media frame & lightbox ---------- */
.frame {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-m);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.frame > img,
.frame > video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.zoomable {
  cursor: zoom-in;
}

.lightbox {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  overflow: hidden;
}
.lightbox::backdrop {
  background: rgb(9 7 13 / 0.92);
  opacity: 0;
  transition: opacity var(--dur-ui) var(--ease-out);
}
.lightbox[data-state="open"]::backdrop {
  opacity: 1;
}
.lightbox-inner {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: var(--space-4);
  height: 100%;
  padding: calc(env(safe-area-inset-top) + 64px) var(--gutter) calc(env(safe-area-inset-bottom) + 24px);
}
.lightbox-img {
  align-self: center;
  justify-self: center;
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-m);
  box-shadow: var(--shadow-1);
  object-fit: contain;
  transform-origin: 0 0;
}
.lightbox-caption {
  justify-self: center;
  max-width: 72ch;
  color: var(--silver);
  font-size: 0.9375rem;
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 12px);
  right: var(--gutter);
  color: #f6f3f7;
  border-color: rgb(246 243 247 / 0.3);
}

/* ---------- Footer ---------- */
.site-footer {
  padding: var(--space-9) 0 calc(var(--space-7) + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--space-7) var(--space-5);
}
.footer-brand {
  grid-column: 1 / span 5;
}
.footer-brand p {
  margin-top: var(--space-4);
  max-width: 36ch;
  color: var(--text-muted);
}
.footer-col {
  grid-column: span 3;
}
.footer-col:last-of-type {
  grid-column: span 4;
}
.footer-col h2 {
  margin-bottom: var(--space-4);
  font-family: var(--font-text);
  font-weight: 600;
  font-size: var(--step--1);
  letter-spacing: 0;
  color: var(--text-muted);
}
.footer-col ul {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.footer-col a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 36px;
  text-decoration: none;
  color: var(--text);
  transition: color var(--dur-hover) ease;
}
@media (hover: hover) and (pointer: fine) {
  .footer-col a:hover {
    color: var(--accent-ink);
  }
}
.footer-base {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-4);
  margin-top: var(--space-9);
  padding-top: var(--space-5);
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.875rem;
}
.footer-base a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  text-decoration: none;
}
@media (max-width: 768px) {
  .footer-brand,
  .footer-col,
  .footer-col:last-of-type {
    grid-column: 1 / -1;
  }
  .footer-col a {
    min-height: 44px;
  }
}

/* ---------- Page cover (sous-pages) ---------- */
.page-top {
  padding-top: calc(var(--header-h) + env(safe-area-inset-top) + clamp(40px, 7vw, 96px));
}
.back-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  color: var(--text-muted);
  font-size: 0.9375rem;
  text-decoration: none;
  transition: color var(--dur-hover) ease;
}
.back-link .icon {
  transition: transform var(--dur-hover) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .back-link:hover {
    color: var(--text);
  }
  .back-link:hover .icon {
    transform: translateX(-3px);
  }
}

/* ---------- Forms ---------- */
.field {
  display: grid;
  gap: var(--space-2);
}
.field label {
  font-weight: 600;
  font-size: 0.9375rem;
}
.field .hint {
  color: var(--text-muted);
  font-size: 0.875rem;
}
.field .error {
  color: var(--danger);
  font-size: 0.875rem;
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-s);
  background: var(--surface);
  color: var(--text);
  font-size: 1rem;
  transition: border-color var(--dur-hover) ease;
}
.textarea {
  min-height: 120px;
  resize: vertical;
}
.input::placeholder,
.textarea::placeholder {
  color: var(--text-muted);
  opacity: 1;
}
.input:focus-visible,
.select:focus-visible,
.textarea:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
  border-color: transparent;
}
.input[aria-invalid="true"],
.textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
.status {
  min-height: 1.5em;
  font-size: 0.9375rem;
  color: var(--text-muted);
}
.status[data-tone="success"] {
  color: var(--success);
}
.status[data-tone="error"] {
  color: var(--danger);
}

/* ---------- View transitions (entre pages) ---------- */
@view-transition {
  navigation: auto;
}
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root) {
    animation: vt-out 180ms var(--ease-out) both;
  }
  ::view-transition-new(root) {
    animation: vt-in 320ms var(--ease-out) both;
  }
  ::view-transition-group(*) {
    animation-duration: 420ms;
    animation-timing-function: var(--ease-in-out);
  }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*),
  ::view-transition-old(*),
  ::view-transition-new(*) {
    animation: none !important;
  }
}
@keyframes vt-out {
  to {
    opacity: 0;
  }
}
@keyframes vt-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}
.site-header {
  view-transition-name: site-header;
}

/* ---------- Print ---------- */
@media print {
  .site-header,
  .menu,
  .site-footer,
  .skip-link,
  .read-progress,
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
    color: #111;
  }
  .page-top {
    padding-top: 0;
  }
}

/* Raccourci clavier inutile sur écran tactile. */
@media (pointer: coarse) {
  .kbd[data-shortcut] {
    display: none;
  }
}

@media (max-width: 639px) {
  .palette-option {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .palette-kind {
    display: none;
  }
  .palette-meta {
    flex-wrap: wrap;
  }
}

/* Très petits écrans : un libellé long passe à la ligne plutôt que de déborder. */
@media (max-width: 400px) {
  .btn {
    white-space: normal;
    text-align: center;
    line-height: 1.25;
    padding-block: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .to-top,
  .to-top[data-visible="true"] {
    transform: none;
  }
}
