/* नेपाली खबर
   ---------------------------------------------------------------------------
   Light theme, on purpose. The previous stylesheet was dark because it was a
   security console people opened for two minutes; this is a newspaper people
   read for twenty, mostly on a phone in daylight.

   Devanagari drives three decisions the rest of the sheet follows:
   · line-height 1.8, not 1.5 — matras sit above and below the baseline and
     collide at tighter leading
   · no webfont — the fallback stack is system-only, because a disaster page
     that waits on a 300KB font file on a 2G connection is a page nobody reads
   · slightly larger base size — Devanagari counters are smaller than Latin at
     the same point size                                                      */

:root {
  color-scheme: light;
  --bg: #FFFFFF;
  --bg-2: #F6F5F3;
  --card: #FFFFFF;
  --raised: #F2F1EE;
  --border: #E2DFDA;
  --border-2: #CFCAC2;
  --red: #C8102E;          /* the Nepali flag crimson, dulled for text use */
  --red-dark: #9C0D24;
  --blue: #12395E;
  --t1: #14110E;
  --t2: #4A443C;
  --t3: #7A736A;
  --sans: "Noto Sans Devanagari", "Mukta", "Kalimati", "Mangal",
          ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Noto Serif Devanagari", "Kokila", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1180px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.8;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--red); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 max(18px, env(safe-area-inset-left)) 0 max(18px, env(safe-area-inset-right));
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Keyboard users land here first. Hidden until focused. */
.skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--t1); color: #fff; padding: 10px 16px;
}
.skip:focus { left: 0; }

/* ── header ──────────────────────────────────────────────────────────────── */

header { border-bottom: 2px solid var(--t1); background: var(--bg); }

.masthead {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 0 12px;
}
.logo { flex: none; }
.brand .name {
  font-size: 27px; font-weight: 700; letter-spacing: -.01em; line-height: 1.2;
  color: var(--red);
}
.brand .sub { font-size: 13px; color: var(--t3); line-height: 1.4; }
.btn-sub {
  margin-inline-start: auto;
  background: var(--red); color: #fff;
  padding: 9px 16px; border-radius: 3px;
  font-size: 15px; font-weight: 600;
  min-height: 44px; display: inline-flex; align-items: center;
}
.btn-sub:hover { background: var(--red-dark); color: #fff; }

/* Below 620px the topic nav scrolls sideways and bleeds to the screen edge,
   so it reads as scrollable rather than clipped. */
.topics {
  display: flex; gap: 4px;
  border-top: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.topics::-webkit-scrollbar { display: none; }
.topics a {
  padding: 11px 13px; font-size: 16px; font-weight: 600; white-space: nowrap;
  color: var(--t2); border-bottom: 3px solid transparent;
  min-height: 44px; display: inline-flex; align-items: center;
}
.topics a:hover { color: var(--red); background: var(--bg-2); }
.topics a[aria-current="page"] { color: var(--red); border-bottom-color: var(--red); }

.livestrip {
  display: flex; align-items: center; gap: 10px;
  border-top: 1px solid var(--border);
  padding: 7px 0; font-size: 13px; color: var(--t3);
}
.livestrip .left { display: flex; align-items: center; gap: 8px; }
.live-word { font-weight: 700; color: var(--red); letter-spacing: .02em; }
.live-word.idle { color: var(--t3); }
.dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  animation: pulse 2s ease-in-out infinite;
}
.dot-idle { background: var(--border-2); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .3 } }
@media (prefers-reduced-motion: reduce) { .dot { animation: none } }

/* ── standing disaster coverage ──────────────────────────────────────────── */

.coverage {
  border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  background: var(--bg-2);
  padding: 16px 18px;
  margin: 22px 0 0;
}
.coverage h2 { font-size: 22px; margin: 4px 0 6px; font-weight: 700; line-height: 1.45; }
.coverage p { margin: 0; color: var(--t2); font-size: 16px; }
.coverage-links { margin-top: 10px !important; display: flex; flex-wrap: wrap; gap: 8px 20px; }
.coverage-links a { color: var(--red); font-weight: 600; font-size: 15.5px; }
.dot-live {
  width: 8px; height: 8px; border-radius: 50%; background: var(--red);
  display: inline-block; margin-inline-end: 6px;
  animation: pulse 2s ease-in-out infinite;
}

.kicker {
  font-size: 13px; font-weight: 700; letter-spacing: .04em;
  color: var(--red); text-transform: uppercase; margin: 0 0 6px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.kicker span { color: var(--t3); font-weight: 600; }

/* ── lead + rail ─────────────────────────────────────────────────────────── */

.lead-grid {
  display: grid; grid-template-columns: minmax(0, 1fr) 330px;
  gap: 30px; align-items: start;
  margin: 24px 0 0; padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.lead-headline {
  font-family: var(--serif);
  font-size: 38px; line-height: 1.35; font-weight: 700;
  margin: 0 0 12px; letter-spacing: -.01em;
}
.lead-headline a:hover { color: var(--red); }
.lead .dek { font-size: 19px; color: var(--t2); margin: 0 0 12px; }
.lead-empty .lead-headline { font-size: 27px; color: var(--t3); }

.why {
  font-size: 16px; color: var(--t2);
  border-inline-start: 3px solid var(--red);
  padding-inline-start: 12px; margin: 12px 0;
}
.why b { color: var(--t1); }

.meta { font-size: 13.5px; color: var(--t3); margin: 8px 0 0; }
.meta a { color: var(--blue); font-weight: 600; }
.cat-chip {
  color: var(--red); font-weight: 700; font-size: 13px;
  text-transform: uppercase; letter-spacing: .03em;
}
.ago { white-space: nowrap; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip {
  font-size: 13px; color: var(--t2);
  border: 1px solid var(--border-2); border-radius: 3px;
  padding: 2px 9px; display: inline-block;
}

.rail { border-inline-start: 1px solid var(--border); padding-inline-start: 24px; }
.rail-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 2px solid var(--t1); padding-bottom: 6px; margin-bottom: 4px;
}
.rail-head h2 { font-size: 19px; margin: 0; font-weight: 700; }
.rail-head a { font-size: 14px; color: var(--red); font-weight: 600; }
.rail-list { list-style: none; margin: 0; padding: 0; }
.rail-list li { padding: 11px 0; border-bottom: 1px solid var(--border); }
.rail-list li:last-child { border-bottom: 0; }
.rail-list a { font-size: 16px; font-weight: 600; line-height: 1.6; display: block; }
.rail-meta { display: block; font-size: 12.5px; color: var(--t3); margin-top: 3px; }

/* ── secondary strip ─────────────────────────────────────────────────────── */

.second-strip {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px; padding: 22px 0; border-bottom: 1px solid var(--border);
}
.second h3 { font-family: var(--serif); font-size: 20px; line-height: 1.45; margin: 0; font-weight: 700; }

/* ── category blocks ─────────────────────────────────────────────────────── */

.cat-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px; margin: 26px 0 0;
}
.cat-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 2px solid var(--t1); padding-bottom: 6px; margin-bottom: 12px;
}
.cat-head h2 { font-size: 21px; margin: 0; font-weight: 700; }
.cat-head a { font-size: 14px; color: var(--red); font-weight: 600; white-space: nowrap; }
.cat-lead h3 { font-family: var(--serif); font-size: 22px; line-height: 1.45; margin: 0 0 6px; font-weight: 700; }
.cat-lead .dek { font-size: 16px; color: var(--t2); margin: 0; }
.cat-list { list-style: none; margin: 14px 0 0; padding: 0; }
.cat-list li { padding: 10px 0; border-top: 1px solid var(--border); }
.cat-list a { font-size: 16.5px; font-weight: 600; line-height: 1.6; }

.block { margin: 30px 0 0; }
.page-h1 { font-family: var(--serif); font-size: 31px; font-weight: 700; margin: 0 0 6px; }
.subsec { font-size: 16px; color: var(--t3); margin: 0 0 16px; }

.item { padding: 15px 0; border-bottom: 1px solid var(--border); }
.item h3 { font-size: 19px; line-height: 1.55; margin: 0; font-weight: 600; }
.item .why { font-size: 15.5px; margin: 9px 0 0; }
.badge-new {
  background: var(--red); color: #fff; font-size: 12px; font-weight: 700;
  padding: 1px 7px; border-radius: 3px; vertical-align: middle;
}
.correction {
  font-size: 14px; color: var(--t2); background: var(--bg-2);
  border-inline-start: 3px solid var(--blue); padding: 7px 11px; margin: 9px 0 0;
}
.opinion .item h3 { font-family: var(--serif); font-style: italic; }

.viewall {
  display: inline-block; margin: 22px 0 0;
  font-size: 16px; font-weight: 700; color: var(--red);
}

/* ── provinces ───────────────────────────────────────────────────────────── */

.prov-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px; margin-top: 12px;
}
.prov-card {
  background: var(--bg-2); border: 1px solid var(--border);
  border-radius: 4px; padding: 12px 13px; display: block;
  min-height: 44px;
}
.prov-card:hover { border-color: var(--red); background: #fff; }
.prov-card .t { display: block; font-size: 17px; font-weight: 700; }
.prov-card .hq { display: block; font-size: 13px; color: var(--t3); }
.prov-card .n { display: block; font-size: 12.5px; color: var(--red); font-weight: 600; margin-top: 4px; }

/* ── newsletter ──────────────────────────────────────────────────────────── */

.news {
  background: var(--bg-2); border: 1px solid var(--border);
  border-top: 4px solid var(--red);
  padding: 22px; margin: 34px 0 40px;
}
.news h2 { font-size: 22px; margin: 0 0 6px; font-weight: 700; }
.news .vp { font-size: 16px; color: var(--t2); margin: 0 0 14px; }
.news form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.news input, .news select {
  font: inherit; font-size: 16px;   /* below 16px iOS zooms on focus and never
                                       zooms back out */
  padding: 11px 13px; min-height: 44px;
  border: 1px solid var(--border-2); border-radius: 3px;
  background: #fff; color: var(--t1);
}
.news select { min-width: 180px; }
.news input[type="email"] { flex: 1; min-width: 220px; }
.news input::placeholder { color: var(--t3); }
.news input[aria-invalid="true"] { border-color: var(--red); }
.news button {
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer;
  background: var(--red); color: #fff; border: 0; border-radius: 3px;
  padding: 12px 22px; min-height: 44px;
}
.news button:hover { background: var(--red-dark); }
.news button[disabled] { opacity: .6; cursor: default; }
.news .status { font-size: 14px; color: var(--t3); margin: 10px 0 0; min-height: 20px; }
.news .status.err { color: var(--red); }
.news .status.ok { color: #146B3A; }

/* ── live layer ──────────────────────────────────────────────────────────── */

.live-new {
  display: block; width: 100%; text-align: start; cursor: pointer;
  font: inherit; font-size: 15.5px; font-weight: 600;
  background: var(--bg-2); border: 1px solid var(--red); color: var(--red);
  border-radius: 3px; padding: 11px 14px; margin: 16px 0;
}
.live-new:hover { background: #fff; }
.live-new[hidden] { display: none; }
.item-new { background: #FFFBF0; }

/* ── prose (policy pages) ────────────────────────────────────────────────── */

.prose p { color: var(--t2); margin: 0 0 14px; }
.prose h3 { font-size: 19px; margin: 24px 0 8px; font-weight: 700; color: var(--t1); }
.prose b { color: var(--t1); }
.links { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.links a { color: var(--red); font-weight: 600; }

/* ── footer ──────────────────────────────────────────────────────────────── */

footer { border-top: 2px solid var(--t1); margin-top: 40px; padding: 22px 0 40px; background: var(--bg-2); }
.foot-cats { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-bottom: 14px; }
.foot-cats a { font-size: 16px; font-weight: 700; }
footer .links { gap: 6px 16px; margin-bottom: 14px; }
footer .links a { font-size: 14.5px; color: var(--t2); font-weight: 400; }
footer .links a:hover { color: var(--red); }
.disclosure { font-size: 13.5px; color: var(--t3); margin: 0; max-width: 76ch; }

/* ── disaster pages ──────────────────────────────────────────────────────── */

.ne-hero { margin: 26px 0 20px; }
.ne-hero h1 { font-family: var(--serif); font-size: 33px; font-weight: 700; margin: 6px 0 12px; line-height: 1.4; }
.ne-hero .mono { font-size: 13px; color: var(--t3); letter-spacing: .03em; margin: 0; }
.ne-standfirst { font-size: 18.5px; color: var(--t2); margin: 0 0 12px; max-width: 74ch; }
.ne-cause, .ne-body { font-size: 16.5px; color: var(--t2); max-width: 74ch; }

.notice {
  border: 1px solid var(--border); border-inline-start-width: 4px;
  background: var(--bg-2); padding: 14px 16px; margin: 0 0 26px;
}
.notice p { margin: 0 0 8px; font-size: 15.5px; color: var(--t2); }
.notice p:last-child { margin-bottom: 0; }
.notice .mono {
  font-size: 12.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--t3); font-weight: 700;
}
.notice a { color: var(--red); font-weight: 600; }
.notice-warn { border-inline-start-color: var(--red); }
.notice-hold { border-inline-start-color: var(--border-2); }

/* Every tile carries its own attribution line — stat() in src/bipad.mjs cannot
   render a value without one. */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 12px; margin: 14px 0 4px;
}
.stat { background: #fff; border: 1px solid var(--border); padding: 14px 15px; }
.stat.prov { border-top: 3px solid var(--red); }
.stat-label { font-size: 14.5px; color: var(--t3); }
.stat-value { font-size: 33px; font-weight: 700; line-height: 1.3; color: var(--t1); }
.stat-qual { font-size: 13.5px; color: var(--t2); }
.stat-src { font-size: 12px; color: var(--t3); margin-top: 7px; }
.stat-src a { color: var(--blue); }
.stat-note { font-size: 13.5px; color: var(--t2); margin: 8px 0 0; }
.await { font-size: 15px; color: var(--t3); font-style: italic; font-weight: 400; }

/* A four-column table at 360px either wraps every cell to one word or clips.
   Horizontal scroll is the honest option. */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 12px 0 0; }
.ne-table { border-collapse: collapse; width: 100%; min-width: 620px; font-size: 15.5px; }
.ne-table caption { text-align: start; color: var(--t3); font-size: 14px; padding-bottom: 8px; }
.ne-table th, .ne-table td {
  text-align: start; padding: 11px 13px;
  border-bottom: 1px solid var(--border); vertical-align: top;
}
.ne-table thead th {
  font-size: 13px; font-weight: 700; letter-spacing: .03em;
  text-transform: uppercase; color: var(--t3);
  border-bottom: 2px solid var(--t1);
}
.ne-table tbody th { font-weight: 700; white-space: nowrap; }
.ne-table td { color: var(--t2); }
.ne-table .td-impact { min-width: 260px; }
.ne-table .td-src { font-size: 12px; white-space: nowrap; }
.ne-table .td-src a { color: var(--blue); }
.ne-table tbody tr:hover { background: var(--bg-2); }
.ne-fields { margin: 10px 0 0; }
.ne-fields .chip { margin: 0 6px 6px 0; }

.ne-timeline { list-style: none; margin: 14px 0 0; padding: 0; }
.ne-timeline li {
  display: grid; grid-template-columns: 165px minmax(0, 1fr); gap: 16px;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.ne-timeline li:last-child { border-bottom: 0; }
.tl-when { color: var(--red); font-size: 14px; font-weight: 700; }
.tl-what { color: var(--t2); font-size: 16px; }
.tl-src { font-size: 12px; color: var(--t3); margin-top: 4px; }
.tl-src a { color: var(--blue); }

.ne-help { margin: 12px 0 0; padding-inline-start: 20px; }
.ne-help li { color: var(--t2); font-size: 16px; margin-bottom: 8px; }
.ne-help b { color: var(--t1); }
.ne-help a { color: var(--blue); font-weight: 600; }

.ne-guidance { margin: 12px 0 0; padding-inline-start: 22px; }
.ne-guidance li { color: var(--t2); font-size: 16px; margin-bottom: 10px; max-width: 74ch; }

.donor {
  border: 1px solid var(--border); border-inline-start: 4px solid var(--blue);
  padding: 16px 17px; margin: 0 0 14px; background: #fff;
}
.donor-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.donor-head h3 { font-size: 19px; margin: 0; font-weight: 700; }
.donor-head a { color: var(--blue); }
.donor-en { font-size: 12.5px; color: var(--t3); margin: 3px 0 9px; letter-spacing: .01em; }
.donor-desc { font-size: 16px; color: var(--t2); margin: 0 0 9px; max-width: 78ch; }
.donor-caution { font-size: 15px; color: var(--red-dark); margin: 9px 0 0; max-width: 78ch; font-weight: 600; }
.donor-src { font-size: 12px; color: var(--t3); margin: 10px 0 0; }
.donor-src a { color: var(--blue); }

/* ── responsive ──────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .lead-grid { grid-template-columns: 1fr; gap: 24px; }
  .rail { border-inline-start: 0; padding-inline-start: 0; border-top: 1px solid var(--border); padding-top: 16px; }
  .cat-grid { grid-template-columns: 1fr; gap: 26px; }
  .second-strip { grid-template-columns: 1fr; gap: 16px; }
  .second { padding-bottom: 14px; border-bottom: 1px solid var(--border); }
  .second:last-child { border-bottom: 0; padding-bottom: 0; }
}

@media (max-width: 620px) {
  body { font-size: 16.5px; }
  .topics { margin: 0 -18px; padding: 0 18px; }
  .lead-headline { font-size: 28px; }
  .lead .dek { font-size: 17px; }
  .ne-hero h1 { font-size: 26px; }
  .stat-value { font-size: 28px; }
  .ne-timeline li { grid-template-columns: 1fr; gap: 4px; }
  .masthead { flex-wrap: wrap; }
  .btn-sub { margin-inline-start: auto; }
}

@media print {
  header .topics, .livestrip, .news, .btn-sub, .rail { display: none; }
  body { font-size: 12pt; }
  a[href^="http"]::after { content: " (" attr(href) ")"; font-size: 9pt; color: #555; }
}

/* ── Missing-persons tracker and status page ───────────────────────────────
   Status is never carried by colour alone: every chip has a word in it. About
   8% of men have a colour vision deficiency, and "green dot vs amber dot" is
   the difference between "found alive" and "still missing" on this page. */

.st {
  display: inline-block;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid;
  white-space: nowrap;
}
.st-ok    { color: #17663A; background: #E7F5EC; border-color: #B6DFC6; }
.st-warn  { color: #8A5200; background: #FDF3E2; border-color: #EBD4A6; }
.st-info  { color: #12395E; background: #E9F0F7; border-color: #BCD0E3; }
.st-grave { color: #8A1121; background: #FBEAED; border-color: #EBBDC5; }

.st-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 20px 0 8px;
}
.st-card {
  border: 1px solid var(--border);
  border-top: 3px solid var(--border-2);
  border-radius: 4px;
  padding: 13px 14px;
  background: var(--card);
}
.st-card.st-ok    { border-top-color: #2E9E5B; background: #fff; }
.st-card.st-warn  { border-top-color: #D08A15; background: #fff; }
.st-card.st-info  { border-top-color: #2E6FA8; background: #fff; }
.st-card.st-grave { border-top-color: var(--red); background: #fff; }
.st-n { font-size: 30px; font-weight: 700; line-height: 1.3; color: var(--t1); }
.st-label { font-size: 15px; font-weight: 600; color: var(--t1); }
.st-desc { font-size: 13.5px; color: var(--t3); margin-top: 3px; }

.track-controls { margin: 14px 0 4px; }
.track-controls input[type="search"] {
  width: 100%;
  max-width: 420px;
  /* 16px minimum: anything smaller makes iOS zoom the viewport on focus, and
     it does not zoom back out. */
  font-size: 16px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  background: #fff;
  color: var(--t1);
}
.track-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.track-filters button {
  font: inherit;
  font-size: 14px;
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--border-2);
  border-radius: 3px;
  background: #fff;
  color: var(--t2);
  cursor: pointer;
}
.track-filters button[aria-pressed="true"] {
  background: var(--red); border-color: var(--red); color: #fff; font-weight: 600;
}
.track-count { font-size: 13px; color: var(--t3); margin: 10px 0 0; min-height: 20px; }
.track-empty { color: var(--t3); padding: 18px 0; }
.row-en { display: block; font-size: 12.5px; color: var(--t3); font-weight: 400; }

.person .person-en { font-size: 16px; color: var(--t3); margin: -4px 0 10px; }
.person-status { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 8px 0 0; }
.person-status-desc { font-size: 15px; color: var(--t2); }
.person-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin: 12px 0 14px; }
.pf { border-bottom: 1px solid var(--border); padding-bottom: 9px; }
.pf dt { font-size: 13px; color: var(--t3); }
.pf dd { margin: 2px 0 0; font-size: 16px; color: var(--t1); }

.status-hero {
  display: flex; align-items: flex-start; gap: 14px;
  border: 1px solid var(--border); border-left-width: 4px;
  border-radius: 4px; padding: 16px 18px; margin: 6px 0 24px; background: #fff;
}
.status-hero p { margin: 4px 0 0; color: var(--t2); font-size: 15.5px; }
.status-word { font-size: 19px; font-weight: 700; color: var(--t1); }
.status-dot { width: 13px; height: 13px; border-radius: 50%; margin-top: 7px; flex: none; }
.status-ok    { border-left-color: #2E9E5B; }
.status-ok .status-dot { background: #2E9E5B; }
.status-warn  { border-left-color: #D08A15; }
.status-warn .status-dot { background: #D08A15; }
.status-down  { border-left-color: var(--red); }
.status-down .status-dot { background: var(--red); }

@media (max-width: 620px) {
  .st-n { font-size: 26px; }
  .track-filters button { flex: 1 1 auto; }
}

/* ── App shell: bottom nav, install bar, offline bar, share ────────────────
   Everything in this block is phone-first. The bottom nav is hidden from
   700px up, where the topic bar in the masthead is already within reach. */

html { -webkit-text-size-adjust: 100%; }

body {
  /* Kills the 300ms tap delay and the grey flash on tap without disabling
     zoom, which some resets do by breaking the viewport instead. */
  -webkit-tap-highlight-color: transparent;
  /* Stops the whole page rubber-banding when a scroll container hits its end. */
  overscroll-behavior-y: contain;
}

a, button, input, select, textarea, summary { touch-action: manipulation; }

/* Anchors would otherwise land under the sticky elements. */
html { scroll-padding-top: 16px; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.offline-bar {
  margin: 0;
  padding: 9px max(18px, env(safe-area-inset-left));
  background: #FDF3E2;
  color: #7A4A00;
  border-bottom: 1px solid #EBD4A6;
  font-size: 14px;
}
.offline-bar[hidden] { display: none; }

.install-bar {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 14px max(18px, env(safe-area-inset-left)) 0;
  padding: 14px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--red);
  border-radius: 4px;
}
.install-bar[hidden] { display: none; }
.install-bar b { font-size: 16px; }
.install-bar p { margin: 3px 0 0; font-size: 14.5px; color: var(--t2); }
.install-actions { display: flex; gap: 8px; margin-inline-start: auto; }
.install-bar button {
  font: inherit; font-size: 15px; font-weight: 600;
  min-height: 44px; padding: 10px 18px;
  border: 1px solid var(--red); border-radius: 3px;
  background: var(--red); color: #fff; cursor: pointer;
}
.install-bar button.secondary { background: #fff; color: var(--t2); border-color: var(--border-2); }

.share-btn {
  display: inline-flex; align-items: center; gap: 8px;
  font: inherit; font-size: 15px; font-weight: 600;
  min-height: 44px; padding: 10px 16px;
  border: 1px solid var(--border-2); border-radius: 3px;
  background: #fff; color: var(--red); cursor: pointer;
}
.share-btn svg { width: 18px; height: 18px; fill: currentColor; }
.share-btn[hidden] { display: none; }

.bottom-nav { display: none; }

@media (max-width: 699px) {
  .bottom-nav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    inset: auto 0 0 0;
    z-index: 40;
    background: #fff;
    border-top: 1px solid var(--border);
    /* The home indicator on a modern iPhone sits over the last ~34px. */
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px;
    min-height: 56px;
    padding: 7px 2px;
    font-size: 12px;
    font-weight: 600;
    color: var(--t3);
    text-decoration: none;
  }
  .bottom-nav a:hover { text-decoration: none; }
  .bottom-nav svg { width: 23px; height: 23px; fill: currentColor; }
  .bottom-nav a[aria-current="page"] { color: var(--red); }
  .bottom-nav a[aria-current="page"] svg { fill: var(--red); }

  /* Content must clear the fixed bar, or the last paragraph and the footer
     links sit permanently underneath it. */
  body { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }

  .install-bar { margin-inline: 0; border-radius: 0; border-inline: 0; }
  .install-actions { margin-inline-start: 0; width: 100%; }
  .install-actions button { flex: 1; }
}

@media print { .bottom-nav, .install-bar, .offline-bar, .share-btn { display: none !important; } }

.person-share { margin: 14px 0 0; }

/* Register thumbnails. 40px, square, and never a body — see validate() in
   src/bepatta.mjs, which refuses a photo on a deceased or unidentified record. */
.row-person { display: flex; align-items: center; gap: 10px; }
.row-photo {
  flex: none; width: 40px; height: 40px; border-radius: 3px; object-fit: cover;
  background: var(--raised); border: 1px solid var(--border);
}
.row-photo-none {
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: var(--t3);
}
.person-photo {
  width: 96px; height: 96px; border-radius: 4px; object-fit: cover;
  border: 1px solid var(--border); margin: 4px 0 4px;
}
.person-photo-credit { font-size: 12px; color: var(--t3); margin: 0 0 8px; }

.nat-table th[scope="row"] { font-weight: 600; }
.nat-n { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.nat-bar { width: 45%; min-width: 90px; }
.nat-bar span {
  display: block; height: 9px; border-radius: 2px; background: var(--red); opacity: .8;
}

/* ── Missing-persons register ──────────────────────────────────────────────
   Built for a relative on a phone, often on a bad connection, often scrolling
   with one thumb while doing something else. Every decision here follows from
   that: whole rows are tap targets, the stat boxes double as filters so there
   is no separate control to find, and the drawer opens over the list so a
   search is never lost. */

.stat-filters { margin-top: 14px; }
.stat-filters .st-card {
  display: block; width: 100%; text-align: start; cursor: pointer;
  font: inherit; border-width: 1px; border-top-width: 3px;
  min-height: 44px; -webkit-tap-highlight-color: transparent;
}
.stat-filters .st-card span { display: block; }
.stat-filters .st-card[aria-pressed="true"] {
  background: var(--bg-2); border-color: var(--red-dark); border-top-color: var(--red);
  box-shadow: inset 0 0 0 1px var(--red);
}
.st-card.st-all { border-top-color: var(--blue); }

.track-controls select {
  font-size: 16px; min-height: 44px; margin-top: 10px;
  width: 100%; max-width: 420px; padding: 10px 12px;
  border: 1px solid var(--border-2); border-radius: 3px; background: #fff; color: var(--t1);
}

.person-list { list-style: none; margin: 14px 0 0; padding: 0; }
.person-row { border-bottom: 1px solid var(--border); }
.person-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  font: inherit; text-align: start; background: none; border: 0; cursor: pointer;
  /* Comfortably over the 44px guideline: this list is scrolled fast. */
  padding: 12px 4px; min-height: 60px;
}
.person-btn:hover { background: var(--bg-2); }
.person-main { flex: 1; min-width: 0; }
.person-name {
  font-size: 16.5px; font-weight: 600; color: var(--t1); line-height: 1.4;
  /* Names run long and must not push the status chip off a 360px screen. */
  overflow-wrap: anywhere;
}
.person-meta { font-size: 13.5px; color: var(--t3); }

.more-btn {
  font: inherit; font-size: 15px; font-weight: 600; margin-top: 16px;
  min-height: 44px; padding: 11px 20px; width: 100%;
  border: 1px solid var(--border-2); border-radius: 3px; background: #fff; color: var(--red);
  cursor: pointer;
}
.more-btn[hidden] { display: none; }

/* Drawer. A sheet from the bottom on a phone, a side panel from 700px up. */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer[hidden] { display: none; }
.drawer-scrim { position: absolute; inset: 0; background: rgba(20, 17, 14, .5); }
.drawer-panel {
  position: absolute; inset: auto 0 0 0;
  max-height: 88vh; max-height: 88dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff; border-radius: 12px 12px 0 0;
  padding: 20px 20px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up .18s ease-out;
}
@keyframes sheet-up { from { transform: translateY(14px); opacity: .6 } to { transform: none; opacity: 1 } }
@media (prefers-reduced-motion: reduce) { .drawer-panel { animation: none } }
body.drawer-open { overflow: hidden; }

.drawer-close {
  position: absolute; top: 10px; inset-inline-end: 12px;
  font: inherit; font-size: 20px; line-height: 1;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--raised); color: var(--t2); cursor: pointer;
}
.drawer-person { display: flex; gap: 14px; align-items: flex-start; padding-inline-end: 48px; }
.drawer-person h2 { font-size: 21px; margin: 0 0 2px; line-height: 1.4; overflow-wrap: anywhere; }
.drawer-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 16px 0 0; }
.drawer-full { font-size: 15px; font-weight: 600; }
.drawer-note {
  font-size: 13.5px; color: var(--t3); margin: 16px 0 0;
  border-top: 1px solid var(--border); padding-top: 12px;
}

@media (min-width: 700px) {
  .drawer-panel {
    inset: 0 0 0 auto; width: min(460px, 100%);
    max-height: none; border-radius: 0; padding: 26px 28px;
    animation: sheet-in .18s ease-out;
  }
  @keyframes sheet-in { from { transform: translateX(18px); opacity: .6 } to { transform: none; opacity: 1 } }
}

/* The search link leads the coverage banner. During a disaster it is the thing
   people arrive for, and it was previously reachable from the front page only
   through the bottom nav — which is hidden above 700px, so desktop had no
   route to it at all. */
.coverage-links .coverage-primary {
  display: inline-flex; align-items: center; min-height: 44px;
  background: var(--red); color: #fff;
  padding: 10px 18px; border-radius: 3px;
  font-weight: 700; margin-inline-end: 6px;
}
.coverage-links .coverage-primary:hover { background: var(--red-dark); text-decoration: none; }

.foot-contact { font-size: 15px; color: var(--t2); margin: 0 0 10px; }
.foot-contact a { font-weight: 700; }
.foot-contact span { font-size: 13.5px; color: var(--t3); }

.stale-note {
  margin: 12px 0 0; padding: 11px 14px;
  background: #FDF3E2; border: 1px solid #EBD4A6; border-left: 3px solid #D08A15;
  border-radius: 4px; font-size: 15px; color: #7A4A00; max-width: 74ch;
}
.stale-note[hidden] { display: none; }

/* Language toggle. Shown only where a translation exists — the register, where
   it matters: most people on that list are foreign nationals. Two anchors
   styled as one control, so it works with no JavaScript. */
.lang-toggle {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  margin-inline-start: auto;
  flex: none;
}
.lang-toggle .seg {
  display: flex; align-items: center; justify-content: center;
  /* 44px tall and 44px+ wide: this sits in a header people hit with a thumb. */
  min-height: 40px; min-width: 52px;
  padding: 8px 14px;
  font-size: 14.5px; font-weight: 600; line-height: 1;
  color: var(--t2); text-decoration: none; white-space: nowrap;
}
.lang-toggle .seg:hover { background: var(--bg-2); text-decoration: none; }
.lang-toggle .seg.on { background: var(--red); color: #fff; cursor: default; }

@media (max-width: 560px) {
  .lang-toggle .seg { min-width: 44px; padding: 8px 11px; font-size: 14px; }
}
