/* =========================================================
   9M PPOTA Malaysia — Heritage & Modern Design System
   Dark by default · brass, deep teal, warm cream
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  --brand: #A07E26;
  --brand-light: #C4A140;
  --brand-dark: #7B5E15;
  --brand-ink: #241B04;
  --brand-tint: rgba(160, 126, 38, .12);

  --water: #1E5C56;
  --water-dark: #133D39;
  --water-tint: rgba(30, 92, 86, .12);

  --accent: #C05F3E;
  --success: #3E7C4F;
  --danger: #C0392B;

  --bg: #F4EEE2;
  --bg-alt: #EAE1CE;
  --card: #FFFDF8;
  --border: #DCCFB4;
  --text: #22302C;
  --text-muted: #66736B;

  --shadow: 0 1px 2px rgba(34, 48, 44, .06), 0 1px 3px rgba(34, 48, 44, .06);
  --shadow-lg: 0 12px 32px rgba(34, 48, 44, .12), 0 4px 10px rgba(34, 48, 44, .06);
  --radius: 16px;
  --radius-sm: 10px;
  --transition: .25s cubic-bezier(.4, 0, .2, 1);

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
}

[data-theme="dark"] {
  --brand: #D5B04C;
  --brand-light: #E5C867;
  --brand-dark: #AB8A33;
  --brand-ink: #1C1500;
  --brand-tint: rgba(213, 176, 76, .14);

  --water: #79B5A6;
  --water-dark: #A7D4C7;
  --water-tint: rgba(121, 181, 166, .14);

  --accent: #DF8A66;
  --success: #74BE8A;
  --danger: #E06A5E;

  --bg: #0A110F;
  --bg-alt: #101A18;
  --card: #16201E;
  --border: #28362F;
  --text: #E8EFEA;
  --text-muted: #9AA99F;

  --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-lg: 0 14px 40px rgba(0, 0, 0, .5), 0 4px 12px rgba(0, 0, 0, .3);
}

/* ---------- Base ---------- */
* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

img { max-width: 100%; display: block; }

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

::selection { background: var(--brand-tint); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Layout ---------- */
.container {
  max-width: 1220px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 2.75rem 0 1rem;
}

.section-title {
  display: flex;
  align-items: center;
  gap: .75rem;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.2vw, 2rem);
  font-weight: 600;
  letter-spacing: -.01em;
  color: var(--water-dark);
  margin-bottom: 1.5rem;
}

.section-title .icon {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 10px;
  background: var(--brand-tint);
  color: var(--brand-dark);
  font-size: 1.15rem;
  border: 1px solid var(--border);
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
  margin-left: .25rem;
}

/* ---------- Site nav ---------- */
.site-nav {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .9rem 1.5rem;
  background: linear-gradient(180deg, rgba(5, 18, 16, .55), rgba(5, 18, 16, 0));
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  color: #fff;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .02em;
  margin-right: auto;
}

.site-brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .35);
}

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

.site-nav-links a {
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  padding: .45rem .85rem;
  border-radius: 100px;
  border: 1px solid transparent;
  transition: all var(--transition);
}

.site-nav-links a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .18);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, .1);
  border: 1px solid rgba(255, 255, 255, .22);
  color: #fff;
  border-radius: 100px;
  cursor: pointer;
  font-size: 1.05rem;
  backdrop-filter: blur(8px);
  transition: all var(--transition);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, .22);
  transform: rotate(20deg);
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  color: #fff;
  padding: 5.5rem 1rem 6.5rem;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 12%, rgba(212, 176, 76, .16), transparent 42%),
    radial-gradient(circle at 8% 20%, rgba(121, 181, 166, .12), transparent 46%),
    linear-gradient(162deg, #0C2B27 0%, #14453E 40%, #0E3430 72%, #08201D 100%);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .05) 1px, transparent 1.4px);
  background-size: 30px 30px;
  pointer-events: none;
}

.hero::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--brand-light) 18%, var(--brand-light) 82%, transparent);
  opacity: .9;
}

.hero-content {
  position: relative;
  max-width: 860px;
  margin: 0 auto;
  animation: fadeUp .7s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(212, 176, 76, .45);
  color: var(--brand-light);
  padding: .35rem 1rem;
  border-radius: 100px;
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.hero-logo-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin: 0 auto 1.5rem;
  background: radial-gradient(circle at 50% 35%, #FFFDF8, #EDE3CB);
  border: 3px solid var(--brand-light);
  border-radius: 50%;
  padding: 10px;
  box-shadow:
    0 10px 30px rgba(0, 0, 0, .35),
    0 0 0 1px rgba(0, 0, 0, .25);
}

.hero-logo {
  width: 128px;
  height: 128px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -.015em;
  line-height: 1.12;
  margin-bottom: 1rem;
  text-wrap: balance;
}

.hero h1 .highlight {
  background: linear-gradient(100deg, #E9CE78 0%, #D5B04C 55%, #C4A140 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: clamp(.98rem, 2vw, 1.15rem);
  opacity: .9;
  max-width: 640px;
  margin: 0 auto 1.75rem;
  text-wrap: pretty;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.hero-callsign {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .06em;
  background: rgba(255, 255, 255, .07);
  border: 1px solid rgba(255, 255, 255, .18);
  padding: .35rem .9rem;
  border-radius: 100px;
  color: rgba(255, 255, 255, .85);
}

.hero-sm {
  padding: 5.5rem 1rem 5rem;
}

.hero-sm .hero-logo { width: 92px; height: 92px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .72rem 1.2rem;
  border: none;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: all var(--transition);
}

.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  color: var(--brand-ink);
  border: 1px solid var(--brand-dark);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .35) inset;
}

.btn-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .15);
}

.btn-secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-secondary:hover { color: var(--brand-light); }

.btn-ghost {
  background: rgba(255, 255, 255, .08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, .28);
  backdrop-filter: blur(8px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, .18);
  transform: translateY(-1px);
}

.btn-hero-primary {
  background: linear-gradient(180deg, #E9CE78, #C4A140);
  color: #241B04;
  border: 1px solid #A98A30;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .3);
}

.btn-hero-primary:hover {
  filter: brightness(1.06);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, .35);
}

.btn-sm {
  padding: .45rem .9rem;
  font-size: .82rem;
}

/* ---------- Stats bar ---------- */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin: -3.2rem auto 2.5rem;
  position: relative;
  z-index: 10;
}

.stat-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1rem 1.1rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: -1px;
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, var(--brand-dark), var(--brand-light));
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--brand-tint);
}

.stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 2.1rem;
  font-weight: 700;
  color: var(--water-dark);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stat-card .stat-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: .4rem;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* ---------- About section ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.about-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
}

.about-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
  transform: translateY(-2px);
}

.about-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--water-dark);
  margin-bottom: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.about-card h3::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 1.1rem;
  background: linear-gradient(180deg, var(--brand-light), var(--brand-dark));
  border-radius: 2px;
}

.about-card p {
  font-size: .92rem;
  margin-bottom: .75rem;
}

.about-card p:last-child { margin-bottom: 0; }

.about-card a {
  color: var(--water);
  text-decoration: none;
  font-weight: 600;
}

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

.about-card code {
  font-family: var(--font-mono);
  font-size: .8rem;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  padding: .12rem .4rem;
  border-radius: 5px;
  color: var(--brand-dark);
}

[data-theme="dark"] .about-card code { color: var(--brand-light); }

.about-list {
  list-style: none;
  padding: 0;
}

.about-list li {
  font-size: .9rem;
  padding: .45rem 0 .45rem 1.55rem;
  position: relative;
  border-bottom: 1px solid var(--border);
}

.about-list li:last-child { border-bottom: none; }

.about-list li::before {
  content: '\2713';
  position: absolute;
  left: 0;
  top: .45rem;
  color: var(--brand-dark);
  font-weight: 700;
}

[data-theme="dark"] .about-list li::before { color: var(--brand-light); }

.about-note {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}

.about-note p {
  font-size: .9rem;
  margin: 0 0 .9rem;
}

.about-note p:last-child { margin-bottom: 0; }

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

/* ---------- Submit CTA ---------- */
.submit-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, var(--water-tint), var(--brand-tint));
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
}

.submit-cta-text {
  display: flex;
  flex-direction: column;
  gap: .15rem;
}

.submit-cta-text strong {
  font-size: .98rem;
  font-family: var(--font-display);
  color: var(--water-dark);
}

.submit-cta-text span {
  font-size: .85rem;
  color: var(--text-muted);
}

.submit-cta .btn { flex: 0 0 auto; }

/* ---------- Map ---------- */
.map-container {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-bottom: 2rem;
}

#map {
  height: 500px;
  width: 100%;
}

.map-legend {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 500;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .7rem 1rem;
  box-shadow: var(--shadow-lg);
  font-size: .78rem;
  color: var(--text);
}

.map-legend .legend-title {
  font-weight: 700;
  font-family: var(--font-display);
  margin-bottom: .35rem;
  color: var(--water-dark);
}

.map-legend .legend-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin: .25rem 0;
  font-size: .78rem;
  color: var(--text-muted);
}

.map-legend .legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}

/* ---------- Toolbar ---------- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.search-box {
  flex: 1 1 280px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: .72rem 1rem .72rem 2.6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: var(--font-body);
  background: var(--card);
  color: var(--text);
  transition: all var(--transition);
}

.search-box input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.search-box input::placeholder { color: var(--text-muted); }

.search-box .search-icon {
  position: absolute;
  left: .9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1rem;
  pointer-events: none;
}

.toolbar select {
  padding: .72rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font-body);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition);
}

.toolbar select:hover,
.toolbar select:focus {
  border-color: var(--brand);
  outline: none;
}

/* ---------- View toggle ---------- */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card);
}

.view-toggle button {
  padding: .72rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font-body);
  transition: all var(--transition);
}

.view-toggle button + button { border-left: 1px solid var(--border); }

.view-toggle button:hover { color: var(--brand-dark); }

[data-theme="dark"] .view-toggle button:hover { color: var(--brand-light); }

.view-toggle button.active {
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  color: var(--brand-ink);
}

/* ---------- Nearest button ---------- */
.nearest-btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .72rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  font-size: .85rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.nearest-btn:hover {
  border-color: var(--brand);
  color: var(--brand-dark);
}

[data-theme="dark"] .nearest-btn:hover { color: var(--brand-light); }

.nearest-btn .nearest-icon { font-size: 1rem; line-height: 1; }

.nearest-btn.active {
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  border-color: var(--brand-dark);
  color: var(--brand-ink);
}

.nearest-btn.loading { opacity: .7; cursor: progress; }

.nearest-btn.error {
  border-color: var(--danger);
  color: var(--danger);
}

@keyframes nearest-spin {
  to { transform: rotate(360deg); }
}

.nearest-btn.loading .nearest-icon {
  animation: nearest-spin 1s linear infinite;
}

/* ---------- Distance ---------- */
.card-distance {
  display: inline-block;
  margin-top: .6rem;
  padding: .2rem .6rem;
  font-size: .75rem;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-tint);
  border: 1px solid var(--brand);
  border-radius: 999px;
  white-space: nowrap;
}

[data-theme="dark"] .card-distance { color: var(--brand-light); }

.cell-distance {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--brand-dark);
  white-space: nowrap;
}

[data-theme="dark"] .cell-distance { color: var(--brand-light); }

/* ---------- User location marker ---------- */
.user-loc-marker { background: transparent; }

.user-loc-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  background: #2563EB;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(37, 99, 235, .8);
}

.user-loc-pulse {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  margin: -11px 0 0 -11px;
  background: rgba(37, 99, 235, .35);
  border-radius: 50%;
  animation: user-loc-pulse 2s ease-out infinite;
}

@keyframes user-loc-pulse {
  0%   { transform: scale(.5); opacity: .8; }
  100% { transform: scale(2.2); opacity: 0; }
}

.result-count {
  font-size: .85rem;
  color: var(--text-muted);
  margin-left: auto;
  font-variant-numeric: tabular-nums;
}

/* ---------- Card grid ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.1rem;
}

.reference-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.3rem;
  box-shadow: var(--shadow);
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}

.reference-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--brand), var(--water));
  opacity: 0;
  transition: opacity var(--transition);
}

.reference-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}

.reference-card:hover::before { opacity: 1; }

.reference-card .card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: .5rem;
  margin-bottom: .6rem;
}

.reference-card .card-code {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: var(--brand-dark);
  background: var(--brand-tint);
  border: 1px solid var(--brand);
  padding: .2rem .55rem;
  border-radius: 6px;
  white-space: nowrap;
}

[data-theme="dark"] .reference-card .card-code { color: var(--brand-light); }

.reference-card .card-area {
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.reference-card .card-name {
  font-family: var(--font-display);
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .35rem;
  line-height: 1.3;
}

.reference-card .card-state {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: .8rem;
}

.reference-card .card-type {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .75rem;
  padding: .28rem .7rem;
  border-radius: 100px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

.type-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}

.reference-card .card-desc {
  margin: .7rem 0 0;
  font-size: .85rem;
  line-height: 1.55;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.reference-card .card-links {
  display: flex;
  flex-wrap: wrap;
  gap: .45rem;
  margin-top: .75rem;
}

.reference-card .card-link {
  font-size: .72rem;
  font-weight: 600;
  color: var(--water);
  text-decoration: none;
  padding: .22rem .6rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: var(--bg-alt);
  transition: all var(--transition);
}

.reference-card .card-link:hover {
  color: var(--brand-dark);
  border-color: var(--brand);
  background: var(--brand-tint);
}

[data-theme="dark"] .reference-card .card-link:hover { color: var(--brand-light); }

.reference-card .card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: .8rem;
  padding-top: .8rem;
  border-top: 1px dashed var(--border);
}

.reference-card .card-coords {
  font-family: var(--font-mono);
  font-size: .75rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.reference-card .card-map-link {
  font-size: .8rem;
  color: var(--water);
  text-decoration: none;
  font-weight: 600;
}

.reference-card .card-map-link:hover { text-decoration: underline; }

/* ---------- Table view ---------- */
.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}

thead th {
  background: var(--bg-alt);
  text-align: left;
  padding: .85rem 1rem;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: background var(--transition);
}

thead th:hover { color: var(--brand-dark); }

[data-theme="dark"] thead th:hover { color: var(--brand-light); }

thead th.sort-asc::after { content: " \25B2"; color: var(--brand-dark); }
thead th.sort-desc::after { content: " \25BC"; color: var(--brand-dark); }

tbody td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background var(--transition); }
tbody tr:hover { background: var(--bg-alt); }

.cell-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-dark);
  white-space: nowrap;
}

[data-theme="dark"] .cell-code { color: var(--brand-light); }

.cell-name { font-weight: 600; }
.cell-type { font-size: .82rem; color: var(--text-muted); }
.cell-area { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.cell-coords {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--text-muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.type-badge {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .74rem;
  padding: .22rem .6rem;
  border-radius: 100px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-weight: 500;
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 20, 18, .6);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 560px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: scale(.95) translateY(8px);
  transition: transform var(--transition);
}

.modal-overlay.active .modal { transform: scale(1) translateY(0); }

.modal-header {
  position: relative;
  background:
    radial-gradient(circle at 90% 10%, rgba(212, 176, 76, .25), transparent 45%),
    linear-gradient(150deg, #14453E, #0E3430 70%, #08201D);
  color: #fff;
  padding: 1.6rem 1.5rem;
  border-bottom: 3px solid var(--brand-light);
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: rgba(255, 255, 255, .14);
  border: 1px solid rgba(255, 255, 255, .25);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.15rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.modal-close:hover { background: rgba(255, 255, 255, .3); }

.modal-header .modal-code {
  font-family: var(--font-mono);
  font-size: .8rem;
  letter-spacing: .05em;
  color: var(--brand-light);
  margin-bottom: .35rem;
}

.modal-header h2 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -.01em;
  margin-bottom: .35rem;
  padding-right: 2.5rem;
}

.modal-header .modal-state {
  font-size: .9rem;
  opacity: .85;
}

.modal-body { padding: 1.5rem; }

.modal-desc {
  margin: 0 0 1rem;
  font-size: .92rem;
  line-height: 1.6;
  color: var(--text);
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}

.modal-links {
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.modal-links-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: .6rem;
}

.modal-links-list {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}

.btn-sm {
  padding: .38rem .8rem;
  font-size: .8rem;
}

.modal-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .9rem;
}

.modal-row:last-child { border-bottom: none; }

.modal-row .label { color: var(--text-muted); font-size: .85rem; }

.modal-row .value {
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.modal-map {
  margin-top: 1rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.modal-map iframe {
  width: 100%;
  height: 240px;
  border: 0;
  display: block;
}

.modal-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
}

/* ---------- Footer ---------- */
footer {
  position: relative;
  text-align: center;
  color: rgba(255, 255, 255, .75);
  font-size: .85rem;
  padding: 2.75rem 1.25rem;
  margin-top: 2.5rem;
  background:
    radial-gradient(circle at 50% 120%, rgba(212, 176, 76, .12), transparent 55%),
    #0A1412;
  border-top: 3px solid var(--brand-dark);
}

.footer-logo {
  width: 60px;
  height: 60px;
  margin: 0 auto .9rem;
  border-radius: 50%;
  border: 2px solid var(--brand-dark);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}

footer p { line-height: 1.8; }

footer a { color: var(--brand-light); text-decoration: none; }

footer a:hover { text-decoration: underline; }

footer code {
  font-family: var(--font-mono);
  font-size: .78rem;
  background: rgba(255, 255, 255, .08);
  padding: .1rem .35rem;
  border-radius: 4px;
}

/* ---------- Sub pages ---------- */
.step-intro {
  font-size: .9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  max-width: 760px;
}

/* Measure toolbar */
.measure-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.measure-btn { flex: 0 0 auto; }

.measure-btn-icon { font-size: 1.1rem; line-height: 1; }

.measure-btn.active {
  background: linear-gradient(180deg, #E08A66, #C05F3E);
  border-color: #A04A2E;
  color: #fff;
}

.measure-hint {
  font-size: .85rem;
  color: var(--text-muted);
  flex: 1 1 300px;
}

/* Measure instructions bubble */
.measure-instructions {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: .8rem 1rem;
  max-width: calc(100% - 2rem);
  width: 540px;
}

.measure-instructions-content {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.measure-instructions-content strong {
  color: var(--accent);
  font-size: .9rem;
}

.measure-instructions-content span { font-size: .85rem; }

.measure-instructions-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
}

/* Measure summary */
.measure-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: .75rem;
  margin-top: 1.25rem;
}

.measure-summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  box-shadow: var(--shadow);
}

.measure-summary-card .label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.measure-summary-card .value {
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: .88rem;
  font-variant-numeric: tabular-nums;
}

.value.elig-ok { color: var(--success); }
.value.elig-fail { color: var(--danger); }

/* Template box */
.measure-template-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.measure-template-wrap label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--water-dark);
  display: block;
  margin-bottom: .4rem;
  font-family: var(--font-display);
}

.measure-template-wrap textarea {
  width: 100%;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .8rem;
  line-height: 1.55;
  background: var(--bg-alt);
  color: var(--text);
  resize: vertical;
  white-space: pre;
  overflow-x: auto;
}

.measure-template-actions {
  display: flex;
  gap: .75rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.measure-template-actions .btn { flex: 0 0 auto; }

/* Submit form */
.submit-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.submit-form fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  background: var(--card);
  box-shadow: var(--shadow);
}

.submit-form legend {
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .05em;
  color: var(--brand-dark);
  background: var(--card);
  padding: 0 .75rem;
  border: 1px solid var(--border);
  border-radius: 100px;
  line-height: 2;
}

[data-theme="dark"] .submit-form legend { color: var(--brand-light); }

.submit-form .form-row {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.submit-form .form-row:last-child { margin-bottom: 0; }

.submit-form .form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.submit-form .form-row-2 > div {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}

.submit-form label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}

.submit-form .req { color: var(--danger); font-weight: 700; }

.submit-form input[type="text"],
.submit-form input[type="email"],
.submit-form input[type="tel"],
.submit-form input[type="url"],
.submit-form select,
.submit-form textarea {
  width: 100%;
  padding: .62rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font-body);
  background: var(--card);
  color: var(--text);
  transition: all var(--transition);
}

.submit-form textarea { resize: vertical; }

.submit-form input:focus,
.submit-form select:focus,
.submit-form textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}

.submit-form small {
  font-size: .78rem;
  color: var(--text-muted);
}

.submit-form .form-check {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  padding: .55rem 0;
  border-bottom: 1px solid var(--border);
}

.submit-form .form-check:last-child { border-bottom: none; }

.submit-form .form-check input[type="checkbox"] {
  margin-top: .25rem;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  accent-color: var(--brand);
  cursor: pointer;
}

.submit-form .form-check label {
  font-size: .88rem;
  font-weight: 400;
  cursor: pointer;
}

.submit-warn {
  margin-top: 1rem;
  padding: .8rem 1rem;
  background: rgba(245, 158, 11, .14);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  color: #B45309;
  font-size: .85rem;
  font-weight: 500;
}

[data-theme="dark"] .submit-warn { color: #F6C96A; }

/* Map search bar overlay (submit page) */
.map-search-bar {
  position: absolute;
  top: 12px;
  left: 54px;
  right: 64px;
  max-width: 360px;
  z-index: 1000;
  display: flex;
  gap: 6px;
  background: var(--card);
  padding: 6px;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.map-search-bar input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: .85rem;
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.map-search-bar input:focus { border-color: var(--brand); }

.map-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  max-height: 220px;
  overflow-y: auto;
  z-index: 1001;
}

.map-search-item {
  padding: 8px 12px;
  font-size: .82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  line-height: 1.3;
}

.map-search-item:last-child { border-bottom: none; }

.map-search-item:hover {
  background: var(--bg-alt);
  color: var(--brand-dark);
}

[data-theme="dark"] .map-search-item:hover { color: var(--brand-light); }

/* Verify page maps */
#measureMap { height: 520px; width: 100%; }
#verifyMap { height: 520px; width: 100%; }

.verify-actions {
  margin-top: 1.25rem;
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

/* ---------- PWA install banner ---------- */
.pwa-install-banner {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1500;
  background: var(--card);
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .75rem 1rem;
  max-width: 420px;
  width: calc(100% - 2rem);
  animation: slideUp .3s ease-out;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(20px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.pwa-install-content {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.pwa-install-content img {
  border-radius: 8px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.pwa-install-text {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.pwa-install-text strong { font-size: .9rem; }

.pwa-install-text span { font-size: .78rem; color: var(--text-muted); }

.pwa-install-content .btn {
  padding: .5rem 1rem;
  font-size: .85rem;
  flex: 0 0 auto;
}

.pwa-install-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  padding: 0 .25rem;
  line-height: 1;
}

.pwa-install-close:hover { color: var(--text); }

/* ---------- Leaflet overrides ---------- */
.leaflet-popup-content-wrapper {
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  background: var(--card);
  color: var(--text);
}

.leaflet-popup-content {
  margin: .75rem .85rem;
  font-family: var(--font-body);
}

.leaflet-popup-tip { background: var(--card); }

.leaflet-popup-content .popup-code {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--brand-dark);
  font-size: .78rem;
  letter-spacing: .03em;
}

[data-theme="dark"] .leaflet-popup-content .popup-code { color: var(--brand-light); }

.leaflet-popup-content .popup-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .98rem;
  margin: .15rem 0;
}

.leaflet-popup-content .popup-state {
  color: var(--text-muted);
  font-size: .8rem;
}

.leaflet-popup-content .popup-desc {
  margin-top: .45rem;
  font-size: .78rem;
  line-height: 1.45;
  color: var(--text-muted);
  border-top: 1px dashed var(--border);
  padding-top: .45rem;
  max-width: 240px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.leaflet-container { font-family: var(--font-body); }

.leaflet-bar a,
.leaflet-bar a:hover {
  background: var(--card);
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

.leaflet-bar a:hover { background: var(--bg-alt); }

.leaflet-control-layers {
  background: var(--card) !important;
  color: var(--text);
  border: 1px solid var(--border) !important;
  border-radius: var(--radius-sm) !important;
  box-shadow: var(--shadow) !important;
}

.leaflet-control-layers-expanded { padding: .5rem .65rem !important; }

.leaflet-control-layers-label { color: var(--text-muted); }

.leaflet-control-layers-overlays label,
.leaflet-control-layers-base label { color: var(--text); font-size: .82rem; }

/* Permanent region labels on the map */
.region-label-tooltip {
  background: transparent;
  border: none;
  box-shadow: none;
  color: var(--water-dark);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-shadow: 0 1px 3px rgba(255, 255, 255, .9), 0 0 1px rgba(255, 255, 255, .9);
  white-space: nowrap;
}

[data-theme="dark"] .region-label-tooltip {
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8), 0 0 1px rgba(0, 0, 0, .8);
}

.region-label-tooltip::before { display: none; }

/* ---------- Animations ---------- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn .4s ease-out; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-alt); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { padding: 5.25rem 1rem 6rem; }
  .hero-sm { padding: 5.25rem 1rem 4.5rem; }
}

@media (max-width: 768px) {
  .site-nav { padding: .8rem 1rem; }
  .site-nav-links a { padding: .4rem .6rem; font-size: .84rem; }
  .site-brand span { display: none; }

  .stats-bar { grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: -2.6rem; }
  .card-grid { grid-template-columns: 1fr; }
  #map { height: 380px; }

  .cell-coords, thead th:nth-child(6) { display: none; }
  td:nth-child(6) { display: none; }

  .toolbar { gap: .5rem; }
  .search-box { flex: 1 1 100%; }
  .section { padding: 2.25rem 0 .75rem; }
  .about-grid { grid-template-columns: 1fr; }
  .about-links { flex-direction: column; }
  .about-links .btn { text-align: center; }
  .submit-form .form-row-2 { grid-template-columns: 1fr; }
  .submit-cta { flex-direction: column; align-items: flex-start; }
  .measure-template-actions { flex-direction: column; }
  #measureMap, #verifyMap { height: 380px; }
  .measure-instructions { width: calc(100% - 1rem); }
  .map-search-bar { left: 10px; top: 10px; right: 60px; max-width: none; }
}

@media (max-width: 480px) {
  .stats-bar { gap: .5rem; }
  .stat-card { padding: 1rem .5rem; }
  .stat-card .stat-value { font-size: 1.6rem; }
  .view-toggle button { padding: .62rem .7rem; font-size: .8rem; }
  .hero-cta .btn { flex: 1 1 100%; }
}
