/* ===========================================================================
   Matières résiduelles Montréal — feuille de style
   Style D « dashboard détaillé » (hybride) : seulement ce qui est propre au
   site. La base commune est dans css/style-d.css (modèle
   outils/communs/style-d.css), chargée avant ; l'habillage est dans hybride.css.

   Palette catégorielle fixe : une catégorie = une couleur sur tout le site
   (jetons --mat-*, utilisés par les graphiques et les boutons de filtre).
   =========================================================================== */

:root {
  /* Catégories de matières (couleurs d'origine du projet) */
  --mat-crd: #f97316;            /* CRD & encombrants — orange */
  --mat-crd-elimines: #fb923c;
  --mat-recyclables: #3b82f6;    /* bleu */
  --mat-organiques: #22c55e;     /* vert */
  --mat-ordures: #ef4444;        /* rouge */
  --mat-rdd: #a855f7;            /* RDD — violet */
  --mat-rdd-pe: #c084fc;
  --mat-textiles: #ec4899;
  --mat-electroniques: #14b8a6;
  --mat-autre: #94a3b8;
}

@media (prefers-color-scheme: dark) {
  :root:not(.print-light):where(:not([data-theme="light"])) {
    --mat-recyclables: #4f8ff7;   /* un peu éclairci : contraste sur fond sombre */
    --mat-rdd: #b77cf8;
  }
}
/* Thème sombre forcé (<html data-theme="dark">), mêmes règles que ci-dessus. */
:root:not(.print-light):where([data-theme="dark"]) {
  --mat-recyclables: #4f8ff7;   /* un peu éclairci : contraste sur fond sombre */
  --mat-rdd: #b77cf8;
}

@media (max-width: 600px) {
  .chart-box.h-320, .chart-box.h-360 { height: 300px; }
  .chart-box.h-boroughs { height: 720px; }
  .chart-box.h-tall-mobile { height: 520px; }

  .callout { padding: 12px 13px; font-size: 13px; }
}

/* ===========================================================================
   Spécifique au bilan massique
   =========================================================================== */

/* Barre des catégories : agit sur tous les graphiques de la page.
   Collante sous l'en-tête sur grand écran ; sur mobile, elle défile avec la page. */
.filter-bar {
  position: sticky;
  top: 57px;
  z-index: 40;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.filter-bar .wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
}
.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 2px;
}
.toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 12px 5px 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
/* Pastille de couleur + case : l'état ne repose pas sur la couleur seule */
.toggle-btn::before {
  content: "";
  flex-shrink: 0;
  width: 12px; height: 12px;
  border-radius: 3px;
  border: 2px solid var(--cat-color);
  background: transparent;
}
.toggle-btn[aria-pressed="true"] { color: var(--text-primary); border-color: var(--cat-color); }
.toggle-btn[aria-pressed="true"]::before {
  background: var(--cat-color)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 6.2 5 8.5l4.5-5' fill='none' stroke='white' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 10px no-repeat;
}

/* Grille des arrondissements */
.boroughs-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.boroughs-grid > .card + .card { margin-top: 0; }
@media (max-width: 860px) {
  .boroughs-grid { grid-template-columns: 1fr; }
}
.card .card-sub {
  font-size: 12.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
  font-variant-numeric: tabular-nums;
}
.card .card-sub strong { color: var(--text-primary); font-weight: 650; }
.chart-box.h-220 { height: 220px; }
.card .table-toggle { margin-top: 10px; }
table.data-table td.na { color: var(--text-muted); }

.limits-list { margin: 0; padding-left: 20px; }
.limits-list li + li { margin-top: 8px; }

@media (max-width: 760px) {
  .filter-bar { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}
