/* Navigation : barre du haut et menu latéral qui glisse depuis la gauche. */
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg); }

/* Barre du haut */
.barre { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: rgba(18, 21, 27, .94); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line); }
.barre-interieur { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.menu-bouton { display: inline-flex; align-items: center; gap: 8px; padding: 7px 12px; font-weight: 600; }
/* Icônes dessinées en CSS (masque SVG en data URI, couleur = currentColor) */
.icone { display: inline-block; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--masque) center / contain no-repeat; mask: var(--masque) center / contain no-repeat; }
.icone-menu { --masque: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 6h18M3 12h18M3 18h18' stroke='black' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E"); }
.icone-loupe { --masque: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='7' stroke='black' stroke-width='2' fill='none'/%3E%3Cpath d='m20 20-4-4' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E"); width: 16px; height: 16px; }
.marque { font-family: var(--display); font-size: 1.25rem; letter-spacing: .04em; color: var(--gold-fg); text-decoration: none; white-space: nowrap; }
.page-titre { color: var(--muted); font-size: .9rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.page-titre:not(:empty)::before { content: "/"; margin-right: 10px; color: var(--line); }

/* Bouton et fenêtre de recherche */
.recherche-bouton { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); min-width: 0; }
.recherche-bouton kbd { font: 600 .68rem var(--body); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; color: var(--muted); }
.recherche { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: flex; justify-content: center; align-items: flex-start;
  padding: calc(env(safe-area-inset-top, 0px) + 10vh) max(16px, env(safe-area-inset-right, 0px)) 16px max(16px, env(safe-area-inset-left, 0px)); }
.recherche[hidden] { display: none !important; }
.recherche-boite { width: min(640px, 100%); background: var(--panel); border: 1px solid var(--gold); border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6); overflow: hidden; display: flex; flex-direction: column; max-height: 75vh; }
.recherche-boite input { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: var(--input); color: var(--fg); font: 500 1rem var(--body); padding: 14px 16px; outline: none; }
.recherche-resultats { list-style: none; margin: 0; padding: 6px; overflow-y: auto; display: grid; gap: 2px; }
.recherche-resultats a { display: grid; gap: 2px; text-decoration: none; color: var(--fg); padding: 9px 12px; border-radius: 6px; }
.recherche-resultats a small { color: var(--muted); font-size: .76rem; }
.recherche-resultats a:hover, .recherche-resultats a.actif { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--gold); }
.recherche-resultats .vide { color: var(--muted); padding: 12px; font-size: .88rem; }
.recherche-aide { margin: 0; padding: 8px 14px; border-top: 1px solid var(--line); font-size: .72rem; color: var(--muted); }
.trouve { animation: trouve 2.4s ease-out; }
@keyframes trouve { 0%, 40% { box-shadow: 0 0 0 2px var(--gold); background-color: rgba(138, 106, 18, .35); } 100% { box-shadow: 0 0 0 0 transparent; } }
@media (max-width: 640px) { .recherche-texte, .recherche-bouton kbd { display: none; } }

/* Barre de minuteurs (sous la barre du haut) */
.minuteurs { max-width: 1200px; margin: 0 auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding-bottom: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.minuteur { flex: none; display: inline-flex; align-items: baseline; gap: 6px; text-decoration: none; color: var(--muted);
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: .74rem; }
.minuteur:hover { border-color: var(--gold); }
.minuteur-temps { color: var(--fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.minuteur.bientot { border-color: var(--gold); }
.minuteur.bientot .minuteur-temps { color: var(--gold-fg); }

/* Indicateur de synchro (à droite de la barre) */
.synchro { flex: none; display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.synchro::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.synchro[data-statut="ok"]::before { background: var(--ok); }
.synchro[data-statut="envoi"]::before, .synchro[data-statut="connexion"]::before { background: var(--opt-fg); }
.synchro[data-statut="erreur"]::before { background: var(--bad-fg); }

/* En-tête de chaque page (titre + description, sauf sur l'accueil) */
.page-entete { display: grid; gap: 4px; margin-bottom: 18px; }
.page-entete h1 { margin: 0; }
.page-entete .sub { margin: 0; }

/* Menu latéral */
.tiroir { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(320px, 86vw);
  background: var(--panel); border-right: 1px solid var(--line); box-shadow: 8px 0 30px rgba(0,0,0,.45);
  display: flex; flex-direction: column;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); padding-left: env(safe-area-inset-left, 0px);
  transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .8, .2, 1); }
.tiroir.ouvert { transform: translateX(0); }
.tiroir-entete { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.tiroir-entete .marque { font-size: 1.4rem; }
.tiroir-fermer { font-size: 1.1rem; line-height: 1; padding: 6px 10px; }
.tiroir-liens { overflow-y: auto; padding: 10px 10px 24px; display: grid; gap: 2px; align-content: start; }
.tiroir-liens a { display: block; text-decoration: none; color: var(--fg); padding: 9px 12px; border-radius: 6px; font-size: .92rem; border-left: 3px solid transparent; }
.tiroir-liens a:hover { background: var(--panel-2); }
.tiroir-liens a[aria-current="page"] { background: var(--panel-2); color: var(--gold-fg); border-left-color: var(--gold); font-weight: 600; }
.tiroir-rubrique { margin: 14px 12px 4px; font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* Voile sombre derrière le menu ouvert */
.voile { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .55); opacity: 0; transition: opacity .28s; }
.voile.visible { opacity: 1; }

@media (max-width: 520px) { .marque-barre { display: none; } }
@media (max-width: 420px) { .synchro { font-size: 0; gap: 0; } }
@media (prefers-reduced-motion: reduce) { .tiroir, .voile { transition: none; } .trouve { animation: none; outline: 2px solid var(--gold); } }
