/* ==========================================================================
   ANEM Centrale — Tokens & fondations
   Palette : nuit d'Agadez (indigo profond) · flamme (orange ANEM) ·
             sahel (vert Niger) · sable · brume
   ========================================================================== */

:root {
  /* --- Couleurs de marque (surchargées par le personnalisateur) --- */
  --anem-ink:        #131A33;
  --anem-ink-2:      #232C55;
  --anem-flame:      #E2551C;
  --anem-ember:      #F79433;
  --anem-sahel:      #0F8A62;
  --anem-ochre:      #C98A2E;

  /* --- Surfaces --- */
  --anem-paper:      #FFFFFF;
  --anem-mist:       #EEF1F8;
  --anem-sand:       #F3EEE6;
  --anem-night:      #0E1428;

  /* --- Dérivées (calculées, ne pas surcharger) --- */
  --surface:         var(--anem-paper);
  --surface-alt:     var(--anem-mist);
  --surface-warm:    var(--anem-sand);
  --surface-deep:    var(--anem-night);

  --text:            var(--anem-ink);
  --text-muted:      color-mix(in srgb, var(--anem-ink) 62%, #fff);
  --text-faint:      color-mix(in srgb, var(--anem-ink) 42%, #fff);
  --text-invert:     #FFFFFF;
  --text-invert-mut: color-mix(in srgb, #FFFFFF 68%, var(--anem-night));

  --line:            color-mix(in srgb, var(--anem-ink) 13%, transparent);
  --line-strong:     color-mix(in srgb, var(--anem-ink) 26%, transparent);
  --line-invert:     color-mix(in srgb, #FFFFFF 18%, transparent);

  --accent:          var(--anem-flame);
  --accent-hover:    color-mix(in srgb, var(--anem-flame) 82%, #000);
  --accent-soft:     color-mix(in srgb, var(--anem-flame) 12%, #fff);
  --accent-ring:     color-mix(in srgb, var(--anem-flame) 38%, transparent);

  /* --- Typographie --- */
  --font-display: "Archivo", "Archivo Expanded", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body:    "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-prose:   "Source Serif 4", Georgia, "Times New Roman", serif;

  --fs-base: 1.0625rem;   /* 17px */
  --lh-base: 1.65;

  /* Échelle modulaire 1.26 (fluide) */
  --fs-xs:   0.78rem;
  --fs-sm:   0.9rem;
  --fs-md:   1rem;
  --fs-lg:   clamp(1.08rem, 0.3vw + 1rem, 1.2rem);
  --fs-xl:   clamp(1.3rem, 0.6vw + 1.1rem, 1.55rem);
  --fs-2xl:  clamp(1.6rem, 1.1vw + 1.25rem, 2.1rem);
  --fs-3xl:  clamp(2rem, 2vw + 1.4rem, 2.9rem);
  --fs-4xl:  clamp(2.4rem, 3.4vw + 1.4rem, 4rem);
  --fs-5xl:  clamp(2.9rem, 5.4vw + 1.2rem, 5.6rem);

  --tracking-display: -0.028em;
  --tracking-tight:   -0.015em;

  /* --- Rythme & géométrie --- */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  --block-space: clamp(3.5rem, 7vw, 7rem);

  --wrap: 1240px;
  --wrap-wide: 1440px;
  --wrap-narrow: 760px;
  --gutter: clamp(1.15rem, 4vw, 3rem);

  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --radius-xl: 34px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(19, 26, 51, .07), 0 2px 8px rgba(19, 26, 51, .05);
  --shadow-md: 0 10px 30px -12px rgba(19, 26, 51, .22);
  --shadow-lg: 0 34px 70px -30px rgba(19, 26, 51, .35);
  --shadow-flame: 0 16px 38px -16px color-mix(in srgb, var(--anem-flame) 55%, transparent);

  --ease: cubic-bezier(.32, .72, .28, 1);
  --dur: 240ms;

  --header-h: 82px;
}

/* --- Mode sombre --- */
html[data-theme="dark"] {
  --surface:         #0E1428;
  --surface-alt:     #141C36;
  --surface-warm:    #17203C;
  --surface-deep:    #090D1C;

  --text:            #EDF0F8;
  --text-muted:      color-mix(in srgb, #EDF0F8 72%, var(--anem-night));
  --text-faint:      color-mix(in srgb, #EDF0F8 50%, var(--anem-night));

  --line:            rgba(255, 255, 255, .12);
  --line-strong:     rgba(255, 255, 255, .24);

  --accent-soft:     color-mix(in srgb, var(--anem-flame) 22%, var(--anem-night));

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 12px 34px -14px rgba(0, 0, 0, .7);
  --shadow-lg: 0 36px 74px -32px rgba(0, 0, 0, .8);

  color-scheme: dark;
}

/* ==========================================================================
   Reset raisonné
   ========================================================================== */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 1.5rem);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: var(--lh-base);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: var(--tracking-display);
  line-height: 1.08;
  margin: 0 0 .6em;
  text-wrap: balance;
}

h1 { font-size: var(--fs-4xl); }
h2 { font-size: var(--fs-3xl); }
h3 { font-size: var(--fs-2xl); line-height: 1.16; }
h4 { font-size: var(--fs-xl); line-height: 1.24; letter-spacing: var(--tracking-tight); }
h5 { font-size: var(--fs-lg); letter-spacing: var(--tracking-tight); }
h6 { font-size: var(--fs-md); letter-spacing: 0; }

p { margin: 0 0 1.1em; max-width: 72ch; }
p:last-child { margin-bottom: 0; }

a {
  color: inherit;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: .22em;
  text-decoration-thickness: .07em;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

img, svg, video, iframe { max-width: 100%; height: auto; display: block; }
figure { margin: 0; }

ul, ol { padding-left: 1.2em; }
li { margin-bottom: .35em; }

blockquote {
  margin: 2rem 0;
  padding: 0 0 0 1.5rem;
  border-left: 3px solid var(--accent);
  font-size: var(--fs-xl);
  line-height: 1.4;
  letter-spacing: var(--tracking-tight);
}

code, kbd, pre, samp { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; font-size: .92em; }
pre {
  background: var(--surface-alt);
  padding: 1.15rem 1.3rem;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  border: 1px solid var(--line);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--space-7) 0;
}

table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
th, td { padding: .8rem 1rem; border-bottom: 1px solid var(--line); text-align: left; }
th { font-weight: 650; background: var(--surface-alt); }

button, input, select, textarea { font: inherit; color: inherit; }

::selection { background: var(--accent); color: #fff; }

/* --- Focus visible : jamais supprimé --- */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--radius-xs);
}
.is-dark-panel :focus-visible { outline-color: var(--anem-ember); }

/* --- Accessibilité --- */
.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: -100px; left: 1rem;
  z-index: 999;
  background: var(--anem-ink);
  color: #fff;
  padding: .8rem 1.25rem;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  font-weight: 600;
  transition: top 160ms var(--ease);
}
.skip-link:focus { top: 0; color: #fff; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
