:root {
  color-scheme: dark;
  --map-ink: #070a08;
  --map-panel: rgba(8, 13, 10, .86);
  --map-panel-solid: #0b100d;
  --map-text: #eee9de;
  --map-muted: #909991;
  --map-line: rgba(236, 239, 230, .14);
  --map-line-strong: rgba(236, 239, 230, .24);
  --map-signal: #73ddb0;
  --map-copper: #ff9a62;
  --map-display: "Libre Caslon Display", Georgia, serif;
  --map-display-italic: "Libre Caslon Text", Georgia, serif;
  --map-sans: "Familjen Grotesk", system-ui, sans-serif;
  --map-mono: "Familjen Grotesk", system-ui, sans-serif;
  --map-stamp: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(.2,.72,.2,1);
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--map-ink); color: var(--map-text); font-family: var(--map-sans); -webkit-font-smoothing: antialiased; }
button, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
.icon { display: block; width: 1rem; height: 1rem; }
.map-sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.map-skip { position: fixed; z-index: 1000; top: .7rem; left: .7rem; transform: translateY(-180%); padding: .7rem 1rem; border-radius: 999px; background: var(--map-text); color: var(--map-ink); font-weight: 700; transition: transform .2s; }
.map-skip:focus { transform: translateY(0); }
:focus-visible { outline: 2px solid var(--map-copper); outline-offset: 3px; }

.map-app { display: grid; height: 100dvh; grid-template-rows: 4.25rem 1fr; }
.map-topbar {
  display: flex;
  position: relative;
  z-index: 20;
  height: 4.25rem;
  padding: 0 .9rem;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  border-bottom: 1px solid var(--map-line);
  background: rgba(6,9,7,.92);
  backdrop-filter: blur(22px) saturate(120%);
}
.map-brand { display: inline-flex; min-width: 0; align-items: center; gap: .58rem; text-decoration: none; }
.map-brand-mark { width: 2rem; height: 2rem; flex: 0 0 auto; }
.map-brand-mark rect, .map-brand-mark path { fill: none; stroke: currentColor; stroke-width: 1.15; }
.map-brand-mark circle { fill: var(--map-copper); filter: drop-shadow(0 0 5px rgba(255,154,98,.65)); }
.map-brand > span { display: flex; min-width: 0; flex-direction: column; line-height: 1; }
.map-brand strong { font-size: .84rem; letter-spacing: -.04em; white-space: nowrap; }
.map-brand strong span { color: #bbbcb3; font-weight: 430; }
.map-brand small { margin-top: .28rem; overflow: hidden; color: var(--map-muted); font-family: var(--map-mono); font-size: .43rem; text-overflow: ellipsis; white-space: nowrap; }
.map-top-status { display: none; align-items: center; gap: .7rem; }
.map-live-dot { position: relative; width: .43rem; height: .43rem; flex: 0 0 auto; border-radius: 50%; background: var(--map-signal); box-shadow: 0 0 0 .22rem rgba(115,221,176,.09), 0 0 1rem rgba(115,221,176,.5); }
.map-top-status > span:last-child { display: flex; flex-direction: column; line-height: 1.15; }
.map-top-status strong { font-size: .63rem; }
.map-top-status small { margin-top: .15rem; color: var(--map-muted); font-family: var(--map-mono); font-size: .43rem; }
.map-nav { display: flex; align-items: center; gap: .45rem; }
.map-nav > a:first-child { display: none; }
.map-exit { display: inline-flex; min-height: 2.6rem; padding: .65rem .8rem; align-items: center; gap: .45rem; border: 1px solid var(--map-line); border-radius: 999px; background: rgba(255,255,255,.04); font-size: .65rem; font-weight: 700; text-decoration: none; transition: transform .25s var(--ease), background .2s; }
.map-exit:hover { transform: translateY(-1px); background: rgba(255,255,255,.08); }

.map-stage { position: relative; min-height: 0; overflow: hidden; isolation: isolate; }
.permit-map { position: absolute; inset: 0; background: #08100c; }
.map-edge-shade { position: absolute; z-index: 1; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(5,8,6,.28), transparent 15%, transparent 75%, rgba(5,8,6,.35)), linear-gradient(90deg, rgba(5,8,6,.18), transparent 20%); }
.map-title-card { position: absolute; z-index: 4; top: 1rem; left: 1rem; max-width: 17rem; pointer-events: none; text-shadow: 0 2px 18px rgba(0,0,0,.65); }
.map-title-card p { display: flex; align-items: center; gap: .65rem; color: #b9c0b9; font-family: var(--map-mono); font-size: .46rem; letter-spacing: .08em; }
.map-title-card h2 { margin: .55rem 0 0; font-family: var(--map-display); font-size: 2rem; font-weight: 370; letter-spacing: -.045em; line-height: .9; }
.map-title-card h2 em { color: #c2c3ba; font-family: var(--map-display-italic); font-weight: 400; }

.map-console {
  position: absolute;
  z-index: 8;
  right: .75rem;
  bottom: .75rem;
  left: .75rem;
  overflow: hidden;
  border: 1px solid var(--map-line-strong);
  border-radius: 1.25rem;
  background: var(--map-panel);
  box-shadow: 0 24px 70px rgba(0,0,0,.46), inset 0 1px rgba(255,255,255,.06);
  backdrop-filter: blur(22px) saturate(125%);
}
.map-console summary { display: grid; min-height: 3.7rem; padding: .85rem 1rem; grid-template-columns: 1fr auto 1rem; align-items: center; gap: .65rem; cursor: pointer; list-style: none; user-select: none; }
.map-console summary::-webkit-details-marker { display: none; }
.map-console summary > span { display: flex; align-items: center; gap: .55rem; font-size: .72rem; font-weight: 700; }
.map-console summary > span .icon { color: var(--map-copper); }
.map-console summary small { color: var(--map-muted); font-family: var(--map-mono); font-size: .44rem; }
.summary-arrow { width: .8rem; color: var(--map-muted); transition: transform .25s var(--ease); }
.map-console[open] .summary-arrow { transform: rotate(180deg); }
.map-filter-body { max-height: 15rem; padding: 0 .75rem .8rem; overflow-y: auto; border-top: 1px solid var(--map-line); }
.filter-group { padding: .75rem .15rem 0; }
.filter-group + .filter-group { margin-top: .65rem; border-top: 1px solid var(--map-line); }
.filter-group-head { display: flex; min-height: 2rem; align-items: center; justify-content: space-between; gap: 1rem; color: #c0c5be; }
.filter-group-head > span { display: flex; align-items: center; gap: .45rem; font-family: var(--map-mono); font-size: .49rem; letter-spacing: .06em; text-transform: uppercase; }
.filter-group-head > span .icon { width: .78rem; color: var(--map-signal); }
.filter-group-head label { display: flex; align-items: center; gap: .5rem; color: var(--map-muted); font-family: var(--map-mono); font-size: .45rem; text-transform: uppercase; }
.filter-group-head select { min-height: 1.9rem; padding: .3rem 1.4rem .3rem .55rem; border: 1px solid var(--map-line); border-radius: 999px; appearance: none; background: #0c130f; color: var(--map-text); font-family: var(--map-sans); font-size: .56rem; }
.chip-scroll { display: flex; width: calc(100% + .7rem); padding: .2rem .7rem .2rem 0; gap: .4rem; overflow-x: auto; scrollbar-width: none; }
.chip-scroll::-webkit-scrollbar { display: none; }
.map-chip { min-width: max-content; min-height: 2.25rem; padding: .5rem .68rem; border: 1px solid var(--map-line); border-radius: 999px; background: rgba(255,255,255,.025); color: #aeb4ad; font-size: .57rem; font-weight: 600; cursor: pointer; transition: transform .2s, border-color .2s, background .2s, color .2s; }
.map-chip:hover { transform: translateY(-1px); border-color: var(--map-line-strong); color: var(--map-text); }
.map-chip:active { transform: translateY(1px); }
.map-chip.is-active { border-color: rgba(115,221,176,.4); background: rgba(115,221,176,.12); color: var(--map-signal); box-shadow: inset 0 1px rgba(255,255,255,.05), 0 0 1.2rem rgba(115,221,176,.06); }
.map-chip-trade.is-active { border-color: rgba(255,154,98,.4); background: rgba(255,154,98,.12); color: var(--map-copper); }

.map-readout { display: flex; position: absolute; z-index: 6; top: 6.35rem; left: 1rem; max-width: calc(100% - 2rem); min-height: 2.25rem; padding: .55rem .75rem; align-items: center; flex-wrap: wrap; gap: .45rem; border: 1px solid var(--map-line); border-radius: 999px; background: rgba(7,11,8,.72); color: var(--map-muted); font-family: var(--map-mono); font-size: .43rem; box-shadow: 0 10px 30px rgba(0,0,0,.24); backdrop-filter: blur(14px); }
.map-readout strong { color: var(--map-text); font-weight: 500; }
.map-readout time { display: none; }
.map-legend { display: none; position: absolute; z-index: 5; right: 1.25rem; bottom: 1.25rem; padding: .8rem .9rem; border: 1px solid var(--map-line); border-radius: .9rem; background: rgba(7,11,8,.76); backdrop-filter: blur(15px); }
.map-legend p { margin: 0 0 .55rem; color: var(--map-muted); font-family: var(--map-mono); font-size: .45rem; letter-spacing: .06em; text-transform: uppercase; }
.map-legend > div { display: grid; grid-template-columns: repeat(3,auto); gap: .35rem .75rem; }
.map-legend span { display: flex; align-items: center; gap: .35rem; color: #bbc0ba; font-size: .49rem; }
.legend-dot { width: .45rem; height: .45rem; border-radius: 50%; background: #9db4ce; box-shadow: 0 0 .5rem currentColor; }
.legend-build { background: var(--map-copper); }
.legend-systems { background: var(--map-signal); }
.legend-exterior { background: #efb854; }
.legend-pool { background: #86b6ea; }
.legend-other { background: #9db4ce; }
.legend-big { width: .65rem; height: .65rem; border: 2px solid white; background: var(--map-copper); }
.map-flight-hint { display: none; position: absolute; z-index: 5; bottom: 1.35rem; left: 50%; align-items: center; gap: .6rem; color: var(--map-muted); font-family: var(--map-mono); font-size: .43rem; transform: translateX(-50%); transition: opacity .45s; }
.map-flight-hint i { width: 2px; height: 2px; border-radius: 50%; background: var(--map-muted); }
.map-flight-hint.is-gone { opacity: 0; }

.map-loading, .map-error { position: absolute; z-index: 15; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.map-loading { display: flex; padding: .9rem 1rem; align-items: center; gap: .7rem; border: 1px solid var(--map-line); border-radius: 999px; background: rgba(7,11,8,.9); color: var(--map-muted); font-family: var(--map-mono); font-size: .49rem; opacity: 0; pointer-events: none; transition: opacity .25s; backdrop-filter: blur(18px); }
.map-loading.is-visible { opacity: 1; }
.map-loading-ring { width: 1rem; height: 1rem; border: 1px solid rgba(255,255,255,.18); border-top-color: var(--map-signal); border-radius: 50%; animation: map-spin .9s linear infinite; }
@keyframes map-spin { to { transform: rotate(360deg); } }
.map-error { width: min(calc(100% - 2rem),26rem); padding: 1rem; border: 1px solid rgba(255,154,98,.35); border-radius: 1rem; background: rgba(29,14,8,.94); box-shadow: 0 24px 60px rgba(0,0,0,.45); text-align: center; }
.map-error strong { display: block; font-family: var(--map-display); font-size: 1.25rem; }
.map-error span { display: block; margin-top: .35rem; color: var(--map-muted); font-size: .62rem; }
.map-noscript { position: fixed; z-index: 100; right: 1rem; bottom: 1rem; left: 1rem; padding: 1rem; border: 1px solid var(--map-line); border-radius: 1rem; background: var(--map-panel-solid); color: var(--map-muted); font-size: .7rem; text-align: center; }

/* MapLibre controls and permit cards */
.maplibregl-canvas { outline: none; }
.maplibregl-ctrl-bottom-right { right: .6rem; bottom: 4.2rem; }
.maplibregl-ctrl-group { overflow: hidden; border: 1px solid var(--map-line) !important; border-radius: .8rem !important; background: rgba(7,11,8,.8) !important; box-shadow: 0 12px 28px rgba(0,0,0,.25) !important; backdrop-filter: blur(12px); }
.maplibregl-ctrl-group button { width: 2rem; height: 2rem; border-color: var(--map-line) !important; }
.maplibregl-ctrl button .maplibregl-ctrl-icon { filter: invert(1) sepia(.1); opacity: .75; }
.maplibregl-ctrl-attrib { border-radius: .4rem 0 0 !important; background: rgba(5,8,6,.74) !important; color: var(--map-muted) !important; font-size: 9px !important; }
.maplibregl-ctrl-attrib a { color: #bcc1bb !important; }
.maplibregl-popup { z-index: 12; }
.maplibregl-popup-content { min-width: min(19rem,calc(100vw - 2rem)); padding: 0 !important; overflow: hidden; border: 1px solid var(--map-line-strong); border-radius: 1.2rem !important; background: rgba(8,13,10,.96) !important; color: var(--map-text); box-shadow: 0 24px 70px rgba(0,0,0,.55) !important; backdrop-filter: blur(20px); }
.maplibregl-popup-tip { border-top-color: rgba(8,13,10,.96) !important; }
.maplibregl-popup-close-button { top: .55rem; right: .55rem; display: grid; width: 1.8rem; height: 1.8rem; place-items: center; border: 1px solid var(--map-line); border-radius: 50%; color: var(--map-muted); font-size: 1rem; line-height: 1; }
.permit-card { padding: 1rem; }
.permit-card-header { display: flex; min-height: 1.8rem; padding-right: 2.2rem; align-items: center; gap: .5rem; }
.permit-card-signal, .permit-card-big { color: var(--map-signal); font-family: var(--map-stamp); font-size: .46rem; letter-spacing: .07em; }
.permit-card-big { padding: .2rem .4rem; border: 1px solid rgba(255,154,98,.28); border-radius: 999px; color: var(--map-copper); }
.permit-card h2 { margin: .8rem 0 0; font-family: var(--map-display); font-size: 1.45rem; font-weight: 420; letter-spacing: -.035em; line-height: 1.05; }
.permit-card-facts { display: grid; margin: 1rem 0 0; grid-template-columns: repeat(2,minmax(0,1fr)); border: 1px solid var(--map-line); border-radius: .75rem; overflow: hidden; }
.permit-card-facts div { min-width: 0; padding: .65rem; border-right: 1px solid var(--map-line); border-bottom: 1px solid var(--map-line); }
.permit-card-facts div:nth-child(2n) { border-right: 0; }
.permit-card-facts div:nth-last-child(-n+2) { border-bottom: 0; }
.permit-card-facts dt { color: var(--map-muted); font-family: var(--map-mono); font-size: .42rem; text-transform: uppercase; }
.permit-card-facts dd { margin: .22rem 0 0; overflow-wrap: anywhere; font-size: .62rem; font-weight: 600; }
.permit-card-link { display: flex; min-height: 2.8rem; margin-top: .8rem; padding: .7rem .8rem; align-items: center; justify-content: center; border-radius: .7rem; background: var(--map-text); color: var(--map-ink); font-size: .67rem; font-weight: 750; text-decoration: none; }

@media (min-width: 48rem) {
  .map-topbar { padding-inline: 1.25rem; }
  .map-top-status { display: flex; }
  .map-nav > a:first-child { display: inline; padding: .6rem .7rem; color: var(--map-muted); font-size: .6rem; text-decoration: none; }
  .map-title-card { top: 1.5rem; left: 1.5rem; max-width: 24rem; }
  .map-title-card h2 { font-size: 3rem; }
  .map-readout { top: 1.5rem; right: 1.5rem; left: auto; }
  .map-readout time { display: inline; }
  .map-console { right: auto; bottom: 1.5rem; left: 1.5rem; width: min(25rem,calc(100% - 3rem)); }
  .map-filter-body { max-height: 19rem; }
  .map-legend { display: block; right: 1.5rem; bottom: 1.5rem; }
  .maplibregl-ctrl-bottom-right { right: 1.25rem; bottom: 7rem; }
}

@media (min-width: 64rem) {
  .map-app { grid-template-rows: 4.7rem 1fr; }
  .map-topbar { height: 4.7rem; padding-inline: 2rem; }
  .map-brand-mark { width: 2.1rem; height: 2.1rem; }
  .map-brand strong { font-size: .92rem; }
  .map-title-card { top: 2rem; left: 2rem; }
  .map-title-card h2 { font-size: 3.6rem; }
  .map-readout { top: 2rem; right: 2rem; min-height: 2.7rem; padding-inline: 1rem; font-size: .47rem; }
  .map-console { bottom: 2rem; left: 2rem; width: 27rem; }
  .map-console summary { min-height: 4.1rem; padding-inline: 1.2rem; }
  .map-filter-body { padding: 0 1rem 1rem; }
  .map-legend { right: 2rem; bottom: 2rem; }
  .maplibregl-ctrl-bottom-right { right: 1.75rem; bottom: 8rem; }
  .map-flight-hint { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
