/* ═══════════════════════════════════════════════════════════════════════════
   NECObot — base : remise à zéro, typographie, focus visible, animations réduites
   Servi sous /theme/base.css. Nécessite tokens.css (et fonts/fonts.css pour les polices).
   Pour les pages du panel, du guide et des autorisations. Les overlays OBS n'en ont pas
   besoin (fond transparent) : ils chargent overlay.css.
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Remise à zéro ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}
* {
  margin: 0;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--color-border-strong) transparent;
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-md);
  font-weight: var(--fw-regular);
  line-height: var(--lh-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button,
[role="button"],
summary {
  cursor: pointer;
}
:disabled {
  cursor: not-allowed;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}
[hidden] {
  display: none !important;
}

/* ── Typographie ── */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-display);
  font-weight: var(--fw-bold);
  line-height: var(--lh-tight);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
  overflow-wrap: break-word;
}
h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-xl); line-height: var(--lh-snug); }
h4 { font-size: var(--fs-lg); line-height: var(--lh-snug); }
h5,
h6 { font-size: var(--fs-md); line-height: var(--lh-snug); }

p,
li,
dd,
blockquote,
figcaption {
  overflow-wrap: break-word;
  text-wrap: pretty;
}
p + p {
  margin-top: var(--space-3);
}
small {
  font-size: var(--fs-sm);
}
strong,
b {
  font-weight: var(--fw-bold);
}
a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: text-decoration-thickness var(--dur-fast) var(--ease);
}
a:hover {
  text-decoration-thickness: 2px;
}
code,
kbd,
samp,
pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  padding: 0.1em 0.35em;
  border-radius: var(--radius-xs);
  background: var(--color-bg-inset);
}
kbd {
  padding: 0.1em 0.4em;
  border: var(--border-width) solid var(--color-border-strong);
  border-bottom-width: 2px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  font-size: 0.85em;
}
pre {
  overflow: auto;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bg-inset);
}
pre code {
  padding: 0;
  background: none;
}
hr {
  border: 0;
  border-top: var(--border-width) solid var(--color-border);
}
::selection {
  background: var(--color-selection-bg);
  color: var(--color-selection-text);
}
::placeholder {
  color: var(--color-text-subtle);
  opacity: 1;
}

/* Chiffres alignés (tableaux, compteurs, minuteries) */
.num,
.tabular {
  font-variant-numeric: tabular-nums;
}
.mono {
  font-family: var(--font-mono);
}
.muted {
  color: var(--color-text-muted);
}

/* ── Focus visible (clavier) : anneau net, toujours au moins 3:1 sur le fond ── */
:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

/* ── Accessibilité : texte réservé aux lecteurs d'écran, lien d'évitement ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-brand);
  color: var(--color-on-brand);
  font-weight: var(--fw-bold);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus-visible {
  transform: none;
}

/* ── Animations réduites : aucun mouvement imposé ── */
@media (prefers-reduced-motion: reduce) {
  html:focus-within {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ── Contraste élevé de Windows : les couleurs système remplacent les nôtres ── */
@media (forced-colors: active) {
  :focus-visible {
    outline-color: Highlight;
  }
}
