/* Cartothèque — système commun (tokens, navigation, bases)
   Identité : papier crème chaud, terracotta, Fraunces italique pour les titres, DM Sans pour le texte.
   Chargé par toutes les pages après leur propre <style> ; les pages dérivent leurs variables locales de celles-ci. */

:root {
  --bg: #f3ebe0;
  --bg-2: #ede3d4;
  --card: #fbf6ed;
  --ink: #1c1917;
  --muted: #8a7d6e;
  --accent: #c1432f;
  --accent-ink: #ffffff;
  --accent-soft: #e8caaf;
  --line: #d9cfc0;
  --grid: #e8dfd1;
  --ok: #3f7d4f;
  --ok-soft: #dfeadb;
  --bad: #b23a2f;
  --bad-soft: #f3d9d3;
  --info: #35627f;
  --shadow: 0 24px 48px -12px rgba(60, 40, 20, 0.18), 0 8px 16px -8px rgba(60, 40, 20, 0.12);
  --serif: 'Fraunces', Georgia, serif;
  --sans: 'DM Sans', system-ui, -apple-system, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1815; --bg-2: #211d19; --card: #27221d; --ink: #f1e9dc; --muted: #a2947f;
    --accent: #e0674f; --accent-ink: #1b1815; --accent-soft: #4a2e22; --line: #3b332b; --grid: #312a23;
    --ok: #86c795; --ok-soft: #223527; --bad: #f08c7c; --bad-soft: #452420; --info: #8db6d2;
    --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), 0 8px 16px -8px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1815; --bg-2: #211d19; --card: #27221d; --ink: #f1e9dc; --muted: #a2947f;
  --accent: #e0674f; --accent-ink: #1b1815; --accent-soft: #4a2e22; --line: #3b332b; --grid: #312a23;
  --ok: #86c795; --ok-soft: #223527; --bad: #f08c7c; --bad-soft: #452420; --info: #8db6d2;
  --shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), 0 8px 16px -8px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Barre de navigation commune (injectée par nav.js) ---------- */
.app-nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
}
.app-nav .inner {
  max-width: 920px; margin: 0 auto; display: flex; align-items: center; gap: 4px;
  padding-block: 8px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  overflow-x: auto; scrollbar-width: none;
}
.app-nav .inner::-webkit-scrollbar { display: none; }
.app-nav .brand {
  font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.15rem; color: var(--ink);
  text-decoration: none; margin-right: 10px; white-space: nowrap; flex: none;
}
.app-nav .brand b { color: var(--accent); font-style: normal; }
.app-nav a.tab {
  color: var(--muted); text-decoration: none; font-size: .92rem; padding: 6px 11px; border-radius: 999px; white-space: nowrap; flex: none;
}
.app-nav a.tab:hover { color: var(--ink); background: var(--bg-2); }
.app-nav a.tab.active { color: var(--accent-ink); background: var(--accent); }
.app-nav a.tab:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.app-nav .spacer { flex: 1; }
.app-nav a.tab.admin { opacity: .7; font-size: .85rem; }
.app-nav a.tab.admin:hover { opacity: 1; }
.app-nav .badge {
  font-size: .75rem; font-variant-numeric: tabular-nums; background: var(--accent-soft); color: var(--ink);
  border-radius: 999px; padding: 2px 8px; margin-left: 4px;
}

/* Place pour la barre fixe, quelle que soit la mise en page de la page hôte */
body.has-nav { padding-top: calc(52px + env(safe-area-inset-top, 0px)) !important; }

/* La Cartothèque a son propre en-tête : la barre commune le remplace */
body.page-cartotheque > header { display: none; }
