/* ==========================================================
   Global base
   ========================================================== */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--gray-900);
  background: var(--gray-100);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
  line-height: 1.2;
}

h1 { font-weight: 600; }
h2 { font-weight: 600; letter-spacing: -0.01em; }
h3 { font-weight: 500; }

.section-eyebrow {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary-700);
}

.section-pad { padding-block: clamp(48px, 6vw, 88px); }

a { color: var(--primary-700); }
a:hover { color: var(--primary-900); }

::selection { background: var(--primary-300); color: var(--primary-900); }

/* Focus visibility (accessibility floor) */
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible {
  outline: 3px solid var(--primary-500);
  outline-offset: 2px;
}

/* Skip-to-content link — hidden until keyboard-focused, so keyboard
   and screen-reader users can bypass the nav instead of tabbing
   through every link on every page load. */
.skip-link {
  position: absolute;
  left: 12px; top: -60px;
  z-index: 2000;
  background: var(--primary-900);
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease-out);
}
.skip-link:focus {
  top: 12px;
  color: #fff;
  outline: 3px solid var(--primary-300);
  outline-offset: 2px;
}

/* ==========================================================
   Buttons
   ========================================================== */
.btn-brand {
  background: var(--primary-700);
  border: none;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out), background var(--dur-fast);
}
.btn-brand:hover {
  background: var(--primary-500);
  box-shadow: var(--shadow-btn);
  transform: translateY(-2px);
  color: #fff;
}
.btn-outline-brand {
  background: transparent;
  border: 1.5px solid rgba(255,255,255,0.55);
  color: #fff;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 12px 28px;
  transition: all var(--dur-fast) var(--ease-out);
}
.btn-outline-brand:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  color: #fff;
  transform: translateY(-2px);
}

/* ==========================================================
   Navbar
   ========================================================== */
.navbar-gov {
  background: var(--primary-900);
  padding-block: 16px;
  transition: padding var(--dur-med) var(--ease-out), box-shadow var(--dur-med);
}
.navbar-gov.scrolled {
  padding-block: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
.navbar-gov .navbar-brand {
  font-family: var(--font-display);
  font-weight: 600;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 18px;
}
.brand-mark {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--primary-300), var(--primary-500));
  display: flex; align-items: center; justify-content: center;
  color: var(--primary-900);
  font-weight: 700;
  font-size: 15px;
  flex-shrink: 0;
}
.navbar-gov .nav-link {
  color: rgba(255,255,255,0.82);
  font-weight: 500;
  font-size: 14px;
  padding: 8px 14px !important;
  position: relative;
}
.navbar-gov .nav-link:hover,
.navbar-gov .nav-link.active { color: #fff; }
.navbar-gov .nav-link::after {
  content: '';
  position: absolute;
  left: 14px; right: 14px; bottom: 2px;
  height: 2px;
  background: var(--primary-300);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease-out);
}
.navbar-gov .nav-link:hover::after { transform: scaleX(1); }

/* Dark-mode toggle sits on the brand-green nav — use a translucent
   ghost-button treatment instead of the light/card-background
   .theme-toggle-btn default (variables.css), matching the existing
   .btn-outline-brand look used elsewhere on this navbar. */
.navbar-gov .theme-toggle-btn {
  border-color: rgba(255,255,255,0.35);
  background: transparent;
  color: #fff;
}
.navbar-gov .theme-toggle-btn:hover {
  background: rgba(255,255,255,0.12);
  border-color: #fff;
  color: #fff;
}

.gov-strip {
  background: #08281e;
  color: rgba(255,255,255,0.65);
  font-size: 12px;
  padding-block: 6px;
  letter-spacing: 0.02em;
}

/* ==========================================================
   Emergency Alert bar
   ========================================================== */
.alert-emergency {
  background: linear-gradient(90deg, #FCEAEA, #FEF3E2);
  border-bottom: 1px solid rgba(214,69,69,0.25);
  border-radius: 0;
  padding: 12px 0;
  margin: 0;
}
.alert-emergency .pulse-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--risk-high);
  position: relative;
  flex-shrink: 0;
}
.alert-emergency .pulse-dot::after {
  content: '';
  position: absolute; inset: -6px;
  border-radius: 50%;
  border: 2px solid var(--risk-high);
  animation: pulse-ring 1.8s var(--ease-out) infinite;
}
@keyframes pulse-ring {
  0%   { transform: scale(0.6); opacity: 0.8; }
  100% { transform: scale(1.8); opacity: 0; }
}
.alert-emergency .btn-close { font-size: 11px; }

/* ==========================================================
   Hero + radar signature graphic
   ========================================================== */
.hero {
  position: relative;
  background:
    radial-gradient(120% 140% at 14% -10%, rgba(18,82,61,0.93) 0%, rgba(11,61,46,0.95) 55%, rgba(7,31,23,0.97) 100%),
    url('../images/hero/hero-monsoon-waterlog.jpg');
  background-size: cover, cover;
  background-position: center, center 38%;
  background-repeat: no-repeat, no-repeat;
  color: #fff;
  overflow: hidden;
  padding-block: clamp(64px, 10vw, 120px);
}
/* Swap in the WebP source where supported, same dark-green gradient on
   top either way — this is a progressive upgrade, not a requirement,
   so browsers without image-set() just keep the JPEG above. */
@supports (background-image: image-set(url('x.webp') type('image/webp'))) {
  .hero {
    background-image:
      radial-gradient(120% 140% at 14% -10%, rgba(18,82,61,0.93) 0%, rgba(11,61,46,0.95) 55%, rgba(7,31,23,0.97) 100%),
      image-set(url('../images/hero/hero-monsoon-waterlog.webp') type('image/webp'), url('../images/hero/hero-monsoon-waterlog.jpg') type('image/jpeg'));
  }
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 30% 30%, black 0%, transparent 70%);
  pointer-events: none;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(111,207,151,0.12);
  border: 1px solid rgba(111,207,151,0.35);
  color: var(--primary-300);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.05em;
  padding: 6px 14px; border-radius: 100px;
  margin-bottom: 20px;
}
.hero h1 {
  font-size: clamp(30px, 4.4vw, 56px);
  letter-spacing: -0.01em;
  margin-bottom: 20px;
}
.hero h1 .accent { color: var(--primary-300); }
.hero p.lead {
  color: rgba(255,255,255,0.78);
  font-size: clamp(15px, 1.2vw, 18px);
  max-width: 46ch;
}
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }

/* Radar sweep — the page's signature element: a live satellite scan
   over a stylized ward grid, standing in for the product's core idea
   (radar-satellite waterlog detection). */
.radar-wrap {
  position: relative;
  width: min(420px, 90%);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
}
.radar-ring {
  position: absolute; inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(111,207,151,0.22);
}
.radar-ring.r2 { inset: 15%; }
.radar-ring.r3 { inset: 30%; }
.radar-ring.r4 { inset: 45%; }
.radar-sweep {
  position: absolute; inset: 0;
  border-radius: 50%;
  background: conic-gradient(from 0deg, rgba(111,207,151,0.55), rgba(111,207,151,0) 28%);
  animation: radar-spin 4s linear infinite;
}
@keyframes radar-spin { to { transform: rotate(360deg); } }
.radar-dot {
  position: absolute;
  width: 9px; height: 9px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 6px currentColor;
  opacity: 0;
  animation: radar-blip 4s linear infinite;
}
.radar-dot.high  { background: var(--risk-high);   color: rgba(214,69,69,0.18); }
.radar-dot.med   { background: var(--risk-medium); color: rgba(245,166,35,0.18); }
.radar-dot.low   { background: var(--risk-low);     color: rgba(46,158,91,0.18); }
@keyframes radar-blip {
  0%, 8%   { opacity: 0; }
  10%, 22% { opacity: 1; }
  26%      { opacity: 0; }
  100%     { opacity: 0; }
}
.radar-center {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 10px; height: 10px; border-radius: 50%;
  background: #fff;
}

/* ==========================================================
   Live Weather & Rainfall Risk widget (hero section)
   Sits in the hero's dark gradient, so it uses a translucent
   "glass" card rather than the light --white/--gray-300 card used
   elsewhere — same border-radius/shadow tokens, just recolored for
   contrast against .hero's background (mirrors .hero-eyebrow's
   translucent-badge treatment above).
   ========================================================== */
.weather-widget {
  margin-top: 28px;
  max-width: 420px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-md);
  padding: 16px 18px;
  backdrop-filter: blur(6px);
}
.weather-widget-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.weather-widget-title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: rgba(255,255,255,0.85);
}
.weather-widget-updated {
  font-size: 11.5px;
  color: rgba(255,255,255,0.55);
}
.ww-live-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--primary-300);
  position: relative; flex-shrink: 0;
}
.ww-live-dot::after {
  content: '';
  position: absolute; inset: -5px;
  border-radius: 50%;
  border: 2px solid var(--primary-300);
  animation: pulse-ring 1.8s var(--ease-out) infinite;
}
.ww-live-dot.is-error { background: var(--risk-high); }
.ww-live-dot.is-error::after { border-color: var(--risk-high); animation: none; opacity: 0; }

/* ---- Loading skeleton ---- */
.ww-skel-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ww-skel {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(255,255,255,0.08) 25%, rgba(255,255,255,0.16) 37%, rgba(255,255,255,0.08) 63%);
  background-size: 400% 100%;
  animation: ww-shimmer 1.6s ease-in-out infinite;
}
.ww-skel-icon { width: 34px; height: 34px; border-radius: 8px; flex-shrink: 0; }
.ww-skel-text { height: 14px; }
.ww-skel-badge { width: 90px; height: 22px; border-radius: 100px; }
@keyframes ww-shimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ww-skel { animation: none; }
  .ww-live-dot::after { animation: none; }
}

/* ---- Loaded state ---- */
.ww-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ww-icon {
  width: 40px; height: 40px; flex-shrink: 0;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1);
  color: var(--primary-300);
  font-size: 19px;
}
.ww-primary { display: flex; flex-direction: column; line-height: 1.25; }
.ww-temp { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: #fff; }
.ww-condition { font-size: 12.5px; color: rgba(255,255,255,0.7); }
.ww-alert-badge {
  margin-left: auto;
  font-size: 11.5px; font-weight: 600;
  padding: 5px 12px; border-radius: 100px;
  white-space: nowrap;
}
.ww-alert-badge.ww-low     { background: var(--risk-low-bg);    color: var(--risk-low); }
.ww-alert-badge.ww-medium  { background: var(--risk-medium-bg); color: var(--risk-medium); }
.ww-alert-badge.ww-high    { background: var(--risk-high-bg);   color: var(--risk-high); }
.ww-alert-badge.ww-unknown { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.75); }

.ww-details {
  display: flex; flex-wrap: wrap; gap: 6px 16px;
  margin-top: 12px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.72);
}
.ww-details i { color: var(--primary-300); margin-right: 4px; }

.ww-link {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 12px;
  font-size: 12.5px; font-weight: 600;
  color: var(--primary-300);
  text-decoration: none;
}
.ww-link:hover { color: #fff; }
.ww-link:focus-visible, .ww-retry:focus-visible { outline: 2px solid var(--primary-300); outline-offset: 2px; }

/* ---- Error / no-data state ---- */
.ww-error { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ww-error i { font-size: 20px; color: rgba(255,255,255,0.5); flex-shrink: 0; }
.ww-error p { margin: 0; font-size: 13px; color: rgba(255,255,255,0.75); flex: 1 1 auto; min-width: 160px; }
.ww-retry {
  border: 1px solid rgba(255,255,255,0.3);
  background: transparent;
  color: #fff;
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 100px;
  cursor: pointer;
}
.ww-retry:hover { background: rgba(255,255,255,0.1); }

@media (max-width: 991.98px) {
  .weather-widget { max-width: none; }
}
@media (max-width: 575.98px) {
  .ww-alert-badge { margin-left: 0; }
  .weather-widget-head { gap: 4px; }
}

/* ==========================================================
   "Reports Submitted Near You" ticker (homepage, between the KPI
   strip and Emergency Alerts). Light card, single-row layout that
   wraps gracefully on small screens. Ward-level text only — see
   api/nearby_reports.php for the privacy stance.
   ========================================================== */
.section-pad-sm { padding-block: 14px; }

.reports-ticker {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--primary-100);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 10px 16px;
}
.rt-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--primary-700);
  white-space: nowrap;
}
.rt-live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--risk-high);
  position: relative; flex-shrink: 0;
}
.rt-live-dot::after {
  content: '';
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--risk-high);
  animation: pulse-ring 1.8s var(--ease-out) infinite;
}

.rt-viewport {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: opacity 0.18s ease;
}
.rt-viewport.rt-fade-out { opacity: 0; }

.rt-item, .rt-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
}
.rt-item-link {
  color: var(--gray-900);
  text-decoration: none;
}
.rt-item-link:hover .rt-text strong,
.rt-item-link:focus-visible .rt-text strong { color: var(--primary-700); }
.rt-item-link:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; border-radius: 4px; }

.rt-muted { color: var(--gray-600); font-size: 13.5px; }
.rt-muted i { margin-right: 6px; }

.rt-cat-icon {
  flex-shrink: 0;
  font-size: 15px;
  width: 22px; text-align: center;
}
.rt-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13.5px;
  color: var(--gray-900);
}
.rt-time { color: var(--gray-600); font-weight: 400; }
.rt-item-link .status-badge { flex-shrink: 0; margin-left: auto; }

.rt-count {
  flex-shrink: 0;
  font-size: 11px;
  color: var(--gray-600);
  margin-left: 10px;
  white-space: nowrap;
}

.rt-nav {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.rt-nav-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--gray-300);
  background: var(--white);
  color: var(--primary-700);
  border-radius: 50%;
  font-size: 12px;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.rt-nav-btn:hover { background: var(--primary-100); border-color: var(--primary-300); }
.rt-nav-btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 1px; }

@media (max-width: 767.98px) {
  .reports-ticker { flex-wrap: wrap; row-gap: 8px; }
  .rt-badge { width: 100%; }
  .rt-viewport { flex-basis: 100%; order: 3; }
  .rt-text { white-space: normal; }
  .rt-count { display: none; }
  .rt-nav { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .rt-live-dot::after { animation: none; }
  .rt-viewport { transition: none; }
}

/* ==========================================================
   Statistics
   ========================================================== */
.stats-strip { margin-top: -56px; position: relative; z-index: 2; }
.stat-card {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-card);
  padding: 24px 20px;
  text-align: left;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.stat-card-link { display: block; text-decoration: none; color: inherit; cursor: pointer; }
.stat-card-link:hover .stat-label { color: var(--primary-700); }
.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--primary-100);
  color: var(--primary-700);
  margin-bottom: 14px;
  font-size: 18px;
}
.stat-card .stat-number {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 30px;
  color: var(--primary-900);
}
.stat-card .stat-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ==========================================================
   Reveal-on-scroll
   ========================================================== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal-stagger.is-visible { transition-delay: calc(var(--i, 0) * 90ms); }

/* ==========================================================
   Cards (news / tips / hospitals)
   ========================================================== */
.card-brand {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
  height: 100%;
}
.card-brand:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }

.badge-risk {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-risk.high   { background: var(--risk-high-bg);   color: var(--risk-high); }
.badge-risk.medium { background: var(--risk-medium-bg); color: #A9660C; }
.badge-risk.low    { background: var(--risk-low-bg);    color: var(--risk-low); }
.badge-risk.unknown { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-300); }

/* Report workflow status pills — same component/colors as the staff
   dashboards (assets/css/dashboard.css), duplicated here (small, static
   rule set) so public pages can show real report status without pulling
   in the whole dashboard stylesheet. Keep both in sync if this changes. */
.status-badge { font-size: 12px; padding: 4px 10px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.status-pending { background: var(--risk-medium-bg); color: var(--risk-medium); }
.status-verified { background: var(--primary-100); color: var(--primary-700); }
.status-assigned { background: #F3E8FF; color: #7C3AED; }
.status-in_progress { background: #E5EEFB; color: #2563EB; }
.status-completed { background: #E0F7FA; color: #0891B2; }
.status-engineer_verified { background: #FEF3C7; color: #B45309; }
.status-closed { background: var(--risk-low-bg); color: var(--risk-low); }
.status-rejected { background: var(--risk-high-bg); color: var(--risk-high); }

/* News */
.news-date {
  font-size: 12px; font-weight: 600; color: var(--primary-700);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.news-thumb {
  aspect-ratio: 16 / 9; /* unified with .tip-thumb below for consistent photo proportions site-wide */
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-300));
  position: relative;
  overflow: hidden;
}
.news-thumb i {
  position: absolute; right: 14px; bottom: 10px;
  font-size: 46px;
  color: rgba(11,61,46,0.22);
}

/* Real documentary-style photo variant (homepage "Latest News" cards) —
   same footprint/rounded-top-corners as the icon variant above, but with
   an <img> (object-fit: cover so source aspect ratio never distorts) and
   a subtle bottom gradient in the brand's dark green so overlaid text
   (if any is ever added) stays readable, and so the photo still reads
   as "part of" the dark-green DWMS identity rather than a random cutout. */
.news-thumb-img { background: var(--gray-100); }
.news-thumb-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: brightness(0.92); /* matches .tip-thumb img — one consistent photo "mood" across the homepage */
  transition: transform 300ms var(--ease-out); /* spec calls for ~250-350ms, subtler than --dur-med (420ms) */
}
.news-thumb-img::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 55%;
  background: linear-gradient(to top, rgba(11,61,46,0.55), rgba(11,61,46,0));
  pointer-events: none;
}
/* Hover: image zooms slightly + whole card lifts (card lift already
   handled by .card-brand:hover above) — kept subtle per spec (~1.04, ~300ms). */
.card-brand:hover .news-thumb-img img { transform: scale(1.04); }

/* Prevention tips */
.tip-item {
  display: flex; gap: 16px;
  padding: 20px;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--gray-300);
  height: 100%;
  transition: border-color var(--dur-fast), transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast);
}
.tip-item:hover { border-color: var(--primary-300); transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.tip-icon {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--primary-100);
  color: var(--primary-700);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px;
}

/* Homepage "Dengue Prevention Tips" cards — deliberately a NEW class
   (.tip-card, not .tip-item) so this vertical photo-card layout only
   affects the 6 cards on index.php. .tip-item/.tip-icon above stay
   exactly as they are for the horizontal "Bookmarked Tips" widget on
   citizen/dashboard.php. */
.tip-card {
  display: flex; flex-direction: column;
  height: 100%;
  border-radius: var(--radius-md);
  background: var(--white);
  border: 1px solid var(--gray-300);
  overflow: hidden;
  transition: border-color var(--dur-fast), transform 300ms var(--ease-out), box-shadow var(--dur-fast);
}
.tip-card:hover { border-color: var(--primary-300); transform: translateY(-4px); box-shadow: var(--shadow-hover); }

.tip-thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--gray-100);
  overflow: hidden;
}
.tip-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  /* Slightly darkened so photos don't fight the site's dark-green
     identity; the gradient below adds extra depth at the bottom. */
  filter: brightness(0.92);
  transition: transform 300ms var(--ease-out);
}
.tip-card:hover .tip-thumb img { transform: scale(1.03); }
.tip-thumb::after {
  content: "";
  position: absolute; inset: auto 0 0 0; height: 60%;
  background: linear-gradient(to top, rgba(11,61,46,0.5), rgba(11,61,46,0));
  pointer-events: none;
}
/* No-photo fallback (file not yet provided) — same icon-panel treatment
   used elsewhere on the site rather than a broken image. */
.tip-thumb.tip-thumb-icon {
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary-100), var(--primary-300));
}
.tip-thumb.tip-thumb-icon i { font-size: 42px; color: rgba(11,61,46,0.3); }

.tip-card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex-grow: 1; }
.tip-card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tip-card-meta i { color: var(--primary-700); font-size: 16px; }
.tip-card-badge {
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 10px; border-radius: 999px;
  background: var(--primary-100); color: var(--primary-700);
}

/* Waterlog reports */
.report-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 4px;
  border-bottom: 1px solid var(--gray-300);
  font-size: 14px;
}
.report-row:last-child { border-bottom: none; }
.chart-card {
  background: var(--white);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  padding: 24px;
}

/* Map */
.map-card {
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--gray-300);
  position: relative;
}
#riskMap { height: 460px; width: 100%; }
.map-legend {
  position: absolute; left: 16px; bottom: 16px; z-index: 500;
  background: rgba(255,255,255,0.96);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 12px 16px;
  font-size: 12.5px;
}
.map-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; margin-right: 6px; }
.map-search {
  position: absolute; top: 16px; right: 16px; z-index: 500;
  background: rgba(255,255,255,0.96);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  padding: 6px 8px;
  display: flex; align-items: center; gap: 6px;
  width: min(240px, 60%);
}
.map-search input {
  border: none; outline: none; font-size: 13px; width: 100%; background: transparent;
}

/* ==========================================================
   Risk map "alert zones" (Leaflet circles drawn by map.js /
   riskmap.js). .zone-pulse is set on wards with an active
   (sent/acknowledged) alert so their ring visibly breathes
   instead of sitting flat like the rest of the risk-colored area.
   ========================================================== */
.risk-zone { pointer-events: none; }
.zone-pulse { animation: zonePulse 2.2s var(--ease-out) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes zonePulse {
  0%   { stroke-opacity: 0.9; fill-opacity: 0.28; transform: scale(1); }
  50%  { stroke-opacity: 0.35; fill-opacity: 0.1; transform: scale(1.06); }
  100% { stroke-opacity: 0.9; fill-opacity: 0.28; transform: scale(1); }
}

/* ==========================================================
   "Top 5 Highest-Risk Wards" leaderboard (homepage, after the risk
   map). Reuses .badge-risk (risk-map.php's own risk-level pill) and
   the same list-row rhythm as .report-row above, just richer per row.
   ========================================================== */
.risk-leaderboard { list-style: none; margin: 0; padding: 0; }
.risk-leaderboard-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--gray-300);
  text-decoration: none;
  color: inherit;
  transition: background var(--dur-fast);
}
.risk-leaderboard li:last-child .risk-leaderboard-row { border-bottom: none; }
.risk-leaderboard-row:hover,
.risk-leaderboard-row:focus-visible { background: var(--primary-100); }
.risk-leaderboard-row:focus-visible { outline: 2px solid var(--primary-500); outline-offset: -2px; }

.rlb-rank {
  flex-shrink: 0;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  background: var(--gray-100);
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.rlb-rank-1 { background: var(--risk-high-bg); color: var(--risk-high); border-color: transparent; }

.rlb-name { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.rlb-name strong { font-size: 14.5px; color: var(--gray-900); }
.rlb-zone { font-size: 12px; color: var(--gray-600); }

.rlb-note {
  flex: 1 1 160px;
  min-width: 0;
  font-size: 12.5px;
  color: var(--gray-600);
}

.rlb-score {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  color: var(--gray-900);
  min-width: 44px;
  text-align: right;
}

@media (max-width: 767.98px) {
  .risk-leaderboard-row { flex-wrap: wrap; padding: 12px 16px; }
  .rlb-note { order: 4; flex-basis: 100%; margin-top: 2px; }
  .rlb-score { order: 2; }
}

/* Hospitals */
.hospital-card { padding: 22px; }
.hospital-card .h-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--risk-low-bg); color: var(--risk-low);
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}
.hospital-meta { font-size: 13px; color: var(--gray-600); }
.hospital-meta i { width: 16px; color: var(--primary-700); }

/* ==========================================================
   Footer
   ========================================================== */
.footer-gov {
  background: var(--primary-900);
  color: rgba(255,255,255,0.72);
  padding-top: 64px;
}
.footer-gov h6 {
  color: #fff;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  margin-bottom: 18px;
}
.footer-gov a {
  color: rgba(255,255,255,0.68);
  text-decoration: none;
  font-size: 14px;
  display: block;
  margin-bottom: 10px;
  transition: color var(--dur-fast), padding-left var(--dur-fast);
}
.footer-gov a:hover { color: var(--primary-300); padding-left: 4px; }
.footer-social a {
  display: inline-flex; width: 36px; height: 36px;
  align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
  margin-right: 8px;
}
.footer-social a:hover { background: var(--primary-500); }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  margin-top: 40px;
  padding-block: 20px;
  font-size: 12.5px;
  color: rgba(255,255,255,0.5);
}

/* Back to top */
#backToTop {
  position: fixed; right: 22px; bottom: 22px; z-index: 999;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary-700); color: #fff; border: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-hover);
  opacity: 0; visibility: hidden; transform: translateY(10px);
  transition: all var(--dur-fast) var(--ease-out);
}
#backToTop.show { opacity: 1; visibility: visible; transform: translateY(0); }
#backToTop:hover { background: var(--primary-500); }
