@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #14283a;
  --muted: #728293;
  --line: #e6ebef;
  --paper: #fff;
  --navy: #102133;
  --teal: #11a398;
  --amber: #d49a34;
  font-family: 'DM Sans', sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; }
body { color: var(--ink); background: #e9eef0; }
button, a { font: inherit; }
button { color: inherit; }

.topbar {
  position: relative;
  z-index: 1000;
  display: flex;
  height: 68px;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  color: #f7fbff;
  background: var(--navy);
  box-shadow: 0 4px 18px #0d20312b;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border: 1px solid #2c5061; border-radius: 13px; color: #70d6c9; background: #19384a; font: 700 31px/1 'Space Grotesk', sans-serif; transform: rotate(-20deg); }
.brand strong, .brand small { display: block; }
.brand strong { font: 600 16px/1.2 'Space Grotesk', sans-serif; letter-spacing: .01em; }
.brand small { margin-top: 4px; color: #9baebc; font-size: 11px; letter-spacing: .05em; }
.topbar-actions { display: flex; align-items: center; gap: 11px; }
.status { display: inline-flex; align-items: center; gap: 8px; margin-right: 8px; color: #bccbd4; font-size: 12px; white-space: nowrap; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: #728293; }
.status[data-state="ready"] .status-dot { background: #45c4a4; box-shadow: 0 0 0 3px #45c4a424; }
.status[data-state="loading"] .status-dot { background: #e2b35e; animation: pulse 1s infinite alternate; }
.status[data-state="error"] .status-dot { background: #f08071; }
.icon-button { width: 38px; height: 38px; border: 1px solid #355064; border-radius: 11px; color: #edf7fb; background: #193548; cursor: pointer; font-size: 22px; line-height: 1; transition: background .18s, border-color .18s; }
.icon-button:hover { border-color: #5e899a; background: #24495d; }

.map-shell { position: relative; height: calc(100% - 68px); }
#map { position: absolute; inset: 0; z-index: 1; background: #dbe5e5; }
.leaflet-container { font-family: 'DM Sans', sans-serif; }
.leaflet-control-attribution { font-size: 10px !important; }

.panel { position: absolute; z-index: 500; top: 18px; bottom: 18px; width: 326px; overflow: auto; padding: 20px; border: 1px solid #fff; border-radius: 17px; background: #fffffff5; box-shadow: 0 16px 45px #14283a21; backdrop-filter: blur(12px); transition: transform .22s ease, opacity .22s ease; }
.filters-panel { left: 18px; }
.filters-panel.is-hidden { transform: translateX(calc(-100% - 28px)); opacity: 0; pointer-events: none; }
.details-panel { right: 18px; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.panel-heading h1, .panel-heading h2 { margin: 2px 0 0; font: 600 22px/1.15 'Space Grotesk', sans-serif; letter-spacing: -.035em; }
.panel-heading h2 { font-size: 19px; overflow-wrap: anywhere; }
.eyebrow { margin: 0; color: var(--teal); font-size: 10px; font-weight: 700; letter-spacing: .13em; text-transform: uppercase; }
.close-button { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; padding: 0; border: 0; border-radius: 9px; color: #71818e; background: #f1f4f6; cursor: pointer; font-size: 22px; line-height: 1; }
.close-button:hover { color: var(--ink); background: #e4eaed; }
.panel-intro { margin: 12px 0 20px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.selection-actions { display: flex; justify-content: space-between; align-items: center; padding: 0 0 11px; border-bottom: 1px solid var(--line); color: #738495; font-size: 11px; font-weight: 600; }
.selection-actions div { display: inline-flex; align-items: center; gap: 7px; }
.selection-actions button { padding: 2px 0; border: 0; color: #128b82; background: none; cursor: pointer; font-size: 11px; font-weight: 700; }
.selection-actions button:hover { color: #075f5a; text-decoration: underline; }
.subtype-list { display: grid; gap: 2px; padding: 9px 0 16px; }
.subtype-option { display: flex; align-items: center; gap: 9px; padding: 8px; border-radius: 9px; cursor: pointer; transition: background .16s; }
.subtype-option:hover { background: #f3f8f8; }
.subtype-option input { width: 15px; height: 15px; flex: 0 0 15px; margin: 0; accent-color: var(--teal); cursor: pointer; }
.subtype-icon { display: grid; flex: 0 0 30px; width: 30px; height: 30px; place-items: center; border-radius: 9px; color: var(--category-color); background: #f1f6f7; }
.category-glyph { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.subtype-label { min-width: 0; }
.subtype-label strong { display: block; color: #263e50; font-size: 12px; font-weight: 600; overflow-wrap: anywhere; }
.subtype-label code { display: block; margin-top: 3px; color: #8b99a5; font: 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.panel-note { display: flex; gap: 9px; margin-top: 6px; padding: 12px; border: 1px solid #e4efec; border-radius: 11px; background: #f4faf8; }
.note-icon { flex: 0 0 auto; color: #258f81; font-size: 15px; }
.panel-note p { margin: 0; color: #607d7b; font-size: 10px; line-height: 1.5; }
.osm-credit { display: inline-block; margin-top: 16px; color: #7b8c98; font-size: 10px; text-decoration: none; }
.osm-credit:hover { color: #118b82; text-decoration: underline; }
.muted { margin: 12px 0; color: var(--muted); font-size: 12px; }

.map-notice { position: absolute; z-index: 700; top: 18px; left: 50%; display: flex; width: min(520px, calc(100% - 38px)); align-items: flex-start; gap: 12px; padding: 14px; border: 1px solid #f0ddbb; border-radius: 13px; background: #fffaf1; box-shadow: 0 10px 28px #14283a1a; transform: translateX(-50%); }
.map-notice[hidden] { display: none; }
.notice-symbol { display: grid; flex: 0 0 24px; width: 24px; height: 24px; place-items: center; border-radius: 50%; color: #7b5314; background: #f3dfb6; font: 700 13px 'Space Grotesk', sans-serif; }
.map-notice strong { display: block; color: #4a3921; font-size: 12px; }
.map-notice p { margin: 4px 0 0; color: #826d4d; font-size: 11px; line-height: 1.45; }
.map-notice .close-button { margin: -4px -4px 0 auto; background: transparent; }
.map-legend { position: absolute; z-index: 400; right: 18px; bottom: 18px; display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid #fff; border-radius: 10px; color: #425565; background: #ffffffeb; box-shadow: 0 6px 18px #14283a17; font-size: 11px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px #11a39820; }

.resource-marker { display: grid; width: 32px; height: 32px; place-items: center; border: 2px solid #fff; border-radius: 50% 50% 50% 4px; color: #fff; background: var(--marker-color, #168f87); box-shadow: 0 4px 10px #0b5d5b5c; transform: rotate(-45deg); }
.resource-marker .marker-glyph { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; transform: rotate(45deg); }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: #159d9142 !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { border: 2px solid #fff; color: #fff !important; background: #117f78 !important; font-family: 'DM Sans', sans-serif; font-weight: 700; box-shadow: 0 4px 12px #0b5d5b38; }
.resource-popup { min-width: 165px; }
.resource-popup strong { display: block; margin-bottom: 4px; color: #173045; font-size: 13px; }
.resource-popup span { color: #687a89; font-size: 10px; }
.resource-popup a { display: inline-block; margin-top: 8px; color: #118b82; font-size: 11px; font-weight: 700; text-decoration: none; }
.resource-popup a:hover { text-decoration: underline; }

.detail-summary { margin: 14px 0; padding: 12px; border-radius: 10px; background: #f2f7f7; }
.detail-summary span { display: block; color: #7c8e98; font-size: 9px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.detail-summary strong { display: block; margin-top: 5px; color: #31495a; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.detail-links { display: flex; gap: 10px; margin-bottom: 15px; }
.detail-links a { display: inline-flex; align-items: center; gap: 5px; padding: 7px 9px; border: 1px solid #e1e9eb; border-radius: 8px; color: #277e79; background: #fff; font-size: 10px; font-weight: 600; text-decoration: none; }
.detail-links a:hover { border-color: #b8d9d4; background: #f6fbfa; }
.tag-heading { margin: 0 0 7px; color: #7b8d98; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.tag-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tag-table tr + tr { border-top: 1px solid #edf0f2; }
.tag-table th, .tag-table td { padding: 8px 4px; vertical-align: top; text-align: left; overflow-wrap: anywhere; }
.tag-table th { width: 45%; color: #687c8b; font: 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.tag-table td { color: #223c4e; font-size: 11px; line-height: 1.45; }

@keyframes pulse { to { opacity: .4; } }

@media (max-width: 680px) {
  .topbar { height: 60px; padding: 0 12px; }
  .brand-mark { width: 35px; height: 35px; font-size: 27px; }
  .brand { gap: 8px; }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 9px; }
  .topbar-actions { gap: 7px; }
  .status { max-width: 112px; margin-right: 0; font-size: 10px; overflow: hidden; text-overflow: ellipsis; }
  .icon-button { width: 34px; height: 34px; font-size: 19px; }
  .map-shell { height: calc(100% - 60px); }
  .panel { top: 10px; bottom: 10px; width: min(326px, calc(100% - 20px)); padding: 17px; }
  .filters-panel { left: 10px; }
  .details-panel { right: 10px; }
  .map-legend { right: 10px; bottom: 10px; }
  .map-notice { top: 10px; }
}
