/* Styles ecran du site rapport Tanko — tout est dans @media screen :
   l'impression (et le PDF) gardent la mise en page A4 d'origine. */
@media screen {
  html { scroll-behavior: smooth; scroll-padding-top: 64px; }

  /* ---------- barre haute ---------- */
  .skip-link {
    position: fixed; top: 8px; left: 8px; z-index: 100;
    background: #1e1a12; color: #f1ece2; padding: 8px 12px; border-radius: 6px;
    transform: translateY(-180%); transition: transform .15s ease;
  }
  .skip-link:focus { transform: translateY(0); }
  .sitebar {
    position: sticky; top: 0; z-index: 50;
    display: flex; align-items: center; gap: 5mm;
    background: #1e1a12; color: #f1ece2;
    padding: 2.8mm 5mm; font-size: 9.5pt;
  }
  .sitebar .brand { height: 5mm; filter: brightness(0) invert(1); }
  .sitebar .spacer { flex: 1; }
  .sitenav { display: flex; gap: 4.5mm; margin-left: 3mm; }
  .sitenav a {
    color: #cfc6b4; text-decoration: none; font-weight: 600; font-size: 9pt;
    padding: 1mm 0; border-bottom: 2px solid transparent;
  }
  .sitenav a:hover { color: #fff; border-bottom-color: #d4952a; }

  /* ---------- graphiques un peu plus grands que le texte ---------- */
  @media (min-width: 861px) {
    .figure { margin-left: -6mm; margin-right: -6mm; }
  }
  .chart-preview { position: relative; cursor: zoom-in; }
  .chart-preview:hover img { filter: contrast(1.03); }
  .zoom-hint {
    position: absolute; right: 3mm; bottom: 3mm; pointer-events: none;
    display: inline-flex; align-items: center; gap: 1.6mm;
    background: rgba(255,255,255,.94); color: #8c5f12;
    border: 1px solid #dbd5c6; border-radius: 999px;
    font-size: 8pt; font-weight: 700; padding: 1.6mm 3.2mm;
    box-shadow: 0 1px 5px rgba(30,26,18,.18);
  }
  .zoom-hint svg { width: 3.4mm; height: 3.4mm; }

  /* ---------- cartes : pastille "carte interactive" ---------- */
  .map-open { position: relative; cursor: pointer; }
  .map-open-pill {
    position: absolute; left: 50%; bottom: 5mm; transform: translateX(-50%);
    pointer-events: none; white-space: nowrap;
    display: inline-flex; align-items: center; gap: 2mm;
    background: #8c5f12; color: #fff; border: 2px solid #fff;
    border-radius: 999px; font-size: 9pt; font-weight: 700;
    padding: 2.2mm 4.5mm; box-shadow: 0 2px 8px rgba(30,26,18,.35);
    transition: background .15s ease;
  }
  .map-open-pill svg { width: 4mm; height: 4mm; }
  .map-open:hover .map-open-pill { background: #a9711a; }

  /* ---------- liens coordonnees ---------- */
  .gmaps { color: #8c5f12; text-decoration: none; border-bottom: 1.5px solid #d4952a; }
  .gmaps:hover { color: #a9711a; }

  /* ---------- visionneuse (dialog) ---------- */
  body.viewer-open { overflow: hidden; }
  .media-viewer {
    width: min(96vw, 1500px); height: 94dvh;
    max-width: none; max-height: none; margin: auto; padding: 0;
    border: 1px solid #dbd5c6; border-radius: 3mm;
    background: #faf9f5; color: #1e1a12;
  }
  .media-viewer::backdrop { background: rgba(30,26,18,.78); backdrop-filter: blur(6px); }
  .viewer-shell { width: 100%; height: 100%; display: grid; grid-template-rows: auto 1fr; }
  .viewer-header {
    display: flex; align-items: center; justify-content: space-between; gap: 4mm;
    padding: 2.5mm 3mm 2.5mm 5mm; border-bottom: 1px solid #dbd5c6;
  }
  .viewer-header h2 {
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 12pt; font-weight: 700;
  }
  .viewer-actions { display: flex; gap: 2mm; flex: 0 0 auto; }
  .viewer-actions button {
    min-height: 9mm; padding: 0 4mm; cursor: pointer; font: inherit; font-size: 9pt;
    font-weight: 700; border: 1px solid #1e1a12; background: transparent;
    color: #1e1a12; border-radius: 2mm;
  }
  .viewer-actions .viewer-close { background: #1e1a12; color: #faf9f5; }
  .viewer-actions button:hover { filter: brightness(1.08); }
  .viewer-content { min-height: 0; overflow: auto; padding: 4mm; }
  .viewer-content.viewer-chart {
    display: flex; align-items: center; justify-content: center;
  }
  .viewer-content.viewer-map { padding: 0; overflow: hidden; }
  .viewer-content img { width: 100%; height: 100%; object-fit: contain; }
  .viewer-content iframe { width: 100%; height: 100%; border: 0; }

  /* ---------- mobile : pages fluides ---------- */
  @media (max-width: 860px) {
    html { scroll-padding-top: 56px; }
    .sitenav { display: none; }
    .page {
      width: 100%; height: auto; min-height: 0; margin: 0 0 4mm;
      padding: 7mm 5mm 8mm; overflow: visible; border-radius: 0;
      box-shadow: none; border-top: 1px solid #dbd5c6; border-bottom: 1px solid #dbd5c6;
    }
    .page .footer { position: static; margin-top: 7mm; }
    .cover .logo { height: 8mm; margin-bottom: 8mm; }
    .cover h1 { font-size: 22pt; }
    .cards { flex-direction: column; }
    .facts { flex-wrap: wrap; gap: 2.5mm; }
    .fact { flex: 1 1 calc(50% - 2mm); }
    .figure { margin-left: -1.5mm; margin-right: -1.5mm; }
    .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .table-scroll table { min-width: 165mm; }
    .card .table-scroll table { min-width: 0; }
    .alertline { font-size: 9pt; }
    .zoom-hint { font-size: 7.5pt; padding: 1.4mm 2.8mm; }
    .map-open-pill { font-size: 8pt; padding: 2mm 3.6mm; bottom: 4mm; }

    /* visionneuse mobile : graphique navigable au doigt */
    .media-viewer { width: 100vw; height: 100dvh; border-radius: 0; border: 0; }
    .viewer-header h2 { white-space: normal; font-size: 10.5pt; }
    .viewer-fullscreen { display: none; }
    .viewer-content { padding: 2mm; }
    .viewer-content.viewer-chart { align-items: flex-start; justify-content: flex-start; }
    .viewer-content.viewer-chart img {
      flex: 0 0 auto; width: 1050px; max-width: none; height: auto;
      object-fit: initial; touch-action: pan-x pan-y;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
  }
}
