/* The home page is always dark: photos read better on black, and it sets the mood. */
body.home {
  --bg: #050505;
  --surface: #121212;
  --surface-2: #1c1c1c;
  --text: #fafafa;
  --muted: #a8a29e;
  --border: #262626;
  /* One green throughout: the lime of the logo, the count and the buttons. */
  --accent: #84cc16;
  --accent-strong: #bef264;
  --accent-soft: rgba(163, 230, 53, .14);
  --ink: #fafafa;
  --ink-text: #0a0a0a;
  --glow: #a3e635;
  color-scheme: dark;
  background: var(--bg);
  color: var(--text);
}

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.home .topbar .wrap { max-width: 1600px; }

.wall-hero, .wall-map-section, .wall { margin-top: 0; }

/* Hero */
.wall-hero {
  position: relative; overflow: hidden; border-bottom: 1px solid var(--border);
  background:
    radial-gradient(60% 80% at 85% 0%, rgba(132, 204, 22, .18), transparent 70%),
    radial-gradient(40% 60% at 0% 100%, rgba(34, 197, 94, .10), transparent 70%);
}
.wall-hero-inner { max-width: 1600px; margin: 0 auto; padding: 56px 16px 44px; }
.wall-hero h1 { margin: 0; font-size: clamp(2.1rem, 6.5vw, 4.5rem); line-height: 1.02; letter-spacing: -.04em; font-weight: 850; max-width: 16ch; }
.wall-count { color: var(--glow); font-variant-numeric: tabular-nums; text-shadow: 0 0 40px rgba(163, 230, 53, .35); }
.wall-sub { margin: 16px 0 0; max-width: 56ch; color: var(--muted); font-size: 1.1rem; }
.wall-facts { list-style: none; padding: 0; margin: 18px 0 26px; display: flex; flex-wrap: wrap; gap: 8px; }
.wall-facts:empty { display: none; }
.wall-facts li { border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: .95rem; color: var(--muted); }
.wall-facts strong { color: var(--text); }
.home .btn-primary { background: var(--glow); color: #0a0a0a; border-color: var(--glow); text-decoration: none; }
.home .btn-primary:hover { background: #bef264; }
.home .btn-primary svg { color: currentColor; }
.home .chip input:checked + span { background: var(--glow); color: #0a0a0a; border-color: var(--glow); }
.wall-facts:empty + .btn { margin-top: 26px; }

/* Map */
.wall-map-section { max-width: 1600px; margin: 0 auto; padding: 32px 16px 0; }
.wall-map-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 12px; }
.wall-map-head h2 { font-size: clamp(1.4rem, 3vw, 2rem); letter-spacing: -.03em; }
.wall-map-caption { margin: 0; color: var(--muted); flex: 1; min-width: 12ch; }
#replay-status { color: var(--glow); font-weight: 600; font-variant-numeric: tabular-nums; }
.btn-glow { border-color: color-mix(in srgb, var(--glow) 50%, transparent); color: var(--glow); background: transparent; }
.btn-glow:hover { border-color: var(--glow); }
.btn-glow:disabled { opacity: .5; cursor: progress; }
.wall-map { height: min(78vh, 720px); min-height: 360px; border-radius: var(--radius); border: 1px solid var(--border); background: #111; z-index: 0; }
/* A dark, grey street map so the lime dots are the only color on it. */
.wall-map .leaflet-tile-pane { filter: grayscale(1) invert(1) brightness(.85) contrast(.9); }
.wall-map .leaflet-control-attribution { background: rgba(0, 0, 0, .6); color: #a8a29e; }
.wall-map .leaflet-control-attribution a { color: #d6d3d1; }
.wall-map .leaflet-bar a { background: #1c1c1c; color: #fafafa; border-color: #333; }
.map-pulse { border-radius: 50%; border: 3px solid #fff; animation: pulse 1.4s ease-out infinite; }
@keyframes pulse { from { transform: scale(.4); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }

.map-options { margin-top: 10px; display: grid; gap: 6px; }
.layer-toggles label { color: var(--muted); }
.dot { border-color: #050505; }
.dot-incident { background: #f97316; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #1c1c1c; color: #fafafa; }
.popup .when { color: #a8a29e; }
.leaflet-container a.leaflet-popup-close-button { color: #a8a29e; }

.wall-where { margin-top: 22px; max-width: 760px; }
.wall-where h3 { margin: 0 0 10px; font-size: 1rem; color: var(--muted); font-weight: 600; }
.where-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.where-bars li { display: grid; grid-template-columns: minmax(10ch, 16rem) 1fr 4ch; align-items: center; gap: 12px; font-size: .92rem; }
.where-bar { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.where-bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--glow)); }
.where-n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
@media (max-width: 600px) {
  .where-bars li { grid-template-columns: 1fr 4ch; gap: 4px 12px; }
  .where-label { grid-column: 1 / -1; }
}

/* The wall */
.wall { max-width: 1600px; margin: 0 auto; padding: 24px 16px 64px; }
.wall-progress {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px; padding: 10px 0;
  margin-bottom: 4px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px);
  font-size: .9rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted);
}
.wall-progress-bar { flex: 1; height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.wall-progress-bar span { display: block; height: 100%; width: 0; background: var(--glow); transition: width .3s ease-out; }
.wall-empty { color: var(--muted); }

.wall-group + .wall-group { margin-top: 28px; }
.wall-group-head {
  display: flex; align-items: baseline; gap: 12px; margin: 14px 0 10px; font-size: clamp(1.1rem, 2.2vw, 1.5rem); letter-spacing: -.02em;
}
.wall-group-n { color: var(--glow); font-size: .9rem; font-weight: 600; letter-spacing: 0; }

/* Mixed-size collage: dense packing fills the holes the big tiles leave. */
.collage {
  --cell: clamp(78px, 11vw, 150px);
  display: grid; gap: 4px;
  grid-template-columns: repeat(auto-fill, minmax(var(--cell), 1fr));
  grid-auto-rows: var(--cell);
  grid-auto-flow: dense;
}
.tile {
  position: relative; overflow: hidden; padding: 0; border: 0; border-radius: 4px; cursor: zoom-in;
  background: var(--surface-2); color: #fff; font: inherit; text-align: left;
}
.collage-few { --cell: clamp(150px, 22vw, 260px); }
.tile-wide { grid-column: span 2; }
.tile-tall { grid-row: span 2; }
.tile-big { grid-column: span 2; grid-row: span 2; }
.tile img {
  width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transform: scale(1.03);
  transition: opacity .4s ease, transform .6s ease;
}
.tile.loaded img { opacity: 1; transform: none; }
.tile:hover img, .tile:focus-visible img { transform: scale(1.05); }
.tile.broken { display: none; }
.tile:focus-visible { outline: 3px solid var(--glow); outline-offset: -3px; }
.tile-cap {
  position: absolute; inset: auto 0 0; display: grid; gap: 2px; padding: 28px 10px 8px;
  background: linear-gradient(transparent, rgba(0, 0, 0, .78)); font-size: .8rem; line-height: 1.3;
  opacity: 0; transition: opacity .2s ease;
}
.tile:hover .tile-cap, .tile:focus-visible .tile-cap, .tile-big .tile-cap, .collage-few .tile-cap { opacity: 1; }
.tile-label { font-weight: 650; }
.tile-when { color: #d6d3d1; font-size: .75rem; }
.tile-note { font-size: .92rem; font-weight: 500; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (hover: none) {
  .collage:not(.collage-few) .tile:not(.tile-big) .tile-cap { display: none; }
}
@media (max-width: 600px) {
  .wall-hero-inner { padding: 32px 16px 32px; }
  .wall-map-caption { flex-basis: 100%; order: 1; }
  .tile-cap { padding: 20px 6px 5px; }
  .tile-big .tile-label, .tile-big .tile-when { font-size: .72rem; }
  .tile-note { font-size: .8rem; -webkit-line-clamp: 2; }
}

.wall-end { text-align: center; padding: 56px 16px 8px; color: var(--muted); }
.wall-end-big { font-size: clamp(1.4rem, 3.5vw, 2.2rem); font-weight: 800; letter-spacing: -.03em; color: var(--text); margin: 0 0 6px; }
.wall-end .btn { margin-top: 12px; }

/* Injuries, about */
.home-more { max-width: 1600px; margin: 0 auto; padding: 0 16px 64px; border-top: 1px solid var(--border); }
.home-more .incident-list { max-width: 900px; }
.incident-list li { border-left-color: #f97316; }
.incident-list a { margin-right: 10px; }
.btn-secondary { background: transparent; color: var(--text); }

/* Lightbox */
.lightbox {
  width: 100vw; height: 100dvh; max-width: 100vw; max-height: 100dvh; margin: 0; border-radius: 0;
  background: rgba(0, 0, 0, .96); color: #fafafa; display: none; grid-template-rows: auto 1fr auto;
  overflow: hidden; overscroll-behavior: contain;
}
.lightbox[open] { display: grid; }
.lightbox::backdrop { background: #000; }
.lightbox-top { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; font-variant-numeric: tabular-nums; color: #a8a29e; }
.lightbox .btn-icon { background: rgba(255, 255, 255, .08); color: #fff; border-color: transparent; }
.lightbox .btn-icon:hover { background: rgba(255, 255, 255, .18); }
.lightbox .btn-icon:disabled { opacity: .25; cursor: default; }
.lightbox-stage { position: relative; min-height: 0; overflow: hidden; }
/* The photo always fills the same fixed box (minus the arrow gutters), so the
   thumbnail and the full-size photo that replaces it render at the same size. */
.lightbox-stage img { position: absolute; top: 0; left: 56px; width: calc(100% - 112px); height: 100%; object-fit: contain; display: block; }
.lb-nav { z-index: 1; position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; font-size: 2rem; }
.lb-prev { left: 8px; }
.lb-next { right: 8px; }
.lightbox-body { padding: 12px 16px 20px; max-width: 900px; width: 100%; margin: 0 auto; max-height: 40dvh; overflow-y: auto; }
.lightbox-body p { margin: 0 0 8px; }
#lb-meta { font-weight: 600; }
#lb-text:empty { display: none; }
.lightbox .btn-small { background: transparent; color: #fafafa; border-color: #333; }
@media (max-width: 600px) {
  .lightbox-stage img { left: 0; width: 100%; }
  .lb-nav { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tile img, .tile-cap, .wall-progress-bar span { transition: none; }
  .map-pulse { animation: none; }
}
