/* ==========================================================================
   FM6PSH — Prototype « Digital Experience »
   Design system : tokens, base, composants, chrome
   ========================================================================== */

:root {
  /* Couleurs institutionnelles */
  --blue: #0049A1;
  --blue-700: #003B84;
  --blue-800: #062E66;
  --night: #0A1F44;
  --night-2: #0F2A57;
  --blue-100: #E3EEFB;
  --blue-50: #F2F7FD;
  --sky: #B9D7F6;
  --sky-2: #7FB3EA;
  --yellow: #FDBA03;
  --yellow-200: #FFE08A;
  --yellow-100: #FFF4D1;
  --yellow-ink: #7A5200;
  --ivory: #FFFBF3;
  --white: #FFFFFF;

  /* Encres et surfaces */
  --ink: #14213D;
  --ink-2: #3E4C66;
  --muted: #56647C;
  --line: #DAE3EF;
  --line-2: #C3D1E3;
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F6F9FD;

  /* États */
  --success: #1B7F4B;
  --success-bg: #E3F4EA;
  --danger: #B42318;
  --danger-bg: #FDECEA;
  --warning: #8A5A00;
  --warning-bg: #FFF4D1;
  --info-bg: #E3EEFB;

  /* Typographie */
  --font-display: "Bricolage Grotesque", "Atkinson Hyperlegible", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --font-ar-display: "Readex Pro", "IBM Plex Sans Arabic", "Atkinson Hyperlegible", Tahoma, sans-serif;
  --font-ar-body: "IBM Plex Sans Arabic", "Atkinson Hyperlegible", Tahoma, sans-serif;

  --fs-xs: .8125rem;
  --fs-sm: .9375rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --fs-2xl: clamp(2rem, 1.4rem + 2.2vw, 3rem);
  --fs-3xl: clamp(2.5rem, 1.6rem + 3.6vw, 4.5rem);

  /* Espace, rayons, ombres */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 24px;
  --r-xl: 36px;
  --shadow-1: 0 1px 2px rgba(10, 31, 68, .06), 0 4px 14px rgba(10, 31, 68, .06);
  --shadow-2: 0 10px 40px rgba(10, 31, 68, .14);
  --shadow-3: 0 24px 70px rgba(10, 31, 68, .22);
  --container: 1280px;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 84px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --dur: .45s;
  --scale: 1;
  --focus: 0 0 0 3px #fff, 0 0 0 6px var(--blue);
}

/* --- Préférences d'affichage (panneau accessibilité) --------------------- */
html { font-size: calc(100% * var(--scale)); }
html[data-contrast="high"] {
  --ink: #000; --ink-2: #111; --muted: #222; --line: #1a1a1a; --line-2: #000;
  --blue: #002A66; --blue-700: #001F4D; --surface-2: #fff; --blue-50: #fff; --blue-100: #EAF1FF;
  --yellow-ink: #3D2900; --sky: #6F9FD8;
  --focus: 0 0 0 3px #fff, 0 0 0 7px #000;
}
html[data-contrast="high"] .card, html[data-contrast="high"] .panel { border: 2px solid #000 !important; }
html[data-spacing="wide"] body { letter-spacing: .04em; word-spacing: .14em; }
html[data-spacing="wide"] p, html[data-spacing="wide"] li { line-height: 1.95 !important; }
html[data-links="underline"] a { text-decoration: underline !important; text-underline-offset: 3px; }
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important;
  transition-duration: .001ms !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before, html:not([data-motion="full"]) *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
}

/* --- Base ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font-body); font-size: var(--fs-md); line-height: 1.6;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
html[dir="rtl"] body { font-family: var(--font-ar-body); line-height: 1.8; }
h1, h2, h3, h4 { font-family: var(--font-display); color: var(--ink); margin: 0; line-height: 1.08; letter-spacing: -.02em; font-weight: 700; }
html[dir="rtl"] h1, html[dir="rtl"] h2, html[dir="rtl"] h3, html[dir="rtl"] h4 { font-family: var(--font-ar-display); letter-spacing: 0; line-height: 1.3; font-weight: 600; }
p { margin: 0 0 1em; }
a { color: var(--blue); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { color: var(--blue-700); }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { padding-inline-start: 1.2em; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--focus); border-radius: 8px; outline: 2px solid transparent; }
/* Cibles de focus programmatique (titres, conteneurs) : pas d'anneau décoratif */
h1[tabindex="-1"]:focus-visible, h2[tabindex="-1"]:focus-visible, h3[tabindex="-1"]:focus-visible, legend[tabindex="-1"]:focus-visible, main:focus-visible, section[tabindex="-1"]:focus-visible, .result:focus-visible, .success-box:focus-visible { box-shadow: none; }
::selection { background: var(--yellow-200); color: var(--ink); }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.ico { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -.22em; }
html[dir="rtl"] .flip-rtl { transform: scaleX(-1); }
.nums { font-variant-numeric: tabular-nums; }
.em { font-family: var(--font-display); font-style: normal; color: var(--blue); position: relative; white-space: nowrap; }
.em::after { content: ""; position: absolute; inset-inline: -2px; bottom: .02em; height: .28em; background: var(--yellow); opacity: .55; z-index: -1; border-radius: 4px; }

/* --- Lien d'évitement ---------------------------------------------------- */
.skip-link {
  position: fixed; top: 10px; inset-inline-start: 10px; z-index: 1000; transform: translateY(-160%);
  background: var(--night); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 700; text-decoration: none;
  transition: transform .2s var(--ease);
}
.skip-link:focus-visible { transform: none; color: #fff; }

/* --- Bandeau démo -------------------------------------------------------- */
.demo-bar {
  background: repeating-linear-gradient(135deg, var(--yellow) 0 14px, #FFC933 14px 28px);
  color: var(--ink); font-size: var(--fs-xs); font-weight: 700; text-align: center; padding: 6px var(--gutter);
}
.demo-bar span { background: rgba(255, 255, 255, .7); padding: 2px 10px; border-radius: 99px; }

/* --- Boutons -------------------------------------------------------------- */
.btn {
  --btn-bg: var(--blue); --btn-fg: #fff; --btn-bd: var(--blue);
  display: inline-flex; align-items: center; justify-content: center; gap: .55em;
  min-height: 48px; padding: .7em 1.35em; border-radius: 999px; border: 2px solid var(--btn-bd);
  background: var(--btn-bg); color: var(--btn-fg); font-weight: 700; font-size: var(--fs-sm);
  text-decoration: none; line-height: 1.2; transition: transform .2s var(--ease), background .2s, box-shadow .2s, color .2s;
  white-space: nowrap;
}
.btn:hover { --btn-bg: var(--blue-700); --btn-bd: var(--blue-700); color: var(--btn-fg); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(0); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.btn--accent { --btn-bg: var(--yellow); --btn-fg: var(--ink); --btn-bd: var(--yellow); }
.btn--accent:hover { --btn-bg: #FFC933; --btn-bd: #FFC933; }
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--blue); --btn-bd: var(--line-2); }
.btn--ghost:hover { --btn-bg: var(--blue-50); --btn-bd: var(--blue); --btn-fg: var(--blue); }
.btn--light { --btn-bg: #fff; --btn-fg: var(--night); --btn-bd: #fff; }
.btn--light:hover { --btn-bg: var(--yellow); --btn-bd: var(--yellow); --btn-fg: var(--ink); }
.btn--outline-light { --btn-bg: transparent; --btn-fg: #fff; --btn-bd: rgba(255, 255, 255, .5); }
.btn--outline-light:hover { --btn-bg: rgba(255, 255, 255, .12); --btn-bd: #fff; --btn-fg: #fff; }
.btn--danger { --btn-bg: var(--danger); --btn-bd: var(--danger); }
.btn--sm { min-height: 40px; padding: .45em 1em; font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center;
  border: 1.5px solid var(--line); background: #fff; color: var(--ink); transition: background .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { background: var(--blue-50); border-color: var(--blue); color: var(--blue); }
.link-arrow { display: inline-flex; align-items: center; gap: .4em; font-weight: 700; text-decoration: none; }
.link-arrow .ico { transition: transform .25s var(--ease); }
.link-arrow:hover .ico { transform: translateX(4px); }
html[dir="rtl"] .link-arrow:hover .ico { transform: translateX(-4px) scaleX(-1); }
html[dir="rtl"] .link-arrow .ico { transform: scaleX(-1); }

/* --- Puces, badges -------------------------------------------------------- */
.chip {
  display: inline-flex; align-items: center; gap: .45em; min-height: 40px; padding: .4em 1em; border-radius: 999px;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 700; font-size: var(--fs-sm);
  transition: all .2s var(--ease);
}
.chip:hover { border-color: var(--blue); color: var(--blue); }
.chip[aria-pressed="true"], .chip[aria-selected="true"], .chip.is-active { background: var(--night); border-color: var(--night); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-flex; align-items: center; gap: .35em; padding: .2em .7em; border-radius: 999px; font-size: var(--fs-xs); font-weight: 700; background: var(--blue-100); color: var(--blue-800); }
.badge--yellow { background: var(--yellow-100); color: var(--yellow-ink); }
.badge--success { background: var(--success-bg); color: var(--success); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--night { background: var(--night); color: #fff; }
.badge--demo {
  background: repeating-linear-gradient(135deg, var(--yellow-100) 0 6px, #FFE7A3 6px 12px);
  color: var(--yellow-ink); border: 1px solid #F3D27A; text-transform: uppercase; letter-spacing: .04em;
}
html[dir="rtl"] .badge--demo { letter-spacing: 0; }
.eyebrow { display: inline-flex; align-items: center; gap: .6em; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--blue); margin-bottom: 1rem; }
.eyebrow::before { content: ""; width: 28px; height: 3px; border-radius: 3px; background: var(--yellow); }
html[dir="rtl"] .eyebrow { letter-spacing: 0; font-size: var(--fs-sm); }
.on-dark .eyebrow { color: var(--yellow); }

/* --- Cartes et panneaux --------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card--hover:hover { transform: translateY(-4px); box-shadow: var(--shadow-2); border-color: var(--sky); }
.panel { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px; }

/* --- Formulaires ---------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field label, .field .label { font-weight: 700; font-size: var(--fs-sm); }
.field .req { color: var(--danger); }
.field .hint { font-size: var(--fs-xs); color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: 14px; border: 1.5px solid var(--line-2);
  background: #fff; font-size: var(--fs-md); transition: border-color .2s, box-shadow .2s;
}
.textarea { min-height: 130px; resize: vertical; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--sky-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--blue); box-shadow: 0 0 0 4px var(--blue-100); border-radius: 14px; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--danger); background: #FFFBFA; }
.field .error { display: none; color: var(--danger); font-size: var(--fs-sm); font-weight: 700; align-items: center; gap: 6px; }
.field.has-error .error { display: flex; }
.check { display: flex; gap: 12px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--blue); flex: none; margin-top: 2px; }
.error-summary { border: 2px solid var(--danger); background: var(--danger-bg); border-radius: var(--r-md); padding: 16px 20px; margin-bottom: 20px; }
.error-summary h3 { font-size: var(--fs-md); color: var(--danger); margin-bottom: 8px; }
.error-summary a { color: var(--danger); font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.form-grid .span-2 { grid-column: span 2; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } .form-grid .span-2 { grid-column: auto; } }
.search-input { position: relative; }
.search-input .ico { position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input .input { padding-inline-start: 46px; }

/* --- Onglets ------------------------------------------------------------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1.5px solid var(--line); margin-bottom: 24px; }
.tab { border: 0; background: none; padding: 12px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1.5px; display: inline-flex; gap: 8px; align-items: center; border-radius: 10px 10px 0 0; }
.tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--yellow); }
.tab:hover { color: var(--blue); background: var(--blue-50); }

/* --- Apparitions au défilement ------------------------------------------ */
[data-reveal] { opacity: 0; transform: translateY(26px); transition: opacity .8s var(--ease), transform .8s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }
[data-reveal="left"] { transform: translateX(-30px); }
[data-reveal="scale"] { transform: scale(.96); }
html[data-motion="reduced"] [data-reveal] { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html:not([data-motion="full"]) [data-reveal] { opacity: 1; transform: none; } }

/* ==========================================================================
   CHROME — en-tête, méga-menu, navigation mobile, pied de page
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent; transition: border-color .3s, box-shadow .3s;
}
.site-header.scrolled { border-bottom-color: var(--line); box-shadow: 0 6px 24px rgba(10, 31, 68, .06); }
.header-inner { display: flex; align-items: center; gap: 14px; height: var(--header-h); }
.main-nav { min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; flex: none; border-radius: 12px; }
.brand img { height: 66px; width: auto; }
.main-nav { flex: 1; display: flex; justify-content: center; }
.main-nav > ul { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0; }
.nav-link {
  display: inline-flex; align-items: center; gap: 4px; padding: 10px 12px; border-radius: 12px; border: 0; background: none;
  color: var(--ink); text-decoration: none; font-weight: 700; font-size: var(--fs-sm); position: relative; white-space: nowrap;
}
.nav-link::after { content: ""; position: absolute; inset-inline: 12px; bottom: 4px; height: 3px; border-radius: 3px; background: var(--yellow); transform: scaleX(0); transition: transform .3s var(--ease); }
.nav-link:hover::after, .nav-link[aria-current="page"]::after, .nav-link[aria-expanded="true"]::after { transform: scaleX(1); }
.nav-link:hover { color: var(--blue); }
.nav-link .ico { width: 16px; height: 16px; transition: transform .3s; }
.nav-link[aria-expanded="true"] .ico { transform: rotate(180deg); }
.header-tools { display: flex; align-items: center; gap: 8px; flex: none; }
.lang-switch { display: flex; border: 1.5px solid var(--line); border-radius: 999px; padding: 3px; background: #fff; }
.lang-switch button { border: 0; background: none; min-width: 38px; height: 36px; border-radius: 999px; font-weight: 700; font-size: var(--fs-xs); color: var(--ink-2); padding: 0 8px; }
.lang-switch button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.cart-btn { position: relative; }
.cart-count { position: absolute; top: -4px; inset-inline-end: -4px; min-width: 20px; height: 20px; border-radius: 99px; background: var(--yellow); color: var(--ink); font-size: 11px; font-weight: 800; display: grid; place-items: center; padding: 0 5px; border: 2px solid #fff; }
.cart-count:empty, .cart-count[data-n="0"] { display: none; }
.burger { display: none; }

/* Méga-menu */
.mega {
  position: absolute; inset-inline: 0; top: 100%; background: #fff; border-top: 1px solid var(--line);
  box-shadow: var(--shadow-3); opacity: 0; visibility: hidden; transform: translateY(-8px);
  transition: opacity .25s var(--ease), transform .25s var(--ease), visibility .25s;
}
.mega.open { opacity: 1; visibility: visible; transform: none; }
.mega-inner { display: grid; grid-template-columns: 300px 1fr; gap: 40px; padding-block: 36px 40px; }
.mega-intro { background: linear-gradient(160deg, var(--night), var(--blue)); color: #fff; border-radius: var(--r-lg); padding: 28px; position: relative; overflow: hidden; }
.mega-intro h2 { color: #fff; font-size: var(--fs-xl); margin-bottom: 10px; }
.mega-intro p { color: #D6E4F7; font-size: var(--fs-sm); }
.mega-intro .arc-deco { position: absolute; inset-inline-end: -60px; bottom: -60px; width: 200px; opacity: .35; }
.mega-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: start; }
.mega-item { display: flex; gap: 14px; padding: 16px; border-radius: var(--r-md); text-decoration: none; color: var(--ink); transition: background .2s; }
.mega-item:hover { background: var(--blue-50); color: var(--ink); }
.mega-item .mi-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--blue-100); color: var(--blue); display: grid; place-items: center; flex: none; transition: background .2s, color .2s; }
.mega-item:hover .mi-icon { background: var(--yellow); color: var(--ink); }
.mega-item strong { display: block; font-size: var(--fs-sm); }
.mega-item span { font-size: var(--fs-xs); color: var(--muted); line-height: 1.45; display: block; }

/* Barre latérale de partage (desktop) */
.social-rail { position: fixed; inset-inline-end: 0; top: 50%; transform: translateY(-50%); z-index: 40; display: flex; flex-direction: column; align-items: center; gap: 6px; background: #fff; padding: 12px 8px; border-radius: 18px 0 0 18px; box-shadow: var(--shadow-2); border: 1px solid var(--line); border-inline-end: 0; }
html[dir="rtl"] .social-rail { border-radius: 0 18px 18px 0; }
.social-rail .rail-label { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
html[dir="rtl"] .social-rail .rail-label { letter-spacing: 0; font-size: 12px; }
.social-rail a, .social-rail button { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: var(--night); background: none; border: 0; transition: background .2s, color .2s, transform .2s; }
.social-rail a:hover, .social-rail button:hover { background: var(--night); color: #fff; transform: scale(1.06); }
.social-rail svg { width: 18px; height: 18px; }

/* Navigation mobile (barre d'onglets) */
.tabbar { display: none; }
.mobile-sheet { position: fixed; inset: 0; z-index: 80; background: #fff; display: flex; flex-direction: column; transform: translateY(100%); transition: transform .4s var(--ease); visibility: hidden; }
.mobile-sheet.open { transform: none; visibility: visible; }
.mobile-sheet header { display: flex; align-items: center; justify-content: space-between; padding: 14px var(--gutter); border-bottom: 1px solid var(--line); }
.mobile-sheet nav { overflow-y: auto; padding: 12px var(--gutter) 120px; }
.mobile-sheet .ms-link { display: flex; align-items: center; gap: 14px; padding: 14px 4px; font-size: var(--fs-lg); font-weight: 700; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.mobile-sheet .ms-link .mi-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--blue-100); color: var(--blue); display: grid; place-items: center; }
.mobile-sheet .ms-tools { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }

@media (max-width: 1500px) {
  .main-nav .nav-hide-md { display: none; }
}
@media (max-width: 1100px) {
  .header-tools .btn.hide-mobile { padding-inline: .8em; }
  .header-tools .btn.hide-mobile .ico + * { display: none; }
}
@media (max-width: 980px) {
  :root { --header-h: 70px; }
  .main-nav, .header-tools .hide-mobile, .social-rail, .mega { display: none; }
  .brand img { height: 54px; }
  .burger { display: inline-grid; }
  .header-inner { justify-content: space-between; }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 10px; bottom: 10px; z-index: 60;
    background: rgba(10, 31, 68, .96); border-radius: 22px; padding: 6px; box-shadow: var(--shadow-3);
    padding-bottom: max(6px, env(safe-area-inset-bottom));
  }
  .tabbar a, .tabbar button { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px; border-radius: 16px; color: #C9D8EE; text-decoration: none; font-size: 11px; font-weight: 700; border: 0; background: none; min-height: 54px; justify-content: center; }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar [aria-current="page"] { background: var(--yellow); color: var(--ink); }
  body { padding-bottom: 92px; }
}

/* Pied de page */
.site-footer { background: var(--night); color: #C9D8EE; margin-top: 0; position: relative; overflow: hidden; }
.site-footer a { color: #fff; text-decoration: none; }
.site-footer a:hover { color: var(--yellow); text-decoration: underline; }
.footer-top { display: grid; grid-template-columns: 1.3fr repeat(3, 1fr); gap: 40px; padding-block: 72px 48px; position: relative; }
.footer-logo { background: #fff; border-radius: var(--r-lg); padding: 14px; width: 150px; margin-bottom: 20px; }
.site-footer h2 { color: #fff; font-size: var(--fs-sm); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 16px; font-family: var(--font-body); }
html[dir="rtl"] .site-footer h2 { letter-spacing: 0; font-family: var(--font-ar-body); }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; font-size: var(--fs-sm); }
.newsletter { display: flex; gap: 8px; margin-top: 12px; }
.newsletter .input { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .25); color: #fff; }
.newsletter .input::placeholder { color: #9FB4D3; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .12); padding-block: 22px; display: flex; flex-wrap: wrap; gap: 16px; justify-content: space-between; font-size: var(--fs-xs); }
.footer-arc { position: absolute; inset-inline-end: -120px; top: -120px; width: 520px; opacity: .14; pointer-events: none; }
@media (max-width: 900px) { .footer-top { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .footer-top { grid-template-columns: 1fr; } }

/* ==========================================================================
   COUCHES : modale, tiroir, toast, palette de recherche, panneau a11y
   ========================================================================== */
dialog { border: 0; padding: 0; color: var(--ink); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(10, 31, 68, .55); backdrop-filter: blur(4px); }
.modal { width: min(760px, calc(100vw - 24px)); max-height: calc(100vh - 40px); margin: auto; }
.modal-box { background: #fff; border-radius: var(--r-xl); box-shadow: var(--shadow-3); overflow: auto; max-height: calc(100vh - 40px); animation: pop .35s var(--ease); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 0; position: sticky; top: 0; background: #fff; z-index: 2; padding-bottom: 12px; }
.modal-head h2 { font-size: var(--fs-xl); }
.modal-body { padding: 8px 28px 28px; }
.modal--wide { width: min(1080px, calc(100vw - 24px)); }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.drawer { margin: 0; margin-inline-start: auto; height: 100vh; max-height: 100vh; width: min(480px, 100vw); }
.drawer .modal-box { border-radius: 0; height: 100%; max-height: 100vh; display: flex; flex-direction: column; animation: slidein .4s var(--ease); }
html[dir="rtl"] .drawer .modal-box { animation-name: slidein-rtl; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes slidein-rtl { from { transform: translateX(-40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer .modal-body { flex: 1; overflow: auto; }
.drawer .drawer-foot { border-top: 1px solid var(--line); padding: 20px 28px; background: var(--surface-2); }

.toasts { position: fixed; bottom: 24px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
html[dir="rtl"] .toasts { transform: translateX(50%); }
.toast { background: var(--night); color: #fff; padding: 14px 20px; border-radius: 16px; box-shadow: var(--shadow-3); display: flex; gap: 12px; align-items: center; font-weight: 700; font-size: var(--fs-sm); animation: pop .35s var(--ease); pointer-events: auto; max-width: min(520px, 92vw); }
.toast .ico { color: var(--yellow); }
@media (max-width: 980px) { .toasts { bottom: 100px; } }

.palette { width: min(680px, calc(100vw - 24px)); margin: 10vh auto auto; }
.palette .modal-box { padding: 0; }
.palette-input { display: flex; align-items: center; gap: 12px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.palette-input input { border: 0; flex: 1; font-size: var(--fs-lg); background: none; min-height: 40px; }
.palette-input input:focus-visible { box-shadow: none; }
.palette-results { max-height: 52vh; overflow: auto; padding: 10px; list-style: none; margin: 0; }
.palette-results a { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; text-decoration: none; color: var(--ink); }
.palette-results a:hover, .palette-results a.active { background: var(--blue-50); }
.palette-results .pr-type { margin-inline-start: auto; }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; background: #fff; color: var(--muted); }

.a11y-panel .opt { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.a11y-panel .opt strong { display: block; }
.a11y-panel .opt span { font-size: var(--fs-xs); color: var(--muted); }
.seg { display: inline-flex; border: 1.5px solid var(--line-2); border-radius: 999px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { border: 0; background: none; min-height: 38px; min-width: 44px; padding: 0 12px; border-radius: 999px; font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); }
.seg button[aria-pressed="true"] { background: var(--blue); color: #fff; }
.switch { position: relative; width: 56px; height: 32px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; z-index: 1; margin: 0; }
.switch span { position: absolute; inset: 0; background: var(--line-2); border-radius: 99px; transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 4px; inset-inline-start: 4px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: transform .25s var(--ease); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(24px); }
html[dir="rtl"] .switch input:checked + span::after { transform: translateX(-24px); }
.switch input:focus-visible + span { box-shadow: var(--focus); }
.onetap-note { margin-top: 18px; font-size: var(--fs-xs); color: var(--muted); background: var(--surface-2); border-radius: 14px; padding: 12px 14px; display: flex; gap: 10px; }

/* Barre de progression de lecture / chargement de page */
.route-progress { position: fixed; top: 0; inset-inline-start: 0; height: 3px; background: linear-gradient(90deg, var(--yellow), var(--blue)); z-index: 300; width: 0; transition: width .4s var(--ease), opacity .3s; }

/* Transitions entre pages */
#main { min-height: 60vh; }
.page-enter { animation: pageIn .6s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }
