/* DIU interactive house style (dj-kit/templates/interactive).
   Taken from the NYT's 2019 air-pollution interactive, first used in City AQI
   (Oct 2026). Free fonts stand in for the NYT's licensed ones. Values and
   their sources: ../README.md. Add NEW classes for a project; do not change
   these defaults (Rule 14). */

:root {
  /* Severity ramp, the NYT's six colours, light to dark. City AQI maps
     them onto CPCB's AQI categories (Good ... Severe). */
  --ramp-1: #D4E8C1;
  --ramp-2: #F3C654;
  --ramp-3: #F28124;
  --ramp-4: #C94227;
  --ramp-5: #A42614;
  --ramp-6: #800000;
  --missing: #E6E6E6;

  /* Text and rules */
  --ink: #121212;
  --ink-2: #333333;
  --meta: #727272;
  --rule: #DFDFDF;
  --page: #FFFFFF;

  --sans: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --column: 600px;   /* reading width, like the NYT's body column */
  --wide: 780px;     /* graphics run a little wider */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
}

.story { padding: 32px 20px 64px; }

.story > *:not(.particles):not(.daily) {
  max-width: var(--column);
  margin-left: auto;
  margin-right: auto;
}
.particles {
  max-width: var(--wide);
  margin-left: auto;
  margin-right: auto;
}
/* The daily charts run wider, like the NYT's 1,050 px side-by-side graphic */
.daily { max-width: 1000px; margin-left: auto; margin-right: auto; }
.daily h2, .daily .daily-intro { max-width: var(--column); margin-left: auto; margin-right: auto; }

/* ---- Header ---------------------------------------------------------- */

/* Headline and deck: the NYT's values (css-rsa88z, interactive-leadin),
   phones first, larger from 740 px */
h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-style: italic;
  font-size: 31px;
  line-height: 36px;
  color: #121212;
  text-align: left;
  text-wrap: balance;
  margin: 0 0 14px;
}

.deck {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 25px;
  color: var(--ink-2);
  margin: 0 0 12.5px;
}

@media (min-width: 740px) {
  h1 { font-size: 40px; line-height: 48px; }
  .deck { font-size: 20px; line-height: 30px; margin-bottom: 15px; }
}

.byline {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 0 0 28px;
}
.dateline {
  display: block;
  font-weight: 500;
  color: var(--meta);
  margin-top: 4px;
}

/* ---- Legend bar, pinned to the top (the NYT's .g-sidebar) -------------- */

.legend-bar {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: rgba(255, 255, 255, 0.9);
  padding: 15px 16px 5px;
  font-family: var(--sans);
  color: #333;
}
.legend-bar-inner { margin: 0 auto; display: block; width: 100%; }
@media (min-width: 740px) { .legend-bar-inner { width: 500px; } }
.legend-bar h3 {
  text-align: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin: 0;
}
#scale-svg { display: block; width: 100%; margin-top: 5px; overflow: visible; }
#scale-svg .tick line { stroke: #333; }
#scale-svg text { fill: #333; font-family: var(--sans); font-size: 11px; font-weight: 300; }
#scale-svg .marker-label { font-weight: 700; }

/* ---- The sentence with the dropdown ------------------------------------ */

.lede p {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.6;
  margin: 0 0 20px;
}

.dropdown-wrap { display: inline-block; vertical-align: middle; min-width: 190px; margin: -4px 0 0; }

/* Choices.js, restyled to sit inside a sentence like the NYT's */
.dropdown-wrap .choices { margin: 0; font-family: var(--sans); }
.dropdown-wrap .choices__inner {
  min-height: 0;
  vertical-align: middle;
  line-height: 1.35;
  padding: 1px 30px 1px 8px;
  background: #F7F7F7;
  border: 1px solid #CCCCCC;
  border-radius: 3px;
  font-size: 18px;
  font-weight: 700;
}
.dropdown-wrap .choices__list--single { padding: 0; }
.dropdown-wrap .choices[data-type*="select-one"]::after {
  border-color: var(--ink) transparent transparent;
  right: 10px;
}
.dropdown-wrap .choices__list--dropdown,
.dropdown-wrap .choices__list[aria-expanded] {
  font-size: 15px;
  font-weight: 500;
  z-index: 20;
  min-width: 240px;
}
.dropdown-wrap .choices__input--cloned {
  font-family: var(--sans);
  font-size: 15px;
}
.dropdown-wrap .choices__item--choice.is-highlighted { background: #EDEDED; }

.category-word { font-weight: 700; }

/* ---- Toggle ------------------------------------------------------------ */

.toggle {
  display: flex;
  gap: 0;
  margin-bottom: 14px;
  font-family: var(--sans);
}
.toggle button {
  flex: 1 1 0;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 6px;
  color: var(--ink-2);
  background: #FFFFFF;
  border: 1px solid #CCCCCC;
  cursor: pointer;
}
.toggle button + button { border-left: none; }
.toggle button:first-child { border-radius: 3px 0 0 3px; }
.toggle button:last-child { border-radius: 0 3px 3px 0; }
.toggle button.is-active { background: var(--ink); color: #FFFFFF; border-color: var(--ink); }
.toggle button:focus-visible { outline: 2px solid #326891; outline-offset: 2px; }

/* ---- Particle panels ----------------------------------------------------- */

.particles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.panel { min-width: 0; }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-family: var(--sans);
  margin-bottom: 6px;
}
.panel-city { font-size: 16px; font-weight: 700; }
.panel-when { font-size: 12px; color: var(--meta); text-align: right; }
.panel canvas {
  display: block;
  width: 100%;
  height: 260px;
  background: #FAFAFA;
  border: 1px solid #EEEEEE;
}
.panel-value {
  font-family: var(--sans);
  font-size: 14px;
  margin-top: 8px;
  color: var(--ink-2);
}
.panel-value strong { font-size: 26px; color: var(--ink); margin-right: 4px; }

.note {
  font-family: var(--sans);
  font-size: 12px;
  line-height: 1.5;
  color: var(--meta);
  margin-top: 10px;
}

/* ---- Numbers table ----------------------------------------------------- */

h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  margin: 44px 0 10px;
}
.numbers-intro, .daily-intro {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 16px;
}
#numbers-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--sans);
  font-size: 15px;
}
#numbers-table th {
  text-align: right;
  font-size: 13px;
  font-weight: 700;
  padding: 0 0 8px 12px;
  border-bottom: 1px solid var(--ink);
}
#numbers-table th:first-child { text-align: left; padding-left: 0; }
#numbers-table td {
  padding: 10px 0 10px 12px;
  border-bottom: 1px solid var(--rule);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
#numbers-table td:first-child { text-align: left; padding-left: 0; color: var(--ink-2); }
#numbers-table td.is-worse { font-weight: 700; }
.swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 6px;
  vertical-align: 0;
}

/* ---- Daily bar charts ---------------------------------------------------- */

.sidebyside {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 8px;
}
.bar-panel { min-width: 0; }
.bar-panel h3 {
  font-family: var(--sans);
  font-size: 1.2em;
  font-weight: 800;
  text-align: left;
  margin: 0 0 4px 20px;
}
.bar-panel h3 .bar-days { font-weight: 500; font-size: 12px; color: var(--meta); margin-left: 6px; }
.bar-panel svg { width: 100%; display: block; overflow: visible; }
.bar-panel svg text { font-family: var(--sans); }
.bar-panel .grid { stroke: #ccc; stroke-dasharray: 1.5, 3; }
.bar-panel .tick { stroke: #ccc; }
.bar-panel .ytick, .bar-panel .xtick { font-size: 10px; fill: #666; }
.bar-panel .worst, .bar-panel .today { font-size: 11px; fill: #444; }
.bar-panel .worst { font-weight: 700; fill: var(--ink); }

.legend {
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-2);
  margin: 0 0 14px;
}

/* ---- Notes ---------------------------------------------------------------- */

.notes {
  margin-top: 48px;
  padding-top: 8px;
  border-top: 1px solid var(--rule);
}
.notes h2 { font-size: 18px; font-family: var(--sans); margin-top: 16px; }
.notes p {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 10px;
}
.notes .credit { color: var(--meta); font-size: 13px; }

/* ---- Phones ---------------------------------------------------------------- */

@media only screen and (max-width: 700px) {
  .story { padding: 20px 16px 48px; }
  .lede p { font-size: 18px; }
  .dropdown-wrap { min-width: 160px; }
  .dropdown-wrap .choices__inner { font-size: 16px; }
  .particles { gap: 10px; }
  .panel canvas { height: 190px; }
  .panel-city { font-size: 14px; }
  .panel-value strong { font-size: 22px; }
  .panel-when { font-size: 11px; }
  h2 { font-size: 22px; }
  .numbers-intro, .daily-intro { font-size: 17px; }
  .sidebyside { grid-template-columns: 1fr; gap: 26px; }  /* one chart per row on phones */
  #numbers-table { font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
