/*
 * Socle — reset, typographie de base, accessibilité, conteneur.
 *
 * Reset et règles partagées, complétés de ce que WordPress
 * impose (.screen-reader-text, classes d'alignement des médias) et de ce que le
 * RGAA demande (respect de prefers-reduced-motion).
 */

/* ==========================================================================
   Reset
   ========================================================================== */

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

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--ff-body);
  background: var(--surface);
  color: var(--text);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }
svg { flex-shrink: 0; }

/* Icônes Phosphor duotone (inc/icons.php) : l'aplat .icon-duo reprend la couleur
   du contour à 20 %. Décor : le contraste se mesure sur le contour. */
.icon .icon-duo {
  fill: var(--icon-duo, currentColor);
  opacity: var(--icon-duo-opacity, 0.2);
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }

/* ==========================================================================
   Conteneur
   ========================================================================== */

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ==========================================================================
   Accessibilité — focus visible, lien d'évitement, texte pour lecteur d'écran
   ========================================================================== */

/*
 * :focus est neutralisé au profit de :focus-visible, qui distingue le clavier de
 * la souris. Tous les navigateurs ciblés le prennent en charge ; l'indicateur
 * reste donc systématiquement présent au clavier (RGAA 10.7).
 */
:focus { outline: none; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/* Composants arrondis : on écarte un peu plus le liseré pour qu'il reste lisible. */
.btn:focus-visible,
.news-card:focus-visible { outline-offset: 4px; }

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--text);
  color: #fff;
  padding: 14px 22px;
  border-radius: 8px;
  z-index: 1000;
  font-weight: 600;
  font-size: 14.5px;
  text-decoration: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.2);
  transition: top .2s ease;
}

.skip-link:focus,
.skip-link:focus-visible {
  top: 16px;
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

/*
 * .sr-only masque visuellement sans retirer du flux d'accessibilité.
 * .screen-reader-text est le nom que WordPress et les modules du parent
 * emploient : les deux partagent la même déclaration.
 */
.sr-only,
.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Un texte masqué qui reçoit le focus doit redevenir visible. */
.screen-reader-text:focus {
  position: static;
  width: auto;
  height: auto;
  margin: 0;
  overflow: visible;
  clip: auto;
  clip-path: none;
  white-space: normal;
}

/*
 * Lien externe : le RGAA demande de signaler l'ouverture d'un nouvel onglet.
 * Le module « main.js » du parent, qui ajoutait target="_blank" en aveugle, est
 * dérégistré ; les liens concernés portent target + rel dans le HTML, et cette
 * règle ajoute le repère visuel.
 */
a[target="_blank"]::after {
  content: "\00a0↗";
  font-size: 0.85em;
  text-decoration: none;
}

a[target="_blank"].no-ext-mark::after { content: none; }

/* ==========================================================================
   Boutons — repris de la maquette
   ==========================================================================

   .btn porte la forme (pilule, icône, flèche), les modificateurs la couleur.
   Couples mesurés :
     .btn-primary  --on-primary sur --primary        10.9:1
     .btn-gold     --text sur --accent                6.2:1
     .btn-white    --primary sur --on-primary        10.9:1
     .btn-outline  --text sur --surface, trait --text 16.3:1

   Écart : hauteur minimale de 44 px (cible tactile). La maquette donnait
   14px + 13px de texte + 14px, soit environ 45 px : l'apparence est inchangée.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch);
  padding: 14px 26px;
  font-family: var(--ff-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.2;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.btn::after { content: none; }  /* pas de repère ↗ générique dans un bouton */

.btn .icon { width: 14px; height: 14px; }

.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--text); transform: translateY(-1px); }

.btn-outline { border-color: var(--text); color: var(--text); }
.btn-outline:hover { background: var(--text); color: var(--on-primary); }

.btn-gold { background: var(--accent); color: var(--text); }
.btn-gold:hover { background: var(--primary); color: var(--on-primary); }

.btn-white { background: var(--on-primary); color: var(--primary); }
.btn-white:hover { background: var(--accent); color: var(--text); }

/* Flèche dessinée en CSS : un trait et une pointe, qui s'allonge au survol. */
.btn .arrow {
  display: inline-block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  position: relative;
  transition: width 0.2s;
}

.btn .arrow::after {
  content: "";
  position: absolute;
  right: 0;
  top: -3px;
  width: 7px;
  height: 7px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
  transform: rotate(45deg);
}

.btn:hover .arrow { width: 24px; }

/* ==========================================================================
   Bouton rond à icône (.icon-btn) — header et footer
   ==========================================================================

   38 px dans la maquette. La zone cliquable est portée à 44 px par un
   pseudo-élément transparent : l'apparence ne change pas.
   ========================================================================== */

.icon-btn {
  position: relative;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.icon-btn::before {
  content: "";
  position: absolute;
  inset: -3px;
}

.icon-btn::after { content: none; }

/* ==========================================================================
   Typographie partagée
   ========================================================================== */

/*
 * Mot en italique éditorial dans un titre (« concrètes, », « Écrivez-nous. »).
 *
 * La maquette le pose en or. L'or #B49759 est la couleur officielle de Kiwanis
 * International et ne se modifie pas (voir CLAUDE.md) ; sur fond clair il
 * plafonne à 2.63:1, sous le seuil même d'un grand titre. On change donc de rôle
 * plutôt que de couleur : sur fond clair, le mot se distingue par sa police
 * (Cormorant Garamond italique contre Anton) et prend le bleu profond,
 * 10.88:1 sur --surface, 9.97:1 sur --surface-alt.
 *
 * Sur fond --primary, l'or passe : .title-accent--on-dark le rétablit, 4.13:1,
 * RÉSERVÉ aux grands titres (24 px et plus).
 */
.title-accent {
  font-family: var(--ff-editorial);
  font-style: italic;
  font-weight: 400;
  text-transform: none;
  color: var(--primary);
}

.title-accent--on-dark { color: var(--accent); }

/*
 * Rythme et titres de section — .section, .section-title, .lede et .eyebrow de
 * la maquette, communs à tous les layouts.
 */
.section { padding-block: var(--section-y); }

.section-title {
  font-family: var(--ff-heading);
  font-weight: 400;
  font-size: var(--fs-h2-section);
  line-height: var(--lh-h2-section);
  letter-spacing: 0.02em;
  color: var(--primary);
}

/* Sur fond bleu : le titre passe en papier, le mot en italique retrouve l'or. */
.section-title--on-dark { color: var(--on-primary); }
.section-title--on-dark .title-accent { color: var(--accent); }

.lede {
  max-width: 60ch;
  font-size: var(--fs-lede);
  line-height: 1.85;
  color: var(--text-2);
}

.eyebrow {
  font-family: var(--ff-label);
  font-size: var(--fs-eyebrow);
  font-weight: 600;
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--primary);
}

/* Point doré décoratif devant un sur-titre. */
.eyebrow .dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 10px;
  background: var(--accent);
  border-radius: 50%;
  vertical-align: middle;
  transform: translateY(-2px);
}

/* ==========================================================================
   Médias insérés par l'éditeur WordPress
   ========================================================================== */

.alignleft { float: left; margin: 0 var(--gutter) 24px 0; }
.alignright { float: right; margin: 0 0 24px var(--gutter); }
.aligncenter { margin: 0 auto 24px; }
.alignnone { margin-bottom: 24px; }
.wp-caption { max-width: 100%; }
.wp-caption-text {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ==========================================================================
   Mouvement réduit (RGAA 13.8 / WCAG 2.3.3)
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

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