/* Pages publiques (commune, département, lexique, guide) : mêmes jetons que l'application (« Registre public »). */
:root {
  --bg: #F7F7F5; --surface: #FFFFFF; --sunken: #EFEFEC; --line: #E4E4E0; --line-strong: #8A93A3;
  --ink: #0F172A; --ink-2: #475467; --ink-3: #5B6474;
  --accent: #1F4FA3; --accent-hover: #183F84; --accent-tint: #E8EEF9; --on-accent: #FFFFFF; --range: #CDD8EA;
  --ok: #17573A; --ok-tint: #E7F3EC; --ok-line: #B9DCC8;
  --warn: #6F4300; --warn-tint: #FBF0DC; --warn-line: #EBCB92;
  --alert: #8F1E18; --alert-tint: #FBE9E7; --alert-line: #F0B8B2;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1217; --surface: #171B22; --sunken: #1E232B; --line: #2C323D; --line-strong: #646E7E;
  --ink: #E9ECF1; --ink-2: #B4BCC8; --ink-3: #9099A6;
  --accent: #8FB2F2; --accent-hover: #A9C4F5; --accent-tint: #18243A; --on-accent: #0F1217; --range: #2B3D5C;
  --ok: #9BDDB7; --ok-tint: #14291E; --ok-line: #24513A;
  --warn: #F1CB8C; --warn-tint: #2E2310; --warn-line: #5C4319;
  --alert: #F7B3AD; --alert-tint: #33191A; --alert-line: #6A2E2B;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
.num { font-variant-numeric: tabular-nums lining-nums; }
.pi { background: var(--surface); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-3); }
.pi div, .entete div, .contenu, footer div { max-width: 1120px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.pi div { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
.entete { background: var(--surface); border-bottom: 1px solid var(--line); }
.entete div { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; flex-wrap: wrap; }
.marque { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 16px; }
.marque svg { width: 32px; height: 32px; flex: none; }
.marque .par { font-weight: 400; font-size: 14px; color: var(--ink-3, #6b7280); }
.entete nav { display: flex; gap: 20px; flex-wrap: wrap; font-size: 14px; }
.entete nav a { color: var(--ink-2); text-decoration: none; }
.entete nav a:hover { color: var(--ink); text-decoration: underline; }
.entete nav a.bouton { color: var(--on-accent); }
.contenu { padding-top: 24px; padding-bottom: 48px; }
.ariane { font-size: 14px; color: var(--ink-3); margin: 0 0 16px; }
.ariane ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.ariane li + li::before { content: "›"; margin-right: 6px; color: var(--line-strong); }
.ariane a { color: var(--ink-3); }
h1 { font-family: "Source Serif 4", Georgia, serif; font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0; text-wrap: balance; }
h2 { font-family: "Source Serif 4", Georgia, serif; font-size: 24px; line-height: 1.25; margin: 40px 0 12px; text-wrap: balance; }
h3 { font-size: 16px; margin: 0; line-height: 1.35; }
.sous-titre { color: var(--ink-3); font-size: 14px; margin: 8px 0 0; }
.chapeau { font-size: 17px; color: var(--ink-2); max-width: 75ch; margin: 16px 0 0; }
.note { font-size: 14px; color: var(--ink-3); max-width: 80ch; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 24px 0 0; }
.chiffre { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.chiffre span { display: block; font-size: 14px; color: var(--ink-3); }
.chiffre strong { display: block; font-size: 26px; line-height: 1.2; margin-top: 4px; font-weight: 600; }
.chiffre small { display: block; font-size: 14px; color: var(--ink-3); margin-top: 2px; }
.grille { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.carte { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 20px; }
.carte .valeur { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }
.carte .valeur strong { font-size: 28px; line-height: 1; font-weight: 600; }
.carte .valeur span { font-size: 14px; color: var(--ink-3); }
.carte p { font-size: 14px; color: var(--ink-2); margin: 8px 0 0; }
.carte .lecture b { color: var(--ink); font-weight: 600; }
.termes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.termes a { font-size: 14px; border: 1px solid var(--line); border-radius: 4px; padding: 3px 8px; color: var(--ink-2); text-decoration: none; }
.termes a:hover { color: var(--accent); border-color: var(--accent); }
.jauge { margin-top: 12px; }
.jauge .piste { position: relative; height: 10px; border-radius: 999px; background: var(--sunken); }
.jauge .plage { position: absolute; top: 0; height: 10px; border-radius: 999px; background: var(--range); }
.jauge .med { position: absolute; top: -4px; width: 2px; height: 18px; background: var(--ink-3); }
.jauge .pt { position: absolute; top: -3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--accent); border: 2px solid var(--surface); }
.jauge .leg { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; color: var(--ink-3); margin-top: 6px; }
.badge { display: inline-block; font-size: 14px; font-weight: 600; border-radius: 4px; padding: 2px 8px; border: 1px solid; }
.badge.ok { color: var(--ok); background: var(--ok-tint); border-color: var(--ok-line); }
.badge.vigilance { color: var(--warn); background: var(--warn-tint); border-color: var(--warn-line); }
.badge.alerte { color: var(--alert); background: var(--alert-tint); border-color: var(--alert-line); }
.appel { background: var(--accent-tint); border: 1px solid var(--line); border-radius: 8px; padding: 20px; margin: 32px 0 0; display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.appel p { margin: 4px 0 0; color: var(--ink-2); font-size: 14px; max-width: 70ch; }
.bouton { display: inline-flex; align-items: center; height: 40px; padding: 0 16px; border-radius: 6px; background: var(--accent); color: var(--on-accent); font-weight: 600; font-size: 14px; text-decoration: none; white-space: nowrap; }
.bouton:hover { background: var(--accent-hover); color: var(--on-accent); }
.liens { columns: 3 220px; column-gap: 24px; padding: 0; margin: 0; list-style: none; font-size: 14px; }
.liens li { break-inside: avoid; padding: 3px 0; }
.liens small { color: var(--ink-3); }
.tableau { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 14px; color: var(--ink-3); font-weight: 600; background: var(--sunken); position: sticky; top: 0; }
td.n, th.n { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.prose { max-width: 75ch; }
.prose p, .prose li { color: var(--ink-2); }
.prose h2 { scroll-margin-top: 16px; }
dl.lexique dt { font-weight: 600; margin-top: 20px; scroll-margin-top: 16px; }
dl.lexique dd { margin: 4px 0 0; color: var(--ink-2); max-width: 75ch; }
footer { border-top: 1px solid var(--line); background: var(--surface); margin-top: 48px; }
footer div { padding-top: 24px; padding-bottom: 24px; font-size: 14px; color: var(--ink-3); display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
footer nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
footer a { color: var(--ink-3); }
@media (max-width: 640px) { .entete nav { gap: 14px; } .appel { display: block; } .appel .bouton { margin-top: 12px; } }
/* Graphiques pluriannuels (SVG statiques, api/_lib/pages-graphiques.ts) */
.graphiques { margin-top: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); }
.graphique .g-repere-txt { paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.fig { margin: 0; }
.fig figcaption { margin-bottom: 8px; }
.graphique { display: block; width: 100%; max-width: 560px; height: auto; font-family: inherit; }
.graphique .g-grille { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
.graphique .g-base { stroke: var(--line-strong); stroke-width: 1; shape-rendering: crispEdges; }
.graphique .g-axe { fill: var(--ink-3); font-size: 14px; }
.graphique .g-val { fill: var(--ink); font-size: 14px; font-weight: 600; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.graphique .g-col { fill: var(--range); }
.graphique .g-col-acc { fill: var(--accent); }
.graphique .g-ligne { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.graphique .g-point { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.graphique .g-repere { stroke: var(--warn); stroke-width: 1; stroke-dasharray: 4 3; }
.graphique .g-repere-txt { fill: var(--warn); font-size: 14px; }
.graphique .g-mandat { stroke: var(--line-strong); stroke-opacity: 0.55; stroke-width: 1; shape-rendering: crispEdges; }
.graphique .g-acc { fill: none; stroke: var(--line-strong); stroke-width: 1; }
h3.sous { font-size: 18px; margin: 32px 0 12px; }
.carte ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; color: var(--ink-2); }
.carte ul li + li { margin-top: 6px; }
.tableau caption { caption-side: bottom; text-align: left; padding: 8px 12px; }
.tableau td.num, .tableau th.num { text-align: right; white-space: nowrap; }
.tableau + .tableau, .grille + .tableau { margin-top: 16px; }
.partage { margin: 12px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bouton-partager { font: inherit; font-size: 14px; font-weight: 600; height: 36px; padding: 0 14px; border-radius: 6px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.bouton-partager:hover { background: var(--sunken); }
.partage-etat { font-size: 14px; color: var(--ink-3); }
pre.code { white-space: pre-wrap; word-break: break-all; background: var(--sunken); border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font-size: 14px; }
caption { text-align: left; font-weight: 600; padding: 6px 0; color: var(--ink); }
/* Tableaux triables (public/tri.js) */
table.triable button.tri { all: unset; cursor: pointer; font: inherit; font-weight: 600; color: inherit; display: inline-flex; align-items: center; gap: 4px; }
table.triable button.tri:hover { color: var(--accent); }
table.triable button.tri:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }
table.triable .tri-fleche::after { content: '↕'; opacity: .35; font-size: .85em; }
table.triable th[aria-sort='ascending'] .tri-fleche::after { content: '▲'; opacity: 1; }
table.triable th[aria-sort='descending'] .tri-fleche::after { content: '▼'; opacity: 1; }
table.triable caption { caption-side: top; font-weight: 400; font-size: 14px; color: var(--ink-3, inherit); padding: 8px 12px 0; }
/* Nouveautés (journal des versions) */
.version { border-top: 1px solid var(--line); padding-top: 4px; }
.version h2 { margin-bottom: 4px; }
.version-date { font-weight: 400; color: var(--ink-3); font-size: 14px; }
.version-actuelle { display: inline-block; vertical-align: middle; font-family: 'Public Sans', system-ui, sans-serif; font-size: 14px; font-weight: 600; line-height: 1; padding: 5px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--accent); }
/* Boutons « Classer par » au-dessus des tableaux triables */
.tri-barre { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 10px; }
.tri-barre > span { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-right: 2px; }
.tri-barre button { font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); cursor: pointer; }
.tri-barre button:hover { background: var(--accent-tint); }
.tri-barre button[aria-pressed='true'] { background: var(--accent); color: var(--on-accent); }
.tri-barre button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.tri-sens { font-weight: 400; }
.pi a.pi-version { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.pi a.pi-version:hover { text-decoration: underline; }
@media (max-width: 720px) { .pi .pi-mention { display: none; } }
/* Barre d'outils de chaque page : partager, PDF */
.outils { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 4px 0 18px; }
.outils .bouton-partager, .outils .bouton-pdf, .outils .bouton-imprimer { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 14px; font-weight: 600; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--accent); background: var(--surface); color: var(--accent); cursor: pointer; text-decoration: none; }
.outils .bouton-pdf { background: var(--accent); color: var(--on-accent); }
.outils .bouton-partager:hover, .outils .bouton-imprimer:hover { background: var(--accent-tint); }
.outils .bouton-pdf:hover { opacity: .9; }
.outils .partage-etat { font-size: 14px; color: var(--ink-3); }

/* Impression et « Enregistrer en PDF » du navigateur : contenu seul, mention de propriété conservée */
@media print {
  :root { --bg: #fff; --surface: #fff; }
  body { background: #fff !important; color: #000; font-size: 11pt; }
  .entete nav, .outils, .tri-barre, .ariane, footer nav, .appel, .partage, button { display: none !important; }
  .pi { border: 0; }
  .pi .pi-version { display: none; }
  .contenu { max-width: none; padding: 0; }
  a { color: inherit; text-decoration: none; }
  .carte, .chiffre, .tableau, figure, tr { break-inside: avoid; page-break-inside: avoid; }
  h2, h3 { break-after: avoid; page-break-after: avoid; }
  .tableau { overflow: visible; border-color: #bbb; }
  .grille { display: block; }
  .grille > * { margin-bottom: 10px; }
  table.triable caption { display: none; }
}

/* 2.14 : barre d'onglets en bas sur téléphone */
.barre-onglets { display: none; }
@media (max-width: 767px) {
  .barre-onglets { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 900; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
  .barre-onglets a { min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 14px; color: var(--ink-2); text-decoration: none; }
  body { padding-bottom: calc(56px + env(safe-area-inset-bottom)); }
  .entete nav a:not(.bouton) { display: none; }
}
@media print { .barre-onglets { display: none !important; } }

/* 2.14 : tableaux sur téléphone, première colonne fixée pendant le défilement */
@media (max-width: 767px) {
  .tableau th:first-child, .tableau td:first-child { position: sticky; left: 0; z-index: 1; background: var(--surface); box-shadow: 1px 0 0 var(--line); }
}

/* 2.14 : aucun texte utile sous 14 px */
.contenu small, footer small { font-size: 14px; }

/* 2.16 : « Les métiers qui recrutent » (sommaire, bassins d'emploi et entreprises dépliables) */
.sommaire { margin: 20px 0 0; font-size: 14px; display: flex; flex-wrap: wrap; gap: 4px 8px; color: var(--ink-3); }
.contenu details { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 10px 14px; margin: 8px 0 0; }
.contenu details > summary { cursor: pointer; font-size: 15px; line-height: 1.5; min-height: 28px; }
.contenu details[open] > summary { margin-bottom: 8px; }
.contenu details ul { margin: 0; padding-left: 18px; font-size: 15px; }
.contenu details li + li { margin-top: 6px; }
.contenu details small { color: var(--ink-3); font-size: 14px; }

/* 2.26 (signalement de l'utilisateur : ancien logo et ancienne charte sur ces pages) — même charte que l'application :
   police Inter, couleur de l'outil de la page (attribut data-outil, pages-html.ts), boutons au style « A · Net ». */
body { font-family: "Inter", "Public Sans", system-ui, sans-serif; }
:root[data-outil="emploi"] { --accent: #0F7A5C; --accent-hover: #0B5E47; --accent-tint: #E6F4EE; --range: #B7DECD; }
:root[data-outil="entreprendre"] { --accent: #6A3FC8; --accent-hover: #55309F; --accent-tint: #F0EAFB; --range: #D7C9F3; }
:root[data-outil="carburants"] { --accent: #C2470E; --accent-hover: #9E390A; --accent-tint: #FCEEE6; --range: #F2CBB4; }
:root[data-outil="carte"] { --accent: #334155; --accent-hover: #1E293B; --accent-tint: #EEF1F5; --range: #CBD3DE; }
:root[data-theme="dark"][data-outil="emploi"] { --accent: #5FD3A4; --accent-hover: #86E0BB; --accent-tint: #12261F; --on-accent: #07130E; --range: #24513F; }
:root[data-theme="dark"][data-outil="entreprendre"] { --accent: #B49BF0; --accent-hover: #C9B6F5; --accent-tint: #221A38; --on-accent: #120A24; --range: #3E2F66; }
:root[data-theme="dark"][data-outil="carburants"] { --accent: #F39A66; --accent-hover: #F6B48C; --accent-tint: #33200F; --on-accent: #1A0D04; --range: #5C3A20; }
:root[data-theme="dark"][data-outil="carte"] { --accent: #AFC0D6; --accent-hover: #C6D3E3; --accent-tint: #1B2330; --on-accent: #0F1217; --range: #33405A; }
.marque { font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
.marque > span { display: inline-flex; align-items: center; gap: 10px; }
.marque .sep { width: 1px; height: 20px; background: var(--line); }
.marque .par { font-weight: 600; font-size: 15px; color: var(--accent); }
.entete nav { align-items: center; }
.entete nav a[aria-current="page"] { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }
.barre-onglets a[aria-current="page"] { color: var(--accent); font-weight: 600; }
:root[data-connecte] .si-visiteur { display: none !important; }
:root:not([data-connecte]) .si-connecte { display: none !important; }
.bouton, .outils .bouton-pdf {
  border: 0; border-radius: 10px; color: var(--on-accent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff) 0%, var(--accent) 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(16, 24, 40, .18), 0 0 0 1px var(--accent-hover);
  transition: transform .15s ease, box-shadow .15s ease;
}
.bouton:hover, .outils .bouton-pdf:hover { color: var(--on-accent); opacity: 1; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 86%, #fff) 0%, var(--accent) 100%); transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 16px -4px color-mix(in srgb, var(--accent) 45%, transparent), 0 0 0 1px var(--accent-hover); }
.bouton-partager, .outils .bouton-partager, .outils .bouton-imprimer {
  border: 0; border-radius: 10px; background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px #D9DDE5; transition: background-color .15s ease, box-shadow .15s ease;
}
.bouton-partager:hover, .outils .bouton-partager:hover, .outils .bouton-imprimer:hover { background: #F8F9FB; box-shadow: 0 2px 6px rgba(16, 24, 40, .08), 0 0 0 1px #C7CCD6; }
.tri-barre button { border-radius: 999px; }
