/* Diwali 2026 pollution replay (/diwali-2026-pollution/, public/assets/diwali-2026.js).
   An app-style screen for visitors from social posts: on a phone the map, the
   time and AQI, and the player fit on one screen, with the app a tap away
   in the header. From 900px the player sits beside the map. */

.wrap.bare { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
/* The header's app button is this page's only app CTA, so it stays on iPhone Safari too (no Smart App Banner here). */
.ios-safari .get-app.keep { display: inline-flex; }
.dwx { margin: 0; }
.dwx .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.dwx button { font-family: inherit; }

/* Title, then region and share */
.dwx-h1 { margin: 2px 0 10px; font-size: 21px; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
.dwx-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 12px; }
.dwx-icon { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--card); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.dwx-icon svg { width: 21px; height: 21px; fill: currentColor; }
.dwx-icon:hover { background: var(--card2); }

.dwx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }

/* Region pill */
.dwx-region { position: relative; display: inline-flex; align-items: center; min-width: 0; max-width: 100%; }
.dwx-region svg { position: absolute; left: 13px; width: 16px; height: 16px; fill: var(--accent); pointer-events: none; }
.dwx-region select {
  height: 40px; max-width: 100%; padding: 0 36px 0 36px; border: 0; border-radius: var(--r-pill);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%238e8e93' d='M7 9.5 12 14.5 17 9.5z'/%3E%3C/svg%3E") no-repeat right 8px center / 22px;
  color: var(--text); font: 600 var(--fs-row)/1 inherit; font-family: inherit; appearance: none; -webkit-appearance: none; cursor: pointer;
}
.dwx-region select:hover { background-color: var(--card2); }

/* Map stage with the time and AQI over it */
.dwx-stage { position: relative; scroll-margin-top: 64px; }
.dw-map { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--card); border-radius: var(--r-xl); overflow: hidden; touch-action: manipulation; }
.dw-map svg, .dw-heat { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.dw-map path { fill: none; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.dw-ctx { stroke: var(--text); stroke-opacity: .28; stroke-width: .8; }
.dw-main { stroke: var(--text); stroke-opacity: .75; stroke-width: 1.4; }
.dw-ring { fill: var(--bg); fill-opacity: .25; stroke: var(--text); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
.dw-town { position: absolute; transform: translate(-50%, -50%); font-size: var(--fs-cap); font-weight: 600; color: var(--text); opacity: .7; pointer-events: none; white-space: nowrap;
  text-shadow: 0 0 3px var(--card), 0 0 3px var(--card), 0 0 6px var(--card); }
.is-loading .dw-map, .is-loading .dw-chart { opacity: .45; transition: opacity .2s; }

/* The hour and the region's average, above the map (never over it) */
.dwx-read { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 8px; min-height: 46px; }
.dwx-when { display: flex; flex-direction: column; gap: 1px; flex: none; }
.dwx-when b { font-size: var(--fs-prose); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dwx-when span { font-size: var(--fs-cap); color: var(--muted); font-weight: 600; }
.dwx-aqi { display: flex; align-items: center; gap: 10px; text-align: right; min-width: 0; }
.dwx-aqi > span:first-child { display: flex; flex-direction: column; min-width: 0; }
.dwx-aqi b { font-size: var(--fs-meta); font-weight: 700; line-height: 1.2; }
.dwx-aqi small { font-size: 11px; color: var(--muted); line-height: 1.3; }
.dwx-aqi .dwx-num { flex: none; }
@media (max-width: 389px) {
  .dwx-read { gap: 8px; }
  .dwx-when b { font-size: var(--fs-body); }
  .dwx-aqi { gap: 8px; }
  .dwx-aqi b { font-size: var(--fs-cap); }
}
.dwx-num { display: inline-grid; place-items: center; flex: none; width: 70px; height: 44px; padding: 0; border-radius: 12px; white-space: nowrap; overflow: hidden; background: var(--badge); color: var(--ink); font-size: 23px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; transition: background-color .3s linear; }
.dwx-num.n4 { font-size: 21px; }
.dwx-num.n5 { font-size: 19px; }
.dwx-num.n6 { font-size: 16px; }
.dwx-num.sm { width: 52px; height: 30px; border-radius: var(--r-sm); font-size: var(--fs-sm); letter-spacing: 0; transition: none; }
.dwx-num.sm.n5, .dwx-num.sm.n6 { font-size: var(--fs-meta); }

/* Colour scale, under the map */
.dwx-key { margin: 14px 4px 0; }
.dwx-key i { display: block; height: 6px; border-radius: 3px; }
.dwx-key span { display: flex; justify-content: space-between; margin-top: 4px; }
.dwx-key b { font-size: 11px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

/* End of the replay: the app */
.dwx-end { position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; border-radius: var(--r-xl); background: color-mix(in srgb, var(--bg) 55%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.dwx-end[hidden] { display: none; }
.dwx-end-card { width: min(300px, 100%); padding: 22px 20px 16px; border-radius: var(--r-xl); background: var(--elev); box-shadow: var(--float); text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; animation: dwx-up .35s ease-out; }
.dwx-end-card img { border-radius: 13px; margin-bottom: 4px; }
.dwx-end-card b { font-size: var(--fs-prose); font-weight: 700; }
.dwx-end-card p { margin: 0 0 8px; font-size: var(--fs-sm); color: var(--muted); line-height: 1.4; }
.dwx-get { display: block; width: 100%; padding: 13px 0; border-radius: var(--r-pill); background: var(--accent); color: #fff; font-weight: 700; font-size: var(--fs-body); }
.dwx-get:hover { text-decoration: none; filter: brightness(1.05); }
.dwx-again { margin-top: 2px; padding: 10px 14px; border: 0; background: none; color: var(--accent); font-weight: 600; font-size: var(--fs-sm); cursor: pointer; }
@keyframes dwx-up { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dwx-end-card { animation: none; } }

.dw-pick { margin: 8px 4px 0; font-size: var(--fs-meta); color: var(--muted); }
.dw-pick:empty { display: none; }
.dwx-hint { margin: 6px 4px 0; font-size: var(--fs-cap); color: var(--muted); }
.dw-pick b { color: var(--text); font-weight: 600; }

/* Player */
.dwx-dock { margin-top: 8px; padding: 10px 12px; border-radius: var(--r-xl); background: var(--card); }
.dw-chart { width: 100%; height: 92px; touch-action: pan-y; cursor: ew-resize; user-select: none; -webkit-user-select: none; }
.dw-chart svg { display: block; }
.dw-night { fill: var(--card2); }
line.dw-grid { stroke: var(--muted); stroke-opacity: .25; stroke-width: 1; }
.dw-tick { stroke: var(--muted); stroke-width: 1; }
.dw-yl { font-size: 11px; fill: var(--muted); text-anchor: end; font-variant-numeric: tabular-nums; }
.dw-xl, .dw-pl { font-size: 11px; fill: var(--muted); }
.dw-pl { font-weight: 600; }
.dw-head-line { stroke: var(--text); stroke-width: 2; }

/* The slider sits under the chart; diwali-2026.js sets its inset and width
   so the dot lines up with the chart's time line. */
.dw-slide { height: 30px; }
.dw-slide input[type=range] { display: block; width: 100%; height: 30px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; cursor: pointer; }
.dw-slide input[type=range]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: var(--card2); }
.dw-slide input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--card2); }
.dw-slide input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .3), 0 0 0 .5px rgba(0, 0, 0, .1); }
.dw-slide input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }

.dw-ctl { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.dw-ctl .dwx-seg { flex: 1; min-width: 0; }
.dw-play { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--btn-bg); color: var(--btn-text); display: grid; place-items: center; cursor: pointer; }
.dw-play svg { width: 18px; height: 18px; fill: currentColor; grid-area: 1 / 1; }
.dw-play .i-pause, .is-playing .dw-play .i-play { display: none; }
.is-playing .dw-play .i-pause { display: block; }
.dw-play:active { transform: scale(.94); }

.dwx-seg { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); padding: 3px; border-radius: 12px; background: var(--card2); }
.dwx-seg button { height: 34px; min-width: 0; overflow: hidden; text-overflow: ellipsis; padding: 0 2px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: var(--fs-meta); font-weight: 600; white-space: nowrap; cursor: pointer; }
.dwx-seg button:disabled { opacity: .4; cursor: default; }
.dwx-seg button[aria-pressed=true] { background: var(--seg-on); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

/* Worst this hour */
.dwx-worst { margin: 18px 0 0; }
.dwx-worst h2 { margin: 0 4px 8px; font-size: var(--fs-body); font-weight: 700; }
.dwx-worst ol { list-style: none; margin: 0; padding: 4px 14px; border-radius: var(--r-xl); background: var(--card); }
.dwx-worst li { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 0; }
.dwx-worst li > span:last-child { min-width: 0; display: flex; flex-direction: column; }
.dwx-worst b { font-size: var(--fs-row); font-weight: 600; line-height: 1.25; }
.dwx-worst small { font-size: var(--fs-cap); color: var(--muted); }

/* About, folded away */
.dwx-about { margin: 14px 4px 0; font-size: var(--fs-meta); color: var(--muted); }
.dwx-about summary { cursor: pointer; padding: 10px 0; font-weight: 600; color: var(--muted); }
.dwx-about p { margin: 0 0 10px; line-height: 1.5; }

/* Below the player: the region's story (diwali-2026.js renderMore) */
.dwx-more { margin: 36px 0 0; }
.dwx-more h2 { margin: 0 0 6px; font-size: var(--h2); font-weight: 700; }
.dwx-say { margin: 0 0 16px; font-size: var(--fs-body); line-height: 1.5; color: var(--muted); }
.dwx-say b { color: var(--text); font-weight: 600; }
.dwx-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0 0 14px; }
.dwx-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; border-radius: var(--r-xl); background: var(--card); min-width: 0; }
.dwx-tile b { font-size: var(--fs-sm); font-weight: 600; margin-top: 4px; }
.dwx-tile small { font-size: var(--fs-cap); color: var(--muted); line-height: 1.35; }
.dwx-num.lg { width: auto; min-width: 64px; height: 40px; padding: 0 10px; font-size: 21px; }
.dwx-num.lg.n5, .dwx-num.lg.n6 { font-size: 19px; }
.dwx-big { font-size: 30px; line-height: 40px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.dwx-big em { font-size: 18px; font-weight: 600; color: var(--muted); margin-left: 2px; }
.dwx-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.dwx-card { padding: 14px 14px 10px; border-radius: var(--r-xl); background: var(--card); min-width: 0; }
.dwx-card h3 { margin: 0 2px 8px; font-size: var(--fs-body); font-weight: 700; }
.dwx-note { margin: 6px 2px 2px; font-size: var(--fs-cap); color: var(--muted); }

.dwx-bars, .dwx-areas { list-style: none; margin: 0; padding: 0; }
.dwx-bars li, .dwx-areas li { margin: 0; }
.dwx-bars li > div, .dwx-bars li > button { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 8fr) 44px; align-items: center; gap: 10px; width: 100%; min-height: 46px; padding: 4px 2px; }
.dwx-bar-name { display: flex; flex-direction: column; min-width: 0; text-align: left; }
.dwx-bar-name b { font-size: var(--fs-sm); font-weight: 600; line-height: 1.25; }
.dwx-bar-name small { font-size: 11px; color: var(--muted); }
.dwx-bar-track { height: 10px; border-radius: 5px; background: var(--card2); overflow: hidden; }
.dwx-bar-track i { display: block; height: 100%; border-radius: 5px; background: var(--badge); }
.dwx-bar-v { font-size: var(--fs-sm); font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.dwx-areas li > button { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 4px 2px; text-align: left; }
.dwx-areas li > button > span:nth-child(2) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dwx-areas b { font-size: var(--fs-row); font-weight: 600; line-height: 1.25; }
.dwx-areas small { font-size: var(--fs-cap); color: var(--muted); }
.dwx-spark { flex: none; }
.dwx-spark path { fill: none; stroke: var(--text); stroke-opacity: .55; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.dwx-more button { border: 0; background: none; color: inherit; font: inherit; cursor: pointer; border-radius: var(--r-md); }
.dwx-more button:hover { background: var(--card2); }

@media (min-width: 900px) {
  .dwx-h1 { font-size: 28px; margin-bottom: 14px; }
  .dwx-top { max-width: calc(57.4% - 12px); }
  .dwx-grid { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 24px; align-items: start; }
  .dwx-right { padding-top: 46px; }
  .dwx-dock { margin-top: 8px; }
  .dw-chart { height: 140px; }
  .dwx-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dwx-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
