:root {
  --ink: #17211c;
  --ink-2: #24312a;
  --muted: #5b6860;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --line: #d8ded8;
  --line-2: #e7ebe6;
  --accent: #b4472d;
  --green: #2e7d50;
  --yellow: #f5c044;
  --orange: #ed861f;
  --red: #c62828;
  --nav-h: 60px;
  --shadow: 0 8px 26px rgba(20, 30, 24, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: inherit; text-underline-offset: 3px; }
h1, h2, h3, h4 { font-family: Georgia, "Times New Roman", serif; line-height: 1.04; letter-spacing: -.02em; margin: 0 0 .6em; text-wrap: balance; }
p { line-height: 1.65; text-wrap: pretty; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.container { width: min(1200px, 100% - 2.5rem); margin-inline: auto; }
.kicker { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--accent); margin-bottom: 1rem; }

/* ---------- navbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  height: var(--nav-h);
  display: flex; align-items: center;
  background: rgba(247, 248, 245, .86);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .container { display: flex; align-items: center; gap: 1.5rem; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.brand .mark { width: 26px; height: 26px; border-radius: 6px; background: linear-gradient(135deg, var(--green), var(--yellow) 40%, var(--orange) 70%, var(--red)); }
.brand small { display: block; font-weight: 600; font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.nav-links { margin-left: auto; display: flex; align-items: center; gap: .3rem; }
.nav-links a { text-decoration: none; padding: .5rem .75rem; border-radius: 8px; font-size: .9rem; font-weight: 600; color: var(--ink-2); }
.nav-links a:hover { background: var(--line-2); }
.nav-links a[aria-current="page"] { color: var(--accent); }
.nav-links a.cta { background: var(--ink); color: #fff; }
.nav-links a.cta:hover { background: var(--accent); }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 8px; padding: .4rem .6rem; font-size: 1rem; cursor: pointer; }
@media (max-width: 760px) {
  .nav { height: auto; }
  .nav .container { flex-wrap: wrap; padding-block: .6rem; }
  .nav-toggle { display: block; }
  .nav-links { display: none; width: 100%; flex-direction: column; align-items: stretch; gap: .1rem; margin-left: 0; padding-bottom: .4rem; }
  .nav-links.open { display: flex; }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: .5rem;
  padding: .8rem 1.15rem; border-radius: 10px; text-decoration: none;
  font-weight: 700; font-size: .92rem; border: 1px solid transparent; cursor: pointer;
  transition: transform .12s ease, background .15s ease, color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #9c3a24; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #000; }
.btn-ghost { border-color: var(--line); color: var(--ink); background: transparent; }
.btn-ghost:hover { background: var(--line-2); }
.on-dark .btn-ghost { color: #f6f8f4; border-color: rgba(255,255,255,.35); }
.on-dark .btn-ghost:hover { background: rgba(255,255,255,.1); }

/* ---------- hero (landing) ---------- */
.hero { background: #14211b; color: #f4f7f2; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; inset: 0; background: radial-gradient(700px 340px at 82% 12%, rgba(237,134,31,.22), transparent 62%), radial-gradient(600px 300px at 8% 96%, rgba(46,125,80,.22), transparent 60%); pointer-events: none; }
.hero .container { position: relative; z-index: 1; padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem); }
.hero h1 { font-size: clamp(2.6rem, 6.4vw, 5.4rem); max-width: 15ch; letter-spacing: -.035em; }
.hero .lede { font-size: clamp(1.05rem, 1.7vw, 1.35rem); max-width: 54ch; color: #cdd7cf; }
.hero .actions { display: flex; flex-wrap: wrap; gap: .8rem; margin-top: 2rem; }
.hero .sources { margin-top: 2.5rem; color: #9fb0a5; font-size: .78rem; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border-block: 1px solid var(--line); }
.stats .stat { background: var(--paper); padding: 1.4rem 1.5rem; }
.stats .stat strong { display: block; font-family: Georgia, serif; font-size: clamp(1.6rem, 3vw, 2.4rem); letter-spacing: -.02em; }
.stats .stat span { color: var(--muted); font-size: .82rem; }
@media (max-width: 760px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* ---------- sections ---------- */
.section { padding: clamp(2.8rem, 6vw, 5rem) 0; }
.section-head { max-width: 70ch; margin-bottom: 2rem; }
.section-head h2 { font-size: clamp(1.8rem, 3.4vw, 3rem); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; align-items: start; }
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 1.2rem 1.3rem; }
.card h3 { font-size: 1.05rem; }
.chip { display: inline-block; border: 1px solid var(--line); border-radius: 999px; padding: .16rem .55rem; margin: .15rem .3rem .15rem 0; font-size: .72rem; background: #fff; }
.chip.accent { border-color: var(--accent); color: var(--accent); }

.bar { height: 9px; background: var(--line-2); border-radius: 999px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }
.ramp { height: 10px; border-radius: 999px; background: linear-gradient(90deg, var(--green), var(--yellow), var(--orange), var(--red)); }
.ramp-labels { display: flex; justify-content: space-between; font-size: .7rem; color: var(--muted); margin-top: .25rem; }

table.data { width: 100%; border-collapse: collapse; font-size: .86rem; }
table.data th, table.data td { border-bottom: 1px solid var(--line-2); padding: .55rem .4rem; text-align: left; vertical-align: top; }
table.data th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- landing: geopark explorer ---------- */
.explore .map-frame { height: 520px; }
.explore-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
@media (max-width: 900px) { .explore-cards { grid-template-columns: 1fr; } }
.map-frame { position: relative; height: 480px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #10201a; }
.map-frame .maplibregl-popup-content, .map .maplibregl-popup-content { font: inherit; }
@media (max-width: 900px) { .map-frame { height: 380px; } }
.gp-list { max-height: 480px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); }
.gp-item { display: flex; align-items: center; gap: .7rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line-2); cursor: pointer; }
.gp-item:last-child { border-bottom: 0; }
.gp-item:hover, .gp-item.active { background: #f1f4ef; }
.gp-item .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; background: var(--accent); }
.gp-item .nm { font-weight: 600; font-size: .9rem; line-height: 1.25; }
.gp-item .rg { font-size: .72rem; color: var(--muted); }

.gs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.gs-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: .8rem .9rem; cursor: pointer; transition: box-shadow .15s ease, transform .12s ease; }
.gs-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.gs-card .id { font-size: .7rem; color: var(--accent); font-weight: 700; letter-spacing: .06em; }
.gs-card h4 { font-family: Georgia, serif; font-size: 1rem; margin: .25rem 0 .2rem; }
.gs-card .tag { font-size: .72rem; color: var(--muted); }
.gs-card .hz { margin-top: .5rem; display: flex; flex-wrap: wrap; gap: .3rem; }
.gs-card .hz span { font-size: .68rem; border: 1px solid var(--line); border-radius: 999px; padding: .1rem .45rem; }
.gs-card .hz span.lead { border-color: var(--accent); color: var(--accent); }

/* ---------- dashboard ---------- */
.dash { display: grid; grid-template-columns: 320px 1fr; grid-template-rows: 1fr auto; gap: 0; height: calc(100vh - var(--nav-h)); }
.sidebar { border-right: 1px solid var(--line); background: var(--panel); overflow: auto; padding: 1rem; }
.sidebar h4 { font-family: Inter, sans-serif; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 1.1rem 0 .5rem; }
.sidebar h4:first-child { margin-top: 0; }
select, .select { width: 100%; padding: .6rem .7rem; border: 1px solid var(--line); border-radius: 9px; background: #fff; font: inherit; font-size: .9rem; }
.layer-btn { display: flex; align-items: center; gap: .5rem; width: 100%; text-align: left; padding: .5rem .55rem; margin: .16rem 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; font: inherit; font-size: .82rem; }
.layer-btn .dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--orange); flex: none; }
.layer-btn[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }
.legend-box { border: 1px solid var(--line); border-radius: 9px; padding: .6rem .7rem; font-size: .74rem; color: var(--muted); }
.map-wrap { position: relative; }
.map { position: absolute; inset: 0; }
.map-wrap .badge { position: absolute; top: 12px; left: 12px; z-index: 3; background: rgba(247,248,245,.94); border: 1px solid rgba(23,33,28,.14); border-radius: 8px; padding: .5rem .7rem; font-size: .8rem; font-weight: 700; box-shadow: var(--shadow); }
.map .maplibregl-ctrl-attrib { font-size: 10px; }

.panel { grid-column: 1 / -1; border-top: 1px solid var(--line); background: var(--panel); display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 0; height: 300px; overflow: hidden; }
.panel > div { overflow: auto; padding: 1rem 1.1rem; border-right: 1px solid var(--line-2); }
.panel > div:last-child { border-right: 0; }
.panel h3 { font-size: 1rem; margin-bottom: .4rem; }
@media (max-width: 980px) {
  .dash { grid-template-columns: 1fr; grid-template-rows: auto 60vh auto; height: auto; }
  .sidebar { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; }
  .panel { grid-template-columns: 1fr; height: auto; }
  .panel > div { border-right: 0; border-bottom: 1px solid var(--line-2); }
}

.hz-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: .5rem; padding: .3rem 0; font-size: .84rem; }
.hz-row .nm { display: flex; justify-content: space-between; gap: .6rem; grid-column: 1 / -1; }
.hz-row .nm b { font-variant-numeric: tabular-nums; }
.trend { width: 100%; height: 120px; display: block; overflow: visible; }
.trend .axis { stroke: var(--line); stroke-width: 1; }
.trend .axis-label { fill: var(--muted); font-size: 10px; }
.trend .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.trend .area { fill: rgba(180,71,45,.10); stroke: none; }

.footer { background: #14211b; color: #cdd7cf; padding: 2.6rem 0; }
.footer a { color: #f2b39e; }
.footer .container { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; align-items: center; }
.footer .small { color: #9fb0a5; }

.callout { background: #eef2ec; border: 1px solid var(--line); border-radius: 10px; padding: .9rem 1rem; line-height: 1.55; font-size: .9rem; }
.source { font-size: .78rem; color: var(--muted); margin-top: .8rem; line-height: 1.5; }

@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.reveal { animation: fade-up .5s ease both; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { animation: none; }
}
