/* ==========================================================================
   3A-ARCHITECTURE — BASE
   Reset, éléments HTML nus, accessibilité, utilitaires transverses.
   ========================================================================== */

/* --- Reset ---------------------------------------------------------------- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  /* Décale les ancres pour qu'elles ne passent pas sous la barre fixe */
  scroll-padding-top: var(--nav-height);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  font-weight: 300;
  line-height: 1.6;
  background: var(--blanc);
  color: var(--noir);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  /* Fond neutre pendant le chargement : évite le flash blanc sur fond sombre */
  background-color: var(--noir-doux);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

a {
  color: inherit;
}

ul,
ol {
  list-style: none;
}

address {
  font-style: normal;
}

/* --- Grain photographique ------------------------------------------------- */
/* Voile de bruit très léger sur toute la page : casse les aplats numériques. */
.grain {
  position: fixed;
  inset: 0;
  z-index: var(--z-grain);
  pointer-events: none;
  opacity: 0.4;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
}

/* --- Titres --------------------------------------------------------------- */
h1,
h2,
h3,
h4 {
  font-weight: 300;
  line-height: var(--lh-tight);
}

h2 {
  font-family: var(--font-serif);
  font-size: var(--fs-h2);
  color: var(--noir);
  margin-bottom: var(--space-lg);
}

h2 em {
  font-style: italic;
  color: var(--bordeaux);
}

/* --- Accessibilité -------------------------------------------------------- */

/* Lien d'évitement : premier élément focusable de la page */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-sm);
  z-index: var(--z-overlay);
  padding: 0.75rem 1.25rem;
  background: var(--bordeaux);
  color: var(--blanc-pur);
  font-family: var(--font-sans);
  font-size: var(--fs-micro);
  font-weight: 600;
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  text-decoration: none;
  transition: top var(--t-fast);
}

.skip-link:focus {
  top: var(--space-sm);
}

/* Contenu réservé aux lecteurs d'écran */
.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;
}

/* Anneau de focus homogène, visible uniquement au clavier */
:focus-visible {
  outline: 2px solid var(--bordeaux);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

/* Sur fond sombre, l'anneau bordeaux manque de contraste : on l'éclaircit */
.section--dark :focus-visible,
.cta-band :focus-visible,
.hero :focus-visible,
.page-header :focus-visible,
.site-footer :focus-visible,
.footer-bottom :focus-visible {
  outline-color: var(--blanc);
}

/* --- Animations ----------------------------------------------------------- */
@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes scroll-pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1; }
}

/* Apparition au défilement — état initial, la classe .is-visible est posée
   par assets/js/reveal.js */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition:
    opacity 0.8s var(--ease-out-expo),
    transform 0.8s var(--ease-out-expo);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* --- Préférence « animations réduites » ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* --- Impression ----------------------------------------------------------- */
@media print {
  .grain,
  .site-nav,
  .hero-controls,
  .hero-scroll-hint,
  .skip-link {
    display: none !important;
  }

  body {
    background: #fff;
    color: #000;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
