/*
 * Mosaïques — feuille de style principale.
 * Objectif : WCAG 2.2 AA (contrastes ≥ 4.5:1 pour le texte, focus visible,
 * cibles ≥ 24 px, respect de prefers-reduced-motion et prefers-color-scheme).
 *
 * @version L10-2.0
 */

/* ===== Jetons de conception ===== */
:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f0e9dd;
  --ink: #1f1b16;
  --muted: #5b5248;
  --line: #ddd2c2;
  --accent: #a8432a;
  --accent-hover: #8c3620;
  --accent-ink: #ffffff;
  --focus: #1a5b87;

  --ok: #1f6a3a;      --ok-bg: #e5f3e9;
  --warn: #8a4b00;    --warn-bg: #fdf0dc;
  --error: #a3221c;   --error-bg: #fbe5e3;
  --info: #1a5b87;    --info-bg: #e3eff7;

  /* Couleurs des tesselles décoratives */
  --tess-1: #c0573a;
  --tess-2: #d9a441;
  --tess-3: #6f7d3c;
  --tess-4: #2f6f73;
  --tess-5: #2e3f73;
  --tess-6: #e6d8bd;
  --grout: #e9e1d4;
  --tile-empty: #fffdf9;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(31 27 22 / 0.06), 0 6px 20px rgb(31 27 22 / 0.06);
  --container: 72rem;
  --gutter: clamp(1rem, 4vw, 2rem);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f;
    --surface: #1e1a16;
    --surface-2: #29231d;
    --ink: #f1ebe1;
    --muted: #bcb1a2;
    --line: #3b342b;
    --accent: #ea8a64;
    --accent-hover: #f3a585;
    --accent-ink: #1a110c;
    --focus: #7cc0ef;
    --ok: #7fd39b;    --ok-bg: #1b2e21;
    --warn: #f2bb66;  --warn-bg: #33270f;
    --error: #f4948d; --error-bg: #3a1b19;
    --info: #8cc6ee;  --info-bg: #142a3a;
    --tess-6: #4a4034;
    --grout: #2a241e;
    --tile-empty: #4a4239;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #15120f;
  --surface: #1e1a16;
  --surface-2: #29231d;
  --ink: #f1ebe1;
  --muted: #bcb1a2;
  --line: #3b342b;
  --accent: #ea8a64;
  --accent-hover: #f3a585;
  --accent-ink: #1a110c;
  --focus: #7cc0ef;
  --ok: #7fd39b;    --ok-bg: #1b2e21;
  --warn: #f2bb66;  --warn-bg: #33270f;
  --error: #f4948d; --error-bg: #3a1b19;
  --info: #8cc6ee;  --info-bg: #142a3a;
  --tess-6: #4a4034;
  --grout: #2a241e;
  --tile-empty: #4a4239;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 20px rgb(0 0 0 / 0.3);
  color-scheme: dark;
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 1rem/1.6 var(--font-body);
}

main { flex: 1; }
main:focus { outline: none; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(1.9rem, 4.5vw, 3rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.8rem); margin-top: 2rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--accent-hover); }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
code { background: var(--surface-2); padding: 0.05em 0.35em; border-radius: 4px; }
img, svg { max-width: 100%; }

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

.skip-link {
  position: absolute;
  left: 0.75rem;
  top: -4rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}
.skip-link:focus { top: 0.75rem; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.page { padding-block: 2.5rem 3rem; }

.lead { font-size: 1.15rem; color: var(--muted); max-width: 60ch; }

.eyebrow {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* ===== En-tête ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: relative;
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  margin-right: auto;
  padding-block: 0.5rem;
}
.brand:hover { color: var(--ink); }
.brand__logo { width: 1.75rem; height: 1.75rem; }
.brand__logo .t1 { fill: var(--tess-1); }
.brand__logo .t2 { fill: var(--tess-2); }
.brand__logo .t3 { fill: var(--tess-4); }
.brand__logo .t4 { fill: var(--tess-5); }

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--ink);
  text-decoration: none;
  font-weight: 500;
}
.site-nav a:hover { background: var(--surface-2); color: var(--ink); }
.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -3px 0 var(--accent);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}

.nav-toggle, .theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
}
.nav-toggle:hover, .theme-toggle:hover { background: var(--surface-2); }
.nav-toggle[hidden], .theme-toggle[hidden] { display: none; }
.theme-toggle svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }

.nav-toggle__bars,
.nav-toggle__bars::before,
.nav-toggle__bars::after {
  display: block;
  width: 1.1rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  position: relative;
}
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ""; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }

@media (max-width: 47.99rem) {
  .theme-toggle__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .has-nav-toggle .site-nav {
    display: none;
    order: 10;
    flex-basis: 100%;
    padding-bottom: 0.75rem;
  }
  .has-nav-toggle .site-nav.is-open { display: block; }
  .has-nav-toggle .site-nav ul { flex-direction: column; }
  .site-nav a[aria-current="page"] { box-shadow: inset 4px 0 0 var(--accent); border-radius: 0; }
}
@media (min-width: 48rem) {
  .nav-toggle { display: none !important; }
}

/* ===== Accueil ===== */
.hero {
  background:
    linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}
.hero__inner {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5rem);
}
@media (min-width: 56rem) {
  .hero__inner { grid-template-columns: 1.1fr 1fr; }
}
.hero__text h1 { max-width: 16ch; }

.tesserae {
  display: block;
  width: 100%;
  height: auto;
  background: var(--grout);
  padding: 6px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.tesserae .c1 { fill: var(--tess-1); }
.tesserae .c2 { fill: var(--tess-2); }
.tesserae .c3 { fill: var(--tess-3); }
.tesserae .c4 { fill: var(--tess-4); }
.tesserae .c5 { fill: var(--tess-5); }
.tesserae .c6 { fill: var(--tess-6); }

.notice {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  max-width: 60ch;
}

.features { padding-block: 2.5rem 4rem; }
.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 0.5rem;
  position: relative;
}
.feature::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 0.5rem;
  margin-bottom: 0.9rem;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--tess-1) 0 30%, transparent 30% 35%, var(--tess-2) 35% 65%, transparent 65% 70%, var(--tess-4) 70%);
}
.feature p { color: var(--muted); }

/* ===== Composants ===== */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-block: 1rem;
  box-shadow: var(--shadow);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.15rem;
  border: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.button--secondary { background: transparent; color: var(--accent); }
.button--secondary:hover { background: var(--surface-2); color: var(--accent-hover); }
.button--small { min-height: 2rem; padding: 0.25rem 0.7rem; font-size: 0.9rem; }

.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }
.actions form { margin: 0; }

.form { max-width: 32rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: 0.35rem; }
.field input, .field textarea, .field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.field textarea { resize: vertical; }
.field [aria-invalid="true"] { border-color: var(--error); border-width: 2px; }
.field__error { color: var(--error); font-weight: 600; margin: 0.35rem 0 0; }
.field .button { margin-top: 0.5rem; }
.copy-status { margin-left: 0.75rem; color: var(--muted); font-size: 0.9rem; }

.alert {
  padding: 0.8rem 1rem;
  border-radius: var(--radius-sm);
  border-left: 5px solid currentColor;
  margin-block: 1rem;
}
.alert--ok, .alert--success { background: var(--ok-bg); color: var(--ok); }
.alert--warn { background: var(--warn-bg); color: var(--warn); }
.alert--error { background: var(--error-bg); color: var(--error); }
.alert--info { background: var(--info-bg); color: var(--info); }
.alert strong, .alert code { color: inherit; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.1rem 0.55rem;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
}
.status--ok { background: var(--ok-bg); color: var(--ok); }
.status--warn { background: var(--warn-bg); color: var(--warn); }
.status--error { background: var(--error-bg); color: var(--error); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); }
thead th { background: var(--surface-2); font-size: 0.9rem; }
tbody th { font-weight: 600; }
.checks th[scope="row"] { width: 30%; }
.checks td:nth-child(2) { width: 9rem; }
.check-group h2 { font-size: 1.3rem; }

/* ===== Erreurs ===== */
.error-page { padding-block: clamp(3rem, 10vw, 6rem); text-align: center; }
.error-page .lead { margin-inline: auto; }
.error-page__code {
  font-family: var(--font-display);
  font-size: clamp(4rem, 14vw, 7rem);
  line-height: 1;
  margin: 0 0 0.5rem;
  color: var(--accent);
}
.debug { text-align: left; margin-top: 2rem; }
.debug pre { overflow-x: auto; background: var(--surface-2); padding: 1rem; border-radius: var(--radius-sm); font-size: 0.85rem; }

/* ===== Pied de page ===== */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
}
.site-footer__inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem;
}
.site-footer__links { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; list-style: none; margin: 0; padding: 0; }
.site-footer__links a { color: var(--muted); }
.site-footer__links a:hover { color: var(--ink); }
.site-footer__version { margin: 0; }
.version { font-family: var(--font-mono); font-size: 0.85em; }

/* ===== Mise en page des pages applicatives (lot 1) ===== */
.page--narrow { max-width: 44rem; }
.small { font-size: 0.9rem; color: var(--muted); }
.hint { font-size: 0.88rem; color: var(--muted); margin: 0.3rem 0 0; }
.empty { padding: 1.5rem; border: 2px dashed var(--line); border-radius: var(--radius); text-align: center; color: var(--muted); }

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-bottom: 1rem;
}
.page-header .lead { margin-bottom: 0; }
.page-header__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.two-cols {
  display: grid;
  gap: 1rem 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 22rem), 1fr));
  align-items: start;
  margin-block: 1.5rem;
}
.two-cols--tight { margin-block: 0.5rem 0; }
.two-cols > .card { margin: 0; }
.card > h2:first-child { margin-top: 0; }
[tabindex="-1"]:focus { outline: none; }
.card[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); }

.checklist { padding-left: 0; list-style: none; }
.checklist li { position: relative; padding-left: 1.6rem; margin-bottom: 0.6rem; }
.checklist li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.45em;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 2px;
  background: var(--tess-4);
}

/* Formulaires */
fieldset { border: 0; margin: 0 0 1rem; padding: 0; min-width: 0; }
legend { font-weight: 700; margin-bottom: 0.5rem; padding: 0; }
.field-row { display: flex; flex-wrap: wrap; gap: 0 1rem; }
.field-row > legend { flex-basis: 100%; }
.field-row > .field { flex: 1 1 7rem; }
.field-row > .hint, .field-row > .field--check { flex-basis: 100%; }
.field--check { display: flex; align-items: center; gap: 0.6rem; }
.field--check input { width: 1.25rem; height: 1.25rem; min-height: 0; margin: 0; accent-color: var(--accent); flex: none; }
.field--check label { margin: 0; font-weight: 500; }
.field.is-disabled { opacity: 0.6; }
.field input[type="file"] { padding: 0.45rem; }
.computed { font-weight: 600; min-height: 1.6em; }
.alert ul { margin: 0.25rem 0 0; padding-left: 1.2rem; }
.alert a { color: inherit; }
.alert p:last-child { margin-bottom: 0; }

.button--danger { background: var(--error); border-color: var(--error); color: #fff; }
.button--danger:hover { background: var(--error); border-color: var(--error); color: #fff; filter: brightness(0.9); }
:root[data-theme="dark"] .button--danger { color: #1a0d0c; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .button--danger { color: #1a0d0c; } }

/* Détails repliables (renommer, supprimer, afficher le lien) */
.inline-details { margin-top: 0.75rem; }
.inline-details > summary,
.reveal > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  min-height: 1.75rem;
  display: list-item;
}
.inline-details--danger > summary { color: var(--error); }
.inline-form { margin-top: 0.6rem; padding: 0.75rem; border-radius: var(--radius-sm); background: var(--surface-2); }
.inline-form label { display: block; font-weight: 600; margin-bottom: 0.3rem; }
.inline-form input[type="text"] {
  width: 100%;
  min-height: 2.5rem;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.6rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
.inline-form p { margin-bottom: 0.6rem; }

.reveal { margin: 1rem 0; }
.reveal__body {
  display: grid;
  gap: 1rem 2rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
  align-items: start;
  margin-top: 1rem;
}
.qr-figure { margin: 0; text-align: center; }
.qr-figure .qr { width: 12rem; height: 12rem; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.qr-figure figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.4rem; }

/* Grille des mosaïques */
.mosaic-grid {
  list-style: none;
  margin: 0 0 1rem;
  padding: 0;
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
}
.mosaic-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.mosaic-card__thumb {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  display: grid;
  place-items: center;
  padding: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.mosaic-card__thumb img { width: 100%; height: 100%; object-fit: contain; }
.mosaic-card__body { padding: 0.9rem 1rem 1rem; display: flex; flex-direction: column; gap: 0.25rem; }
.mosaic-card h3 { margin: 0 0 0.4rem; font-size: 1.1rem; overflow-wrap: anywhere; }
.mosaic-card h3 a { color: var(--ink); text-decoration: none; }
.mosaic-card h3 a:hover { text-decoration: underline; }
.mosaic-card__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.mosaic-card__actions form { margin: 0; }

.specs { margin: 0; font-size: 0.9rem; }
.specs > div { display: flex; gap: 0.5rem; }
.specs dt { color: var(--muted); min-width: 6.5rem; }
.specs dd { margin: 0; }

.hero__cta { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.25rem; }

/* ===== Choix du jeu de couleurs (formulaire de création) ===== */
.palette-choice { display: grid; gap: 0.4rem; }
.palette-choice legend { margin-bottom: 0.4rem; }
.palette-option { position: relative; }
.palette-option input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.palette-option label {
  display: grid;
  gap: 0.35rem;
  padding: 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.palette-option input:checked + label { border: 2px solid var(--accent); padding: calc(0.5rem - 1px) calc(0.7rem - 1px); box-shadow: inset 0 0 0 1px var(--accent); }
.palette-option input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.palette-option__name { font-weight: 600; }
.palette-strip { display: block; width: 100%; height: 0.9rem; border-radius: 3px; }

/* ===== Éditeur ===== */
.is-editor .site-footer { display: none; }
.is-editor main {
  flex: none;
  display: flex;
  flex-direction: column;
  height: calc(100vh - 4rem - 1px);
  height: calc(100dvh - 4rem - 1px);
  min-height: 34rem;
}
.is-editor main > .container { flex: none; }
.is-editor main > .container .alert { margin-block: 0.5rem; }
.editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.editor-stage { user-select: none; -webkit-user-select: none; }
.editor-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.5rem var(--gutter);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.editor-bar__title { flex: 1 1 14rem; min-width: 10rem; }
.editor-title {
  width: 100%;
  min-height: 2.4rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: 600 1.2rem/1.2 var(--font-display);
}
.editor-title:hover { border-color: var(--line); }
.editor-title:focus { border-color: var(--muted); background: var(--surface); }
.save-status { margin: 0; font-size: 0.88rem; color: var(--muted); min-width: 9rem; }
.save-status::before {
  content: "";
  display: inline-block;
  width: 0.6rem;
  height: 0.6rem;
  margin-right: 0.4rem;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: baseline;
}
.save-status[data-state="dirty"]::before, .save-status[data-state="saving"]::before { background: var(--warn); }
.save-status[data-state="error"] { color: var(--error); font-weight: 600; }
.save-status[data-state="error"]::before { background: var(--error); }

.toolbar { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.toolbar__sep { width: 1px; height: 1.6rem; background: var(--line); margin: 0 0.25rem; }
.tool-button {
  display: inline-grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.tool-button:hover:not(:disabled) { background: var(--surface-2); }
.tool-button:disabled { opacity: 0.4; cursor: default; }
.tool-button svg, .segmented svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.zoom-level { min-width: 3.5rem; text-align: center; font-variant-numeric: tabular-nums; font-size: 0.9rem; }

.draft-banner[hidden] { display: none; }
.draft-banner { margin: 0.5rem var(--gutter); display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; }
.draft-banner p { margin: 0; }
.draft-banner .actions { margin: 0; }

.editor-body {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr) 17rem;
  grid-template-rows: minmax(0, 1fr);
}
.editor-panel {
  min-height: 0;
  overflow-y: auto;
  padding: 0.75rem 1rem 1.5rem;
  background: var(--surface);
  font-size: 0.92rem;
}
.editor-panel--tools { border-right: 1px solid var(--line); }
.editor-panel--props { border-left: 1px solid var(--line); }
.editor-panel legend { font-size: 0.95rem; }
.editor-panel .field { margin-bottom: 0.6rem; }
.editor-panel .field input, .editor-panel .field select { min-height: 2.3rem; padding: 0.3rem 0.5rem; }
.editor-panel .field-row > .field { flex: 1 1 4rem; }
.editor-panel h2 { font-size: 1rem; margin: 0 0 0.4rem; font-family: var(--font-body); font-weight: 700; }
.props-form, .props-info { padding-bottom: 0.9rem; margin-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.props-form:last-child { border-bottom: 0; }
.props-info .specs dt { min-width: 5.5rem; }

.editor-stage { position: relative; min-width: 0; min-height: 0; overflow: hidden; background: var(--surface-2); }
.editor-stage canvas { position: absolute; inset: 0; display: block; touch-action: none; }
.editor-stage canvas:focus { outline: none; }
.editor-stage canvas:focus-visible { box-shadow: inset 0 0 0 3px var(--focus); }

.segmented, .swatches, .anchor-grid, .palette-option { position: relative; }
.segmented { display: grid; gap: 0.3rem; }
.segmented input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segmented label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2.4rem;
  padding: 0.3rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 500;
}
.segmented input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.segmented input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.tool-group, .color-group { margin-bottom: 1rem; }

.swatches { display: grid; gap: 0.2rem; }
.swatches input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch {
  display: grid;
  grid-template-columns: 1.6rem 1.2rem 1fr;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.2rem;
  padding: 0.2rem 0.4rem;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.swatch:hover { background: var(--surface-2); }
.swatch svg { width: 1.6rem; height: 1.6rem; display: block; filter: drop-shadow(0 0 0.5px var(--muted)); }
.swatch__symbol { text-align: center; color: var(--muted); }
.swatch__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swatches input:checked + .swatch { border-color: var(--accent); background: var(--surface-2); font-weight: 600; }
.swatches input:focus-visible + .swatch { outline: 3px solid var(--focus); outline-offset: 1px; }

.anchor-picker legend { font-weight: 500; font-size: 0.88rem; }
.anchor-grid { display: grid; grid-template-columns: repeat(3, 2rem); gap: 0.2rem; margin-bottom: 0.4rem; }
.anchor-grid input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.anchor-grid label {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  color: var(--muted);
}
.anchor-grid input:checked + label { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.anchor-grid input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 1px; }

.dialog {
  max-width: min(32rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}
.dialog--wide { max-width: min(46rem, calc(100vw - 2rem)); }
.dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.dialog h2 { margin-top: 0; }
.dialog .actions { margin-top: 1.25rem; }
.shortcuts th { white-space: nowrap; }
kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0.05em 0.4em;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--surface-2);
  font: 0.85em var(--font-mono);
  text-align: center;
}

@media (max-width: 64rem) {
  .is-editor main { flex: 1; height: auto; min-height: 0; }
  .editor { height: auto; min-height: 0; }
  .editor-body { grid-template-columns: 1fr; grid-template-rows: auto; }
  .editor-stage { height: 65vh; height: 65dvh; min-height: 20rem; order: -1; }
  .editor-panel--tools, .editor-panel--props { border: 0; border-top: 1px solid var(--line); overflow: visible; }
  .editor-panel--tools .swatches { grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); }
  .is-editor .site-footer { display: block; }
}

.flash { transition: opacity 0.4s ease, transform 0.4s ease; }
.flash.is-leaving { opacity: 0; transform: translateY(-0.5rem); }

/* ===== Jeux de couleurs (lot 3) ===== */
html:not(.js) .js-only { display: none !important; }
html.js .nojs-only { display: none !important; }
.breadcrumb { margin-bottom: 0.5rem; font-size: 0.95rem; }

.palette-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: 0.6rem; }
.palette-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.palette-item.is-dragging, .color-row.is-dragging { opacity: 0.6; box-shadow: var(--shadow); border-color: var(--accent); }
.palette-item__main { flex: 1 1 16rem; min-width: 0; }
.palette-item__main h3 { margin: 0 0 0.35rem; font-size: 1.05rem; }
.palette-item__main h3 a { color: var(--ink); }
.palette-item__main .palette-strip { height: 1.1rem; }
.palette-item__main p { margin: 0.35rem 0 0; }
.palette-item__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.palette-item__actions form { margin: 0; }
.palette-item__actions .inline-details { margin: 0; }
.drag-handle {
  align-self: stretch;
  width: 1.75rem;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: grab;
  touch-action: none;
}
.drag-handle:hover { background: var(--surface-2); }

.palette-form__head { display: grid; gap: 1rem 2rem; grid-template-columns: minmax(0, 24rem) minmax(0, 1fr); align-items: end; }
@media (max-width: 40rem) { .palette-form__head { grid-template-columns: 1fr; } }
.palette-preview .palette-strip { height: 2.6rem; border-radius: var(--radius-sm); }
.color-count { font-weight: 600; }

.color-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.color-row {
  display: grid;
  grid-template-columns: 1.75rem 1.6rem minmax(0, 1fr) auto;
  grid-template-areas: "handle num fields actions" "handle num warning actions";
  align-items: start;
  gap: 0 0.6rem;
  padding: 0.6rem 0.75rem 0.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.color-row.has-warning { border-color: var(--warn); }
.color-row > .drag-handle { grid-area: handle; }
.color-row__num { grid-area: num; padding-top: 2rem; font-weight: 700; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.color-row__fields {
  grid-area: fields;
  display: grid;
  gap: 0 0.6rem;
  grid-template-columns: minmax(10rem, 1.3fr) minmax(8rem, 1.5fr) 4.5rem minmax(6rem, 1fr) minmax(7rem, 1fr) 5.5rem 5.5rem;
}
.color-row__fields .field { margin-bottom: 0.4rem; }
.color-row__fields label { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.15rem; }
.color-row__fields input { min-height: 2.4rem; padding: 0.3rem 0.5rem; }
.color-row__warning { grid-area: warning; margin: 0 0 0.4rem; color: var(--warn); font-size: 0.88rem; font-weight: 600; }
.color-row__warning:empty { display: none; }
.color-row__actions, .color-row > .field--check { grid-area: actions; display: flex; gap: 0.25rem; padding-top: 1.55rem; }
.color-input { display: flex; gap: 0.35rem; }
.color-input input[type="color"] {
  flex: none;
  width: 2.6rem;
  height: 2.4rem;
  padding: 0.15rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}
.color-input input[type="text"] { font-family: var(--font-mono); }
@media (max-width: 72rem) {
  .color-row__fields { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }
  .color-row__fields .field--color, .color-row__fields .field--name { grid-column: span 2; }
}
@media (max-width: 40rem) {
  .color-row { grid-template-columns: 1.6rem minmax(0, 1fr); grid-template-areas: "num fields" "num warning" "num actions"; }
  .color-row > .drag-handle { display: none; }
  .color-row__actions, .color-row > .field--check { padding-top: 0; padding-bottom: 0.5rem; }
}
.palette-form__actions { position: sticky; bottom: 0; padding: 0.75rem 0; background: var(--bg); border-top: 1px solid var(--line); }

.color-table td, .color-table th { vertical-align: middle; }
.swatch-cell { width: 1.6rem; height: 1.6rem; display: block; filter: drop-shadow(0 0 0.5px var(--muted)); }

.palette-panel { margin-bottom: 1rem; padding-bottom: 0.9rem; border-bottom: 1px solid var(--line); }
.palette-panel h2 { font: 700 0.95rem/1.3 var(--font-body); margin: 0 0 0.2rem; }
.palette-panel__name { margin: 0 0 0.4rem; font-weight: 600; }
.palette-panel__status { margin: 0 0 0.5rem; padding: 0.4rem 0.55rem; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn); font-size: 0.86rem; }
.palette-panel__actions { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.palette-choice--dialog { max-height: 45vh; overflow-y: auto; padding: 0.2rem; }
.dialog fieldset { margin-bottom: 1rem; }

/* ===== Outils de dessin (lot 4) ===== */
.segmented--grid { grid-template-columns: 1fr 1fr; }
.segmented--grid label { min-height: 2.25rem; padding: 0.25rem 0.45rem; gap: 0.35rem; font-size: 0.88rem; }
.segmented--grid svg { flex: none; }
.tool-options { margin: 0 0 1rem; padding: 0.75rem 0 0.9rem; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tool-options__title { font: 700 0.95rem/1.3 var(--font-body); margin: 0 0 0.6rem; }
.tool-options fieldset { margin-bottom: 0.6rem; }
.tool-options legend { font-size: 0.9rem; font-weight: 600; margin-bottom: 0.25rem; }
.tool-options .field--check { margin-bottom: 0.3rem; }
.tool-options .field--check label { font-size: 0.88rem; }
.tool-options .hint { margin-top: 0.2rem; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.6rem; }
.gradient-stops { margin: 0 0 0.4rem; padding-left: 1.4rem; display: grid; gap: 0.3rem; }
.gradient-stops li { display: flex; gap: 0.3rem; align-items: center; }
.gradient-stops select {
  flex: 1;
  min-width: 0;
  min-height: 2.2rem;
  padding: 0.2rem 0.4rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 0.88rem;
}
.gradient-points .field-row > .field { flex: 1 1 5rem; }
.gradient-points input { width: 100%; min-height: 2.2rem; padding: 0.2rem 0.4rem; }
.gradient-points label { font-size: 0.82rem; }

/* ===== Outil Texte (lot 5) ===== */
.segmented--row { grid-template-columns: repeat(3, 1fr); }
.segmented--row label { justify-content: center; min-height: 2.1rem; padding: 0.2rem 0.3rem; font-size: 0.86rem; }
.tool-options textarea {
  width: 100%;
  min-height: 4.5rem;
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.tool-options input[type="range"] { width: 100%; accent-color: var(--accent); }
.tool-options .field-row > .field { flex: 1 1 5rem; }
.text-info { font-size: 0.86rem; color: var(--muted); margin: 0.4rem 0; }
.text-info:empty { display: none; }

/* ===== Matériel et plan PDF (lot 6) ===== */
.field--inline { display: flex; align-items: center; gap: 0.6rem; justify-content: space-between; }
.field--inline label { margin: 0; }
.input-suffix { display: inline-flex; align-items: center; gap: 0.3rem; }
.input-suffix input { width: 4.5rem; text-align: right; }
.material-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin: 0.5rem 0; }
.material-table th, .material-table td { padding: 0.25rem 0.3rem; border-bottom: 1px solid var(--line); text-align: left; font-weight: normal; vertical-align: middle; }
.material-table thead th { color: var(--muted); font-size: 0.78rem; }
.material-table tbody th { display: flex; align-items: center; gap: 0.45rem; }
.material-table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.material-swatch {
    --swatch: #ccc;
    display: inline-grid; place-items: center; flex: none;
    width: 1.35rem; height: 1.35rem; border-radius: 3px;
    background: var(--swatch); border: 1px solid rgb(0 0 0 / 0.25);
    font-size: 0.75rem; line-height: 1; color: #fff;
    text-shadow: 0 0 2px #000, 0 0 1px #000;
}
.material #m-vide { margin: 0.4rem 0; }
.material__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.pdf-options { display: grid; gap: 0.8rem; }
.pdf-options fieldset { margin: 0; }
.pdf-estimate { margin: 0.9rem 0 0.3rem; padding: 0.55rem 0.7rem; border-radius: 6px; background: var(--surface-2); font-weight: 600; }
.pdf-estimate[data-state="error"] { color: var(--error); background: var(--error-bg); }

/* ===== Galerie, publication et modération (lot 7) ===== */
.optional { font-weight: normal; color: var(--muted); font-size: 0.9em; }
.card--danger { border-color: color-mix(in srgb, var(--error) 45%, var(--line)); }
.card--danger > h2 { color: var(--error); }
.card + .card { margin-top: 1.25rem; }
.copyable { user-select: all; overflow-wrap: anywhere; }
.pre-line { white-space: pre-line; overflow-wrap: anywhere; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.form--narrow { max-width: 26rem; }
.field--trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.field--check label strong { font-weight: 650; }
.license-choice .field--check { align-items: flex-start; margin-bottom: 0.4rem; }
.license-choice .field--check input { margin-top: 0.15rem; }

.badge {
    display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px;
    font-size: 0.78rem; font-weight: 600; line-height: 1.5; vertical-align: middle;
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--error { background: var(--error-bg); color: var(--error); }
.publication-state { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.3rem 0 0; }
.publication-state__note { color: var(--warn); }
.orphan { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; padding: 0.5rem 0; border-top: 1px solid var(--line); }
.orphan form { margin: 0; }

.publish { display: grid; gap: 1.25rem; grid-template-columns: minmax(0, 16rem) minmax(0, 1fr); align-items: start; margin-bottom: 1.25rem; }
.publish__preview { margin: 0; }
.publish__preview img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem; }
.publish__preview figcaption { font-size: 0.88rem; color: var(--muted); margin-top: 0.35rem; }
.publish__status > :first-child { margin-top: 0; }
.publish__status ul { padding-left: 1.2rem; }
@media (max-width: 40rem) { .publish { grid-template-columns: 1fr; } .publish__preview { max-width: 18rem; } }

/* Galerie */
.gallery-filters {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem; margin-bottom: 1rem;
}
.gallery-filters .field { margin: 0; flex: 1 1 11rem; }
.gallery-filters .field:first-of-type { flex: 3 1 16rem; }
.gallery-filters__actions { display: flex; gap: 0.5rem; }
.gallery-filters--compact { padding: 0.75rem 1rem; }
.gallery-count { color: var(--muted); margin: 0 0 1rem; }
.gallery-grid {
    list-style: none; margin: 0 0 1.5rem; padding: 0;
    display: grid; gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 14rem), 1fr));
}
.gallery-card {
    position: relative; display: flex; flex-direction: column;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
    transition: box-shadow 0.15s, transform 0.15s;
}
.gallery-card:hover, .gallery-card:focus-within { box-shadow: var(--shadow); transform: translateY(-2px); }
.gallery-card__link { display: flex; flex-direction: column; color: var(--ink); text-decoration: none; }
.gallery-card__link::after { content: ""; position: absolute; inset: 0; } /* toute la carte est cliquable */
.gallery-card__link:focus-visible { outline: none; }
/* Focus dessiné sur la surface cliquable (toute la carte), sans dépendre de :has() */
.gallery-card__link:focus-visible::after { outline: 3px solid var(--focus); outline-offset: -3px; border-radius: var(--radius); } /* à l’intérieur : la carte masque ce qui déborde */
.gallery-card__thumb { aspect-ratio: 4 / 3; background: var(--surface-2); display: grid; place-items: center; padding: 0.6rem; border-bottom: 1px solid var(--line); }
.gallery-card__thumb img { width: 100%; height: 100%; object-fit: contain; }
.gallery-card__title { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; padding: 0.7rem 0.9rem 0; overflow-wrap: anywhere; }
.gallery-card__meta { margin: 0.2rem 0 0; padding: 0 0.9rem 0.8rem; font-size: 0.85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0 0.7rem; }

.pagination ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.35rem; justify-content: center; align-items: center; }
.pagination a, .pagination [aria-current] {
    display: inline-block; min-width: 2.5rem; padding: 0.45rem 0.7rem; text-align: center;
    border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); text-decoration: none;
}
.pagination [aria-current] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }

/* Page publique d'une mosaïque */
.public-mosaic__header h1 { margin-bottom: 0.2rem; overflow-wrap: anywhere; }
.public-mosaic__byline, .public-mosaic__origin { margin: 0.1rem 0; color: var(--muted); }
.public-mosaic__layout { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 3fr) minmax(16rem, 2fr); align-items: start; margin: 1.25rem 0; }
.public-mosaic__preview { margin: 0; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; display: grid; place-items: center; }
.public-mosaic__preview img { width: 100%; height: auto; max-height: 75vh; object-fit: contain; }
.public-mosaic__preview.is-tall img { width: auto; max-width: 100%; }
.public-mosaic__side { display: flex; flex-direction: column; gap: 1rem; }
.public-mosaic__actions .hint { margin: 0.4rem 0 0; }
.public-mosaic__description { border-top: 1px solid var(--line); padding-top: 0.75rem; overflow-wrap: anywhere; }
.public-mosaic__description p { margin: 0 0 0.6rem; }
.public-mosaic__footer { margin-top: 1.5rem; text-align: right; font-size: 0.9rem; }
.report-link { color: var(--muted); }
.material-swatch-svg { width: 1.1rem; height: 1.1rem; vertical-align: -0.2rem; margin-right: 0.15rem; }
.material-symbol { display: inline-block; width: 1.1rem; text-align: center; color: var(--muted); }
.public-mosaic .material-table tbody th { display: table-cell; }
.material-table tfoot th, .material-table tfoot td { font-weight: 700; border-bottom: 0; }
@media (max-width: 52rem) { .public-mosaic__layout { grid-template-columns: 1fr; } }

/* Administration */
.stats { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0 0 1.25rem; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.6rem 1rem; min-width: 9rem; }
.stats dt { color: var(--muted); font-size: 0.88rem; }
.stats dd { margin: 0; font-size: 1.5rem; font-weight: 700; }
.tabs ul { list-style: none; margin: 0 0 1rem; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.tabs a { display: block; padding: 0.55rem 0.9rem; text-decoration: none; color: var(--ink); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }
.tabs a[aria-current] { background: var(--surface); border: 1px solid var(--line); border-bottom-color: var(--surface); margin-bottom: -1px; font-weight: 700; }
.tabs__count { color: var(--muted); font-weight: normal; }
.moderation-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.moderation-item { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0.9rem; }
.moderation-item.is-hidden { border-style: dashed; }
.moderation-item__thumb img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: var(--surface-2); border-radius: var(--radius-sm); }
.moderation-item__title { font-size: 1.1rem; margin: 0 0 0.2rem; display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; overflow-wrap: anywhere; }
.moderation-item__actions { display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: flex-start; margin-top: 0.6rem; }
.moderation-item__actions form { margin: 0; }
.report-list { margin: 0.5rem 0 0; padding: 0.6rem 0.8rem 0.6rem 1.8rem; background: var(--error-bg); border-radius: var(--radius-sm); font-size: 0.92rem; }
.report-list li + li { margin-top: 0.35rem; }
@media (max-width: 36rem) { .moderation-item { grid-template-columns: 1fr; } .moderation-item__thumb { max-width: 12rem; } }

/* ===== Pages d'information, accueil, erreurs (lot 8) ===== */
.page--prose { max-width: 52rem; }
.page--prose > section { margin-top: 2.5rem; scroll-margin-top: 1rem; }
.page--prose > section > h2 { border-bottom: 1px solid var(--line); padding-bottom: 0.35rem; }
.page--prose h3 { margin: 1.5rem 0 0.5rem; font-size: 1.15rem; }
.page--prose p, .page--prose li { max-width: 70ch; }
.page--prose li + li { margin-top: 0.35rem; }
.page-updated { margin-top: 3rem; color: var(--muted); }
:target { scroll-margin-top: 1rem; }

.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; }
.toc h2 { font-size: 1rem; margin: 0 0 0.4rem; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.toc ol { margin: 0; padding-left: 1.4rem; columns: 2 16rem; column-gap: 2rem; }
.toc li { break-inside: avoid; margin: 0.15rem 0; }

.data-entry { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.25rem; margin: 1rem 0; }
.data-entry h3 { margin-top: 0; }
.data-entry dl { margin: 0; display: grid; gap: 0.5rem; }
.data-entry dl > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 0.75rem; }
.data-entry dt { font-weight: 650; color: var(--muted); }
.data-entry dd { margin: 0; }
@media (max-width: 36rem) { .data-entry dl > div { grid-template-columns: 1fr; gap: 0.1rem; } }

.data-table { width: 100%; border-collapse: collapse; font-size: 0.92rem; background: var(--surface); }
.data-table caption { text-align: left; font-weight: 650; padding: 0 0 0.5rem; }
.data-table th, .data-table td { text-align: left; vertical-align: top; padding: 0.55rem 0.65rem; border: 1px solid var(--line); }
.data-table thead th { background: var(--surface-2); }
.data-table code { white-space: normal; overflow-wrap: anywhere; }
.data-table tbody th { min-width: 10rem; }

.rights-actions { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); margin-top: 1rem; }
.rights-actions > div { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.9rem 1rem; display: flex; flex-direction: column; }
.rights-actions > div > :last-child { margin-top: auto; }
.rights-actions h3, .rights-browser h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.rights-actions p { font-size: 0.92rem; }
.rights-browser { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px solid var(--line); }

.legal-address { font-style: normal; line-height: 1.6; padding-left: 1rem; border-left: 3px solid var(--line); }

.definitions { margin: 1rem 0; display: grid; gap: 0.6rem; }
.definitions > div { display: grid; grid-template-columns: 13rem minmax(0, 1fr); gap: 1rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.definitions dt { font-weight: 650; }
.definitions dd { margin: 0; }
@media (max-width: 36rem) { .definitions > div { grid-template-columns: 1fr; gap: 0.2rem; } }

.steps { list-style: none; counter-reset: step; padding: 0; margin: 1rem 0; display: grid; gap: 0.75rem; }
.steps > li { counter-increment: step; position: relative; padding: 0.9rem 1rem 0.9rem 3.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); max-width: none; }
.steps > li::before {
    content: counter(step); position: absolute; left: 1rem; top: 0.9rem;
    width: 1.8rem; height: 1.8rem; border-radius: 6px; display: grid; place-items: center;
    background: var(--accent); color: var(--accent-ink); font-weight: 700;
}
.steps h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.steps p { margin: 0; }

.faq { border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); margin: 0.5rem 0; }
.faq > summary { cursor: pointer; padding: 0.75rem 1rem; font-weight: 650; }
.faq > p { margin: 0; padding: 0 1rem 0.9rem; }
.faq[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: 0.7rem; }

/* Accueil */
.how { padding-block: 2.5rem 0.5rem; }
.how__steps { list-style: none; counter-reset: how; margin: 0; padding: 0; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.how__steps > li { counter-increment: how; padding: 1rem 1.25rem; border-top: 4px solid var(--tess-1); background: var(--surface); border-radius: 0 0 var(--radius) var(--radius); }
.how__steps > li:nth-child(2) { border-top-color: var(--tess-2); }
.how__steps > li:nth-child(3) { border-top-color: var(--tess-4); }
.how__steps h3 { margin: 0 0 0.35rem; }
.how__steps h3::before { content: counter(how) ". "; color: var(--muted); }
.how__steps p { margin: 0; }
.home-gallery { padding-block: 2.5rem 0; }
.section-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.5rem 1rem; margin-bottom: 1rem; }
.section-heading h2 { margin: 0; }
.gallery-grid--home { grid-template-columns: repeat(auto-fill, minmax(min(100%, 11rem), 1fr)); }
.quick-links { padding-block: 0 4rem; }
.quick-links__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.quick-links__list a { display: flex; flex-direction: column; gap: 0.2rem; height: 100%; padding: 0.9rem 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--ink); }
.quick-links__list a:hover { border-color: var(--accent); }
.quick-links__list strong { color: var(--accent); }
.quick-links__list span { font-size: 0.9rem; color: var(--muted); }
.quick-links__privacy { margin: 1.25rem 0 0; text-align: center; color: var(--muted); }

/* Pages d'erreur */
.error-page__links { list-style: none; margin: 1.5rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }

/* ===== Import d'image (lot 10) ===== */
.dialog--image { width: min(64rem, calc(100vw - 2rem)); max-width: min(64rem, calc(100vw - 2rem)); }
.image-drop {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem;
    padding: 1rem; border: 2px dashed var(--line); border-radius: var(--radius); background: var(--surface-2);
}
.image-drop.is-over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.image-drop input[type="file"]:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.image-drop__name { flex-basis: 100%; font-weight: 600; }
.image-work { margin-top: 1rem; }
.image-panes { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); }
.image-pane { margin: 0; }
.image-pane figcaption { font-weight: 650; margin-bottom: 0.4rem; }
.image-source, .image-preview {
    position: relative; display: grid; place-items: center; min-height: 12rem;
    background: repeating-conic-gradient(var(--surface-2) 0 25%, var(--surface) 0 50%) 0 0 / 16px 16px;
    border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.image-source canvas { display: block; }
.image-source { place-items: start; justify-items: start; width: fit-content; max-width: 100%; }
.crop-box {
    position: absolute; box-sizing: border-box; cursor: move; touch-action: none;
    border: 2px solid #fff; outline: 1px solid rgb(0 0 0 / 0.6);
    box-shadow: 0 0 0 9999px rgb(0 0 0 / 0.45);
}
.crop-box:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.crop-box[aria-disabled="true"] { cursor: default; }
.crop-box[aria-disabled="true"] .crop-box__handle { display: none; }
.crop-box__handle {
    position: absolute; right: -0.55rem; bottom: -0.55rem; width: 1.1rem; height: 1.1rem; cursor: nwse-resize;
    background: #fff; border: 2px solid #1f1b16; border-radius: 3px;
}
.image-preview canvas { display: block; max-width: 100%; }
.image-options { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); margin-top: 1rem; }
.image-options fieldset { margin: 0; }
.image-options .field--inline input[type="range"], .image-pane input[type="range"] { flex: 1; min-width: 6rem; accent-color: var(--accent); }
.image-options output, .image-pane output { min-width: 3.2rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ===== Mouvements réduits ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ===== Contraste renforcé ===== */
@media (prefers-contrast: more) {
  :root { --line: var(--muted); }
  .button--secondary, .nav-toggle, .theme-toggle { border-width: 2px; }
}
