/* GEMS Stakeholder Atlas
   One stylesheet. Tokens first, then layout, then each view. */

:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --surface: #ffffff;
  --surface-2: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .14);
  --accent: #0071e3;
  --accent-ink: #0066cc;
  --accent-soft: rgba(0, 113, 227, .10);
  --nav-bg: rgba(255, 255, 255, .8);
  --shadow-1: 0 0 0 1px rgba(0, 0, 0, .06), 0 2px 10px rgba(0, 0, 0, .04);
  --shadow-2: 0 4px 12px rgba(0, 0, 0, .06), 0 16px 40px rgba(0, 0, 0, .08);
  --shadow-sheet: 0 24px 80px rgba(0, 0, 0, .22);
  --r-sm: 10px;
  --r: 18px;
  --r-lg: 28px;
  --wrap: 1180px;
  --gutter: clamp(16px, 4vw, 40px);
  --nav-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "PingFang TC", "Noto Sans TC", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(.28, .11, .32, 1);

  /* category palette (Apple system colours, darkened where text sits on them) */
  --c-academia: #0071e3;
  --c-research: #5e5ce6;
  --c-government: #248a3d;
  --c-industry: #c75c00;
  --c-ngo: #d6245a;
  --c-education: #0a84a0;
  --c-community: #8a6d3b;
  --c-medical: #d70015;
  --c-igem: #a33dd1;
  --c-media: #6e6e73;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--nav-h) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.47 var(--font);
  letter-spacing: -.022em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
html[data-lang="zh"] body { letter-spacing: 0; }
img { max-width: 100%; display: block; }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.02em; }
p { margin: 0; }
.muted { color: var(--text-2); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

/* ---------- global nav ---------- */
.gnav {
  position: sticky; top: 0; z-index: 1000;
  height: var(--nav-h);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.gnav-inner {
  max-width: var(--wrap); height: 100%; margin: 0 auto; padding: 0 var(--gutter);
  display: flex; align-items: center; gap: 20px;
}
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); white-space: nowrap; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 24px; }
.brand-text b { font-weight: 700; }
.brand-text span { color: var(--text); font-weight: 600; }
.tabs { display: flex; gap: 4px; margin: 0 auto; }
.tabs a {
  color: var(--text); opacity: .8; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  transition: background .2s var(--ease), opacity .2s;
}
.tabs a:hover { text-decoration: none; opacity: 1; background: var(--line); }
.tabs a[aria-current="page"] { opacity: 1; background: var(--text); color: var(--bg); }

/* segmented control */
.seg {
  position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--line); border-radius: 9px; padding: 2px; isolation: isolate;
}
.seg button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  font-size: 12px; font-weight: 500; padding: 4px 12px; border-radius: 7px; min-width: 36px;
  color: var(--text-2); transition: color .2s;
}
.seg button[aria-pressed="true"] { color: var(--text); }
.seg-thumb {
  position: absolute; z-index: 0; top: 2px; bottom: 2px; left: 2px; border-radius: 7px;
  background: var(--surface); box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04);
  transition: transform .3s var(--ease), width .3s var(--ease);
}
.seg-sm button { font-size: 12px; padding: 5px 14px; }

/* buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 999px; cursor: pointer; font-size: 15px; padding: 11px 22px;
  transition: background .2s, opacity .2s, transform .15s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #0077ed; }
.btn-link { background: none; color: var(--accent-ink); padding: 11px 8px; }
.btn-link:hover span:first-child { text-decoration: underline; }
.btn-quiet { background: var(--surface); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); font-size: 13px; padding: 7px 14px; }
.btn-quiet:hover { background: var(--surface-2); }
.btn-quiet:disabled { opacity: .45; cursor: default; }
.btn-sm { font-size: 13px; padding: 8px 16px; }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--line); font-size: 11px; font-weight: 600;
}
.btn-quiet:not(:disabled) .badge { background: var(--accent); color: #fff; }

/* ---------- views ---------- */
.view { animation: fade .45s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- overview ---------- */
.hero { text-align: center; padding: clamp(56px, 9vw, 112px) var(--gutter) clamp(40px, 6vw, 72px); }
.hero-logo { margin: 0; }

/* GEMS Academy lockup: one teal line (gem + heart) and an outlined Inter Display wordmark.
   Colours live on the SVG itself; these rules only size it and animate it. */
.gems-logo { display: block; width: min(780px, 88vw); height: auto; margin: 0 auto; overflow: visible; }
.hero-logo.play:not(.done) .gl-mark { stroke-dasharray: 1; stroke-dashoffset: 1; animation: gl-draw 1.8s cubic-bezier(.65, 0, .35, 1) .1s forwards; }
.hero-logo.play:not(.done) .gl-word { opacity: 0; transform: translateX(-18px); animation: gl-in 1s var(--ease) .55s forwards; }
.hero-logo.play:not(.done) .gl-sub { opacity: 0; transform: translateX(-18px); animation: gl-in 1s var(--ease) .8s forwards; }
@keyframes gl-draw { to { stroke-dashoffset: 0; } }
@keyframes gl-in { to { opacity: 1; transform: none; } }

.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px;
  background: var(--line); border-radius: var(--r); overflow: hidden; box-shadow: var(--shadow-1);
}
.stat { background: var(--surface); padding: 26px 22px; }
.stat-n { font-size: clamp(34px, 4vw, 48px); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-l { color: var(--text-2); font-size: 14px; margin-top: 8px; }


.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 20px; }
.grid-2 > .panel { margin: 0; }
.panel { background: var(--surface); border-radius: var(--r-lg); padding: clamp(20px, 3vw, 32px); box-shadow: var(--shadow-1); margin-top: 20px; }
.panel-head { margin-bottom: 22px; }
.panel-head h2 { font-size: 24px; }
.panel-head p { font-size: 14px; margin-top: 4px; }

.chart-years { display: flex; align-items: flex-end; gap: clamp(10px, 3vw, 28px); height: 240px; padding-top: 24px; }
.cy-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; }
.cy-bar { width: 100%; max-width: 64px; margin-top: auto; display: flex; flex-direction: column-reverse; border-radius: 8px; overflow: hidden; position: relative; cursor: pointer; transition: opacity .2s; }
.cy-bar:hover { opacity: .85; }
.cy-seg { width: 100%; transition: height .8s var(--ease); }
.cy-n { font-size: 13px; font-weight: 600; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.cy-y { font-size: 13px; color: var(--text-2); margin-top: 8px; font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 20px; font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.chart-cats { display: grid; gap: 10px; }
.cc-row { display: grid; grid-template-columns: 150px 1fr 36px; align-items: center; gap: 12px; font-size: 14px; cursor: pointer; border-radius: 8px; padding: 2px 4px; margin: 0 -4px; }
.cc-row:hover { background: var(--bg-alt); }
.cc-track { display: block; height: 10px; background: var(--bg-alt); border-radius: 99px; overflow: hidden; }
.cc-fill { display: block; height: 100%; border-radius: 99px; width: 0; transition: width 1s var(--ease); }
.cc-n { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-cities { display: flex; flex-wrap: wrap; gap: 10px; }
.city-chip {
  display: inline-flex; align-items: baseline; gap: 8px; padding: 10px 16px; border-radius: 14px;
  background: var(--bg-alt); font-size: 15px; cursor: pointer; border: 0; transition: background .2s;
}
.city-chip:hover { background: var(--accent-soft); }
.city-chip b { font-variant-numeric: tabular-nums; }

.section-head { margin: 56px 0 20px; }
.section-head h2 { font-size: 32px; }
.section-head p { margin-top: 4px; }

.logo-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 64px; }
.lw-item {
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 18px 14px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; cursor: pointer; border: 0;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.lw-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.lw-item .logo { width: 56px; height: 56px; }
.lw-name { font-size: 12px; line-height: 1.3; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lw-n { font-size: 11px; color: var(--text-3); }

/* logo tile, shared */
.logo {
  flex: none; width: 44px; height: 44px; border-radius: 12px; background: #fff;
  display: grid; place-items: center; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
}
.logo img { width: 82%; height: 82%; object-fit: contain; }
.logo.mono { color: #fff; font-weight: 700; font-size: 17px; letter-spacing: 0; box-shadow: none; }
.logo.round { border-radius: 50%; }
.avatar { flex: none; border-radius: 50%; object-fit: cover; background: var(--surface-2); }

/* category pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500; line-height: 1;
  padding: 5px 10px; border-radius: 999px; white-space: nowrap;
  color: var(--cat); background: color-mix(in srgb, var(--cat) 12%, transparent);
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--cat); }
.yr { display: inline-block; font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 3px 7px; border-radius: 6px; background: var(--bg-alt); color: var(--text-2); }
.tag { display: inline-block; font-size: 12px; padding: 3px 9px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text-2); }

/* ---------- filters ---------- */
.page-head { padding-top: clamp(40px, 6vw, 72px); padding-bottom: 20px; }
.page-title { font-size: clamp(34px, 5vw, 56px); font-weight: 700; letter-spacing: -.03em; }
.page-sub { font-size: 19px; margin-top: 8px; max-width: 720px; }
.sticky-filters {
  position: sticky; top: var(--nav-h); z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  padding-top: 12px; padding-bottom: 12px; border-bottom: 1px solid transparent;
}
.sticky-filters.stuck { border-bottom-color: var(--line); }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.search {
  position: relative; flex: 1 1 260px; max-width: 360px;
}
.search input {
  width: 100%; border: 0; border-radius: 12px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  font: inherit; font-size: 15px; padding: 9px 12px 9px 36px; color: var(--text); outline: none;
  transition: box-shadow .2s;
}
.search input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 0; cursor: pointer; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text);
  transition: background .2s, color .2s, box-shadow .2s; display: inline-flex; align-items: center; gap: 6px;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: none; }
.chip.cat[aria-pressed="true"] { background: var(--cat); color: #fff; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--cat); }
.chip.cat[aria-pressed="true"] .dot { background: #fff; }
.chip-clear { color: var(--accent-ink); background: none; box-shadow: none; }
.chip-clear:hover { background: var(--accent-soft); }
.filter-group { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.filter-sep { width: 1px; height: 22px; background: var(--line-strong); margin: 0 4px; }

.sortbar, .tbl-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.tbl-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.select select {
  appearance: none; -webkit-appearance: none; border: 0; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line-strong);
  border-radius: 10px; font: inherit; font-size: 13px; padding: 7px 30px 7px 12px; color: var(--text); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2386868b' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}

/* ---------- directory cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px; padding: 16px 0 80px; }
.card {
  background: var(--surface); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-1);
  cursor: pointer; display: flex; flex-direction: column; text-align: left; border: 0; padding: 0;
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card-media { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.card-media img.ph { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.card:hover .card-media img.ph { transform: scale(1.04); }
.card-media.empty { display: grid; place-items: center; background: linear-gradient(135deg, color-mix(in srgb, var(--cat) 16%, var(--surface-2)), var(--surface-2)); }
.card-media.empty .logo { width: 72px; height: 72px; border-radius: 18px; }
.card-media .nphotos { position: absolute; right: 10px; bottom: 10px; font-size: 11px; font-weight: 600; color: #fff; background: rgba(0,0,0,.5); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); padding: 3px 8px; border-radius: 999px; }
.card-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card-top { position: relative; z-index: 1; display: flex; gap: 12px; align-items: center; }
.card-top .logo { margin-top: -38px; width: 52px; height: 52px; border-radius: 14px; box-shadow: 0 0 0 3px var(--surface), inset 0 0 0 1px rgba(0,0,0,.06); }
.card-top .logo.mono { box-shadow: 0 0 0 3px var(--surface); }
.card-name { font-size: 18px; font-weight: 600; line-height: 1.25; }
.card-org { font-size: 14px; color: var(--text-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-sum { font-size: 14px; color: var(--text-2); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; flex-wrap: wrap; }
.card-years { display: flex; gap: 4px; }
.empty-state { text-align: center; padding: 80px 20px; color: var(--text-2); grid-column: 1 / -1; }

/* ---------- table ---------- */
.table-wrap {
  margin: 16px 0 80px; background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1);
  overflow: auto; max-height: calc(100vh - 230px);
}
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; min-width: 1080px; }
.tbl th {
  position: sticky; top: 0; z-index: 2; background: var(--surface); text-align: left; font-weight: 600; font-size: 12px;
  color: var(--text-2); padding: 12px 14px; border-bottom: 1px solid var(--line-strong); white-space: nowrap; user-select: none;
}
.tbl th.sortable { cursor: pointer; }
.tbl th.sortable:hover { color: var(--text); }
.tbl th .arr { display: inline-block; width: 10px; margin-left: 4px; opacity: 0; }
.tbl th[aria-sort] .arr { opacity: 1; color: var(--accent-ink); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { cursor: pointer; transition: background .15s; }
.tbl tbody tr:hover { background: var(--bg-alt); }
.tbl tbody tr.sel { background: var(--accent-soft); }
.tbl .c-check { width: 40px; padding-right: 0; }
.tbl .c-name { min-width: 250px; }
.tbl .who { display: flex; align-items: center; gap: 12px; }
.tbl .who .logo { width: 34px; height: 34px; border-radius: 9px; }
.tbl .who .logo.mono { font-size: 13px; }
.tbl .who b { font-weight: 600; display: block; line-height: 1.3; }
.tbl .who small { color: var(--text-2); font-size: 12px; display: block; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .years { display: flex; gap: 3px; flex-wrap: wrap; }
.tbl .ints { color: var(--text-2); font-size: 13px; max-width: 220px; }
.tbl td.org { min-width: 220px; max-width: 300px; }
.tbl .org small { display: block; color: var(--text-2); font-size: 12px; }
.check { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* ---------- map ---------- */
.view-map { animation: none; }
.map-shell { position: relative; height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h)); display: grid; grid-template-columns: 380px minmax(0, 1fr); }
.map-side { background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 2; }
.map-side-head { padding: 16px 16px 10px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.map-side-head .seg { justify-self: start; }
.filterbar.compact .search { max-width: none; flex-basis: 100%; }
.filterbar.compact .chip { font-size: 12px; padding: 5px 10px; }
.map-count { font-size: 13px; }
.map-list { list-style: none; margin: 0; padding: 6px 8px 16px; overflow: auto; flex: 1; }
.ml-item { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; cursor: pointer; transition: background .15s; }
.ml-item:hover, .ml-item.hl { background: var(--bg-alt); }
.ml-item .logo { width: 40px; height: 40px; border-radius: 11px; }
.ml-txt { min-width: 0; flex: 1; }
.ml-txt b { display: block; font-weight: 600; font-size: 15px; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-txt small { display: block; font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ml-years { display: flex; gap: 3px; flex: none; }
.map-canvas { height: 100%; background: var(--bg-alt); }
.leaflet-container { font-family: var(--font); background: var(--bg-alt); }
.leaflet-control-attribution { font-size: 10px; background: color-mix(in srgb, var(--surface) 80%, transparent) !important; color: var(--text-3); }
.leaflet-control-attribution a { color: var(--text-2); }
.leaflet-bar { border: 0 !important; box-shadow: var(--shadow-2) !important; border-radius: 12px !important; overflow: hidden; }
.leaflet-bar a { background: var(--surface) !important; color: var(--text) !important; border-color: var(--line) !important; width: 34px !important; height: 34px !important; line-height: 34px !important; }
.pin {
  width: 40px; height: 40px; border-radius: 50%; background: #fff; display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 0 0 3px var(--cat), 0 6px 16px rgba(0,0,0,.25); transition: transform .2s var(--ease);
}
.pin:hover { transform: scale(1.12); }
.pin img { width: 74%; height: 74%; object-fit: contain; }
.pin.mono { background: var(--cat); color: #fff; font-weight: 700; font-size: 15px; }
.pin-n { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.cluster {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  background: color-mix(in srgb, var(--accent) 88%, transparent); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 22%, transparent), 0 6px 16px rgba(0,0,0,.25);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.leaflet-popup-content-wrapper { border-radius: 16px; background: var(--surface); color: var(--text); box-shadow: var(--shadow-2); padding: 0; }
.leaflet-popup-tip { background: var(--surface); }
.leaflet-popup-content { margin: 0; width: 300px !important; }
.pop { padding: 14px 14px 10px; }
.pop h4 { font-size: 15px; margin: 0 0 2px; }
.pop .pop-city { font-size: 12px; color: var(--text-2); margin-bottom: 10px; }
.pop ul { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.pop li { display: flex; gap: 10px; align-items: center; padding: 7px 6px; border-radius: 10px; cursor: pointer; }
.pop li:hover { background: var(--bg-alt); }
.pop li .logo { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }
.pop li b { font-size: 13px; display: block; line-height: 1.3; }
.pop li small { font-size: 12px; color: var(--text-2); display: block; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); top: 6px; right: 6px; }

/* ---------- timeline ---------- */
.tl-year { padding: clamp(40px, 6vw, 72px) 0; border-top: 1px solid var(--line); }
.tl-year:first-child { border-top: 0; padding-top: 12px; }
.tl-head { display: grid; grid-template-columns: auto 1fr auto; gap: clamp(16px, 3vw, 40px); align-items: end; margin-bottom: 26px; }
.tl-num { font-size: clamp(56px, 9vw, 112px); font-weight: 700; line-height: .85; letter-spacing: -.05em; font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--text) 30%, var(--text-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tl-proj h2 { font-size: clamp(22px, 2.6vw, 30px); }
.tl-proj p { color: var(--text-2); margin-top: 4px; font-size: 15px; max-width: 620px; }
.tl-meta { text-align: right; color: var(--text-2); font-size: 14px; white-space: nowrap; }
.tl-meta b { display: block; font-size: 28px; color: var(--text); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tl-meta a { font-size: 13px; }
.tl-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 300px); gap: 16px; overflow-x: auto; padding: 4px var(--gutter) 20px; margin: 0 calc(-1 * var(--gutter)); scroll-snap-type: x mandatory; scroll-padding: 0 var(--gutter); }
.tl-strip::-webkit-scrollbar { height: 8px; }
.tl-strip::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
.tl-strip .card { scroll-snap-align: start; }
.tl-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 2000; background: rgba(0,0,0,.36);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  display: grid; place-items: center; padding: 24px; animation: bdin .3s var(--ease);
}
@keyframes bdin { from { opacity: 0; } }
.sheet {
  position: relative; width: min(920px, 100%); max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--bg); border-radius: var(--r-lg); box-shadow: var(--shadow-sheet); overflow: hidden;
  display: flex; flex-direction: column; animation: shin .45s var(--ease);
}
@keyframes shin { from { opacity: 0; transform: translateY(24px) scale(.98); } }
.sheet-body { overflow: auto; overscroll-behavior: contain; }
.sheet-close {
  position: absolute; top: 14px; right: 14px; z-index: 5; width: 34px; height: 34px; border-radius: 50%; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--surface-2) 85%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  display: grid; place-items: center; color: var(--text-2);
}
.sheet-close:hover { color: var(--text); }
.sh-cover { position: relative; height: 240px; background: var(--surface-2); overflow: hidden; }
.sh-cover img { width: 100%; height: 100%; object-fit: cover; }
.sh-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--bg)); }
.sh-cover.empty { height: 120px; background: linear-gradient(135deg, color-mix(in srgb, var(--cat) 22%, var(--bg)), var(--bg)); }
.sh-cover.empty::after { display: none; }
.sh-head { position: relative; padding: 0 clamp(20px, 4vw, 44px); margin-top: -56px; display: flex; gap: 18px; align-items: flex-end; z-index: 2; }
.sh-head .logo { width: 88px; height: 88px; border-radius: 22px; box-shadow: 0 0 0 4px var(--bg), var(--shadow-2); }
.sh-head .logo.mono { font-size: 32px; }
.sh-head .avatar { width: 88px; height: 88px; box-shadow: 0 0 0 4px var(--bg), var(--shadow-2); margin-left: -34px; }
.sh-title { padding: 18px clamp(20px, 4vw, 44px) 0; }
.sh-title h2 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.15; letter-spacing: -.025em; }
.sh-title .alt { font-size: 17px; color: var(--text-2); font-weight: 500; margin-left: 6px; letter-spacing: 0; }
.sh-role { color: var(--text-2); font-size: 16px; margin-top: 6px; }
.sh-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.sh-facts {
  margin: 24px clamp(20px, 4vw, 44px) 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1); overflow: hidden;
}
.sh-fact { padding: 14px 18px; border-right: 1px solid var(--line); }
.sh-fact:last-child { border-right: 0; }
.sh-fact dt { font-size: 12px; color: var(--text-2); }
.sh-fact dd { margin: 3px 0 0; font-size: 15px; font-weight: 500; word-break: break-word; }
.sh-section { padding: 30px clamp(20px, 4vw, 44px) 0; }
.sh-section > h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-2); font-weight: 600; margin-bottom: 14px; }
.eng { position: relative; padding-left: 28px; padding-bottom: 28px; }
.eng::before { content: ""; position: absolute; left: 6px; top: 12px; bottom: 0; width: 2px; background: var(--line); }
.eng:last-child::before { bottom: 28px; }
.eng::after { content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); box-shadow: inset 0 0 0 3px var(--cat); }
.eng-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.eng-year { font-size: 22px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.eng-proj { font-size: 15px; color: var(--text-2); }
.eng-dates { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.eng-tags { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0 12px; }
.eng p { font-size: 16px; line-height: 1.6; }
.eng-impact { margin-top: 14px; background: var(--surface); border-radius: 14px; padding: 14px 16px; box-shadow: var(--shadow-1); }
.eng-impact b { display: block; font-size: 12px; color: var(--c-government); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.eng-impact p { font-size: 15px; }
.eng blockquote { margin: 16px 0 0; padding: 2px 0 2px 16px; border-left: 3px solid var(--cat); font-size: 17px; line-height: 1.5; font-style: italic; color: var(--text); }
.eng-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.eng-photos button { border: 0; padding: 0; cursor: zoom-in; border-radius: 12px; overflow: hidden; aspect-ratio: 4 / 3; background: var(--surface-2); }
.eng-photos img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.eng-photos button:hover img { transform: scale(1.05); }
.eng-src { display: inline-block; margin-top: 12px; font-size: 14px; }
.sh-foot { padding: 8px clamp(20px, 4vw, 44px) 36px; display: flex; gap: 12px; flex-wrap: wrap; }
.sh-foot .btn { font-size: 14px; padding: 9px 18px; }

/* compare */
.cmp { padding: 28px clamp(20px, 4vw, 40px) 36px; }
.cmp h2 { font-size: 28px; margin-bottom: 20px; }
.cmp-grid { display: grid; gap: 14px; grid-template-columns: repeat(var(--n), minmax(200px, 1fr)); overflow-x: auto; }
.cmp-col { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-1); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 200px; }
.cmp-col .logo { width: 56px; height: 56px; border-radius: 15px; }
.cmp-col h3 { font-size: 18px; line-height: 1.25; }
.cmp-row dt { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); font-weight: 600; }
.cmp-row dd { margin: 4px 0 0; font-size: 14px; line-height: 1.5; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0,0,0,.92); display: grid; grid-template-columns: 64px 1fr 64px; align-items: center; animation: bdin .25s; }
.lb-figure { margin: 0; display: flex; flex-direction: column; align-items: center; gap: 14px; max-height: 100vh; padding: 40px 0; }
.lb-figure img { max-width: 100%; max-height: calc(100vh - 140px); object-fit: contain; border-radius: 10px; }
.lb-figure figcaption { color: #d2d2d7; font-size: 14px; text-align: center; max-width: 720px; padding: 0 16px; }
.lb-btn { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 44px; height: 44px; border-radius: 50%; cursor: pointer; font-size: 26px; line-height: 1; justify-self: center; display: grid; place-items: center; }
.lb-btn:hover { background: rgba(255,255,255,.22); }
.lb-close { position: absolute; top: 18px; right: 18px; font-size: 18px; }

/* toast */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 4000;
  background: var(--text); color: var(--bg); padding: 11px 18px; border-radius: 999px; font-size: 14px; transition: all .35s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* footer */
.footer { border-top: 1px solid var(--line); background: var(--bg-alt); font-size: 12px; color: var(--text-2); padding: 22px 0 34px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { color: var(--text-2); }
body.on-map .footer { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .tabs a { padding: 6px 9px; }
  .brand-text span { display: none; }
  .brand-text { display: inline; }
  .stats { grid-template-columns: repeat(3, 1fr); }
      .grid-2 { grid-template-columns: 1fr; }
  .map-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .map-side { order: 2; max-height: 44vh; border-right: 0; border-top: 1px solid var(--line); }
  .map-canvas { order: 1; }
}
@media (max-width: 680px) {
  :root { --nav-h: 94px; }
  body { font-size: 16px; }
  .gnav-inner { flex-wrap: wrap; gap: 0; align-content: center; row-gap: 6px; }
  .brand { order: 1; }
  .lang-switch { order: 2; margin-left: auto; }
  .brand-text span { display: inline; }
  .tabs { order: 3; width: 100%; margin: 0; justify-content: space-between; gap: 0; overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { font-size: 13px; padding: 6px 10px; white-space: nowrap; }
  .sticky-filters { position: static; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:last-child:nth-child(odd) { grid-column: span 2; }
  .stat { padding: 18px 16px; }
  .cc-row { grid-template-columns: 110px 1fr 30px; font-size: 13px; }
  .tl-head { grid-template-columns: 1fr; gap: 10px; }
  .tl-meta { text-align: left; }
  .sheet-backdrop { padding: 0; align-items: end; }
  .sheet { border-radius: 22px 22px 0 0; max-height: 94vh; max-height: 94dvh; }
  .sh-cover { height: 180px; }
  .lightbox { grid-template-columns: 44px 1fr 44px; }
  .lb-btn { width: 36px; height: 36px; font-size: 22px; }
  .search { max-width: none; }
  .table-wrap { max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .gnav, .sticky-filters, .footer, .tbl-actions { display: none; }
  .table-wrap { max-height: none; overflow: visible; box-shadow: none; }
}
