/* Header et footer de KairoBot v2. */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-5);
}

.brand { display: flex; align-items: center; gap: var(--s-3); font-weight: 700; font-size: 1.125rem; }
.brand img { width: 28px; height: 28px; }

.nav { display: flex; align-items: center; gap: var(--s-5); }
.nav a { color: var(--text-2); font-size: 0.9375rem; transition: color 0.15s; }
.nav a:hover { color: var(--text); }
.nav .btn { color: var(--on-accent); height: 36px; padding-inline: var(--s-4); }
.nav .btn:hover { color: var(--on-accent); }

.nav-toggle { display: none; width: 40px; height: 40px; border: 1px solid var(--border-strong); position: relative; }
.nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
  display: block; width: 18px; height: 2px; background: var(--text); content: "";
}
.nav-toggle span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); }
.nav-toggle span::before { position: absolute; top: -6px; left: 0; }
.nav-toggle span::after  { position: absolute; top: 6px;  left: 0; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: var(--s-3) var(--gutter) var(--s-5);
  }
  .nav.is-open { display: flex; }
  .nav a { padding-block: var(--s-3); }
  .nav .btn { margin-top: var(--s-3); height: 40px; }
}

/* Footer ----------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--border); padding-top: var(--s-8); overflow: hidden; }
.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr));
  gap: var(--s-7);
}
.footer-brand p { margin: var(--s-4) 0 var(--s-5); max-width: 36ch; font-size: 0.9375rem; }
.footer-col h4 { margin-bottom: var(--s-4); }
.footer-col li + li { margin-top: var(--s-3); }
.footer-col a { color: var(--text-2); font-size: 0.9375rem; transition: color 0.15s; }
.footer-col a:hover { color: var(--accent-hover); }

.footer-bottom {
  margin-top: var(--s-7);
  display: flex;
  justify-content: space-between;
  gap: var(--s-4);
  flex-wrap: wrap;
  border-top: 1px solid var(--border);
  padding-block: var(--s-5);
  font-size: 0.8125rem;
  color: var(--text-2);
}
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
.footer-links a { color: var(--text-2); transition: color 0.15s; }
.footer-links a:hover, .footer-links a[aria-current="page"] { color: var(--text); }
.footer-up { transition: color 0.15s; }
.footer-up:hover { color: var(--text); }

@media (max-width: 900px) {
  .footer-top { grid-template-columns: 1fr 1fr; gap: var(--s-6); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 520px) { .footer-top { grid-template-columns: 1fr; } }

/* Compte : connexion / pastille dans le menu */

.nav-account { display: inline-flex; align-items: center; gap: var(--s-2); max-width: 180px; }
.nav-account img { width: 22px; height: 22px; border-radius: 50% !important; background: var(--surface-2); flex: none; }
.nav-account span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-badge { display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 6px; font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 600; line-height: 18px; text-align: center; color: var(--on-accent); background: var(--accent); border-radius: 999px !important; }
.nav a[aria-current="page"] { color: var(--text); }

/* Bandeau d'annonce (piloté depuis la console admin ; aperçu identique dans /admin) */
.ad-prev { min-height: 44px; }
.site-banner { border-left: 3px solid var(--accent); background: var(--surface-2); color: var(--text); }
.site-banner--warn { border-left-color: var(--warn); }
.site-banner--danger { border-left-color: var(--danger); }
.site-banner .sb-inner { display: flex; align-items: center; gap: var(--s-3); max-width: var(--container); margin-inline: auto; padding: 10px var(--gutter); font-size: 0.9375rem; }
.site-banner .sb-msg { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.site-banner .sb-link { color: var(--accent-hover); text-decoration: underline; text-underline-offset: 3px; white-space: nowrap; }
.site-banner .sb-close { padding: 0 6px; font: inherit; font-size: 1.125rem; line-height: 1; color: var(--text-2); background: none; border: 0; cursor: pointer; }
.site-banner .sb-close:hover { color: var(--text); }
.site-banner .sb-tag { flex: none; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-hover); }
.site-banner--warn .sb-tag { color: var(--warn); }
.site-banner--danger .sb-tag { color: var(--danger); }


/* Fond décoratif des pages sobres : quadrillage fin sur toute la hauteur + formes en filet qui se répondent
   à gauche et à droite le long de la page (elles remplissent les marges vides). Aplats uniquement : ni dégradé
   ni ombre. Tout est derrière le contenu, qui reste lisible. */
.bg-deco { position: relative; min-height: 100vh; }
.bg-deco::before {
  content: ""; position: absolute; z-index: -1; inset: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M48 0H0v48' fill='none' stroke='%231a1a1a' stroke-width='1'/%3E%3C/svg%3E"); background-position: center top;
}
.bg-deco::after {
  content: ""; position: absolute; z-index: -1; top: var(--header-h); bottom: 0; left: 0; right: 0; opacity: 0.75; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='960' fill='none' stroke='%235b6ef0' stroke-width='1.5'%3E%3Crect x='300' y='40' width='150' height='150' stroke-opacity='.45'/%3E%3Crect x='360' y='110' width='150' height='150' stroke-opacity='.22'/%3E%3Crect x='190' y='230' width='70' height='70' stroke-opacity='.3'/%3E%3Cpath d='M70 80h26M83 67v26M210 360h26M223 347v26M440 330h26M453 317v26' stroke-opacity='.5'/%3E%3Crect x='120' y='190' width='9' height='9' fill='%235b6ef0' fill-opacity='.55' stroke='none'/%3E%3Crect x='430' y='250' width='9' height='9' fill='%235b6ef0' fill-opacity='.55' stroke='none'/%3E%3Ccircle cx='60' cy='300' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='330' cy='300' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Crect x='380' y='560' width='96' height='96' stroke-opacity='.35'/%3E%3Crect x='330' y='610' width='96' height='96' stroke-opacity='.2'/%3E%3Crect x='130' y='700' width='120' height='120' stroke-opacity='.28'/%3E%3Cpath d='M60 600h24M72 588v24M300 800h24M312 788v24M470 760h24M482 748v24' stroke-opacity='.5'/%3E%3Crect x='260' y='640' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Crect x='60' y='820' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Ccircle cx='450' cy='880' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='200' cy='540' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3C/svg%3E"), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='360' height='1100' fill='none' stroke='%235b6ef0' stroke-width='1.5'%3E%3Crect x='30' y='420' width='120' height='120' stroke-opacity='.3'/%3E%3Crect x='80' y='470' width='120' height='120' stroke-opacity='.18'/%3E%3Crect x='210' y='140' width='64' height='64' stroke-opacity='.3'/%3E%3Cpath d='M60 160h24M72 148v24M250 330h24M262 318v24M40 760h24M52 748v24M230 900h24M242 888v24' stroke-opacity='.5'/%3E%3Crect x='150' y='250' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Crect x='270' y='650' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Crect x='90' y='980' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Ccircle cx='40' cy='300' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='300' cy='520' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='160' cy='860' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Crect x='200' y='740' width='90' height='90' stroke-opacity='.25'/%3E%3Crect x='60' y='1010' width='56' height='56' stroke-opacity='.3'/%3E%3C/svg%3E");
  background-repeat: repeat-y, repeat-y;
  background-position: right top, left 0 top 380px;
}
:root[data-theme="light"] .bg-deco::before { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48'%3E%3Cpath d='M48 0H0v48' fill='none' stroke='%23ececf0' stroke-width='1'/%3E%3C/svg%3E"); }
@media (max-width: 1400px) { .bg-deco::after { opacity: 0.5; } }
@media (max-width: 1100px) { .bg-deco::after { opacity: 0.45; background-size: 360px auto, 240px auto; } }
@media (max-width: 700px) { .bg-deco::after { opacity: 0.35; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='520' height='960' fill='none' stroke='%235b6ef0' stroke-width='1.5'%3E%3Crect x='300' y='40' width='150' height='150' stroke-opacity='.45'/%3E%3Crect x='360' y='110' width='150' height='150' stroke-opacity='.22'/%3E%3Crect x='190' y='230' width='70' height='70' stroke-opacity='.3'/%3E%3Cpath d='M70 80h26M83 67v26M210 360h26M223 347v26M440 330h26M453 317v26' stroke-opacity='.5'/%3E%3Crect x='120' y='190' width='9' height='9' fill='%235b6ef0' fill-opacity='.55' stroke='none'/%3E%3Crect x='430' y='250' width='9' height='9' fill='%235b6ef0' fill-opacity='.55' stroke='none'/%3E%3Ccircle cx='60' cy='300' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='330' cy='300' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Crect x='380' y='560' width='96' height='96' stroke-opacity='.35'/%3E%3Crect x='330' y='610' width='96' height='96' stroke-opacity='.2'/%3E%3Crect x='130' y='700' width='120' height='120' stroke-opacity='.28'/%3E%3Cpath d='M60 600h24M72 588v24M300 800h24M312 788v24M470 760h24M482 748v24' stroke-opacity='.5'/%3E%3Crect x='260' y='640' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Crect x='60' y='820' width='9' height='9' fill='%235b6ef0' fill-opacity='.5' stroke='none'/%3E%3Ccircle cx='450' cy='880' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3Ccircle cx='200' cy='540' r='4' fill='%235b6ef0' fill-opacity='.45' stroke='none'/%3E%3C/svg%3E"); background-repeat: repeat-y; background-position: right top; background-size: 260px auto; } }
@media print { .bg-deco::before, .bg-deco::after { display: none; } }

/* Barre visible par l'équipe seulement quand la maintenance est active */
.maint-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s-4); padding: var(--s-2) var(--s-4); font-size: 0.8125rem; text-align: center; color: #0d0d0d; background: var(--warn); }
.maint-bar a { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; color: inherit; }

/* Sélecteur de langue (pied de page) */
.lang-switch { display: inline-flex; border: 1px solid var(--border-strong); }
.lang-switch button { padding: 4px 12px; font: inherit; font-size: 0.8125rem; color: var(--text-2); background: transparent; border: 0; cursor: pointer; transition: color 0.15s, background-color 0.15s; }
.lang-switch button + button { border-left: 1px solid var(--border-strong); }
.lang-switch button:hover { color: var(--text); }
.lang-switch button[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); }
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* Fenêtre « Rejoindre le serveur de support ? » */
.sj-overlay { position: fixed; inset: 0; z-index: 400; display: grid; place-items: center; padding: var(--s-4); background: rgba(0, 0, 0, 0.7); opacity: 0; transition: opacity 0.2s; }
.sj-overlay.show { opacity: 1; }
.sj-card { width: min(440px, 100%); padding: var(--s-6); text-align: center; background: var(--surface); border: 1px solid var(--border-strong); border-top: 3px solid var(--accent); transform: translateY(8px); transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.2, 1); }
.sj-overlay.show .sj-card { transform: none; }
.sj-logo { display: block; margin: 0 auto var(--s-4); }
.sj-card h2 { font-size: 1.375rem; letter-spacing: -0.01em; }
.sj-card p { margin-top: var(--s-3); line-height: 1.6; color: var(--text-2); }
.sj-check { display: flex; align-items: center; justify-content: center; gap: var(--s-3); margin: var(--s-5) 0; padding: var(--s-3) var(--s-4); cursor: pointer; text-align: left; border: 1px solid var(--border-strong); background: var(--bg); }
.sj-check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.sj-go { width: 100%; justify-content: center; }
.sj-card small { display: block; margin-top: var(--s-3); font-size: 0.75rem; color: var(--text-2); }
@media (prefers-reduced-motion: reduce) { .sj-overlay, .sj-card { transition: none; } }

/* Téléphone / tablette tactile (13/10/2026) : cibles de 44 px, recommandation Apple et Google.
   Avant, le logo faisait 29 px de haut et les liens du pied de page 21 px : un doigt les ratait. */
@media (pointer: coarse) {
  .brand { min-height: 44px; }
  .footer-col a, .footer-col .ck-reopen, .footer-links a { display: inline-flex; align-items: center; min-height: 44px; }
  .nav a { min-height: 44px; display: flex; align-items: center; }
}

/* Tactile (13/10/2026, suite) : sélecteur de langue et « Retour en haut » à 44 px. */
@media (pointer: coarse) {
  .lang-switch button { min-height: 44px; padding-inline: 16px; }
  .footer-up { display: inline-flex; align-items: center; min-height: 44px; }
}
