/* Design tokens of the Citadelle charter (DA § 2 to § 4). Light by default, dark only through prefers-color-scheme. */
:root {
  color-scheme: light dark;
  --fond: #F7F4EE; --fond-lateral: #F2EEE6; --carte: #FCFAF6; --puce: #EFE9DF;
  --bordure: #E6DFD3; --bordure-forte: #8A8172;
  --texte: #0F1B2D; --courant: #3D372E; --attenue: #6B6357;
  --accent: #2F5BB8; --accent-vif: #4F7FE0; --accent-texte: #2F5BB8; --sur-accent: #FCFAF6; --accent-doux: #E3EBFA;
  --bois: #C69A6B; --bois-doux: #F3E9DC; --bois-texte: #7A5418;
  --succes: #4D6B4F; --succes-doux: #E4EAE0; --danger: #8C4A3C; --danger-doux: #F2E6E1; --alerte: #7A5418; --alerte-doux: #F3E8D4;
  --nuit: #0F1B2D; --sur-nuit: #F7F4EE; --sur-nuit-doux: #CFC6B6; --accent-nuit: #8FB0F2;
  --action: #0F1B2D; --sur-action: #F7F4EE; --plan: #BEB4A2; --nuit-ligne: #22324C; --nuit-puce: #1A2A42;

  --r-s: 10px; --r-m: 14px; --r-b: 16px; --r-c: 22px; --r-h: 26px; --pilule: 999px;
  --lecture: 65ch; --page: 1200px; --marge: var(--space-7); --cible: 44px; --entete: 64px;

  /* Spacing scale, 4 px base; the last three grow with the viewport from 360 to 1440 px. */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px; --space-6: 24px; --space-7: 32px;
  --space-8: clamp(32px, 26.5px + 1.5vw, 48px);
  --space-9: clamp(40px, 34px + 1.6vw, 56px);
  --space-10: clamp(56px, 45px + 3vw, 88px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0B1422; --fond-lateral: #0B1422; --carte: #0F1B2D; --puce: #172338;
    --bordure: #1F2C42; --bordure-forte: #5B6F8F;
    --texte: #F7F4EE; --courant: #DCD5C8; --attenue: #A39A8B;
    --accent: #8FB0F2; --accent-vif: #8FB0F2; --accent-texte: #8FB0F2; --sur-accent: #0B1422; --accent-doux: #16284A;
    --bois-doux: #2A2219; --bois-texte: #C69A6B;
    --succes: #9CC7A0; --succes-doux: #18281E; --danger: #D9A08F; --danger-doux: #2E1F1B; --alerte: #E3C08A; --alerte-doux: #2E2415;
    --nuit: #132644;
    --action: #F7F4EE; --sur-action: #0B1422; --plan: #22324C; --nuit-ligne: #2A4068; --nuit-puce: #1D3557;
  }
}

/* The back office keeps its own light/dark switch (cookie), over the same tokens. */
.adm[data-theme="sombre"] {
  --fond: #0B1422; --fond-lateral: #0F1B2D; --carte: #0F1B2D; --puce: #172338;
  --bordure: #1F2C42; --bordure-forte: #5B6F8F;
  --texte: #F7F4EE; --courant: #DCD5C8; --attenue: #A39A8B;
  --accent: #8FB0F2; --accent-texte: #8FB0F2; --sur-accent: #0B1422;
  --succes: #9CC7A0; --danger: #D9A08F;
  --action: #F7F4EE; --sur-action: #0B1422; --plan: #22324C;
}
.adm[data-theme="clair"] {
  --fond: #F7F4EE; --fond-lateral: #F2EEE6; --carte: #FCFAF6; --puce: #EFE9DF;
  --bordure: #E6DFD3; --bordure-forte: #8A8172;
  --texte: #0F1B2D; --courant: #3D372E; --attenue: #6B6357;
  --accent: #2F5BB8; --accent-texte: #2F5BB8; --sur-accent: #FCFAF6;
  --succes: #4D6B4F; --danger: #8C4A3C;
  --action: #0F1B2D; --sur-action: #F7F4EE; --plan: #BEB4A2;
}

/* A Nuit band is a local re-reading of the same tokens. */
.surface-nuit, .surface-nuit-profonde, .cta-final {
  --fond: var(--nuit); --texte: var(--sur-nuit); --courant: var(--sur-nuit-doux); --attenue: var(--sur-nuit-doux);
  --accent-texte: var(--accent-nuit); --bordure: #2B3C57; --bordure-forte: #5B6F8F; --puce: var(--nuit-puce);
  --succes: #9CC7A0; --succes-doux: #18281E; --alerte: #E3C08A; --alerte-doux: #2E2415; --bois-doux: #2A2219; --bois-texte: #C69A6B;
  background: var(--fond); color: var(--courant);
}
.surface-calcaire { background: var(--fond); color: var(--courant); }
.surface-sable { background: var(--fond-lateral); color: var(--courant); }

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
dialog { margin: auto; }
html { background: var(--fond); color: var(--courant); font: 400 16px/1.6 Libron, serif; -webkit-text-size-adjust: 100%; }
body { position: relative; isolation: isolate; min-height: 100vh; }
.fond-plan { position: absolute; inset: 0 0 auto 0; height: 520px; overflow: clip; pointer-events: none; z-index: -1; color: var(--plan); }
.plan { position: absolute; top: -94px; left: -94px; width: 520px; height: 520px; color: var(--plan); rotate: var(--tour-base, 0deg); }
@media (max-width: 760px) { .fond-plan { height: 300px; } .plan { top: -54px; left: -54px; width: 300px; height: 300px; } }
.tour-1 { --tour-base: 22.5deg; --tour-citadelle: 36deg; }
.tour-2 { --tour-base: 11.25deg; --tour-citadelle: 18deg; }
h1, h2, h3 { color: var(--texte); font-weight: 700; text-wrap: balance; }
h1 { font-size: 40px; line-height: 1.15; }
h2 { font-size: 28px; line-height: 1.2; }
h3 { font-size: 22px; line-height: 1.25; }
p { max-width: var(--lecture); }
a { color: var(--accent-texte); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent-texte); outline-offset: 3px; border-radius: var(--r-s); }
address { font-style: normal; }
img, svg { max-width: 100%; }

@media (max-width: 760px) {
  :root { --marge: var(--space-5); }
  h1 { font-size: 28px; }
  h2 { font-size: 22px; }
  h3 { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
