:root {
  --paper: #eef1ee;
  --panel: #ffffff;
  --ink: #14181a;
  --ink-soft: #4b5359;
  --line: #d7ddd8;
  --accent: #2f5db3;      /* the required blue for "See more >>" and links */
  --accent-soft: #e3ebfb;

  --aqi-good-bg: #059669;       /* deepened green, keeps white text legible */
  --aqi-moderate-bg: #d4a300;   /* deepened yellow, keeps white text legible */
  --aqi-usg-bg: #ff7e00;
  --aqi-unhealthy-bg: #e0332f;
  --aqi-very-unhealthy-bg: #8f3f97;
  --aqi-hazardous-bg: #7e0023;

  --font-display: "Space Grotesk", sans-serif;
  --font-mono: "IBM Plex Mono", monospace;

  --radius: 10px;
  --shadow: 0 8px 24px rgba(20, 24, 26, 0.10);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-mono);
}

body {
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); }

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  z-index: 500;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
 
.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
}
 
.brand-trace {
  display: block;
  width: 27px;
  height: 31px;
  flex: none;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}

.topbar nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  color: var(--ink-soft);
}
.topbar nav a:hover { color: var(--accent); }

#map {
  flex: 1;
  width: 100%;
}

.legend {
  position: absolute;
  bottom: 22px;
  left: 16px;
  z-index: 600;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 14px;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.legend-row { display: flex; align-items: center; gap: 8px; margin: 3px 0; }
.legend-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }

/* custom divIcon marker */
.aqi-marker {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.85);
  box-shadow: 0 2px 8px rgba(0,0,0,0.28);
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  position: relative;
}

.aqi-marker::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 25%;
  border: 1.5px solid currentColor;
  opacity: 0;
  animation: pulse 3.2s ease-out infinite;
}
@keyframes pulse {
  0%   { transform: scale(0.82); opacity: 0.55; }
  70%  { transform: scale(1.25); opacity: 0; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .aqi-marker::after { animation: none; display: none; }
}

.leaflet-popup-content-wrapper {
  border-radius: var(--radius);
  font-family: var(--font-mono);
}

.popup {
  min-width: 190px;
}
.popup h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 6px;
}
.popup .cat {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: #fff;
  margin-bottom: 8px;
}
.popup dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  font-size: 0.8rem;
}
.popup dt { color: var(--ink-soft); }
.popup dd { margin: 0; text-align: right; }
.popup .see-more {
  display: block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
}
.popup .see-more:hover { text-decoration: underline; }
.popup .stale {
  margin-top: 6px;
  font-size: 0.68rem;
  color: #b5432f;
}

.detail-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 24px 60px;
  width: 100%;
}

.detail-header {
  margin-bottom: 22px;
}
.detail-header .owner {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 700;
  margin: 0 0 4px;
}
.detail-header .sub {
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.now-row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 30px;
}
.now-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 18px;
  min-width: 120px;
  box-shadow: var(--shadow);
}
.now-card .label {
  font-size: 0.68rem;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.now-card .value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  margin-top: 2px;
}
.now-card.aqi .value { display: inline-flex; align-items: center; gap: 8px; }
.now-card .swatch {
  width: 12px; height: 12px; border-radius: 50%;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px 8px;
  margin-bottom: 22px;
}
.panel h2 {
  font-family: var(--font-display);
  font-size: 1rem;
  margin: 0 0 12px;
}
.panel canvas { max-height: 260px; }

.empty-state {
  color: var(--ink-soft);
  font-size: 0.85rem;
  padding: 20px 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  font-size: 0.8rem;
  color: var(--accent);
  text-decoration: none;
}
.back-link:hover { text-decoration: underline; }
