/* Accueil public AMA (5 nov. 2026). Jour et nuit : ama-theme.js pose data-ama-theme (choix, sinon nuit de 20 h à 8 h). */
html:root {
  --papier: #fbf8f2;
  --papier-2: #f3eee3;
  --encre: #28352e;
  --encre-2: #56645c;
  --ligne: #ddd5c6;
  --ocre: #c4612f;
  --teal: #3e6b57;
  --mer: #e3ebe6;
  --terre: #c9d3c2;
  --focus: #c4612f;
  --panel-w: 280px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
html:root[data-ama-theme="nuit"] {
  --papier: #161c19; --papier-2: #1e2622; --encre: #ece6d8; --encre-2: #a9b2aa;
  --ligne: #34403a; --ocre: #e08a5a; --teal: #7fb39b; --mer: #1c2a25; --terre: #3d4d43;
  --focus: #e08a5a; color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0; background: var(--papier); color: var(--encre);
  font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0; }
a { color: var(--teal); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--encre); color: var(--papier); padding: 8px 12px; z-index: 50; }
.skip:focus { left: 8px; }

/* Barre du haut */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: color-mix(in srgb, var(--papier) 92%, transparent);
  backdrop-filter: blur(6px); border-bottom: 1px solid var(--ligne);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--encre); text-decoration: none; font-family: var(--serif); font-weight: 600; font-size: 1.2rem; }
.brand-mark { width: 26px; height: 26px; color: var(--teal); }
.panel-toggle {
  margin-left: auto; display: flex; align-items: center; gap: 6px; font: inherit; font-size: .9rem;
  background: transparent; color: var(--encre); border: 1px solid var(--ligne); border-radius: 8px; padding: 6px 10px; cursor: pointer; min-height: 40px;
}
.panel-toggle svg { width: 20px; height: 20px; }
.panel-toggle:hover { background: var(--papier-2); }

/* Mise en page */
.layout { display: block; }
main { max-width: 860px; margin: 0 auto; padding: 0 16px 48px; }
main:focus { outline: none; }

.hero { padding: 40px 0 24px; }
.kicker { margin: 0 0 10px; font-size: .8rem; letter-spacing: .06em; text-transform: uppercase; color: var(--teal); font-weight: 600; }
h1 { font-size: clamp(1.9rem, 6vw, 3rem); max-width: 18ch; }
.subtitle { margin: 14px 0 28px; font-size: 1.08rem; color: var(--encre-2); max-width: 52ch; }

.entries { display: grid; gap: 10px; }
.entry {
  display: grid; grid-template-columns: 36px 1fr; column-gap: 12px; align-items: baseline;
  padding: 14px 16px; border: 1px solid var(--ligne); border-radius: 12px; text-decoration: none; color: var(--encre);
  background: var(--papier); transition: border-color .15s, background .15s;
}
.entry:hover { border-color: var(--teal); background: var(--papier-2); }
.entry-num { grid-row: span 2; font-family: var(--serif); font-size: 1.6rem; color: var(--ocre); }
.entry-title { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; }
.entry-text { font-size: .92rem; color: var(--encre-2); }

.block { padding: 36px 0 8px; border-top: 1px solid var(--ligne); margin-top: 24px; scroll-margin-top: 64px; }
.block-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
h2 { font-size: 1.6rem; display: flex; align-items: baseline; gap: 10px; }
h2 .num { color: var(--ocre); font-size: 1.1rem; }
.sub { font-size: 1.15rem; margin: 28px 0 6px; }
.note { font-size: .9rem; color: var(--encre-2); }

/* Filtres et cartes Infos */
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip, .seg-btn {
  font: inherit; font-size: .85rem; padding: 6px 12px; min-height: 36px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--ligne); background: transparent; color: var(--encre);
}
.chip[aria-pressed="true"], .seg-btn[aria-pressed="true"] { background: var(--encre); color: var(--papier); border-color: var(--encre); }
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card { border: 1px solid var(--ligne); border-radius: 12px; padding: 16px; background: var(--papier); }
.card[hidden] { display: none; }
.card h3 { font-size: 1.1rem; margin: 2px 0 6px; }
.card p { margin: 0 0 8px; font-size: .94rem; }
.card-kind { font-size: .75rem !important; text-transform: uppercase; letter-spacing: .05em; color: var(--teal); font-weight: 600; }
.card-meta { font-size: .8rem !important; color: var(--encre-2); margin: 0 !important; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.bars { display: grid; gap: 6px; margin: 6px 0 10px; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 28px; gap: 8px; align-items: center; font-size: .82rem; }
.bar-track { height: 10px; background: var(--papier-2); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 5px; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* Carte */
.seg { display: inline-flex; gap: 4px; padding: 3px; border: 1px solid var(--ligne); border-radius: 999px; }
.seg-btn { border: 0; }
.map-wrap {
  position: relative; border-radius: 14px; overflow: hidden; background: var(--papier-2);
  border: 1px solid var(--ligne); height: 340px; transition: height .3s;
}
.map-wrap[data-full="true"] { height: min(78vh, 620px); }
.map-wrap[data-view="plat"], .map-wrap[data-view="plat"][data-full="true"] { height: auto; aspect-ratio: 2 / 1; }
@media (prefers-reduced-motion: reduce) { .map-wrap { transition: none; } }
#globe { width: 100%; height: 100%; display: block; cursor: grab; touch-action: pan-y; }
#globe:active { cursor: grabbing; }
.map-loading { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--encre-2); font-size: .9rem; }
.map-loading[hidden] { display: none; }
.map-tip {
  position: absolute; pointer-events: none; max-width: 240px; background: var(--encre); color: var(--papier);
  font-size: .8rem; padding: 6px 9px; border-radius: 6px; transform: translate(-50%, calc(-100% - 10px));
}
.map-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.legend { list-style: none; display: flex; gap: 14px; margin: 0; padding: 0; font-size: .85rem; color: var(--encre-2); }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.s-en_cours { background: var(--teal); } .s-passe { background: var(--encre-2); } .s-futur { background: var(--ocre); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; font: inherit; font-size: .9rem; font-weight: 500;
  padding: 8px 14px; min-height: 40px; border-radius: 8px; border: 1px solid var(--teal); background: var(--teal);
  color: var(--papier); text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn-full { width: 100%; }
.map-detail:not(:empty) { margin-top: 12px; padding: 12px 14px; border-left: 3px solid var(--ocre); background: var(--papier-2); border-radius: 0 8px 8px 0; font-size: .92rem; }
.map-detail h3 { font-size: 1.05rem; margin-bottom: 4px; }
.map-detail p { margin: 0 0 4px; }
.map-list { margin-top: 14px; }
.field { display: grid; gap: 4px; font-size: .85rem; color: var(--encre-2); }
.field input, .field select {
  font: inherit; font-size: .95rem; color: var(--encre); background: var(--papier); border: 1px solid var(--ligne);
  border-radius: 8px; padding: 8px 10px; min-height: 40px;
}
.init-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 300px; overflow: auto; border: 1px solid var(--ligne); border-radius: 10px; }
.init-list li + li { border-top: 1px solid var(--ligne); }
.init-list button {
  width: 100%; text-align: left; font: inherit; font-size: .9rem; background: transparent; color: var(--encre);
  border: 0; padding: 9px 12px; cursor: pointer; display: flex; gap: 8px; align-items: center;
}
.init-list button:hover { background: var(--papier-2); }

/* Méthode et stats */
.steps { list-style: none; counter-reset: s; margin: 0; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: grid; grid-template-columns: 30px 1fr; column-gap: 10px; }
.steps li::before { content: counter(s); grid-row: span 2; font-family: var(--serif); color: var(--ocre); font-size: 1.3rem; }
.steps span { color: var(--encre-2); font-size: .93rem; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 10px 0; }
.stat { border: 1px dashed var(--ligne); border-radius: 10px; padding: 12px 14px; }
.stat dt { font-size: .8rem; color: var(--encre-2); }
.stat dd { margin: 2px 0 0; font-family: var(--serif); font-size: 1.8rem; font-variant-numeric: tabular-nums; }
.sources { padding-left: 18px; font-size: .92rem; color: var(--encre-2); }
.foot { margin-top: 40px; padding-top: 16px; border-top: 1px solid var(--ligne); font-size: .82rem; color: var(--encre-2); }

/* Panneau latéral droit */
.panel {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(86vw, var(--panel-w)); z-index: 9995;
  background: var(--papier); border-left: 1px solid var(--ligne); padding: 12px 16px 96px; overflow-y: auto;
  transform: translateX(100%); visibility: hidden; transition: transform .25s, visibility 0s .25s;
  box-shadow: -12px 0 30px rgba(0, 0, 0, .12);
}
.panel[data-open="true"] { transform: none; visibility: visible; transition: transform .25s; }
@media (prefers-reduced-motion: reduce) { .panel, .panel[data-open="true"] { transition: none; } }
.backdrop { position: fixed; inset: 0; z-index: 9994; background: rgba(20, 26, 23, .35); }
.backdrop[hidden] { display: none; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.panel-title { margin: 0; font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; background: transparent; color: var(--encre); border: 1px solid transparent; border-radius: 8px; cursor: pointer; }
.icon-btn:hover { background: var(--papier-2); }
.icon-btn svg { width: 20px; height: 20px; }
.panel-sec { padding: 14px 0; border-top: 1px solid var(--ligne); display: grid; gap: 10px; }
.panel-h { font-family: var(--sans); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--encre-2); font-weight: 600; }
.account { display: flex; gap: 10px; align-items: center; }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--papier-2); display: grid; place-items: center; color: var(--teal); }
.avatar svg { width: 22px; height: 22px; }
.account p { margin: 0; }
.account-role { font-weight: 600; }
.account-state { font-size: .82rem; color: var(--encre-2); }
.tools { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.tools a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--encre); text-decoration: none; font-size: .94rem; }
.tools a:hover { background: var(--papier-2); }
.tools svg { width: 20px; height: 20px; color: var(--teal); flex: none; }
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }
.check input { width: 18px; height: 18px; accent-color: var(--teal); }

/* Grand écran : panneau ancré, repliable, le contenu se décale */
@media (min-width: 960px) {
  .panel { top: 61px; box-shadow: none; z-index: 15; }
  .backdrop { display: none !important; }
  .layout[data-panel="open"] { padding-right: var(--panel-w); }
  .entries { grid-template-columns: repeat(3, 1fr); }
  .entry { grid-template-columns: 1fr; row-gap: 4px; padding: 18px; }
  .entry-num { grid-row: auto; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
  .map-wrap { height: 420px; }
}
@media (min-width: 640px) and (max-width: 959px) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 420px) {
  .panel-toggle-label { display: none; }
}

/* Branchement sur le site (5 nov. 2026) */
html:root { --bg: var(--papier); --card: var(--papier-2); --border: var(--ligne); --text: var(--encre); --text2: var(--encre-2); --muted: var(--encre-2); --accent: var(--teal); --al: var(--teal); }
html:root[data-ama-theme="nuit"] { --bg: var(--papier); --card: var(--papier-2); --border: var(--ligne); --text: var(--encre); --text2: var(--encre-2); --muted: var(--encre-2); --accent: var(--teal); --al: var(--teal); }
html.acc body { background: var(--papier); color: var(--encre); }
.topbar .pnav-toggle { display: none !important; }   /* le panneau porte déjà le menu */
.topbar .nav-links { display: flex; gap: 2px; margin-left: 12px; flex-wrap: wrap; }
.topbar .nav-links a { color: var(--encre-2); text-decoration: none; font-size: .9rem; padding: 6px 9px; border-radius: 6px; }
.topbar .nav-links a:hover, .topbar .nav-links a.active, .topbar .nav-links a.pnav-active { color: var(--encre); background: var(--papier-2); }
@media (max-width: 1099px) { .topbar .nav-links { display: none !important; } }
.maj { margin: 0; font-size: .8rem; color: var(--encre-2); }
.etat { font-size: .92rem; color: var(--encre-2); }
.etat:empty { display: none; }
.plus { font-size: .9rem; margin: 14px 0 0; }
.card h3 a { color: var(--encre); text-decoration: none; }
.card h3 a:hover, .card h3 a:focus-visible { text-decoration: underline; text-underline-offset: 3px; }
.card .ech { color: var(--ocre); font-weight: 600; }
.card-figure .valeur { font-family: var(--serif); font-size: 1.9rem; line-height: 1.1; margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.card-figure .valeur small { font-size: .55em; color: var(--encre-2); margin-left: 4px; }
.card-meta a { color: var(--teal); }
.figure { margin-top: 18px; max-width: 460px; }
.figure[hidden] { display: none; }
.btn-line { background: transparent; color: var(--teal); }
.steps li { margin-bottom: 4px; }
.steps a { color: var(--teal); }
.stat dd small { display: block; font-family: var(--sans); font-size: .78rem; color: var(--encre-2); }
#tenu[hidden] { display: none; }
.lien-sec { display: block; margin-top: 8px; font-size: .9rem; text-align: center; }
.account-state { margin: 0 0 8px; font-size: .9rem; color: var(--encre-2); }
[hidden] { display: none !important; }
/* Pied commun posé par public-nav.js */
html.acc .pnav-footer { background: var(--papier-2) !important; color: var(--encre-2) !important; border-top: 1px solid var(--ligne) !important; }
html.acc .pnav-footer a { color: var(--encre-2) !important; }
html.acc .pnav-footer .footer-brand { color: var(--teal) !important; }
@media (min-width: 960px) { html.acc .layout[data-panel="open"] ~ .pnav-footer { padding-right: var(--panel-w); } }
.lien-copie { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; font-size: .8rem; color: var(--encre-2); }
.lien-copie .ext-url-text { overflow-wrap: anywhere; }
.lien-copie .ext-copy-btn { font: inherit; font-size: .78rem; min-height: 32px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--ligne); background: var(--papier-2); color: var(--encre); cursor: pointer; }
.lien-copie .ext-copy-btn:hover { border-color: var(--teal); }
.lien-copie .ext-copy-btn.copied { color: var(--teal); border-color: var(--teal); }
@media (max-width: 639px) { .cards { grid-template-columns: minmax(0, 1fr); } }
.card, .card h3, .card p { min-width: 0; overflow-wrap: anywhere; }
/* Les feuilles communes injectées (public-polish) restylent .btn : on garde nos couleurs, contraste vérifié jour et nuit. */
html.acc .btn { background: var(--teal) !important; color: var(--papier) !important; border: 1px solid var(--teal) !important; }
html.acc .btn.btn-line { background: transparent !important; color: var(--teal) !important; }
