/* ==========================================================================
   Témonia · Musées — socle commun (accueil + musée)
   Jetons de design, typographie, éléments partagés.
   ========================================================================== */

:root {
  /* Papier et encre */
  --paper: #f5f1e8;
  --paper-2: #ece5d6;
  --paper-3: #e2d9c6;
  --ink: #16171b;
  --ink-2: #44454c;
  --muted: #76767d;
  --line: rgba(22, 23, 27, 0.12);
  --line-strong: rgba(22, 23, 27, 0.28);
  --night: #0d121c;
  --night-2: #151c2a;
  --on-night: #f3efe6;
  --on-night-2: rgba(243, 239, 230, 0.62);

  /* Charte Témonia */
  --temonia-marine: #002b5c;
  --temonia-rouge: #c4362a;
  --temonia-creme: #faf3e2;

  /* Accent : remplacé par le domaine UNESCO du musée (voir plus bas) */
  --accent: #b8322a;
  --accent-ink: #ffffff;
  --accent-soft: color-mix(in oklab, var(--accent) 14%, var(--paper));

  /* Familles */
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-text: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --f-ui: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;

  /* Rythme */
  --gutter: clamp(1rem, 4vw, 3rem);
  --section: clamp(5rem, 11vw, 10rem);
  --radius: 14px;
  --radius-sm: 8px;
  --measure: 66ch;
  --wide: 1240px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --topbar-h: 64px;
}

/* Une couleur par domaine UNESCO : c'est le premier levier de déclinaison des templates */
[data-domain="orales"]    { --accent: #2f4aa0; }
[data-domain="spectacle"] { --accent: #b8322a; }
[data-domain="festif"]    { --accent: #c96f12; }
[data-domain="nature"]    { --accent: #2e6a4c; }
[data-domain="artisanat"] { --accent: #8a5433; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #12141a;
    --paper-2: #1a1d25;
    --paper-3: #232733;
    --ink: #efebe2;
    --ink-2: #c9c5bc;
    --muted: #94939a;
    --line: rgba(239, 235, 226, 0.12);
    --line-strong: rgba(239, 235, 226, 0.28);
    --accent-soft: color-mix(in oklab, var(--accent) 22%, var(--paper));
  }
  :root:not([data-theme="light"]) [data-domain="orales"] { --accent: #7d95e6; }
  :root:not([data-theme="light"]) [data-domain="spectacle"] { --accent: #ec6a5c; }
  :root:not([data-theme="light"]) [data-domain="festif"] { --accent: #f0a050; }
  :root:not([data-theme="light"]) [data-domain="nature"] { --accent: #6cbf93; }
  :root:not([data-theme="light"]) [data-domain="artisanat"] { --accent: #d39a74; }
}
:root[data-theme="dark"] {
  --paper: #12141a;
  --paper-2: #1a1d25;
  --paper-3: #232733;
  --ink: #efebe2;
  --ink-2: #c9c5bc;
  --muted: #94939a;
  --line: rgba(239, 235, 226, 0.12);
  --line-strong: rgba(239, 235, 226, 0.28);
}

/* ---------- Remise à zéro légère ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 1rem); overflow-x: clip; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-text);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}
img, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--f-display); font-weight: 400; line-height: 1.05; letter-spacing: -0.015em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
figure { margin: 0; }
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { width: min(100% - 2 * var(--gutter), var(--wide)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Petits éléments partagés ---------- */
.kicker {
  font-family: var(--f-ui);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.42em 0.85em;
  border: 1px solid currentColor;
  border-radius: 999px;
  font-family: var(--f-ui);
  font-size: 0.78rem;
  font-weight: 500;
  line-height: 1.2;
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  background: var(--chip-dot, currentColor);
}
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  padding: 0.85em 1.3em;
  border-radius: 999px;
  font-family: var(--f-ui);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  background: var(--ink);
  color: var(--paper);
  transition: transform 0.35s var(--ease), background 0.3s;
}
.btn:hover { transform: translateY(-2px); background: var(--accent); color: var(--accent-ink); }
.btn--ghost { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn--ghost:hover { background: var(--ink); color: var(--paper); }
.icon { width: 1.15em; height: 1.15em; flex: none; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 50;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-inline: var(--gutter);
  color: var(--ink);
  transition: background 0.4s, color 0.4s, box-shadow 0.4s;
}
.topbar.is-solid {
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  box-shadow: 0 1px 0 var(--line);
}
.topbar.is-on-dark:not(.is-solid) { color: #fff; }
.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  text-decoration: none;
  font-family: var(--f-display);
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand b { font-weight: 600; }
.brand span {
  font-family: var(--f-ui);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  opacity: 0.7;
}
.topbar__title {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-family: var(--f-display);
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.4s, transform 0.5s var(--ease);
}
.topbar.is-solid .topbar__title { opacity: 1; transform: none; }
.topbar__actions { display: flex; gap: 0.4rem; margin-left: auto; }
.topbar__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  height: 40px;
  padding: 0 0.95rem;
  border-radius: 999px;
  font-family: var(--f-ui);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, currentColor 30%, transparent);
  transition: background 0.3s, color 0.3s;
}
.topbar__btn:hover { background: var(--ink); color: var(--paper); box-shadow: none; }
.topbar.is-on-dark:not(.is-solid) .topbar__btn:hover { background: #fff; color: #111; }
.topbar__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
@media (max-width: 640px) {
  .topbar__title { display: none; }
  .topbar__btn .label { display: none; }
  .topbar__btn { width: 40px; padding: 0; justify-content: center; }
}

/* ---------- Bulle de notification ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 90;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-ui);
  font-size: 0.9rem;
  transform: translate(-50%, 150%);
  transition: transform 0.5s var(--ease);
}
.toast.is-on { transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
