/* Edith — socle commun aux trois modules (Découper, Animer, Affiche) et à l'accueil.
   Polices hébergées ici (rien n'est demandé à Google), couleurs, barre du haut,
   onglets des modules (ordinateur) et menu (tous écrans).
   Chargé APRÈS les styles propres à chaque page : les règles de la barre l'emportent. */

@font-face { font-family: 'Atkinson Hyperlegible'; src: url('/polices/atkinson-400.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url('/polices/atkinson-700.woff2') format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Bricolage Grotesque'; src: url('/polices/bricolage-800.woff2') format('woff2'); font-weight: 800; font-display: swap; }

:root {
  --e-bg: #E6ECF4; --e-panel: #F8FAFD; --e-surface: #FFFFFF; --e-ink: #1B2433; --e-muted: #566377;
  --e-line: #D5DDE8; --e-accent: #2F4BD8; --e-accent-ink: #FFFFFF; --e-accent-soft: #E3E8FB;
  --e-hi: #FFC928; --e-ombre: 0 1px 2px rgba(27,36,51,.06), 0 8px 24px rgba(27,36,51,.08);
  --e-ombre-forte: 0 18px 48px rgba(15,22,40,.22);
  --e-titre: 'Bricolage Grotesque', 'Arial Black', sans-serif;
  --e-texte: 'Atkinson Hyperlegible', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --e-barre-h: 56px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --e-bg: #131824; --e-panel: #1B2130; --e-surface: #212839; --e-ink: #E6EBF3; --e-muted: #9AA5B7;
    --e-line: #323B4D; --e-accent: #8599FF; --e-accent-ink: #0E1330; --e-accent-soft: #262F4D;
    --e-ombre: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); --e-ombre-forte: 0 18px 48px rgba(0,0,0,.5);
  }
}
:root[data-theme="dark"] {
  --e-bg: #131824; --e-panel: #1B2130; --e-surface: #212839; --e-ink: #E6EBF3; --e-muted: #9AA5B7;
  --e-line: #323B4D; --e-accent: #8599FF; --e-accent-ink: #0E1330; --e-accent-soft: #262F4D;
  --e-ombre: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.35); --e-ombre-forte: 0 18px 48px rgba(0,0,0,.5);
}

/* ---------------------------------------------------------------- la barre du haut */
header.e-barre {
  grid-column: 1 / -1;
  display: flex; flex-wrap: nowrap; align-items: center; gap: 8px;
  min-height: var(--e-barre-h); height: auto;
  padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
  padding-top: env(safe-area-inset-top);
  background: var(--e-panel); color: var(--e-ink);
  border-bottom: 1px solid var(--e-line);
  font-family: var(--e-texte);
  position: sticky; top: 0; z-index: 60;
}
.e-marque {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  color: inherit; text-decoration: none; border-radius: 10px; padding: 4px 6px 4px 2px; min-height: 44px;
}
.e-marque svg { width: 30px; height: 30px; flex: none; }
.e-marque .e-nom { font: 800 21px/1 var(--e-titre); letter-spacing: -.02em; }
.e-marque .e-module { font: 700 15px/1 var(--e-texte); color: var(--e-muted); display: none; }   /* ordinateur : l'onglet actif le dit déjà */
.e-marque:hover .e-nom { color: var(--e-accent); }

/* Onglets des modules : ordinateur seulement (le menu les porte sur téléphone) */
.e-onglets { display: flex; gap: 4px; margin-left: 8px; flex: none; }
.e-onglets a {
  display: inline-flex; align-items: center; gap: 7px; padding: 0 13px; min-height: 38px;
  border-radius: 99px; color: var(--e-muted); text-decoration: none; font-weight: 700; font-size: 14.5px;
}
.e-onglets a svg { width: 18px; height: 18px; }
.e-onglets a:hover { color: var(--e-ink); background: var(--e-accent-soft); }
.e-onglets a[aria-current="page"] { color: var(--e-accent); background: var(--e-accent-soft); }

.e-grow { flex: 1 1 auto; min-width: 0; }
.e-actions { display: flex; align-items: center; gap: 6px; flex: none; min-width: 0; }
.e-actions input[type="text"] { min-width: 0; }
.e-court { display: none; }

.e-icone {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--e-ink);
  cursor: pointer; padding: 0;
}
.e-icone:hover { background: var(--e-accent-soft); }
.e-icone svg, .e-feuille svg, .e-onglets svg { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.e-icone svg { width: 24px; height: 24px; }

/* Bouton de la barre, pour les pages qui n'ont pas leur propre .btn (Studio, accueil) */
.e-bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; flex: none;
  min-height: 40px; padding: 0 14px; border-radius: 11px; border: 1px solid var(--e-line);
  background: var(--e-surface); color: var(--e-ink); font: 700 14.5px/1 var(--e-texte); cursor: pointer; text-decoration: none;
}
.e-bouton svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.e-bouton:hover { border-color: var(--e-accent); }
.e-bouton.primaire { background: var(--e-accent); border-color: var(--e-accent); color: var(--e-accent-ink); }
.e-bouton.primaire:hover { filter: brightness(1.08); }
.e-bouton:disabled, .e-icone:disabled { opacity: .4; cursor: default; filter: none; }
@media (max-width: 900px) { .e-bouton { padding: 0 11px; } }

/* État du serveur : on ne le montre que s'il y a quelque chose à dire (hors ligne) */
header.e-barre #srvChip.on { display: none; }
header.e-barre #srvChip { flex: none; }

@media (max-width: 900px) {
  :root { --e-barre-h: 52px; }
  header.e-barre { gap: 4px; }
  .e-onglets { display: none; }
  .e-marque .e-nom { display: none; }             /* le logo suffit : il ramène à l'accueil */
  .e-marque .e-module { display: inline; color: var(--e-ink); font-size: 16px; }
  .e-txt { display: none; }                       /* boutons de la barre : icône seule sur téléphone */
  .e-long { display: none; } .e-court { display: inline; }   /* ou un libellé court */
  header.e-barre .btn { min-height: 40px; min-width: 40px; padding: 6px 9px; }
}

/* ---------------------------------------------------------------- le menu */
.e-voile {
  position: fixed; inset: 0; background: rgba(12,17,30,.42); z-index: 4000;
  opacity: 0; transition: opacity .18s ease;
}
.e-voile.ouvert { opacity: 1; }
.e-feuille {
  position: fixed; z-index: 4001; background: var(--e-surface); color: var(--e-ink);
  font: 15px/1.45 var(--e-texte); box-shadow: var(--e-ombre-forte);
  display: flex; flex-direction: column; overflow: auto; overscroll-behavior: contain;
  /* ordinateur : un panneau accroché en haut à droite */
  top: calc(var(--e-barre-h) + 6px); right: 12px; width: 340px; max-height: calc(100dvh - var(--e-barre-h) - 24px);
  border-radius: 16px; padding: 8px;
  opacity: 0; transform: translateY(-6px); transition: opacity .16s ease, transform .16s ease;
}
.e-feuille.ouvert { opacity: 1; transform: none; }
.e-feuille .e-poignee { display: none; }
.e-feuille h2 {
  font: 700 12px/1 var(--e-texte); text-transform: uppercase; letter-spacing: .08em; color: var(--e-muted);
  margin: 12px 12px 6px;
}
.e-feuille hr { border: 0; border-top: 1px solid var(--e-line); margin: 8px 4px; }
.e-lien {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 12px;
  border: 0; border-radius: 12px; background: none; color: inherit; font: inherit; text-align: left;
  text-decoration: none; cursor: pointer;
}
.e-lien:hover, .e-lien:focus-visible { background: var(--e-accent-soft); }
.e-lien > svg { width: 22px; height: 22px; flex: none; color: var(--e-muted); }
.e-lien .e-pastille {
  width: 38px; height: 38px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--e-accent-soft); color: var(--e-accent);
}
.e-lien .e-pastille svg { width: 21px; height: 21px; }
.e-lien b { display: block; font-weight: 700; }
.e-lien small { display: block; color: var(--e-muted); font-size: 13px; line-height: 1.35; }
.e-lien[aria-current="page"] { background: var(--e-accent-soft); }
.e-lien[aria-current="page"] b::after { content: " · vous êtes ici"; font-weight: 400; color: var(--e-muted); font-size: 13px; }
.e-compte { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.e-compte .e-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  background: var(--e-accent); color: var(--e-accent-ink); font: 700 16px var(--e-texte);
}
.e-compte b { display: block; }
.e-compte small { color: var(--e-muted); font-size: 13px; }
.e-pied { color: var(--e-muted); font-size: 12.5px; padding: 6px 12px 10px; }
.e-pied a { color: inherit; }

@media (max-width: 900px) {
  /* téléphone : une feuille qui monte du bas, à portée de pouce */
  .e-feuille {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 88dvh;
    border-radius: 20px 20px 0 0; padding: 6px 10px calc(12px + env(safe-area-inset-bottom));
    transform: translateY(100%); opacity: 1; transition: transform .24s cubic-bezier(.2,.8,.2,1);
  }
  .e-feuille.ouvert { transform: none; }
  .e-feuille .e-poignee { display: block; width: 40px; height: 5px; border-radius: 99px; background: var(--e-line); margin: 6px auto 4px; flex: none; }
}
@media (prefers-reduced-motion: reduce) {
  .e-voile, .e-feuille { transition: none; }
}
body.e-menu-ouvert { overflow: hidden; }

/* Partout : un élément « hidden » reste caché, même s'il a un display (01/11 : le menu montrait des entrées cachées sur À propos). */
[hidden] { display: none !important; }
/* Menu, sans compte : les entrées qui demandent un compte le disent */
.e-feuille.e-anonyme .e-compte-requis small::after { content: " · avec un compte"; font-weight: 600; color: var(--e-accent, #2F4BD8); }
/* posé par-dessus (les pages en grille ne doivent pas recevoir un élément de plus) ; un toucher le replie */
.e-hors-ligne { position: fixed; left: 0; right: 0; top: calc(var(--e-barre-h) + env(safe-area-inset-top)); z-index: 59; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.12); background: #FFF4CC; color: #5A4300; border-bottom: 1px solid #F0D98A; padding: 8px 16px; font-size: 13.5px; line-height: 1.4; text-align: center; }
