:root {
  --ink: #0a1218;
  --ink-soft: #142028;
  --mist: #8fa3b0;
  --fog: #c5d2da;
  --paper: #e8eef2;
  --gold: #d4a04a;
  --gold-soft: #e6c07a;
  --teal: #3d7a7a;
  --line: rgba(232, 238, 242, 0.1);
  --card: rgba(14, 24, 32, 0.72);
  --font-display: "Instrument Serif", "Noto Serif SC", Georgia, serif;
  --font-body: "Noto Sans SC", "Helvetica Neue", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 960px;
  --header-h: 3rem;
  --mobile-nav-h: 3.25rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 0.5rem);
}

@media (max-width: 720px) {
  html {
    scroll-padding-bottom: calc(var(--mobile-nav-h) + var(--safe-bottom) + 0.5rem);
  }
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  background:
    radial-gradient(120% 80% at 50% -10%, #1a3340 0%, transparent 55%),
    linear-gradient(180deg, #071015 0%, var(--ink) 40%, #0d1820 100%);
  overflow-x: hidden;
  padding-bottom: calc(var(--mobile-nav-h) + var(--safe-bottom));
}

@media (min-width: 721px) {
  body {
    padding-bottom: 0;
  }
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

/* Header */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  padding: 0 clamp(0.85rem, 3vw, 1.5rem);
  background: rgba(7, 16, 21, 0.88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.15rem;
  letter-spacing: 0.01em;
}

.nav {
  display: none;
  gap: 1rem;
  font-size: 0.82rem;
  color: var(--fog);
}

.nav a {
  opacity: 0.7;
  transition: opacity 0.2s var(--ease);
}

.nav a:hover {
  opacity: 1;
}

@media (min-width: 721px) {
  .nav {
    display: flex;
  }
}

/* Mobile bottom nav */
.mobile-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  height: calc(var(--mobile-nav-h) + var(--safe-bottom));
  padding-bottom: var(--safe-bottom);
  background: rgba(7, 16, 21, 0.94);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}

.mobile-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  font-size: 0.68rem;
  color: var(--mist);
  transition: color 0.2s var(--ease);
}

.mobile-nav a:active,
.mobile-nav a:focus-visible {
  color: var(--gold-soft);
}

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

@media (min-width: 721px) {
  .mobile-nav {
    display: none;
  }
}

/* Hero — compact on mobile */
.hero {
  position: relative;
  min-height: clamp(36svh, 42svh, 52svh);
  display: grid;
  align-items: end;
  padding:
    calc(var(--header-h) + 1rem)
    clamp(0.85rem, 3vw, 1.5rem)
    clamp(1.25rem, 3.5vh, 2rem);
  isolation: isolate;
}

.hero-media {
  position: absolute;
  inset: 0;
  z-index: -1;
  overflow: hidden;
}

.hero-media canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(7, 16, 21, 0.25) 0%, rgba(7, 16, 21, 0.55) 55%, rgba(7, 16, 21, 0.92) 100%),
    linear-gradient(90deg, rgba(7, 16, 21, 0.4) 0%, transparent 55%);
  pointer-events: none;
}

.hero-content {
  max-width: 32rem;
  animation: rise-in 0.9s var(--ease) both;
}

.brand {
  margin: 0 0 0.4rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 6vw, 3rem);
  line-height: 1;
  letter-spacing: -0.02em;
}

.hero h1 {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  line-height: 1.3;
  color: var(--gold-soft);
}

.lede {
  margin: 0 0 1rem;
  color: var(--fog);
  font-size: 0.88rem;
  font-weight: 300;
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5rem;
  padding: 0.55rem 1rem;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.btn-primary {
  background: var(--gold);
  color: #1a1408;
  font-weight: 500;
}

.btn-primary:hover {
  background: var(--gold-soft);
}

.btn-ghost {
  border-color: rgba(232, 238, 242, 0.28);
  color: var(--paper);
  background: rgba(10, 18, 24, 0.35);
}

.btn-block {
  width: 100%;
}

/* Sections */
.section {
  padding: clamp(1.25rem, 3vh, 2rem) clamp(0.85rem, 3vw, 1.5rem);
}

.section-alt {
  background: rgba(20, 32, 40, 0.35);
}

.section-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.section-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3.5vw, 1.65rem);
  font-weight: 400;
  letter-spacing: -0.01em;
}

.section-desc {
  margin: 0;
  color: var(--mist);
  font-size: 0.78rem;
  font-weight: 400;
}

/* Cards */
.card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  padding: 0.85rem;
}

.data-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  overflow: hidden;
}

.data-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
}

@media (min-width: 540px) {
  .data-card-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .stat-chip-wide {
    grid-column: span 2;
  }
}

@media (min-width: 721px) {
  .stat-chip-wide {
    grid-column: span 1;
  }
}

.data-row {
  display: grid;
  grid-template-columns: minmax(4.5rem, 5.5rem) 1fr;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

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

.data-row-highlight {
  background: rgba(212, 160, 74, 0.06);
}

.data-label {
  color: var(--mist);
  font-size: 0.78rem;
  white-space: nowrap;
}

.data-values {
  display: flex;
  align-items: baseline;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  text-align: right;
  min-width: 0;
}

.data-values strong {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--paper);
}

.data-values-stack {
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}

.data-values-stack span {
  display: flex;
  align-items: baseline;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.data-values-stack em {
  display: inline-block;
  min-width: 1.1rem;
  color: var(--mist);
  font-style: normal;
  font-size: 0.72rem;
}

.data-values-stack strong {
  font-size: 0.88rem;
  font-weight: 500;
}

.data-sub {
  color: var(--mist);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.data-value-wide {
  font-size: 0.85rem !important;
  font-weight: 500 !important;
  line-height: 1.35;
  white-space: normal;
  word-break: break-word;
}

.stat-chip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border-radius: 8px;
  background: rgba(7, 16, 21, 0.45);
  border: 1px solid var(--line);
  min-width: 0;
}

.stat-chip .label {
  font-size: 0.68rem;
  margin: 0;
}

.stat-chip strong {
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  word-break: break-word;
}

.stat-chip-wide strong {
  font-size: 0.82rem;
  font-weight: 500;
}

/* Location */
.location-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

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

@media (min-width: 768px) {
  .location-layout.map-open {
    grid-template-columns: 0.85fr 1.15fr;
  }
}

.map-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.map-wrap[hidden] {
  display: none !important;
}

.map-hint {
  margin: 0;
}

.map {
  min-height: 220px;
  height: clamp(220px, 38vw, 320px);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  filter: saturate(0.85) contrast(1.05);
}

.location-panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.place-name {
  margin: 0.15rem 0 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.2;
}

.coords {
  margin: 0.1rem 0 0;
  color: var(--mist);
  font-variant-numeric: tabular-nums;
  font-size: 0.78rem;
}

.label {
  display: block;
  color: var(--mist);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.coord-form {
  display: grid;
  gap: 0.55rem;
}

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

.coord-form label {
  display: grid;
  gap: 0.25rem;
  color: var(--fog);
  font-size: 0.78rem;
}

.coord-form input {
  width: 100%;
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(7, 16, 21, 0.55);
  color: var(--paper);
  font-size: 0.88rem;
  outline: none;
}

.coord-form input:focus {
  border-color: rgba(212, 160, 74, 0.55);
}

.hint {
  margin: 0;
  color: var(--mist);
  font-size: 0.75rem;
  line-height: 1.4;
}

.footnote {
  margin: 0.65rem 0 0;
  color: var(--mist);
  font-size: 0.72rem;
  line-height: 1.45;
}

.chart-wrap {
  margin-top: 0.65rem;
  padding: 0.5rem 0.35rem 0.25rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#cloud-chart {
  width: 100%;
  min-width: 280px;
  height: auto;
  display: block;
}

.site-footer {
  padding: 1.25rem clamp(0.85rem, 3vw, 1.5rem) 1.5rem;
  border-top: 1px solid var(--line);
  text-align: center;
}

.site-footer p {
  margin: 0.15rem 0;
  font-size: 0.82rem;
}

.site-footer .muted {
  font-size: 0.72rem;
  color: var(--mist);
}

/* Leaflet */
.leaflet-container {
  background: #0d1820;
  font-family: var(--font-body);
  font-size: 11px;
}

.leaflet-control-zoom a {
  width: 28px !important;
  height: 28px !important;
  line-height: 28px !important;
}

.leaflet-control-attribution {
  background: rgba(7, 16, 21, 0.75) !important;
  color: var(--mist) !important;
  font-size: 9px !important;
}

.leaflet-control-attribution a {
  color: var(--fog) !important;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-content {
    animation: none;
  }
}
