/*
 * components.css -- Composants reutilisables (cards, buttons, forms, tags)
 * Commune de Silly -- Theme custom
 *
 * Les boutons (.btn) sont definis dans header.css car ils y sont utilises en premier.
 * Ce fichier contient les composants partages entre les pages.
 *
 * @package Silly
 */

/* ============================================
   SECTION TAG PATTERN (template Routena)
   ============================================ */
.section-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-tag__icon {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
}

.section-tag__label {
  display: inline-flex;
  align-items: center;
  padding: 8px;
  background: var(--color-primary);
  border-radius: 4px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 16px;
  line-height: 16px;
  letter-spacing: -0.32px;
  color: var(--color-text-light);
}

.section-tag--dark .section-tag__label {
  color: var(--color-bg-dark);
}

.section-tag--light .section-tag__label {
  background: rgba(255, 255, 255, 0.16);
  color: var(--color-text-light);
}

/* ============================================
   ARROW BUTTON (used in cards)
   ============================================ */
.arrow-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
  transition: all var(--transition-base);
  flex-shrink: 0;
}

.arrow-btn:hover {
  background: var(--color-primary);
}

.arrow-btn:hover svg {
  fill: var(--color-text-light);
}

.arrow-btn svg {
  width: 20px;
  height: 20px;
  fill: var(--color-text);
  transition: fill var(--transition-base);
}

.arrow-btn--primary {
  background: var(--color-primary);
}

.arrow-btn--primary svg {
  fill: var(--color-text-light);
}

.arrow-btn--primary:hover {
  background: var(--color-primary-dark);
}

/* ============================================
   BREADCRUMB (fil d'Ariane dans page-hero)
   ============================================ */
.page-hero__breadcrumb {
  margin-top: var(--space-lg);
}

/* Styles pour le breadcrumb custom ET Yoast SEO */
.page-hero__breadcrumb a,
.page-hero__breadcrumb span {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
}

.page-hero__breadcrumb a {
  color: rgba(255, 255, 255, 0.56);
  transition: color var(--transition-base);
}

.page-hero__breadcrumb a:hover {
  color: var(--color-text-light);
}

.page-hero__breadcrumb span[aria-current],
.page-hero__breadcrumb .breadcrumb__item--current {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
}

/* Séparateur Yoast (texte ›) */
.page-hero__breadcrumb .breadcrumb_last {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
}

/* Breadcrumb custom (ol/li) */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: center;
  list-style: none;
  margin: 0;
  padding: 0;
}

.breadcrumb__item {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.56);
}

.breadcrumb__link {
  color: rgba(255, 255, 255, 0.56);
  transition: color var(--transition-base);
  text-decoration: none;
}

.breadcrumb__link:hover {
  color: var(--color-text-light);
}

.breadcrumb__item--current {
  color: rgba(255, 255, 255, 0.88);
  font-weight: 500;
}

.breadcrumb__separator {
  display: flex;
  align-items: center;
}

.breadcrumb__separator svg {
  width: 8px;
  height: 12px;
  stroke: rgba(255, 255, 255, 0.32);
}

@media (max-width: 768px) {
  .breadcrumb {
    flex-wrap: wrap;
    gap: 4px 6px;
  }

  .breadcrumb__item,
  .breadcrumb__link,
  .breadcrumb__item--current {
    font-size: 14px;
    line-height: 20px;
  }

  .page-hero__breadcrumb,
  .page-hero__breadcrumb a,
  .page-hero__breadcrumb span {
    font-size: 14px;
    line-height: 20px;
  }
}

/* ============================================
   CHATBOT WIDGET (bulle flottante)
   ============================================ */
.chatbot {
  position: fixed;
  bottom: 24px;
  right: 24px;
  /* Au-dessus de l'en-tête fixe (1000) et de sa barre (1001), sous le menu
     mobile (9999) : une fenêtre de 720 px atteint l'en-tête sur un portable,
     et son propre en-tête — avec la croix — passait dessous. */
  z-index: 1002;
}

/* Bulle flottante */
.chatbot__bubble {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: transparent;
  color: var(--color-primary);
  border: none;
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s ease, filter 0.3s ease;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
  filter: drop-shadow(0 6px 20px rgba(51, 109, 148, 0.25)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
}

/* Cercle bleu + blanc (fond de la bulle) */
.chatbot__bubble::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--color-bg);
  border: 2px solid var(--color-primary);
  transition: background 0.3s ease, border-color 0.3s ease;
  z-index: 0;
}

/* Empilement : cercle (0) → mascotte clippée dans le cercle (1) → tête qui dépasse (2) */
.chatbot__bubble-mascot--clip { z-index: 1; }
.chatbot__bubble-mascot--free { z-index: 2; }

.chatbot__bubble:hover {
  transform: scale(1.08);
  filter: drop-shadow(0 10px 28px rgba(51, 109, 148, 0.32)) drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.chatbot__bubble:hover::before {
  border-color: var(--color-primary-dark);
}

.chatbot--open .chatbot__bubble {
  color: var(--color-text-light);
}

.chatbot--open .chatbot__bubble::before {
  background: var(--color-primary);
  border-color: var(--color-primary);
}

.chatbot__bubble:hover .chatbot__bubble-mascot img {
  transform: translate(-50%, 0) translateY(-3px) rotate(-4deg);
}

/* ============================================
   BULLE BD D'ACCUEIL (style comic)
   ============================================ */
.chatbot__greeting {
  position: absolute;
  bottom: calc(100% + 27px);
  right: 0;
  width: max-content;
  max-width: 260px;
  background: var(--color-bg);
  color: var(--color-text);
  padding: 14px 36px 14px 18px;
  border-radius: 18px;
  border: 2px solid var(--color-primary);
  box-shadow: 0 8px 24px rgba(51, 109, 148, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.92);
  transform-origin: bottom right;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), visibility 0.3s;
}

.chatbot__greeting--visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Masquer la bulle BD quand le chatbot est ouvert */
.chatbot--open .chatbot__greeting {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px) scale(0.92);
}

/* Queue de la bulle (style BD) — double triangle (bord + remplissage) */
.chatbot__greeting::before,
.chatbot__greeting::after {
  content: "";
  position: absolute;
  right: 22px;
  bottom: -10px;
  width: 0;
  height: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-top: 10px solid var(--color-primary);
}

.chatbot__greeting::after {
  bottom: -7px;
  border-top-color: var(--color-bg);
}

.chatbot__greeting-text {
  margin: 0;
  color: var(--color-text);
}

.chatbot__greeting-text strong {
  color: var(--color-primary);
  font-weight: 700;
}

.chatbot__greeting-close {
  position: absolute;
  top: 5px;
  right: 5px;
  /* 24 px : taille minimale d'une cible (WCAG 2.5.8, niveau AA) */
  width: 24px;
  height: 24px;
  padding: 0;
  border: none;
  background: var(--color-bg-alt);
  color: var(--color-text-secondary);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.chatbot__greeting-close:hover {
  background: var(--color-primary);
  color: var(--color-text-light);
  transform: rotate(90deg);
}

.chatbot__greeting-close svg {
  width: 12px;
  height: 12px;
}


/* Mascotte Sillya dans la bulle.
   Deux calques pour avoir un comportement z-index différencié :
   - calque "bas" (--clip) : clippé au cercle, corps coupé par le cercle
   - calque "haut" (--free) : non clippé, tête libre de dépasser au-dessus
   Les deux affichent la MEME image parfaitement alignée. */
.chatbot__bubble-mascot {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chatbot__bubble-mascot--clip {
  border-radius: 50%;
  overflow: hidden;
}

.chatbot__bubble-mascot--free {
  overflow: visible;
  /* Ne garde que ce qui dépasse au-dessus du cercle de la bulle.
     Le cercle fait 64px et le bord arrondi commence à ~8%. On masque
     la moitié basse pour ne laisser visible que la tête qui dépasse. */
  clip-path: inset(-40px 0 50% 0);
}

.chatbot__bubble-mascot img {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 84px;
  height: 84px;
  object-fit: contain;
  object-position: bottom center;
  transform: translate(-50%, 0);
  transition: transform 0.3s ease;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.15));
}

.chatbot__bubble-icon {
  width: 24px;
  height: 24px;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chatbot__bubble-icon--close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.chatbot--open .chatbot__bubble-mascot {
  opacity: 0;
  transform: scale(0.6);
}

.chatbot--open .chatbot__bubble-icon--close {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* Fenêtre chatbot */
.chatbot__window {
  position: absolute;
  bottom: calc(100% + 16px);
  right: 0;
  width: 440px;
  /* Une HAUTEUR, pas un plafond : avec `max-height`, la fenêtre prenait la
     hauteur de son contenu et le fil de messages restait à sa base flex de
     180 px, sur n'importe quel écran. Bulle de 64 px à 24 px du bas, 16 px
     d'écart ; la fenêtre s'arrête 16 px SOUS l'en-tête (posé à 8 px du haut,
     bandeau du CPAS compris dans --total-header-height), et n'excède pas
     720 px sur un grand écran. Elle montait à 24 px du haut : sur un portable
     (1280 × 800), elle recouvrait en entier « Rechercher » et « e-Guichet »
     quand ils recevaient le focus (revue du 24 sept. 2026, WCAG 2.4.11). */
  height: min(720px, calc(100vh - 128px - var(--total-header-height, 80px)));
  background: var(--color-bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.25s ease;
}

.chatbot--open .chatbot__window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.chatbot__header {
  background: var(--color-primary);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chatbot__header-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.chatbot__avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}

.chatbot__avatar img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

/* Variante mascotte : image en plein cadre, sans padding */
.chatbot__avatar--mascot {
  background: #fff;
  border: 2px solid rgba(255, 255, 255, 0.35);
}

.chatbot__avatar--mascot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.chatbot__header-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chatbot__header-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
  color: var(--color-text-light);
}

.chatbot__header-status {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 12px;
  line-height: 1;
  color: #FFFFFF;
}

.chatbot__status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  flex-shrink: 0;
}

/* Les deux boutons de l'en-tête : effacer, fermer. Même dessin, la croix
   étant celle que le visiteur connaît déjà. */
.chatbot__header-actions {
  display: flex;
  align-items: center;
  /* 12 px, pas 8 : la corbeille efface sans confirmation, et un doigt qui
     visait la croix ne doit pas la trouver. */
  gap: 12px;
  flex-shrink: 0;
}

.chatbot__header-close,
.chatbot__header-clear {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.chatbot__header-close:hover,
.chatbot__header-clear:hover {
  background: rgba(255, 255, 255, 0.24);
}

.chatbot__header-clear[hidden] {
  display: none;
}

/* Pendant qu'une réponse est en route, la corbeille ne fait rien : qu'elle
   le montre, comme le bouton Envoyer. */
.chatbot__header-clear:disabled {
  opacity: 0.4;
  cursor: default;
}

.chatbot__header-clear:disabled:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chatbot__header-close svg,
.chatbot__header-clear svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-light);
}

/* Messages */
.chatbot__messages {
  flex: 1 1 180px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  /* 0, pas 180px : sur un petit écran, c'est le fil qui se comprime, jamais
     le champ de saisie ni la disclosure. */
  min-height: 0;
}

.chatbot__messages:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: -2px;
}

.chatbot__message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 85%;
}

.chatbot__message--bot {
  align-self: flex-start;
}

.chatbot__message--user {
  align-self: flex-end;
}

.chatbot__message-bubble {
  padding: 12px 16px;
  border-radius: 14px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 22px;
  color: var(--color-text);
}

.chatbot__message--bot .chatbot__message-bubble {
  background: var(--color-bg-alt);
  border-bottom-left-radius: 4px;
}

.chatbot__message--user .chatbot__message-bubble {
  background: var(--color-primary);
  color: var(--color-text-light);
  border-bottom-right-radius: 4px;
}

.chatbot__message-time {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--color-text-secondary);
  padding: 0 4px;
}

/* Actions rapides */
.chatbot__quick-actions {
  padding: 0 20px 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chatbot__quick-btn {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-full);
  background: var(--color-bg);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 13px;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  line-height: 1.25;
  min-height: 26px;
  -webkit-tap-highlight-color: transparent;
}

.chatbot__quick-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary-ink);
  background: rgba(51, 109, 148, 0.05);
}

/* Champ de saisie */
.chatbot__input {
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatbot__input-field {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 15px;
  line-height: 22px;
  color: var(--color-text);
  background: transparent;
}

.chatbot__input-field::placeholder {
  color: var(--color-text-secondary);
  opacity: 1; /* 4,5:1 minimum : le placeholder est du texte lu */
}

.chatbot__input-send {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--color-primary);
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  opacity: 0.4;
  transition: opacity 0.2s ease;
}

.chatbot__input-send svg {
  width: 16px;
  height: 16px;
  color: var(--color-text-light);
}

/* Admin bar compensation */
body.admin-bar .chatbot {
  bottom: 48px;
}

/* Barre d'administration (agent connecté) : la bulle remonte de 24 px et
   l'en-tête descend de 32 px — 56 px de moins, pour rester sous l'en-tête. */
@media (min-width: 769px) {
  body.admin-bar .chatbot__window {
    height: min(720px, calc(100vh - 184px - var(--total-header-height, 80px)));
  }
}

/* Responsive mobile */
@media (max-width: 768px) {
  .chatbot__window {
    width: calc(100vw - 32px);
    right: -8px;
    /* dvh : la barre d'adresse mobile ne mange pas le champ de saisie.
       Bulle de 64 px à 16 px du bas, 16 px d'écart : la fenêtre s'arrête
       16 px sous l'en-tête fixe (80 px, en haut de l'écran) au lieu de
       recouvrir le burger sur un petit écran (revue du 24 sept. 2026). */
    height: min(80vh, calc(100dvh - 112px - var(--header-height, 80px)));
  }

  .chatbot {
    bottom: 16px;
    right: 16px;
  }

  .chatbot__greeting {
    max-width: 220px;
    font-size: 13px;
    padding: 12px 32px 12px 14px;
  }
}

/* --- Assistante : conversation (assets/js/chatbot.js) --- */

/* Sans JavaScript, pas de bulle : une assistante inerte serait pire que rien. */
.chatbot:not(.chatbot--js) {
  display: none;
}

.chatbot__quick-actions[hidden] {
  display: none;
}

.chatbot__input-send {
  opacity: 1;
}

.chatbot__input-send:disabled,
.chatbot__input-field:disabled {
  opacity: 0.4;
  cursor: default;
}

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

.chatbot__input-send:focus-visible,
.chatbot__quick-btn:focus-visible,
.chatbot__header-close:focus-visible,
.chatbot__header-clear:focus-visible,
.chatbot__escalade-btn:focus-visible,
.chatbot__sources-list a:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Sur l'en-tête bleu, un contour bleu ne se voit pas. */
.chatbot__header-close:focus-visible,
.chatbot__header-clear:focus-visible {
  outline-color: var(--color-text-light);
}

/* Contenu HTML d'une réponse (assaini côté serveur) */
.chatbot__message--bot .chatbot__message-bubble p {
  margin: 0;
}

.chatbot__message--bot .chatbot__message-bubble p + p,
.chatbot__message--bot .chatbot__message-bubble p + ul,
.chatbot__message--bot .chatbot__message-bubble p + ol,
.chatbot__message--bot .chatbot__message-bubble ul + p,
.chatbot__message--bot .chatbot__message-bubble ol + p {
  margin-top: 8px;
}

.chatbot__message--bot .chatbot__message-bubble ul:not(.chatbot__sources-list),
.chatbot__message--bot .chatbot__message-bubble ol {
  margin: 0;
  padding-left: 18px;
}

/* La liste des sources a sa propre flèche : exclue, sinon elle prenait aussi
   la puce, plus spécifique que son `list-style: none`. */
.chatbot__message--bot .chatbot__message-bubble ul:not(.chatbot__sources-list) {
  list-style: disc;
}

.chatbot__message--bot .chatbot__message-bubble ol {
  list-style: decimal;
}

.chatbot__message--bot .chatbot__message-bubble li + li {
  margin-top: 4px;
}

.chatbot__message--bot .chatbot__message-bubble a:not(.chatbot__escalade-btn) {
  color: var(--color-primary-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
  overflow-wrap: anywhere;
}

.chatbot__message--bot .chatbot__message-bubble a:not(.chatbot__escalade-btn):hover {
  color: var(--color-primary-ink-dark);
}

/* Le bouton « Contacter » vit DANS une bulle : exclu ci-dessus, sinon la règle
   des liens, plus spécifique, l'écrivait en bleu souligné sur fond bleu. */

.chatbot__message--error .chatbot__message-bubble {
  background: #fff4e5;
  border-left: 3px solid var(--color-accent);
}

/* Indicateur de frappe */
.chatbot__typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  height: 20px;
}

.chatbot__typing i {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  opacity: 0.5;
  animation: chatbot-typing 1.2s infinite ease-in-out;
}

.chatbot__typing i:nth-child(2) { animation-delay: 0.2s; }
.chatbot__typing i:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatbot-typing {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot__typing i {
    animation: none;
    opacity: 0.7;
  }
}

/* Sources citées */
.chatbot__sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  line-height: 19px;
}

.chatbot__sources-label {
  display: block;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-secondary);
  margin-bottom: 4px;
}

.chatbot__sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.chatbot__sources-list li {
  padding: 3px 0 3px 14px;
  position: relative;
  line-height: 18px;
}

.chatbot__sources-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  color: var(--color-primary-ink);
}

.chatbot__source--pdf a::after {
  content: " (PDF)";
  color: var(--color-text-secondary);
}

.chatbot__sources-list a {
  color: var(--color-primary-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Escalade vers un humain */
.chatbot__escalade {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  border: 1px solid var(--color-border);
}

.chatbot__escalade p {
  margin: 0 0 8px;
  font-size: 14px;
  line-height: 20px;
  color: var(--color-text-secondary);
}

.chatbot__escalade-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: var(--color-text-light);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background 0.2s ease;
}

.chatbot__escalade-btn:hover {
  background: var(--color-primary-dark);
  color: var(--color-text-light);
}

/* Disclosure AI Act, sous le champ de saisie */
.chatbot__disclosure {
  margin: 0;
  padding: 8px 16px 12px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 16px;
  color: var(--color-text-secondary);
}

.chatbot__disclosure a {
  color: var(--color-primary-ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Pendant une réponse, la bulle marque l'attente */
.chatbot--busy .chatbot__status-dot {
  animation: chatbot-pulse 1s infinite ease-in-out;
}

@keyframes chatbot-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

@media (prefers-reduced-motion: reduce) {
  .chatbot--busy .chatbot__status-dot {
    animation: none;
  }
}

/* ============================================
   ARTICLE CARD — HORIZONTAL
   Card actualité avec image à droite.
   Composant réutilisable (accueil, pages service).
   ============================================ */
.article-card__badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  background: var(--badge-color, var(--color-primary));
  color: var(--color-text-light);
  border-radius: var(--radius-full);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: -0.24px;
  white-space: nowrap;
}

.article-card__meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.article-card__date {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 13px;
  line-height: 18px;
  letter-spacing: -0.26px;
  color: rgba(26, 26, 26, 0.62);
}

.article-card__title {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.72px;
  color: var(--color-text);
}

.article-card__title a {
  color: inherit;
  text-decoration: none;
  transition: color var(--transition-base);
}

.article-card__title a:hover {
  color: var(--color-primary-ink);
}

.article-card__excerpt {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 14px;
  line-height: 21px;
  letter-spacing: -0.28px;
  color: var(--color-text-secondary);
}

.article-card__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  line-height: 18px;
  letter-spacing: -0.28px;
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-base);
  padding-top: 4px;
}

.article-card__link:hover {
  color: var(--color-primary-ink-dark);
}

.article-card__link svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  transition: transform var(--transition-base);
}

.article-card__link:hover svg {
  transform: translateX(3px);
}

.article-card--horizontal {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 20px;
  padding: 24px;
  background: var(--color-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  transition: box-shadow var(--transition-base), transform var(--transition-base);
}

.article-card--horizontal:hover {
  box-shadow: var(--shadow-natural);
  transform: translateY(-2px);
}

.article-card--horizontal .article-card__body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.article-card--horizontal .article-card__title {
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: -0.36px;
}

.article-card--horizontal .article-card__excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-card__thumb {
  flex-shrink: 0;
  width: 120px;
  height: 100px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  display: block;
}

.article-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-base);
}

.article-card--horizontal:hover .article-card__thumb img {
  transform: scale(1.03);
}

@media (max-width: 768px) {
  .article-card--horizontal {
    flex-direction: column;
    gap: 16px;
  }

  .article-card--horizontal .article-card__thumb {
    width: 100%;
    height: 200px;
    order: -1;
  }
}

/* ============================================
   ONGLETS (.cpas-tabs)
   Composant partagé : Actualités & Agenda du CPAS, Économie locale…
   Le préfixe .cpas-* est historique (le composant est né sur le mini-site
   CPAS) ; il est conservé pour ne pas casser le markup existant.
   Progressive enhancement : sans .cpas-tabs--js, tous les panneaux restent
   visibles. Le JS (initCpasTabs, assets/js/main.js) ajoute .cpas-tabs--js
   puis masque les panneaux inactifs via l'attribut [hidden].
   La couleur suit --color-primary : mauve sous .is-cpas, bleu ailleurs.
   ============================================ */
.cpas-tabs {
  padding: var(--section-padding, 96px) 0;
}

.cpas-tabs__inner {
  max-width: var(--container-max, 1280px);
}

.cpas-tabs__tablist {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 40px;
}

.cpas-tabs__tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -1px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.3px;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: color var(--transition-base), border-color var(--transition-base);
  -webkit-tap-highlight-color: transparent;
}

.cpas-tabs__tab svg {
  width: 18px;
  height: 18px;
}

.cpas-tabs__tab:hover {
  color: var(--color-primary-ink);
}

.cpas-tabs__tab[aria-selected="true"] {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.cpas-tabs__tab:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 4px 4px 0 0;
}

/* Panneaux : visibles par défaut (sans JS). Masqués seulement en mode JS. */
.cpas-tabs--js .cpas-tabs__panel[hidden] {
  display: none;
}

/* Espacement entre les deux panneaux quand ils sont empilés (sans JS) */
.cpas-tabs__panel + .cpas-tabs__panel {
  margin-top: 56px;
}

.cpas-tabs--js .cpas-tabs__panel + .cpas-tabs__panel {
  margin-top: 0;
}

.cpas-tabs__panel:focus-visible {
  outline: none;
}

.cpas-tabs__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
}

.cpas-tabs__empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-secondary);
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
}

@media (max-width: 1024px) {
  .cpas-tabs__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  /* Grille en 1 colonne, onglets répartis sur toute la largeur */
  .cpas-tabs__grid {
    grid-template-columns: 1fr;
  }

  .cpas-tabs__tablist {
    gap: 0;
  }

  .cpas-tabs__tab {
    flex: 1;
    justify-content: center;
    padding: 14px 12px;
    font-size: 15px;
  }
}

/* Variante « inline » : onglets insérés dans une colonne de contenu
   (.service-content) et non en pleine largeur de page. On neutralise le
   padding vertical de section et la largeur max du conteneur. */
.cpas-tabs--inline {
  padding: 0;
}

.cpas-tabs--inline .cpas-tabs__inner {
  max-width: none;
  padding: 0;
}

/* ============================================
   ADRESSE + LIEN « ITINÉRAIRE » (.adresse-itineraire)
   Composant partagé : toute adresse de la colonne de droite
   (template-parts/page-sidebar.php) et, par le même dessin, celle du pied
   de page. Le lien vient de silly_itineraire_lien() (inc/theme-setup.php).
   L'enveloppe empile l'adresse et son lien ; elle prend la place de
   l'<address> dans les lignes en flex (icône + texte) sans rien leur ôter.
   <div> dans la colonne de droite (elle contient l'<address>), <span> dans
   une ligne <p> du pied de page.
   Couleur « encre » du service : lisible en texte (4,5:1) même sur les
   services aux couleurs claires (Sports, Espaces verts).
   ============================================ */
.adresse-itineraire {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
}

.adresse-itineraire__lien {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  /* Cible de 24 px au moins (WCAG 2.5.8). */
  min-height: 24px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  line-height: 18px;
  color: var(--color-primary-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color var(--transition-base);
}

.adresse-itineraire__lien:hover {
  color: var(--color-primary-ink-dark);
  text-decoration-thickness: 2px;
}

.adresse-itineraire__icone {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
}

/* Fond foncé (pied de page) : blanc à 85 % sur #1A1A2E, 12:1. */
.adresse-itineraire__lien--sombre {
  color: rgba(255, 255, 255, 0.85);
}

.adresse-itineraire__lien--sombre:hover {
  color: var(--color-text-light);
}

.adresse-itineraire__lien--sombre:focus-visible {
  outline-color: var(--color-text-light);
}

@media (prefers-reduced-motion: reduce) {
  .adresse-itineraire__lien {
    transition: none;
  }
}

/* ============================================
   DOC LIST — Liste de documents à ouvrir (.doc-list)
   Composant partagé : le bloc « Documents » des pages (section-render.php)
   et les documents joints d'une actualité (single.php). Il vivait dans
   pages/service.css seulement, que single.php ne sert pas (148 Ko) : la
   copie de service.css est identique à celle-ci, règle pour règle — à
   retirer de service.css, et à ne jamais laisser diverger.
   ============================================ */
.doc-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-list__intro {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--color-text-secondary);
  margin: 24px 0 12px;
}

.doc-list__link,
.doc-list__item--inactive {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: inherit;
  transition: border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.doc-list__link:hover,
.doc-list__link:focus-visible {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-natural);
}

.doc-list__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  color: var(--color-primary);
}

.doc-list__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.doc-list__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 16px;
  color: var(--color-text);
}

.doc-list__meta {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.doc-list__action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--color-primary);
}

/* Documents non disponibles en ligne (style atténué, non cliquable) */
.doc-list--muted .doc-list__item--inactive {
  background: var(--color-bg-alt);
  border-style: dashed;
  cursor: default;
}

.doc-list--muted .doc-list__icon {
  background: var(--color-bg);
  color: var(--color-text-secondary);
}

.doc-list--muted .doc-list__title {
  color: var(--color-text-secondary);
  font-weight: 500;
}

/* ============================================
   PARTAGE (.single-article__share) — actualités et fiches circuit
   Pastilles rondes Facebook / LinkedIn / X / e-mail / copier le lien. Les
   teintes passent par --color-primary-ink (lisible sur une page Tourisme,
   identique à --color-primary ailleurs). Le bouton « copier » naît caché et
   n'est révélé que par le script qui le rend utile (main.js, topofiche.js).
   ============================================ */
.single-article__share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.single-article__share-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text);
  margin-right: 8px;
}

.single-article__share-label svg {
  width: 18px;
  height: 18px;
  stroke: var(--color-primary-ink);
}

.single-article__share-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.single-article__share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
}

.single-article__share-btn[hidden] {
  display: none;
}

.single-article__share-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.single-article__share-btn:hover {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-text-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-natural);
}

.single-article__share-btn--copy.is-copied {
  background: var(--color-secondary);
  border-color: var(--color-secondary);
  color: var(--color-text-light);
}

@media (max-width: 768px) {
  .single-article__share {
    padding: 16px;
    gap: 12px;
  }

  .single-article__share-label {
    width: 100%;
    margin-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .single-article__share-btn {
    transition: none;
  }

  .single-article__share-btn:hover {
    transform: none;
  }
}

/* La bulle d'accueil de Sillya s'efface au-dessus du bas du pied de page
   (assets/js/chatbot.js) : elle y couvrait « Retour en haut de page » et les
   liens légaux. */
.chatbot__greeting.chatbot__greeting--pied-visible {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
