:root {
  --blue: #283789;
  --blue-dark: #1d2765;
  --yellow: #fbbb21;
  --teal: #119da4;
  --ink: #161b3a;
  --muted: #5b6296;
  --grey: #e6e6e9;
  --pale: #f4f4f7;
  --white: #fff;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { color: var(--ink); background: var(--teal); }
button, select { font: inherit; }
button:focus-visible, select:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(251,187,33,.8); outline-offset: 2px; }
.app-shell { height: 100%; display: flex; flex-direction: column; overflow: hidden; }

.site-header {
  min-height: 88px; padding: 15px 28px; display: flex; align-items: center; gap: 16px; position: relative;
  color: var(--white); background: var(--blue); border-bottom: 5px solid var(--yellow); z-index: 10;
}
.site-header img { width: auto; height: 52px; margin-left: auto; object-fit: contain; }
.site-title h1 { margin: 0; font-size: clamp(20px, 2vw, 29px); line-height: 1.1; letter-spacing: -.02em; }
.site-title p { margin: 5px 0 0; color: #dfe3f5; font-size: 13px; }
.brand-mark { width: 38px; height: 44px; display: grid; place-items: center; position: relative; flex: none; }
.brand-mark span:first-child { position: absolute; inset: 0; background: var(--yellow); clip-path: polygon(0 0, 100% 0, 50% 55%, 0 100%); }
.brand-mark span:last-child { position: absolute; inset: 9px 6px 2px 15px; background: var(--teal); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.site-navigation { --navigation-width: min(320px, 100vw); flex: none; }
.site-navigation summary {
  width: 44px; height: 44px; padding: 10px; display: flex; flex-direction: column; justify-content: center; gap: 5px;
  position: relative; border: 1px solid rgba(255,255,255,.55); border-radius: 8px; cursor: pointer; list-style: none;
}
.site-navigation summary::-webkit-details-marker { display: none; }
.site-navigation summary:hover { background: rgba(255,255,255,.1); }
.site-navigation summary:focus-visible { outline: 3px solid rgba(251,187,33,.8); outline-offset: 2px; }
.site-navigation summary span { width: 100%; height: 2px; display: block; background: var(--white); border-radius: 2px; transition: transform .18s ease, opacity .18s ease; }
.site-navigation[open] summary { position: fixed; top: 22px; right: calc(var(--navigation-width) - 68px); z-index: 13; }
.site-navigation[open] summary span { width: 22px; position: absolute; top: 50%; left: 50%; }
.site-navigation[open] summary span:first-child { transform: translate(-50%, -50%) rotate(45deg); }
.site-navigation[open] summary span:nth-child(2) { opacity: 0; }
.site-navigation[open] summary span:last-child { transform: translate(-50%, -50%) rotate(-45deg); }
.site-navigation nav {
  width: var(--navigation-width); height: 100vh; height: 100dvh; padding: 88px 24px 24px;
  position: fixed; inset: 0 0 0 auto; z-index: 12;
  background: var(--blue-dark); border-left: 4px solid var(--yellow);
  box-shadow: -12px 0 28px rgba(19,27,77,.3);
}

.view-toolbar {
  min-height: 58px; padding: 10px 28px; display: flex; align-items: center; gap: 12px;
  background: var(--white); border-bottom: 1px solid var(--grey); z-index: 8;
}
.view-toolbar p { margin: 0; color: var(--muted); font-size: 13px; }
.view-tabs { display: flex; padding: 3px; background: var(--pale); border-radius: 999px; }
.view-tabs button { border: 0; padding: 8px 18px; color: var(--blue); background: transparent; border-radius: 999px; cursor: pointer; font-size: 13px; font-weight: 650; }
.view-tabs button.active { color: white; background: var(--blue); }
.export-button { margin-left: auto; padding: 9px 15px; color: var(--blue); background: white; border: 1px solid var(--blue); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 650; }
.export-button:hover { background: #f0f1f8; }

.workspace { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--teal); }
#mapCanvas, .marker-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
#mapCanvas { cursor: grab; touch-action: none; will-change: transform; }
#mapCanvas.dragging { cursor: grabbing; }
.marker-layer { pointer-events: none; will-change: transform; }
.map-controls { position: absolute; right: 20px; bottom: 20px; z-index: 5; display: flex; overflow: hidden; background: white; border: 1px solid var(--grey); border-radius: 10px; box-shadow: 0 8px 24px rgba(29,39,101,.24); }
.map-controls button { min-width: 42px; height: 42px; padding: 0 12px; color: var(--blue); background: white; border: 0; border-right: 1px solid var(--grey); cursor: pointer; font-weight: 750; }
.map-controls button:last-child { border-right: 0; font-size: 12px; }
.map-controls button:hover { background: var(--pale); }
.map-marker { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 5px; border: 0; padding: 0; background: transparent; color: white; cursor: pointer; pointer-events: auto; }
.map-marker b { min-width: 42px; height: 42px; padding: 0 9px; display: grid; place-items: center; border-radius: 999px; color: white; background: var(--blue); border: 3px solid var(--yellow); box-shadow: 0 5px 18px rgba(20,29,82,.42); transition: transform .16s, background .16s; }
.map-marker span { display: none; padding: 3px 7px; color: white; background: rgba(29,39,101,.82); border-radius: 5px; white-space: nowrap; font-size: 11px; font-weight: 650; text-shadow: 0 1px 2px #111; }
.map-marker:hover b, .map-marker.active b { transform: scale(1.15); color: var(--blue); background: var(--yellow); border-color: white; }
.map-marker:hover span, .map-marker.active span { display: block; }

.filter-panel, .results-panel { position: absolute; top: 20px; bottom: 20px; z-index: 4; background: white; border-radius: 16px; box-shadow: 0 18px 44px rgba(29,39,101,.28); overflow: hidden; }
.filter-panel { left: 24px; width: 344px; overflow-y: auto; }
.panel-heading { padding: 20px 24px 18px; color: white; background: var(--blue); position: relative; overflow: hidden; }
.panel-heading::after { content: ""; position: absolute; width: 120px; height: 120px; right: -30px; top: -30px; background: rgba(251,187,33,.16); clip-path: polygon(100% 0,100% 100%,0 0); }
.panel-heading-row { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.panel-heading h2 { margin: 0; font-size: 19px; }
.clear-heading-button { position: relative; z-index: 1; flex: none; padding: 6px 9px; color: white; background: transparent; border: 1px solid rgba(255,255,255,.75); border-radius: 7px; cursor: pointer; font-size: 12px; font-weight: 700; }
.clear-heading-button:hover { color: var(--blue); background: white; }
.heading-rule { display: block; width: 46px; height: 4px; margin-bottom: 12px; background: var(--yellow); }
.panel-heading p { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 15px; }
.panel-heading strong { min-width: 30px; height: 27px; padding: 0 8px; display: inline-grid; place-items: center; color: var(--blue); background: var(--yellow); border-radius: 999px; font-size: 14px; }
.filter-body { padding: 18px 24px 26px; display: flex; flex-direction: column; gap: 23px; }
.filter-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.filter-group label, .filter-group legend { display: block; margin-bottom: 9px; color: var(--ink); font-weight: 650; font-size: 16px; }
.filter-group-toggle { padding: 0; color: inherit; background: transparent; border: 0; font: inherit; text-align: left; }
.filter-group select { width: 100%; padding: 11px 12px; color: var(--blue); background: white; border: 1.5px solid #d8dae6; border-radius: 10px; }
.filter-group small { display: block; margin-top: 7px; color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; color: var(--blue); background: white; border: 1.5px solid #c8cbdd; border-radius: 999px; cursor: pointer; font-size: 13.5px; line-height: 1.4; transition: transform .16s, color .16s, background .16s; }
.filter-chip:hover { transform: translateY(-2px); }
.filter-chip span { width: 12px; text-align: center; }
.filter-chip[aria-pressed="true"] { color: white; background: var(--blue); border-color: var(--blue); }
.filter-chip[aria-pressed="true"] span::before { content: "✓"; }
.map-key { padding-top: 17px; border-top: 1px solid var(--grey); }
.map-key p { margin: 0 0 10px; display: flex; align-items: center; gap: 10px; color: #3b4372; font-size: 12.5px; line-height: 1.4; }
.map-key i { width: 20px; height: 20px; flex: none; }
.key-dot { border: 2px solid var(--yellow); border-radius: 50%; background: var(--blue); }
.key-square { border-radius: 4px; background: var(--yellow); }
.clear-button { width: 100%; padding: 10px 14px; color: var(--blue); background: white; border: 1px solid var(--blue); border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700; }

.active-filters { position: absolute; left: 392px; top: 20px; right: 480px; z-index: 3; padding: 11px 14px; display: flex; align-items: center; gap: 10px; color: var(--blue); background: rgba(255,255,255,.96); border-radius: 14px; box-shadow: 0 12px 30px rgba(29,39,101,.22); }
.active-filters[hidden] { display: none; }
.active-filters > strong { color: var(--teal); text-transform: uppercase; letter-spacing: .1em; font-size: 12px; }
.active-filters > div { display: flex; flex-wrap: wrap; gap: 7px; }
.active-filters button { border: 0; cursor: pointer; }
.active-filter { padding: 7px 12px; color: white; background: var(--blue); border-radius: 999px; font-size: 12px; }
#clearActiveFiltersBtn { margin-left: auto; color: var(--blue); background: transparent; text-decoration: underline; font-weight: 700; }

.results-panel { right: 20px; width: 440px; display: flex; flex-direction: column; transition: transform .3s ease; }
.results-panel.closed { transform: translateX(calc(100% + 40px)); }
.results-panel > header, .modal-card > header { min-height: 76px; padding: 17px 22px; display: flex; justify-content: space-between; gap: 15px; color: white; background: var(--blue); border-bottom: 4px solid var(--yellow); }
.results-panel h2, .results-panel header p { margin: 0; }
.results-panel h2 { font-size: 17px; }
.results-panel header p { margin-top: 4px; color: #c9cee7; font-size: 13px; }
.results-panel header button, .modal-card header button { width: 34px; height: 34px; border: 0; color: white; background: rgba(255,255,255,.16); border-radius: 50%; cursor: pointer; font-size: 21px; }
.results-grid { flex: 1; min-height: 0; padding: 18px; overflow-y: auto; display: grid; align-content: start; gap: 14px; background: var(--pale); }
.project-card { width: 100%; padding: 19px 21px; text-align: left; color: var(--ink); background: white; border: 1.5px solid var(--grey); border-radius: 14px; box-shadow: 0 2px 8px rgba(29,39,101,.08); cursor: pointer; transition: transform .16s, border-color .16s, box-shadow .16s; }
.project-card:hover { transform: translateY(-2px); border-color: var(--yellow); box-shadow: 0 8px 22px rgba(29,39,101,.15); }
.project-card-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.project-card h3 { margin: 0; color: var(--ink); font-size: 16px; line-height: 1.35; }
.project-card p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.national-badge { flex: none; padding: 5px 8px; color: var(--blue); background: var(--yellow); border-radius: 6px; font-size: 10px; font-weight: 750; letter-spacing: .07em; text-transform: uppercase; }
.card-chips { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.card-chips span { padding: 5px 10px; color: #0e7f85; background: #edf6f6; border-radius: 999px; font-size: 11.5px; font-weight: 650; }
.card-chips .area-chip { color: var(--blue); background: #f0f1f8; }
.card-chips .evidence-chip { color: white; background: var(--blue); }
.empty-results { padding: 42px 20px; text-align: center; color: var(--muted); }
.results-tab { position: absolute; right: 0; top: 50%; z-index: 3; transform: translateY(-50%); padding: 18px 13px; display: flex; flex-direction: column; align-items: center; gap: 9px; color: white; background: var(--blue); border: 0; border-radius: 14px 0 0 14px; box-shadow: -6px 0 20px rgba(29,39,101,.3); cursor: pointer; }
.results-tab strong { min-width: 30px; padding: 6px; color: var(--blue); background: var(--yellow); border-radius: 999px; }
.results-tab span { writing-mode: vertical-rl; font-size: 12px; font-weight: 650; }

.workspace.list-mode { overflow-y: auto; background: var(--pale); }
.workspace.list-mode #mapCanvas, .workspace.list-mode .marker-layer, .workspace.list-mode .map-controls, .workspace.list-mode .filter-panel, .workspace.list-mode .active-filters, .workspace.list-mode .results-tab { display: none; }
.workspace.list-mode .results-panel { position: absolute; inset: 0; width: auto; border-radius: 0; box-shadow: none; transform: none; }
.workspace.list-mode .results-panel > header button { display: none; }
.workspace.list-mode .results-grid { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); padding: 24px 28px 40px; }

.modal { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(15,22,56,.72); backdrop-filter: blur(5px); }
.modal[hidden] { display: none; }
.modal-card { width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: white; border-radius: 16px; box-shadow: 0 24px 70px rgba(15,22,56,.48); overflow: hidden; }
.modal-card > header { min-height: auto; align-items: flex-start; }
.modal-card h2 { margin: 5px 0 0; font-size: 22px; line-height: 1.25; }
.modal-kicker { color: var(--yellow); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-body section { margin-bottom: 20px; }
.modal-body h3 { margin: 0 0 6px; color: var(--teal); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.modal-body p { margin: 0; color: #3b4372; line-height: 1.6; }
.modal-columns { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 3px 28px; }
.modal-columns .modal-full-width { grid-column: 1 / -1; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.detail-chips span { padding: 5px 9px; color: var(--blue); background: #f0f1f8; border-radius: 999px; font-size: 12px; font-weight: 650; }
.modal-links { padding-top: 4px; display: flex; flex-wrap: wrap; gap: 12px; }
.modal-links a { padding: 10px 15px; color: white; background: var(--blue); border-radius: 8px; text-decoration: none; font-size: 13px; font-weight: 700; }
.modal-links a:last-child { color: var(--blue); background: var(--yellow); }
.modal-links a[hidden] { display: none; }

@media (max-width: 1149px) {
  .active-filters { right: 76px; }
  .results-panel { width: min(440px, calc(100% - 40px)); }
}

@media (min-width: 1150px) {
  .map-controls { right: 480px; }
}

@media (max-width: 760px) {
  .app-shell { height: auto; min-height: 100%; overflow: visible; }
  .site-header { padding: 12px 16px; min-height: 76px; }
  .site-header img { height: 38px; max-width: 145px; }
  .site-navigation[open] summary { top: 16px; }
  .site-title p, .brand-mark { display: none; }
  .view-toolbar { padding: 9px 14px; flex-wrap: wrap; }
  .view-toolbar p { display: none; }
  .workspace { min-height: 900px; }
  .filter-panel { position: relative; inset: auto; width: calc(100% - 24px); max-height: none; margin: 12px; border-radius: 12px; }
  #mapCanvas, .marker-layer { top: 0; height: 430px; }
  .map-controls { top: 12px; right: 12px; bottom: auto; }
  .filter-panel { margin-top: 450px; }
  .collapsible-filter-group legend { width: 100%; margin-bottom: 0; }
  .filter-group-toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
  .filter-group-toggle span::after { content: "+"; display: block; font-size: 22px; line-height: 1; }
  .filter-group-toggle[aria-expanded="true"] span::after { content: "−"; }
  .collapsible-filter-group .filter-group-content { display: none; padding-top: 12px; }
  .collapsible-filter-group.is-expanded .filter-group-content { display: flex; }
  .active-filters { display: none !important; }
  .results-panel { position: relative; inset: auto; width: calc(100% - 24px); height: 520px; margin: 12px; transform: none !important; border-radius: 12px; }
  .results-panel header button, .results-tab { display: none !important; }
  .workspace.list-mode { min-height: calc(100vh - 134px); }
  .workspace.list-mode .results-panel { margin: 0; width: 100%; height: 100%; }
  .workspace.list-mode .results-grid { grid-template-columns: 1fr; padding: 16px; }
  .modal-columns { grid-template-columns: 1fr; }
}
