/* ==========================================================================
   GA UI — petits composants propres à Garde Alternée

   Composants absents de la bibliothèque, écrits sur ses conventions (BEM,
   tokens seuls) à partir des maquettes (projet/design/) :

   - .segmented                → Choix exclusif en pastilles (Mois / Année,
                                 Clair / Sombre / Système, Zone A / B / C)
     - .segmented__option      → Une option (<button aria-pressed>)
     - .segmented--block       → Pleine largeur, options de même taille
   - .icon-btn                 → Bouton rond 44 px à pictogramme (‹ ›)
     - .icon-btn--quiet        → Filet line (défaut : filet line aussi ; --strong = encre)
   - .sync-status              → État de synchronisation de l'en-tête
     - .sync-status--ok        → « À jour » : point encre
     - .sync-status--offline   → « Hors ligne » : losange encre, texte gras souligné
     - .sync-status--conflict  → « 1 conflit » : pastille « ! »
     - .sync-status__mark      → Le repère (point, losange, pastille)
   - .ga-corner                → Pastille « coin corné » (légende, bandeau, menu)
     - .ga-corner--sm          → 14 px (défaut 20 px)
   - .ga-banner                → Bandeau d'information dans la page
                                 (« Thomas a modifié 4 jours… », « Hors ligne · 3 en attente »)
     - .ga-banner__text        → Texte (le <strong> porte l'essentiel)
     - .ga-banner__actions     → Actions (.btn--link)
   - .caps                     → Intitulé en capitales (12 px, 700, .08em, muted)
   - .sr-only                  → Masqué à l'écran, lu par les lecteurs d'écran

   Usage :
   <div class="segmented" role="group" aria-label="Vue">
     <button class="segmented__option" aria-pressed="true">Mois</button>
     <button class="segmented__option" aria-pressed="false">Année</button>
   </div>

   <button class="sync-status sync-status--offline" aria-expanded="false" aria-controls="sync-list">
     <span class="sync-status__mark" aria-hidden="true"></span>Hors ligne
   </button>

   <div class="ga-banner" role="status">
     <span class="ga-corner" aria-hidden="true"></span>
     <span class="ga-banner__text"><strong>Thomas a modifié 4 jours</strong> depuis votre dernière visite, mer. 21 oct.</span>
     <span class="ga-banner__actions"><button class="btn btn--link">Tout marquer comme vu</button></span>
   </div>

   Accessibilité :
   - .segmented : role="group" + aria-label ; chaque option porte aria-pressed
     (classe d'état .is-active posée avec lui par le script qui bascule).
   - .icon-btn : aria-label obligatoire, SVG en aria-hidden.
   - .sync-status : bouton qui ouvre la liste des modifications en attente
     (aria-expanded + aria-controls) ; son texte dit l'état, le repère est décoratif.
   ========================================================================== */

/* --------------------------------------------------------------------------
   SEGMENTED
   -------------------------------------------------------------------------- */
.segmented {
  display: inline-flex;
  flex: none;
  box-sizing: border-box;
  padding: 3px;
  border: var(--border-control) solid var(--color-border);
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
}

.segmented--block {
  display: flex;
  width: 100%;
}

.segmented__option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  height: var(--control-height-sm);
  padding: 0 14px;
  border: none;
  border-radius: var(--radius-full);
  background: transparent;
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 0.875rem;
  font-weight: var(--font-weight-normal);
  white-space: nowrap;
  cursor: pointer;
}

.segmented--block .segmented__option {
  flex: 1 1 0;
  height: 40px;
  font-size: var(--font-size-md);
}

.segmented__option.is-active,
.segmented__option[aria-pressed="true"] {
  background-color: var(--color-primary);
  color: var(--color-text-inverse);
  font-weight: var(--font-weight-bold);
}

.segmented__option:not([aria-pressed="true"]):hover {
  background-color: var(--color-surface-hover);
}

.segmented__option:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: 1px;
}

/* --------------------------------------------------------------------------
   ICON BUTTON
   -------------------------------------------------------------------------- */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  box-sizing: border-box;
  width: var(--tap-min);
  height: var(--tap-min);
  padding: 0;
  border: var(--border-control) solid var(--color-border);
  border-radius: var(--radius-full);
  background-color: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}

.icon-btn--strong {
  border-color: var(--color-border-strong);
}

.icon-btn--md {
  width: var(--control-height);
  height: var(--control-height);
}

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

.icon-btn:hover {
  background-color: var(--color-surface-hover);
}

.icon-btn:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: var(--focus-ring-offset);
}

/* --------------------------------------------------------------------------
   SYNC STATUS
   -------------------------------------------------------------------------- */
.sync-status {
  display: inline-flex;
  align-items: center;
  flex: none;
  gap: 6px;
  min-height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-normal);
  white-space: nowrap;
  cursor: pointer;
}

.sync-status:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-focus);
  outline-offset: 2px;
  border-radius: 4px;
}

.sync-status__mark {
  flex: none;
  box-sizing: border-box;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  background-color: var(--color-text);
}

/* En attente : anneau encre de 2 px (maquette Application, réglage sync « En attente ») */
.sync-status--pending .sync-status__mark {
  background-color: transparent;
  border: var(--border-strong) solid var(--color-text);
}

/* Hors ligne : losange encre, texte encre gras souligné, sans fond */
.sync-status--offline {
  gap: 4px;
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.sync-status--offline .sync-status__mark {
  border-radius: 1px;
  background-color: transparent;
  border: var(--border-control) solid var(--color-text);
  transform: rotate(45deg);
}

/* Conflit : pastille « ! » encre de 16 px */
.sync-status--conflict .sync-status__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  color: var(--color-surface);
  font-size: 11px;
  font-weight: var(--font-weight-bold);
  line-height: 1;
}

.sync-status--conflict .sync-status__mark::before {
  content: '!';
}

/* --------------------------------------------------------------------------
   COIN CORNÉ (pastille)
   -------------------------------------------------------------------------- */
.ga-corner {
  display: inline-block;
  flex: none;
  box-sizing: border-box;
  width: 20px;
  height: 20px;
  border: var(--border-hair) solid var(--color-border);
  border-radius: 4px;
  background: linear-gradient(225deg, var(--ga-vermillon) 0 46%, var(--color-surface) 46% 58%, transparent 58%), var(--color-surface);
}

.ga-corner--sm {
  width: 14px;
  height: 14px;
  border-radius: 3px;
}

/* --------------------------------------------------------------------------
   BANNER
   -------------------------------------------------------------------------- */
.ga-banner {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  box-sizing: border-box;
  padding: 6px 6px 6px 14px;
  border: var(--border-control) solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-md);
}

.ga-banner__text {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.ga-banner__text strong {
  font-weight: var(--font-weight-bold);
}

.ga-banner__actions {
  display: inline-flex;
  flex: none;
  gap: var(--space-2xs);
}

@media (max-width: 640px) {
  .ga-banner {
    padding: 4px 4px 4px 12px;
    font-size: 0.875rem;
  }
}

/* --------------------------------------------------------------------------
   UTILITAIRES
   -------------------------------------------------------------------------- */
.caps {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--letter-spacing-caps);
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.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;
}
