/* shadcn/ui-style design tokens (mimicked in plain CSS, no build step) */
:root{
  --background:215 28% 96%;
  --foreground:222 22% 14%;
  --card:0 0% 100%;
  --card-foreground:222 22% 14%;
  --primary:222 30% 14%;
  --primary-foreground:0 0% 98%;
  --secondary:215 20% 92%;
  --secondary-foreground:222 22% 16%;
  --muted:215 22% 93%;
  --muted-foreground:218 12% 42%;
  --accent:215 22% 91%;
  --accent-foreground:222 22% 16%;
  --border:216 16% 86%;
  --input:216 16% 86%;
  --ring:222 30% 30%;
  --radius:0.5rem;
  --shadow-sm:0 1px 2px 0 hsl(240 5% 10% / .05);
  --shadow:0 1px 3px 0 hsl(240 5% 10% / .1),0 1px 2px -1px hsl(240 5% 10% / .1);
}
[data-theme="dark"]{
  --background:222 24% 6%;
  --foreground:210 20% 96%;
  --card:222 18% 11%;
  --card-foreground:210 20% 96%;
  --primary:0 0% 98%;
  --primary-foreground:222 30% 12%;
  --secondary:222 14% 17%;
  --secondary-foreground:210 20% 96%;
  --muted:222 14% 16%;
  --muted-foreground:217 12% 64%;
  --accent:222 14% 18%;
  --accent-foreground:210 20% 96%;
  --border:222 14% 19%;
  --input:222 14% 19%;
  --ring:210 20% 70%;
  --shadow-sm:0 1px 2px 0 hsl(0 0% 0% / .3);
  --shadow:0 1px 3px 0 hsl(0 0% 0% / .4),0 1px 2px -1px hsl(0 0% 0% / .4);
}

*{box-sizing:border-box;margin:0;padding:0}
html{overflow-x:hidden}            /* guard: nothing causes sideways scroll on mobile */
img,svg{max-width:100%}
body{
  font-family:"Inter",-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif;
  background:hsl(var(--background));color:hsl(var(--foreground));
  line-height:1.55;font-size:15px;-webkit-font-smoothing:antialiased;
  transition:background .2s,color .2s;
}

/* ---------- shared nav header ---------- */
.nav{
  background:hsl(var(--card));border-bottom:1px solid hsl(var(--border));
  position:sticky;top:0;z-index:1000;
}
.nav-inner{
  max-width:1180px;margin:0 auto;padding:12px 26px;
  display:grid;grid-template-columns:1fr auto 1fr;align-items:center;gap:22px;
}
.brand{justify-self:start}
.navlinks{justify-self:center;display:flex;gap:4px}
.navlinks a{
  color:hsl(var(--muted-foreground));text-decoration:none;font-size:13.5px;font-weight:500;
  padding:7px 12px;border-radius:calc(var(--radius) - 2px);transition:.15s;
}
.navlinks a:hover{color:hsl(var(--foreground));background:hsl(var(--accent))}
.navlinks a.active{color:hsl(var(--foreground));background:hsl(var(--secondary))}
.navctl{display:flex;align-items:center;gap:10px;justify-self:end}

.brand{display:flex;flex-direction:column;align-items:flex-start;gap:1px;text-decoration:none}
.wordmark{height:30px;width:auto;display:block}
.wordmark text{font-family:"Inter",sans-serif;font-size:16px;font-weight:700;letter-spacing:-.015em}
.wordmark .mark rect{fill:hsl(var(--foreground))}
.wm-strong{fill:hsl(var(--foreground))}
.wm-muted{fill:hsl(var(--muted-foreground));font-weight:500}
.tagline{color:hsl(var(--muted-foreground));font-size:13px}
.brand-sub{font-size:11.5px;font-weight:500;letter-spacing:.02em;color:hsl(var(--muted-foreground));margin-top:2px}

.datasets{display:flex;gap:4px;margin-left:auto;background:hsl(var(--muted));padding:4px;border-radius:var(--radius)}
.ds{
  background:transparent;border:none;color:hsl(var(--muted-foreground));
  padding:6px 13px;border-radius:calc(var(--radius) - 2px);cursor:pointer;
  font-size:13px;font-weight:500;font-family:inherit;transition:.15s;
}
.ds:hover:not(:disabled){color:hsl(var(--foreground))}
.ds.active{background:hsl(var(--background));color:hsl(var(--foreground));box-shadow:var(--shadow-sm)}
.ds.soon{opacity:.55;cursor:default}
.ds.soon span{font-size:9px;text-transform:uppercase;letter-spacing:.03em;
  background:hsl(var(--secondary));color:hsl(var(--muted-foreground));padding:1px 5px;border-radius:5px;margin-left:5px}

/* icon + toggle buttons */
.iconbtn,.langtoggle button{
  font-family:inherit;cursor:pointer;border:1px solid hsl(var(--border));
  background:hsl(var(--background));color:hsl(var(--foreground));
}
.iconbtn{width:36px;height:36px;border-radius:var(--radius);font-size:15px;
  display:inline-flex;align-items:center;justify-content:center;flex:none}
.iconbtn:hover{background:hsl(var(--accent))}
.langtoggle{display:inline-flex;border:1px solid hsl(var(--border));border-radius:var(--radius);overflow:hidden}
.langtoggle button{border:none;padding:8px 11px;font-size:12px;font-weight:600;color:hsl(var(--muted-foreground))}
.langtoggle button.active{background:hsl(var(--primary));color:hsl(var(--primary-foreground))}

/* ---------- layout ---------- */
main{max-width:1180px;margin:0 auto;padding:26px 26px 64px}
.intro{margin-bottom:20px}
.intro h2{font-size:24px;font-weight:600;letter-spacing:-.02em;margin-bottom:5px}
.intro p{color:hsl(var(--muted-foreground));max-width:700px}

/* card primitive */
.kpi,.controls,.tablewrap{
  background:hsl(var(--card));border:1px solid hsl(var(--border));
  border-radius:var(--radius);box-shadow:var(--shadow-sm);
}

.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:14px;margin-bottom:20px}
.kpi{padding:16px 18px;min-width:0}
.kpi .lbl{color:hsl(var(--muted-foreground));font-size:11px;font-weight:500;text-transform:uppercase;letter-spacing:.04em}
.kpi .val{font-size:26px;font-weight:700;margin-top:6px;font-variant-numeric:tabular-nums;letter-spacing:-.02em}

.controls{display:flex;gap:24px;align-items:flex-end;flex-wrap:wrap;padding:16px 18px;margin-bottom:16px}
.filtergroup label{display:block;color:hsl(var(--muted-foreground));font-size:11px;font-weight:500;
  text-transform:uppercase;letter-spacing:.04em;margin-bottom:8px}
.chips{display:flex;gap:6px;flex-wrap:wrap}
.chip{
  border:1px solid hsl(var(--border));background:hsl(var(--background));color:hsl(var(--foreground));
  padding:5px 11px;border-radius:9999px;cursor:pointer;font-size:12px;font-weight:500;font-family:inherit;
  display:flex;align-items:center;gap:6px;transition:.15s;
}
.chip:hover{background:hsl(var(--accent))}
.chip .dot{width:9px;height:9px;border-radius:50%}
.chip.off{opacity:.45}
.years{display:flex;align-items:center;gap:8px;color:hsl(var(--muted-foreground))}
/* must out-specify `.filtergroup label` (which is display:block + uppercase) */
.filtergroup label.checkrow{display:inline-flex;align-items:center;gap:8px;font-size:13.5px;cursor:pointer;
  color:hsl(var(--foreground));height:38px;margin-bottom:0;
  text-transform:none;letter-spacing:normal;font-weight:400}
.checkrow input{width:16px;height:16px;accent-color:hsl(var(--primary));cursor:pointer;flex:none}

select{
  font-family:inherit;font-size:13px;background:hsl(var(--background));color:hsl(var(--foreground));
  border:1px solid hsl(var(--input));border-radius:calc(var(--radius) - 2px);
  height:38px;padding:0 10px;cursor:pointer;
}
select:focus{outline:none;box-shadow:0 0 0 2px hsl(var(--ring) / .35)}

.reset{
  margin-left:auto;font-family:inherit;font-size:13px;font-weight:500;cursor:pointer;
  background:hsl(var(--background));border:1px solid hsl(var(--border));color:hsl(var(--foreground));
  padding:8px 15px;border-radius:calc(var(--radius) - 2px);
}
.reset:hover{background:hsl(var(--accent))}

.resultbar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px;min-height:30px}
.rb-count{font-size:14px;font-weight:600}
.rb-chip{display:inline-flex;align-items:center;gap:7px;font-size:12.5px;
  background:hsl(var(--secondary));color:hsl(var(--secondary-foreground));
  border:1px solid hsl(var(--border));border-radius:9999px;padding:4px 6px 4px 11px}
.rb-chip button{border:none;background:hsl(var(--muted-foreground) / .2);color:inherit;cursor:pointer;
  width:18px;height:18px;border-radius:50%;font-size:12px;line-height:1;display:flex;align-items:center;justify-content:center}
.rb-chip button:hover{background:hsl(var(--muted-foreground) / .4)}
.rb-note{font-size:13px;color:hsl(var(--muted-foreground))}
.rb-clear{font-size:12.5px;font-weight:500;cursor:pointer;background:none;border:none;
  color:hsl(var(--muted-foreground));text-decoration:underline;text-underline-offset:2px;padding:0}
.rb-clear:hover{color:hsl(var(--foreground))}
#map{height:440px;border-radius:var(--radius);border:1px solid hsl(var(--border));margin-bottom:8px;z-index:1}
.maphint{color:hsl(var(--muted-foreground));font-size:12.5px;margin-bottom:26px}

.tablewrap{overflow:hidden}
.tablehead{padding:15px 18px;border-bottom:1px solid hsl(var(--border))}
.tablehead h3{font-size:15px;font-weight:600}
.tablehead span{color:hsl(var(--muted-foreground));font-weight:400;font-size:13px}
.scroll{max-height:460px;overflow-y:auto}
table{width:100%;border-collapse:collapse;font-size:13px}
th,td{text-align:left;padding:11px 16px;border-bottom:1px solid hsl(var(--border))}
th{color:hsl(var(--muted-foreground));font-size:11px;font-weight:500;text-transform:uppercase;letter-spacing:.04em;
  cursor:pointer;position:sticky;top:0;background:hsl(var(--card));white-space:nowrap}
th[data-sort]:hover{color:hsl(var(--foreground))}
td.num,th.num{text-align:right;font-variant-numeric:tabular-nums}
tbody tr:hover{background:hsl(var(--muted) / .5)}
tbody tr:last-child td{border-bottom:none}
.pill{display:inline-flex;align-items:center;gap:6px}
.pill .dot{width:9px;height:9px;border-radius:50%}

footer{margin-top:26px;color:hsl(var(--muted-foreground));font-size:12px;
  border-top:1px solid hsl(var(--border));padding-top:14px}
footer a{color:hsl(var(--foreground));text-underline-offset:2px}

/* leaflet */
.leaflet-popup-content{font-size:13px;line-height:1.5;font-family:inherit}
.leaflet-popup-content-wrapper,.leaflet-popup-tip{
  background:hsl(var(--card));color:hsl(var(--card-foreground));box-shadow:var(--shadow)}
.legend{background:hsl(var(--card));color:hsl(var(--card-foreground));padding:9px 12px;
  border-radius:var(--radius);border:1px solid hsl(var(--border));font-size:11.5px;line-height:1.8;box-shadow:var(--shadow-sm)}
.legend .dot{display:inline-block;width:10px;height:10px;border-radius:50%;margin-right:7px}

/* ---------- dataset bar (explorer secondary nav) ---------- */
.datasetbar{display:flex;gap:4px;background:hsl(var(--muted));padding:4px;border-radius:var(--radius);
  margin-bottom:22px;width:fit-content;max-width:100%;overflow-x:auto}

/* ---------- site footer ---------- */
.sitefooter{margin-top:64px;border-top:1px solid hsl(var(--border));background:hsl(var(--card))}
.footgrid{max-width:1180px;margin:0 auto;padding:36px 26px 28px;display:grid;
  grid-template-columns:1.6fr 1fr 1fr 1.4fr;gap:28px}
.footbrand .wordmark{height:22px}
.footbrand p{color:hsl(var(--muted-foreground));font-size:13px;margin-top:8px;max-width:240px}
.sitefooter h4{font-size:12px;text-transform:uppercase;letter-spacing:.05em;color:hsl(var(--muted-foreground));margin-bottom:10px}
.sitefooter a{display:block;color:hsl(var(--foreground));text-decoration:none;font-size:13.5px;padding:3px 0}
.sitefooter a:hover{color:hsl(var(--muted-foreground))}
.sitefooter .muted{color:hsl(var(--muted-foreground));font-size:13px;line-height:1.7}
.footbottom{max-width:1180px;margin:0 auto;padding:16px 26px;border-top:1px solid hsl(var(--border));
  display:flex;justify-content:space-between;gap:12px;flex-wrap:wrap;align-items:center;
  color:hsl(var(--muted-foreground));font-size:12.5px}
.footproject{display:inline-flex;align-items:center;gap:8px}
.footlogo{height:22px;width:auto;background:#fff;border-radius:4px;padding:3px 6px;vertical-align:middle}

/* ---------- landing hero ---------- */
.hero{max-width:720px;margin:0 auto;padding:84px 26px 48px;text-align:center}
.hero .wordmark{height:50px;margin:0 auto 8px}
.hero .hero-sub{font-size:13px;font-weight:500;letter-spacing:.04em;text-transform:uppercase;
  color:hsl(var(--muted-foreground));margin-bottom:26px}
.hero h1{font-size:33px;font-weight:700;letter-spacing:-.02em;margin-bottom:14px;line-height:1.2}
.hero p.lead{color:hsl(var(--muted-foreground));font-size:17px;max-width:560px;margin:0 auto 30px}
.searchbar{display:flex;gap:10px;max-width:520px;margin:0 auto}
.searchbar input{flex:1;font-family:inherit;font-size:15px;background:hsl(var(--background));
  color:hsl(var(--foreground));border:1px solid hsl(var(--input));border-radius:var(--radius);padding:12px 15px}
.searchbar input:focus{outline:none;box-shadow:0 0 0 3px hsl(var(--ring) / .3)}
.searchbar button{font-family:inherit;font-size:14px;font-weight:600;cursor:pointer;
  background:hsl(var(--primary));color:hsl(var(--primary-foreground));border:none;
  border-radius:var(--radius);padding:0 20px}
.searchbar button:hover{opacity:.9}
.herohint{color:hsl(var(--muted-foreground));font-size:13.5px;margin-top:16px}
.herohint a{color:hsl(var(--foreground))}

/* ---------- "explore the data" cards (home hierarchy) ---------- */
.explore{max-width:1180px;margin:0 auto;padding:8px 26px 10px}
.section-title{text-align:center;margin-bottom:6px}
.section-title h2{font-size:22px;font-weight:700;letter-spacing:-.01em}
.section-title p{color:hsl(var(--muted-foreground));font-size:14.5px;margin-top:6px}
.ecards{display:grid;grid-template-columns:repeat(4,1fr);gap:16px;margin-top:26px}
.ecard{display:flex;flex-direction:column;gap:10px;padding:20px 18px;text-decoration:none;
  background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:var(--radius);box-shadow:var(--shadow-sm)}
a.ecard:hover{border-color:hsl(var(--foreground) / .35);transform:translateY(-2px);transition:.15s}
.ecard.soon{opacity:.62}
.ecard .eicon{color:hsl(var(--foreground))}
.ecard h3{font-size:16px;font-weight:600}
.ecard p{font-size:13.5px;color:hsl(var(--muted-foreground));flex:1}
.ebadge{align-self:flex-start;font-size:11px;font-weight:600;text-transform:uppercase;letter-spacing:.04em;
  padding:3px 9px;border-radius:9999px}
.ebadge.on{background:hsl(142 60% 92%);color:hsl(142 70% 24%)}
[data-theme="dark"] .ebadge.on{background:hsl(142 40% 18%);color:hsl(142 55% 70%)}
.ebadge.off{background:hsl(var(--secondary));color:hsl(var(--muted-foreground))}

/* ---------- autocomplete ---------- */
.ac-wrap{position:relative}
.searchbar .ac-wrap{flex:1}
/* explorer place search: keep the field a sensible width, not full card width */
.controls .filtergroup .ac-wrap{width:100%;max-width:440px}
.ac-wrap > input{width:100%}
.ac-list{position:absolute;top:calc(100% + 5px);left:0;right:0;z-index:1200;
  background:hsl(var(--card));border:1px solid hsl(var(--border));border-radius:var(--radius);
  box-shadow:var(--shadow);max-height:300px;overflow-y:auto;text-align:left}
.ac-item{display:flex;align-items:baseline;justify-content:space-between;gap:12px;
  padding:9px 13px;cursor:pointer;border-bottom:1px solid hsl(var(--border))}
.ac-item:last-child{border-bottom:none}
.ac-item:hover,.ac-item.active{background:hsl(var(--accent))}
.ac-name{font-size:14.5px;font-weight:500;color:hsl(var(--foreground))}
.ac-parent{font-size:12.5px;color:hsl(var(--muted-foreground));white-space:nowrap}

/* ---------- partners strip (tertiary, de-emphasized) ---------- */
.section{max-width:1180px;margin:0 auto;padding:30px 26px}
.partners-wrap{margin-top:40px;border-top:1px solid hsl(var(--border));padding-top:14px}
.section h2{font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:hsl(var(--muted-foreground));
  text-align:center;margin-bottom:22px;font-weight:600}
.logos{display:flex;flex-wrap:wrap;justify-content:center;gap:16px}
.logo{height:88px;min-width:min(172px,100%);display:flex;align-items:center;justify-content:center;
  background:#fff;border:1px solid hsl(var(--border));border-radius:var(--radius);
  padding:16px 24px;transition:.15s;text-decoration:none}
a.logo:hover{box-shadow:var(--shadow);transform:translateY(-1px)}
.logo img{max-height:52px;max-width:220px;width:auto;object-fit:contain;display:block}
.logo.featured{height:120px;min-width:min(280px,100%)}
.logo.featured img{max-height:72px;max-width:280px}
.logo-ph{height:64px;min-width:150px;display:flex;align-items:center;justify-content:center;
  border:1px dashed hsl(var(--border));border-radius:var(--radius);color:hsl(var(--muted-foreground));
  font-size:12.5px;background:hsl(var(--card))}
.author-line{text-align:center;color:hsl(var(--muted-foreground));font-size:13px;margin-bottom:16px}
.ownbrands{margin-top:30px}

/* ---------- prose (about / legal) ---------- */
.prose{max-width:760px;margin:0 auto;padding:40px 26px 20px}
.prose h1{font-size:28px;font-weight:700;letter-spacing:-.02em;margin-bottom:6px}
.prose .updated{color:hsl(var(--muted-foreground));font-size:12.5px;margin-bottom:28px}
.prose h2{font-size:18px;font-weight:600;margin:30px 0 10px}
.prose p{margin-bottom:14px;color:hsl(var(--foreground))}
.prose ul{margin:0 0 16px 20px}
.prose li{margin-bottom:7px}
.prose a{color:hsl(var(--foreground));text-underline-offset:2px}
.prose .muted{color:hsl(var(--muted-foreground))}
.callout{background:hsl(var(--muted) / .5);border:1px solid hsl(var(--border));
  border-radius:var(--radius);padding:14px 16px;font-size:13px;color:hsl(var(--muted-foreground));margin:18px 0}

/* ---------- responsive ---------- */
@media(max-width:760px){
  .nav-inner{display:flex;flex-wrap:wrap;gap:10px 12px;padding:10px 16px}
  .brand{flex:1 1 auto;min-width:0}
  .navlinks{justify-self:auto}
  .navctl{order:2;flex:none}
  .navlinks{order:3;width:100%;gap:2px;overflow-x:auto;-webkit-overflow-scrolling:touch;
    padding-bottom:2px;border-top:1px solid hsl(var(--border));padding-top:8px}
  .navlinks a{white-space:nowrap}
  .footgrid{grid-template-columns:1fr 1fr;gap:22px}
  .hero{padding:60px 20px 30px}
  .hero h1{font-size:24px}
  .searchbar{flex-direction:column}
  .searchbar button{padding:12px}
}
@media(max-width:430px){ .footgrid{grid-template-columns:1fr} }
@media(max-width:900px){
  main{padding:22px 18px 56px}
  .controls{gap:18px}
  .ecards{grid-template-columns:repeat(2,1fr)}
}
@media(max-width:760px){
  header{gap:10px;padding:11px 16px}
  .brand{order:1}
  #themeToggle{order:2;margin-left:auto}
  .langtoggle{order:3}
  .datasets{order:4;width:100%;margin-left:0;overflow-x:auto;-webkit-overflow-scrolling:touch}
  .ds{white-space:nowrap}
  .intro h2{font-size:20px}
  .kpis{grid-template-columns:repeat(2,1fr);gap:10px}
  .kpi{padding:13px 14px}
  .kpi .val{font-size:21px}
  .controls{flex-direction:column;align-items:stretch;gap:14px}
  .filtergroup{width:100%}
  .years select{flex:1}
  .reset{margin-left:0;width:100%}
  #sizeBy{width:100%}
  #map{height:340px}
  /* let the table scroll sideways instead of squashing */
  .scroll{overflow-x:auto}
  table{min-width:560px}
}
@media(max-width:560px){ .ecards{grid-template-columns:1fr} }
@media(max-width:430px){
  .kpis{grid-template-columns:1fr 1fr}
  .kpi .val{font-size:17px;letter-spacing:-.02em}
  .wordmark{height:27px}
  #map{height:300px}
}
