/*
 * ODITIERS - Base (LOT11.1): reinitialisation, typographie, focus, accessibilite.
 * Aucune valeur en dur: tout vient de tokens.css. Les classes de ce dossier sont prefixees `ui-` pour coexister
 * avec les pages historiques (qui ne chargent pas ces feuilles).
 */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.ui-body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-body);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}

/*
 * Reinitialisations en :where(): specificite NULLE, pour qu'un composant (.ui-btn, .ui-nav-link...) l'emporte
 * toujours sans guerre de specificite.
 */
:where(.ui-body) h1,
:where(.ui-body) h2,
:where(.ui-body) h3,
:where(.ui-body) h4,
:where(.ui-body) p,
:where(.ui-body) ul,
:where(.ui-body) ol,
:where(.ui-body) dl,
:where(.ui-body) dd,
:where(.ui-body) figure {
  margin: 0;
}

:where(.ui-body) ul,
:where(.ui-body) ol {
  padding: 0;
  list-style: none;
}

:where(.ui-body) a {
  color: var(--color-link);
  text-underline-offset: 0.18em;
}

:where(.ui-body) a:hover {
  color: var(--color-primary-hover);
}

:where(.ui-body) img,
:where(.ui-body) svg {
  max-width: 100%;
}

:where(.ui-body) button,
:where(.ui-body) input,
:where(.ui-body) select,
:where(.ui-body) textarea {
  font: inherit;
  color: inherit;
}

/* Titres: hierarchie nette (page 22 px, section 16 px, bloc 14,5 px), graisse 600 comme les pages V4. */
.ui-h1 {
  font-size: var(--title-page);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}

.ui-h2 {
  font-size: var(--title-section);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
}

.ui-h3 {
  font-size: var(--title-block);
  line-height: var(--leading-tight);
  font-weight: var(--weight-semibold);
}

.ui-text-muted {
  color: var(--color-text-muted);
}

.ui-text-meta {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
}

.ui-mono {
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-variant-numeric: tabular-nums;
}

/* Focus: anneau net et visible au clavier uniquement; jamais supprime sans remplacement. */
.ui-body :focus {
  outline: none;
}

.ui-body :focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.ui-sidebar :focus-visible {
  outline-color: var(--nav-focus);
  outline-offset: -2px;
}

/* Lien d'evitement: premier element focusable de la page. */
.ui-skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-2);
  z-index: calc(var(--z-menu) + 10);
  padding: var(--space-2) var(--space-4);
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-radius: var(--radius-md);
  font-weight: var(--weight-semibold);
  text-decoration: none;
  transform: translateY(-200%);
}

.ui-skip-link:focus {
  transform: none;
  color: var(--color-on-primary);
}

/* Texte reserve aux lecteurs d'ecran. */
.ui-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* Icones: sprite SVG local, traits homogenes, heritent la couleur du texte. */
.ui-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex: none;
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ui-icon--sm {
  width: 1rem;
  height: 1rem;
}

.ui-icon--lg {
  width: 1.5rem;
  height: 1.5rem;
}

/* Mouvement: aucune animation pour qui demande de les reduire. */
@media (prefers-reduced-motion: reduce) {
  .ui-body *,
  .ui-body *::before,
  .ui-body *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Mode contraste eleve du systeme: les bordures et les etats restent visibles. */
@media (forced-colors: active) {
  .ui-body :focus-visible {
    outline: 2px solid highlight;
  }
}
