:root {
  --ink: #25272b;
  --muted: #606873;
  --line: #dedede;
  --surface: #ffffff;
  --soft: #f4f6f8;
  --pale-blue: #e7f0f4;
  --red: #a60906;
  --red-dark: #850603;
  --blue: #166d97;
  --shadow: 0 2px 15px rgba(0, 0, 0, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
  background: var(--surface);
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
select {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 50px;
  padding: 0 5%;
}

.brand,
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
}

.brand-text {
  font-weight: 700;
  letter-spacing: 0;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.4rem;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.98rem;
  color: #1f2227;
}

.nav-links a:hover {
  color: var(--red);
}

.nav-toggle,
.nav-button {
  display: none;
}

.hero {
  position: relative;
  min-height: calc(100vh - 50px);
  max-height: 820px;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: #111;
}

.hero-map {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.6);
}

.hero-content {
  position: relative;
  z-index: 2;
  min-height: calc(100vh - 50px);
  width: min(980px, 92vw);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: 3rem 0 2rem;
  text-align: center;
  color: #fff;
}

.hero h1 {
  margin: 0;
  max-width: 860px;
  font-size: clamp(2.2rem, 6vw, 3rem);
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: 0;
}

.hero p {
  margin: 0;
  max-width: 760px;
  font-size: 1.35rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.92);
}

.primary-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(26rem, 80vw);
  min-height: 3.5rem;
  padding: 0.75rem 2rem;
  border: 5px solid #fff;
  border-radius: 8px;
  background: var(--red);
  color: #fff;
  text-decoration: none;
  font-size: 1.12rem;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.primary-cta:hover,
.alert-form button:hover,
.login-form button:hover {
  background: #c1190d;
}

.app-badges {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.app-badges span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 10rem;
  height: 3rem;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 7px;
  background: #111;
  font-weight: 700;
}

.learn-more {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  color: #fff;
  text-decoration: none;
  font-size: 0.88rem;
}

.learn-more svg {
  width: 1.6rem;
  height: 1.6rem;
}

.intro,
.browse,
.login {
  width: min(52rem, 84vw);
  margin: 0 auto;
  padding: 4.5rem 0;
  text-align: center;
}

.intro h2,
.spotlights h2,
.alerts h2,
.browse h2,
.login h2,
.map-toolbar h2 {
  margin: 0 0 1.2rem;
  font-size: 2.35rem;
  font-weight: 500;
  letter-spacing: 0;
}

.intro p,
.spotlights p,
.alerts p,
.footer p {
  color: var(--muted);
  line-height: 1.65;
}

.section-icon {
  width: 4rem;
  height: 4rem;
  color: var(--red);
  margin-bottom: 1.4rem;
  stroke-width: 1.5;
}

.spotlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
  width: min(64rem, 92vw);
  margin: 0 auto 3rem;
  padding: 0 0 2rem;
}

.spotlights article {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 23rem;
  padding: 2.2rem;
  background: var(--pale-blue);
  text-align: center;
}

.map-shell {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 2.5rem 0 5rem;
}

.map-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.map-toolbar h2 {
  margin-bottom: 0.3rem;
}

.map-toolbar p {
  margin: 0;
  color: var(--muted);
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: min(22rem, 86vw);
  height: 3rem;
  padding: 0 0.9rem;
  background: #fff;
  border: 1px solid #bfc5ca;
  border-radius: 4px;
}

.search-field svg {
  width: 1.15rem;
  color: var(--muted);
  flex: 0 0 auto;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
}

.toolbar-actions select,
.alert-form select,
.alert-form input,
.login-form input {
  height: 3rem;
  border: 1px solid #bfc5ca;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  padding: 0 0.85rem;
}

.map-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 23rem;
  min-height: 38rem;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.interactive-map {
  min-height: 38rem;
  background: #d9e5dd;
}

.incident-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: rgba(255, 255, 255, 0.98);
  border-left: 1px solid var(--line);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 3.5rem;
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
}

.icon-button svg {
  width: 1rem;
}

.incident-list {
  overflow: auto;
  max-height: 34.5rem;
}

.incident-card {
  display: grid;
  grid-template-columns: 2.2rem minmax(0, 1fr);
  gap: 0.75rem;
  width: 100%;
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--line);
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.incident-card:hover,
.incident-card.is-active {
  background: #eaf2f5;
}

.incident-icon {
  width: 2.1rem;
  height: 2.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
}

.incident-icon svg {
  width: 1.15rem;
  height: 1.15rem;
}

.incident-card strong {
  display: block;
  margin-bottom: 0.2rem;
}

.incident-card span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.province-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  text-align: left;
}

.province-card {
  min-height: 14rem;
  padding: 1.2rem;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.province-card h3 {
  margin: 0 0 0.8rem;
  font-size: 1.25rem;
}

.province-card a {
  display: inline-flex;
  margin: 0.15rem 0.6rem 0.15rem 0;
  color: var(--blue);
  text-decoration: none;
  font-size: 0.95rem;
}

.province-card a:hover {
  text-decoration: underline;
}

.alerts {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 27rem);
  gap: 3rem;
  align-items: center;
  width: min(64rem, 90vw);
  margin: 0 auto;
  padding: 4rem 0 5rem;
}

.data-section,
.activity-section {
  width: min(1180px, 94vw);
  margin: 0 auto;
  padding: 4rem 0 5rem;
}

.data-heading {
  max-width: 56rem;
  margin-bottom: 1.5rem;
}

.data-heading h2 {
  margin: 0.75rem 0 0.6rem;
  font-size: 2.35rem;
  font-weight: 500;
}

.data-heading p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: #eef5f7;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 700;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
}

.stat-card,
.data-card,
.source-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stat-card {
  min-height: 9.2rem;
  padding: 1rem;
}

.stat-card span,
.bar-row span,
.station-list span {
  color: var(--muted);
}

.stat-card span {
  display: block;
  min-height: 2.6rem;
  font-size: 0.85rem;
  line-height: 1.35;
}

.stat-card strong {
  display: block;
  margin: 0.45rem 0 0.2rem;
  font-size: 1.75rem;
}

.stat-card em,
.bar-row em {
  font-style: normal;
  font-weight: 700;
}

.is-down {
  color: #136d43;
}

.is-up {
  color: var(--red);
}

.is-flat {
  color: var(--muted);
}

.data-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(13rem, 18rem);
  gap: 0.9rem;
  margin: 1rem 0;
}

.data-tools label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 700;
}

.data-tools select {
  height: 3rem;
  border: 1px solid #bfc5ca;
  border-radius: 4px;
  background: #fff;
  padding: 0 0.85rem;
}

.data-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 27rem);
  gap: 1rem;
}

.data-card {
  padding: 1rem;
}

.data-card h3,
.source-section h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.bar-list,
.station-list {
  display: grid;
  gap: 0.75rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(10rem, 15rem) minmax(0, 1fr) 4.4rem;
  gap: 0.8rem;
  align-items: center;
}

.bar-row strong,
.bar-row span,
.station-list span {
  display: block;
}

.bar-row span,
.station-list span {
  font-size: 0.85rem;
}

.bar-track {
  height: 0.6rem;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f4;
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.station-list article {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.source-section {
  margin-top: 2rem;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.source-card {
  padding: 1rem;
}

.activity-feed {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.activity-card {
  min-height: 13rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.activity-card h3 {
  margin: 0.75rem 0 0.6rem;
  font-size: 1.05rem;
  line-height: 1.35;
}

.activity-card p {
  color: var(--muted);
  line-height: 1.5;
}

.activity-card a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.source-card h4 {
  margin: 0.75rem 0 0.5rem;
  font-size: 1.05rem;
}

.source-card p {
  color: var(--muted);
  line-height: 1.5;
}

.source-card a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.alert-copy {
  text-align: center;
}

.small-note,
#form-status {
  font-size: 0.84rem;
}

.alert-form,
.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.alert-form label,
.login-form label {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-weight: 700;
  text-align: left;
}

.alert-form button,
.login-form button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.35rem;
  border: 0;
  border-radius: 4px;
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

.alert-form button svg,
.login-form button svg {
  width: 1.15rem;
}

.login {
  padding-top: 2rem;
}

.login-form {
  max-width: 28rem;
  margin: 0 auto;
}

.footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  padding: 2.5rem 2rem;
  background: var(--soft);
  border-top: 1px solid var(--line);
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.1rem;
}

.footer-links a {
  color: var(--ink);
  text-decoration: none;
}

.footer-links a:hover {
  color: var(--red);
}

.leaflet-popup-content {
  font-family: "Open Sans", Arial, Helvetica, sans-serif;
}

.popup-title {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.popup-meta {
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

@media (max-width: 900px) {
  .nav-button {
    display: inline-flex;
    width: 2.5rem;
    height: 2.5rem;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
  }

  .nav-button span {
    width: 1.3rem;
    height: 2px;
    background: var(--ink);
  }

  .nav-links {
    position: fixed;
    inset: 50px 0 auto 0;
    display: none;
    flex-direction: column;
    align-items: flex-end;
    padding: 1rem 5% 1.5rem;
    background: rgba(31, 34, 39, 0.96);
  }

  .nav-links a {
    color: #fff;
    font-size: 1.1rem;
    padding: 0.6rem 0;
  }

  .nav-toggle:checked ~ .nav-links {
    display: flex;
  }

  .map-toolbar,
  .alerts {
    grid-template-columns: 1fr;
    display: grid;
  }

  .map-grid {
    grid-template-columns: 1fr;
  }

  .stat-grid,
  .data-layout,
  .source-grid,
  .activity-feed,
  .data-tools {
    grid-template-columns: 1fr;
  }

  .incident-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .incident-list {
    max-height: 23rem;
  }

  .province-grid,
  .spotlights {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .hero {
    min-height: 680px;
  }

  .hero-content {
    min-height: 680px;
  }

  .hero p {
    font-size: 1.06rem;
    line-height: 1.45;
  }

  .intro h2,
  .spotlights h2,
  .data-heading h2,
  .alerts h2,
  .browse h2,
  .login h2,
  .map-toolbar h2 {
    font-size: 1.85rem;
  }

  .toolbar-actions,
  .search-field,
  .toolbar-actions select {
    width: 100%;
  }

  .map-shell {
    width: 100vw;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .bar-row {
    grid-template-columns: 1fr;
    gap: 0.35rem;
  }
}
