/* iOS-style, mobile-first. System fonts only (SF Pro on Apple, Roboto on Android) — no external requests. */
:root {
  --bg: #f2f2f7;
  --card: #ffffff;
  --fill: #e9e9ee;
  --label: #000000;
  --label-2: rgba(60, 60, 67, .62);
  --sep: rgba(60, 60, 67, .16);
  --tint: #007aff;
  --green: #34c759;
  --red: #ff3b30;
  --bar: rgba(249, 249, 251, .78);
  --radius: 18px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 6px 20px rgba(0, 0, 0, .05);
  /* category colours */
  --c-blue: #007aff; --c-indigo: #5856d6; --c-teal: #30b0c7; --c-green: #34a853; --c-purple: #af52de;
  --c-pink: #ff2d55; --c-orange: #ff9500; --c-red: #ff3b30; --c-gray: #8e8e93; --c-brown: #a2845e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --card: #1c1c1e; --fill: #2c2c2e; --label: #ffffff;
    --label-2: rgba(235, 235, 245, .6); --sep: rgba(84, 84, 88, .55); --tint: #0a84ff;
    --bar: rgba(22, 22, 24, .78); --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--label);
  font: 400 17px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--tint); text-decoration: none; }
h1, h2, h3, p { margin: 0; }

/* ---------- top bar (sticky, translucent) ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid var(--sep);
  padding-top: env(safe-area-inset-top);
}
.topbar-in { max-width: 1100px; margin: 0 auto; height: 48px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--label); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand img { border-radius: 7px; }
.brand .wm span { color: var(--tint); font-weight: 600; }
.toplinks { display: none; gap: 4px; }
.toplink { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; color: var(--label-2); font-size: 15px; font-weight: 500; }
.toplink svg { width: 18px; height: 18px; }
.toplink[aria-current="page"] { color: var(--tint); background: color-mix(in srgb, var(--tint) 12%, transparent); }

/* ---------- page ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 0 16px calc(96px + env(safe-area-inset-bottom)); }
.hero { padding: 18px 2px 10px; }
.hero-sub { color: var(--label-2); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
.hero h1 { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.02em; margin-top: 2px; }

.section-head { font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 28px 2px 10px; }

/* municipality chips: horizontal scroll */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 4px -16px 14px; padding: 2px 16px; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start;
  padding: 8px 14px; border-radius: 999px;
  background: var(--card); color: var(--label); font-size: 15px; font-weight: 500;
  box-shadow: var(--shadow); border: .5px solid var(--sep);
}
.chip[aria-current="page"] { background: var(--label); color: var(--bg); border-color: transparent; }

/* ---------- widgets (iOS home-screen style) ---------- */
/* phone: two small squares side by side, the duties widget full width below */
.widgets { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
.widget {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px; border-radius: 22px; min-width: 0;
  background: var(--card); color: var(--label); box-shadow: var(--shadow);
}
.widget.small { aspect-ratio: 1 / 1; min-height: 160px; }
.w-duty { grid-column: 1 / -1; }
.w-label { font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; }
.w-sub { font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; margin-top: 8px; }

.w-weather { background: linear-gradient(160deg, #4a90e2, #2563c9); color: #fff; }
.w-weather .w-label { color: #fff; font-size: 15px; text-transform: none; letter-spacing: 0; }
.w-now { display: flex; align-items: center; justify-content: space-between; }
.w-temp { font-size: 38px; font-weight: 300; line-height: 1; letter-spacing: -.03em; }
.w-icon { font-size: 26px; }
.w-place { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .88); }
.w-mini { list-style: none; margin: auto 0 0; padding: 0; font-size: 12px; }
.w-mini li { display: flex; justify-content: space-between; gap: 6px; padding: 2px 0; border-top: .5px solid rgba(255, 255, 255, .25); }

.w-cal {
  position: relative; font: inherit; text-align: left; border: 0; cursor: pointer; padding: 0; overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.cal-face { position: absolute; inset: 0; display: flex; flex-direction: column; padding: 14px; transition: opacity .35s, transform .35s; }
.cal-face.back { opacity: 0; transform: translateY(12px); pointer-events: none; background: #fffaf0; color: #2b2118; }
.w-cal.flipped .front { opacity: 0; transform: translateY(-12px); }
.w-cal.flipped .back { opacity: 1; transform: none; }
.cal-head { font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--red); text-transform: uppercase; }
.cal-day { font-size: 40px; font-weight: 700; line-height: 1; letter-spacing: -.03em; margin-top: 2px; }
.cal-dow { font-size: 14px; font-weight: 600; }
.cal-names { font-size: 12px; color: var(--label-2); line-height: 1.3; margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cal-names b { color: var(--label); font-weight: 600; }
.cal-hint { margin-top: auto; font-size: 11px; color: var(--tint); font-weight: 600; }
.q-t { font: italic 600 15px/1.3 Georgia, "Times New Roman", serif; margin-top: 8px; }
.q-m { font-size: 12px; line-height: 1.35; color: #5a4a3a; margin-top: 6px; }
.q-a { font-size: 11px; color: #8a7560; margin-top: auto; }

.w-duty-head { display: flex; justify-content: space-between; align-items: baseline; }
.w-big { font-size: 32px; font-weight: 700; line-height: 1.1; color: var(--green); letter-spacing: -.02em; }
.w-big span { font-size: 15px; font-weight: 500; color: var(--label-2); letter-spacing: 0; }
.w-list { list-style: none; margin: 2px 0 0; padding: 0; font-size: 15px; }
.w-list li { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: .5px solid var(--sep); }
.w-list li span:first-child { color: var(--label-2); flex: none; }
.trunc { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
.w-more { font-size: 15px; font-weight: 600; color: var(--tint); }

/* ---------- alerts ---------- */
.alerts { display: grid; gap: 10px; margin: 6px 0 14px; }
.alert { display: flex; gap: 12px; padding: 14px; border-radius: var(--radius); background: var(--red); color: #fff; box-shadow: var(--shadow); }
.alert-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; background: #fff; color: var(--red); font-weight: 800; display: grid; place-items: center; }
.alert-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.alert-kicker { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; opacity: .9; }
.alert-title { font-size: 17px; font-weight: 700; line-height: 1.25; }
.alert-sum { font-size: 14px; opacity: .92; }

/* ---------- deaths & accidents (collapsed) ---------- */
.quiet { margin-top: 28px; }
.quiet summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 16px; border-radius: var(--radius); background: var(--card); box-shadow: var(--shadow);
  font-size: 17px; font-weight: 600;
}
.quiet summary::-webkit-details-marker { display: none; }
.quiet[open] summary { border-radius: var(--radius) var(--radius) 0 0; border-bottom: .5px solid var(--sep); }
.quiet[open] .group { border-radius: 0 0 var(--radius) var(--radius); }
.quiet-row .row-kicker { color: var(--label-2); }
.quiet-row .row-title { font-size: 16px; }

/* ---------- lead + feed cards ---------- */
.lead {
  margin-top: 18px; padding: 20px; border-radius: 24px; color: #fff;
  background: linear-gradient(150deg, var(--g1), var(--g2));
  box-shadow: var(--shadow);
}
.lead h2 { font-size: 26px; line-height: 1.18; font-weight: 700; letter-spacing: -.02em; margin: 12px 0 10px; }
.lead p { max-width: 62rem; font-size: 17px; line-height: 1.5; color: rgba(255, 255, 255, .92); }
.lead .pill { background: rgba(255, 255, 255, .22); color: #fff; }
.lead .meta { color: rgba(255, 255, 255, .8); }
.lead .src { border-top-color: rgba(255, 255, 255, .25); color: rgba(255, 255, 255, .8); }
.lead .src a { color: #fff; }
.g-blue { --g1: #2f80ed; --g2: #1c4fb8; } .g-indigo { --g1: #6366f1; --g2: #3730a3; }
.g-teal { --g1: #14b8a6; --g2: #0e7490; } .g-green { --g1: #22a559; --g2: #15703c; }
.g-purple { --g1: #a855f7; --g2: #6b21a8; } .g-pink { --g1: #f43f5e; --g2: #9f1239; }
.g-orange { --g1: #f59e0b; --g2: #c2410c; } .g-red { --g1: #ef4444; --g2: #991b1b; }
.g-gray { --g1: #6b7280; --g2: #374151; } .g-brown { --g1: #a16207; --g2: #713f12; }

.feed { display: grid; gap: 12px; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card h3 { font-size: 19px; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; margin: 10px 0 6px; }
.card p { font-size: 16px; color: var(--label-2); line-height: 1.5; }
.lead-top, .card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; letter-spacing: .01em;
  color: var(--pc); background: color-mix(in srgb, var(--pc) 13%, transparent);
}
.c-blue { --pc: var(--c-blue); } .c-indigo { --pc: var(--c-indigo); } .c-teal { --pc: var(--c-teal); }
.c-green { --pc: var(--c-green); } .c-purple { --pc: var(--c-purple); } .c-pink { --pc: var(--c-pink); }
.c-orange { --pc: var(--c-orange); } .c-red { --pc: var(--c-red); } .c-gray { --pc: var(--c-gray); } .c-brown { --pc: var(--c-brown); }
.meta { font-size: 13px; color: var(--label-2); white-space: nowrap; }
.src {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  margin-top: 14px; padding-top: 12px; border-top: .5px solid var(--sep);
  font-size: 13px; color: var(--label-2);
}
.src a { font-weight: 600; white-space: nowrap; }
.ai { opacity: .8; }

/* ---------- events (calendar tiles) ---------- */
.events { display: grid; grid-auto-flow: column; grid-auto-columns: 70%; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px 6px; scroll-snap-type: x mandatory; }
.events::-webkit-scrollbar { display: none; }
.event { scroll-snap-align: start; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center; padding: 14px; border-radius: var(--radius); background: var(--card); color: var(--label); box-shadow: var(--shadow); }
.cal { grid-row: span 2; display: flex; flex-direction: column; align-items: center; width: 52px; border-radius: 12px; overflow: hidden; background: var(--fill); }
.cal-m { width: 100%; text-align: center; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 0; }
.cal-d { font-size: 24px; font-weight: 600; padding: 2px 0 4px; }
.event-t { font-size: 15px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- grouped lists (Settings style) ---------- */
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.row { display: flex; align-items: center; gap: 12px; padding: 12px 16px; min-height: 52px; color: var(--label); }
.row + .row { border-top: .5px solid var(--sep); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-kicker { font-size: 12px; font-weight: 600; color: var(--tint); text-transform: uppercase; letter-spacing: .02em; }
.row-title { font-size: 17px; font-weight: 500; }
.row-sub { font-size: 14px; color: var(--label-2); }
.row-note { font-size: 13px; color: var(--c-orange); margin-top: 2px; }
.chev { color: var(--label-2); font-size: 22px; }
.badge-num { font-weight: 700; color: var(--red); font-size: 17px; }
.actions { display: flex; gap: 8px; flex: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--fill); color: var(--tint); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.green { background: var(--green); color: #fff; }
.banner { background: color-mix(in srgb, var(--tint) 10%, var(--card)); border-radius: var(--radius); padding: 12px 16px; font-size: 15px; margin-bottom: 4px; }
.muted { color: var(--label-2); }
.empty { text-align: center; color: var(--label-2); padding: 40px 16px; }

.prose { padding: 4px 16px 16px; margin-top: 12px; }
.prose h3 { font-size: 17px; font-weight: 650; margin: 14px 0 4px; }
.prose p { font-size: 15px; color: var(--label-2); line-height: 1.55; }

.foot { margin-top: 36px; text-align: center; font-size: 13px; color: var(--label-2); line-height: 1.5; }
.foot p + p { margin-top: 6px; }

/* ---------- tab bar (mobile) ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: var(--bar);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--sep);
}
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; color: var(--label-2); font-size: 11px; font-weight: 500; }
.tab svg { width: 26px; height: 26px; }
.tab[aria-current="page"] { color: var(--tint); }

/* ---------- tablet / desktop ---------- */
@media (min-width: 700px) {
  .widgets { grid-template-columns: 1fr 1fr 2fr; }
  .w-duty { grid-column: auto; }
  .widget.small { aspect-ratio: auto; min-height: 200px; }
  .events { grid-auto-columns: 34%; }
  .feed { grid-template-columns: repeat(2, 1fr); }
  .lead { padding: 28px; }
  .lead h2 { font-size: 32px; }
}
@media (min-width: 1000px) {
  .tabbar { display: none; }
  .toplinks { display: flex; }
  .page { padding-bottom: 40px; }
  .hero h1 { font-size: 40px; }
  .chips { margin: 4px 0 18px; padding: 2px 0; flex-wrap: wrap; }
  .feed { grid-template-columns: repeat(3, 1fr); }
  .events { grid-auto-columns: 24%; }
}

/* ---------- outages ---------- */
.strip {
  display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 16px;
  border-radius: var(--radius); background: color-mix(in srgb, var(--c-orange) 14%, var(--card));
  color: var(--label); box-shadow: var(--shadow);
}
.strip-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--c-orange); color: #fff; flex: none; }
.strip-icon svg { width: 18px; height: 18px; }
.strip-text { flex: 1; font-size: 16px; }
.note { font-size: 13px; color: var(--label-2); margin: 8px 4px 0; }
.sub-head { font-size: 13px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: .02em; margin: 14px 4px 6px; }
