/* ==========================================================================
   Révis'Onze – fondations : couleurs, typographie, éléments de base
   Palette inspirée des engins de la Sécurité civile : bleu nuit, orange
   haute visibilité, bandes de signalisation.
   ========================================================================== */

/* Polices Barlow et Barlow Condensed (licence SIL OFL), hébergées avec le site */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap; src: url("../assets/fonts/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: italic; font-weight: 400; font-display: swap; src: url("../assets/fonts/barlow-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 600; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 700; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-style: normal; font-weight: 800; font-display: swap; src: url("../assets/fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }

:root {
  --font-body: "Barlow", "Segoe UI", system-ui, sans-serif;
  --font-display: "Barlow Condensed", "Arial Narrow", "Segoe UI", sans-serif;

  /* Échelle typographique (rapport 1,25) */
  --step--1: 0.8rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.563rem;
  --step-3: 1.953rem;
  --step-4: 2.441rem;
  --step-5: 3.052rem;

  --radius-s: 4px;
  --radius: 6px;
  --radius-l: 10px;
  --space: 1rem;
  --topbar-h: 4rem;
  --content-w: 72rem;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* Thème sombre (par défaut) */
:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1E33;
  --bg-deep: #0B1728;
  --surface: #162A45;
  --surface-2: #1C3354;
  --line: #2B4466;
  --line-strong: #3D5A80;
  --text: #EAF0F7;
  --text-muted: #9AAEC6;
  --accent: #FF7A1A;
  --accent-strong: #FF8F3D;
  --on-accent: #1B0B00;
  --done: #3BC77E;
  --verif: #F2C230;
  --wait: #5AA9F5;
  --danger: #FF6B6B;
  --good-bg: rgba(59, 199, 126, .14);
  --bad-bg: rgba(255, 107, 107, .12);
  --band-gap: #0B1728;
  --shadow: 0 18px 50px rgba(3, 9, 20, .55);
  --backdrop: rgba(5, 12, 24, .72);
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #E8EDF3;
  --bg-deep: #DCE3EC;
  --surface: #FFFFFF;
  --surface-2: #F2F5F9;
  --line: #CDD7E3;
  --line-strong: #A9B8CB;
  --text: #0F1E33;
  --text-muted: #4D627D;
  --accent: #F26A0F;
  --accent-strong: #D95A05;
  --on-accent: #1B0B00;
  --done: #1E8A50;
  --verif: #D6A300;
  --wait: #2F7FD0;
  --danger: #C62828;
  --good-bg: rgba(30, 138, 80, .12);
  --bad-bg: rgba(198, 40, 40, .09);
  --band-gap: #0F1E33;
  --shadow: 0 18px 50px rgba(15, 30, 51, .18);
  --backdrop: rgba(15, 30, 51, .45);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: calc(var(--topbar-h) + 1rem);
}

body {
  margin: 0;
  min-height: 100vh;
  font: 400 1rem/1.55 var(--font-body);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

html.has-dialog { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 700;
  line-height: 1.2;
}

p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img { max-width: 100%; height: auto; }

a { color: var(--accent); text-underline-offset: .15em; }

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }

svg { width: 1.25rem; height: 1.25rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

kbd {
  font: 600 var(--step--1)/1 var(--font-body);
  padding: .2rem .4rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: var(--radius-s);
  color: var(--text-muted);
}

[hidden] { display: none !important; }

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

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 1rem; top: -3rem;
  z-index: 100;
  padding: .6rem 1rem;
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
  border-radius: var(--radius);
}
.skip-link:focus { top: 1rem; }

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

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

/* ───────────── Boutons ───────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 2.5rem;
  padding: .45rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface-2);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover:not(:disabled) { border-color: var(--text-muted); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 700;
}
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-outline { background: transparent; }

.btn-quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-muted);
}
.btn-quiet:hover:not(:disabled) { color: var(--text); border-color: transparent; background: var(--surface-2); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
  font-weight: 700;
}

.btn-large { min-height: 2.9rem; font-size: 1.05rem; }

.btn:disabled { opacity: .45; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }

/* Champs */
input[type="text"], input[type="password"], input[type="search"], input[type="email"] {
  width: 100%;
  min-height: 2.75rem;
  padding: .55rem .8rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--bg-deep);
}
input[type="text"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="email"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}
input[aria-invalid="true"] { border-color: var(--danger); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }

.check {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .95rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
}

.error, .loading {
  padding: 1rem;
  border-radius: var(--radius);
  color: var(--text-muted);
}
.error { border: 1px solid var(--danger); color: var(--text); background: var(--bad-bg); }
