/* Parsed Parcels — gallery / digital-art studio aesthetic */
:root {
  --paper: #f6f3ee;
  --paper-2: #efeae2;
  --ink: #1c1b19;
  --ink-soft: #5c574f;
  --line: rgba(28, 27, 25, 0.12);
  --glass: rgba(246, 243, 238, 0.88);
  --accent: #2a4a5c;
  --a: #3d6b5a;
  --b: #b8954a;
  --c: #8a8680;
  --shadow: 0 12px 40px rgba(28, 27, 25, 0.08);
  --radius: 2px;
  --font: "DM Sans", system-ui, sans-serif;
  --serif: "Instrument Serif", Georgia, serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
/* Map apps: lock viewport so absolute chrome is relative to a full-height shell */
html.map-app,
body.map-app {
  overflow: hidden;
  height: 100%;
  width: 100%;
}
/* Paid Atlas shells (SOS + tax-sale) after auth — full viewport for MapLibre */
body.atlas #atlasApp {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100%;
  height: 100%;
}
body.atlas #map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #efeae2;
  z-index: 0 !important;
}
body.atlas #atlasApp > .season-banner,
body.atlas #atlasApp > .chrome,
body.atlas #atlasApp > .studio-card,
body.atlas #atlasApp > .fav-table-host,
body.atlas #atlasApp > footer {
  z-index: 20 !important;
}
/* Paid Atlas shell (auth-gated) — full viewport containing block */
#atlasApp {
  position: fixed;
  inset: 0;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}
#atlasApp[hidden] {
  display: none !important;
}

#map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 100%;
  background: var(--paper-2);
  z-index: 0;
}
#atlasApp > .chrome,
#atlasApp > .studio-card,
#atlasApp > .season-banner,
#atlasApp > .user-bar,
#atlasApp > .fav-table-host,
#atlasApp > footer {
  z-index: 3;
}
#map .maplibregl-map,
#map .maplibregl-canvas-container,
#map .maplibregl-canvas {
  width: 100% !important;
  height: 100% !important;
}

.season-banner {
  position: absolute;
  z-index: 4;
  top: 0;
  left: 0;
  right: 0;
  padding: 0.4rem 1.25rem;
  font-size: 0.72rem;
  line-height: 1.4;
  color: var(--ink-soft);
  background: rgba(239, 234, 226, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
}
.season-banner strong { color: var(--ink); font-weight: 500; }
body:has(.season-banner) .chrome.top { top: 1.85rem; }
body:has(.season-banner) .studio-card { top: 7.2rem; }
.micro {
  margin: -0.25rem 0 0.65rem;
  font-size: 0.65rem;
  color: var(--c);
  line-height: 1.35;
}
.popup-row a { color: var(--accent); }

.tab-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0 0 0.85rem;
}
.tab-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.tab-row-label {
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
  min-width: 4.2rem;
  font-weight: 500;
}
.tab-nav a {
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  padding: 0.28rem 0.55rem;
  border-radius: 2px;
  background: var(--paper);
}
.tab-nav a.active,
.tab-nav a:hover {
  color: var(--paper);
  background: var(--accent);
  border-color: var(--accent);
}
.icon-btn.active {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.popup-row.muted {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* soft map chrome */
.maplibregl-ctrl-group {
  border: 1px solid var(--line) !important;
  border-radius: var(--radius) !important;
  box-shadow: none !important;
  overflow: hidden;
  background: var(--glass) !important;
}
.maplibregl-ctrl-group button {
  background: transparent !important;
  border-color: var(--line) !important;
}

.chrome.top {
  position: absolute;
  z-index: 3;
  top: 0; left: 0; right: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  padding: 1rem 1.25rem;
  background: linear-gradient(180deg, rgba(246, 243, 238, 0.96) 0%, rgba(246, 243, 238, 0.75) 70%, transparent 100%);
  pointer-events: none;
}
.chrome.top > * { pointer-events: auto; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.mark {
  width: 28px;
  height: 28px;
  color: var(--ink);
  display: block;
  flex-shrink: 0;
}
.brand-text h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.45rem;
  letter-spacing: 0.02em;
  line-height: 1.1;
}
.tagline {
  margin: 0.1rem 0 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-left: auto;
  align-items: flex-end;
}
/* Keep Outlines / Cities / Satellite / Sign out together on the right */
.map-toggles {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 0.45rem;
  margin-left: auto;
}
.map-toggles .user-bar {
  margin-left: 0.55rem;
  padding-left: 0.55rem;
  border-left: 1px solid var(--line);
}
.map-toggles .signout-btn {
  font-size: 0.78rem;
  padding: 0.4rem 0.55rem;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.field.grow { min-width: 10rem; flex: 1; max-width: 16rem; }
.field select,
.field input {
  font-family: var(--font);
  font-size: 0.85rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.45rem 0.55rem;
  outline: none;
}
.field select:focus,
.field input:focus {
  border-color: var(--accent);
}

.studio-card {
  position: absolute;
  z-index: 3;
  top: 5.5rem;
  /* Measured footer height via --pp-footer-h (chrome-layout.js); never sit under footer */
  bottom: calc(var(--pp-footer-h, 2.75rem) + 0.5rem);
  left: 1.25rem;
  width: min(300px, calc(100vw - 2.5rem));
  max-height: none;
  padding: 1.25rem 1.2rem 0.85rem;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Paid Atlas: pinned top (tabs/metrics) + scroll filters + pinned bottom dock */
.studio-card.studio-card--docked {
  display: flex;
  flex-direction: column;
  overflow: hidden; /* only .studio-scroll scrolls */
  min-height: 0;
  padding-bottom: 0.65rem;
}
.studio-card.studio-card--docked .studio-top {
  flex: 0 0 auto;
  flex-shrink: 0;
  padding-bottom: 0.35rem;
}
.studio-card.studio-card--docked .studio-top .lede,
.studio-card.studio-card--docked .studio-top .lede-tight {
  margin: 0 0 0.65rem;
  font-size: 0.8rem;
  line-height: 1.4;
}
.studio-card.studio-card--docked .studio-top .metric-row.secondary {
  margin-bottom: 0;
  padding-bottom: 0.25rem;
}
.studio-card.studio-card--docked .studio-scroll {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0.15rem 0 0.45rem;
  border-top: 1px solid var(--line);
}
.studio-card.studio-card--docked .studio-scroll .refine {
  margin-top: 0.45rem;
}
.studio-card.studio-card--docked .studio-dock {
  flex: 0 0 auto;
  flex-shrink: 0;
  margin-top: 0;
  padding: 0.45rem 0 0.1rem;
  border-top: 1px solid var(--line);
  background: var(--glass);
}
/* Compact legend — one wrapped row of tier swatches */
.studio-card.studio-card--docked .studio-dock .legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.2rem 0.7rem;
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  line-height: 1.25;
}
.studio-card.studio-card--docked .studio-dock .legend li {
  margin: 0;
  gap: 0.35rem;
}
.studio-card.studio-card--docked .studio-dock .fine {
  margin: 0.12rem 0;
  font-size: 0.68rem;
  line-height: 1.3;
}
/* Tools: single dense wrap row instead of stacked full-width buttons */
.studio-card.studio-card--docked .studio-dock .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
  margin-top: 0.25rem;
}
.studio-card.studio-card--docked .studio-dock .actions .ghost {
  flex: 0 0 auto;
  padding: 0.28rem 0.45rem;
  font-size: 0.7rem;
  line-height: 1.2;
  white-space: nowrap;
}
.studio-card.studio-card--docked .studio-dock .dock-note {
  margin: 0.3rem 0 0;
  font-size: 0.65rem;
  line-height: 1.3;
}

.eyebrow {
  margin: 0 0 0.35rem;
  font-size: 0.65rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.studio-card h2 {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.55rem;
  line-height: 1.15;
}
.lede {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--ink-soft);
  font-weight: 300;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.55rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}
.metric-row.secondary {
  grid-template-columns: 1fr 1fr;
  border-bottom: none;
  padding-bottom: 0.4rem;
}
.metric {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.metric .n {
  font-family: var(--serif);
  font-size: 1.25rem;
  line-height: 1;
  color: var(--ink);
}
.metric.tier-a .n { color: var(--a); }
.metric.tier-b .n { color: var(--b); }
.metric.tier-c .n { color: var(--c); }
/* Implicit tier legend: label color matches the stat above it */
.metric.tier-a .l { color: var(--a); }
.metric.tier-b .l { color: var(--b); }
.metric.tier-c .l { color: var(--c); }
.metric .l {
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.metric.tier-a .l,
.metric.tier-b .l,
.metric.tier-c .l {
  font-weight: 500;
  opacity: 0.92;
}

.legend {
  list-style: none;
  margin: 0.4rem 0 0.8rem;
  padding: 0;
  font-size: 0.78rem;
  color: var(--ink-soft);
  line-height: 1.55;
}
.legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.swatch.a { background: var(--a); }
.swatch.b { background: var(--b); }
.swatch.c { background: var(--c); }

.fine {
  min-height: 1em;
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  /* Soft ink (not error red) — status lines, not failures */
  color: var(--ink-soft);
}
.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ghost {
  font-family: var(--font);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.4rem 0.65rem;
  cursor: pointer;
}
.ghost:hover {
  border-color: var(--accent);
  background: rgba(42, 74, 92, 0.06);
}
.ghost.active {
  border-color: var(--accent);
  background: rgba(42, 74, 92, 0.1);
  color: var(--ink);
}
.ghost.full {
  width: 100%;
  margin-top: 0.35rem;
}
.icon-btn {
  align-self: flex-end;
  margin-bottom: 1px;
}

/* Refine drawer — secondary filters stay out of the way */
.refine {
  margin: 0.15rem 0 0.75rem;
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}
.refine > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  user-select: none;
}
.refine > summary::-webkit-details-marker { display: none; }
.refine-hint {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--c);
}
.refine[open] .refine-hint { color: var(--a); }
.refine-body {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.65rem;
  padding-bottom: 0.15rem;
}
.refine-body .field span {
  font-size: 0.62rem;
}
.refine-body .field select {
  width: 100%;
}

.chrome.bottom {
  position: absolute;
  z-index: 4;
  left: 0; right: 0; bottom: 0;
  max-height: min(42vh, 320px);
  overflow: auto;
  background: rgba(246, 243, 238, 0.98);
  border-top: 1px solid var(--line);
  padding: 0.55rem 1.25rem 0.75rem;
  backdrop-filter: blur(8px);
  box-shadow: 0 -6px 20px rgba(28, 27, 25, 0.04);
}
/* MapLibre zoom/attribution clear footer (height from chrome-layout.js) */
body.map-app .maplibregl-ctrl-bottom-right,
#atlasApp .maplibregl-ctrl-bottom-right {
  bottom: calc(var(--pp-footer-h, 2.75rem) + 0.35rem) !important;
}
.disclaimer summary {
  cursor: pointer;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  list-style: none;
}
.disclaimer summary::-webkit-details-marker { display: none; }
.disclaimer-body {
  margin-top: 0.65rem;
  max-width: 52rem;
  font-size: 0.78rem;
  line-height: 1.55;
  color: var(--ink-soft);
  font-weight: 300;
}
.disclaimer-body strong { color: var(--ink); font-weight: 500; }
.disclaimer-body p { margin: 0 0 0.55rem; }

/* Favorites strip (paid maps, when filter = favorites only) */
.fav-table-host {
  position: absolute;
  z-index: 4;
  left: 0;
  right: 0;
  bottom: var(--pp-footer-h, 2.75rem);
  max-height: 7.5rem;
  pointer-events: none;
}
.fav-table-host[hidden] {
  display: none !important;
}
.fav-table-bar {
  pointer-events: auto;
  margin: 0 0.75rem 0.35rem;
  padding: 0.4rem 0.5rem 0.45rem;
  background: rgba(246, 243, 238, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.fav-table-label {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0 0 0.3rem 0.15rem;
}
.fav-table-scroll {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
}
.fav-chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  min-width: 9rem;
  max-width: 14rem;
  padding: 0.35rem 0.5rem;
  border: 1px solid var(--line);
  background: var(--paper);
  cursor: pointer;
  font: inherit;
  text-align: left;
  border-radius: var(--radius);
  color: var(--ink);
}
.fav-chip:hover {
  border-color: var(--accent);
}
.fav-chip-tier {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.fav-chip-tier.t-a { color: var(--a); }
.fav-chip-tier.t-b { color: var(--b); }
.fav-chip-tier.t-c { color: var(--c); }
.fav-chip-id {
  font-size: 0.72rem;
  font-weight: 500;
  word-break: break-all;
}
.fav-chip-meta {
  font-size: 0.65rem;
  color: var(--ink-soft);
  font-weight: 300;
}
/* When favorites strip is open, leave room above footer for the panel bottom */
body.fav-table-open .studio-card {
  bottom: calc(var(--pp-footer-h, 2.75rem) + 8rem);
}
body.fav-table-open .maplibregl-ctrl-bottom-right {
  bottom: calc(var(--pp-footer-h, 2.75rem) + 7.8rem) !important;
}

/* popups — scannable hierarchy (hero → metrics → detail → links) */
.maplibregl-popup-content {
  font-family: var(--font);
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem 0.85rem 0.7rem;
  max-width: 300px;
  font-size: 0.78rem;
  line-height: 1.35;
}
.maplibregl-popup-tip { border-top-color: var(--paper) !important; }
.maplibregl-popup-close-button {
  color: var(--ink-soft);
  font-size: 1.1rem;
  padding: 0.2rem 0.45rem;
}
.pp-pop { min-width: 200px; }
.pp-id {
  font-family: var(--serif);
  font-size: 1.05rem;
  color: var(--ink);
  line-height: 1.2;
  margin: 0 0 0.2rem;
  padding-right: 1.1rem;
  word-break: break-all;
}
.pp-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.15rem;
}
.pp-tier {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pp-tier.t-a { color: var(--a); }
.pp-tier.t-b { color: var(--b); }
.pp-tier.t-c { color: var(--c); }
.pp-score {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}
.pp-sub {
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin: 0 0 0.55rem;
  font-weight: 400;
}
.pp-kicker {
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin: 0.45rem 0 0.25rem;
}
.pp-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.55rem;
  margin: 0 0 0.35rem;
}
.pp-cell {
  min-width: 0;
}
.pp-lab {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
  font-weight: 500;
  margin-bottom: 0.08rem;
}
.pp-val {
  display: block;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--ink);
  word-break: break-word;
}
.pp-val.em {
  font-size: 0.95rem;
  font-weight: 600;
}
.pp-row {
  color: var(--ink-soft);
  margin: 0.2rem 0;
  font-weight: 300;
  font-size: 0.76rem;
}
.pp-row strong {
  color: var(--ink);
  font-weight: 500;
}
.pp-note {
  font-size: 0.65rem;
  color: var(--ink-soft);
  opacity: 0.9;
  margin: 0.35rem 0 0.15rem;
  line-height: 1.35;
}
.pp-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.65rem;
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--line);
  font-size: 0.74rem;
}
.pp-links a { color: var(--accent); font-weight: 500; }
.pp-actions { margin-top: 0.4rem; }
/* legacy class names still used in a few places */
.popup-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
}
.popup-row {
  color: var(--ink-soft);
  margin: 0.18rem 0;
  font-weight: 300;
}
.popup-row b {
  color: var(--ink);
  font-weight: 500;
}
.popup-row.muted {
  font-size: 0.78rem;
  opacity: 0.85;
}

/* ===== Mobile map-first shell (desktop ≥721px unchanged) ===== */
.mobile-backdrop,
.mobile-peek,
.mobile-tools-sheet,
.mobile-map-sheet,
.mobile-sheet-head-card,
.season-banner-toggle {
  display: none !important;
  pointer-events: none !important;
}
/* Desktop: always show full banner body (never leave collapse wrapper visible) */
.season-banner-inner {
  display: contents;
}
/* Desktop safety: if mobile collapse classes leak, still show full banner text */
@media (min-width: 721px) {
  .season-banner.is-collapsed .season-banner-inner,
  .season-banner .season-banner-inner {
    display: contents !important;
  }
  .season-banner-toggle {
    display: none !important;
    pointer-events: none !important;
  }
}
@media (max-width: 720px) {
  .season-banner-inner {
    display: block;
  }
}
/* Paid Atlas: hide mobile chrome until auth unlocks */
body.auth-locked .mobile-peek,
body.auth-locked .mobile-tools-sheet,
body.auth-locked .mobile-map-sheet,
body.auth-locked .mobile-backdrop {
  display: none !important;
}

@media (max-width: 720px) {
  .mobile-backdrop {
    display: block !important;
    position: fixed;
    inset: 0;
    z-index: 100;
    background: rgba(28, 27, 25, 0.35);
    /* Map stays under this; touch outside sheet closes (see mobile-shell.js) */
    pointer-events: auto !important;
  }
  .mobile-backdrop[hidden] {
    display: none !important;
    pointer-events: none !important;
  }

  .mobile-peek {
    display: flex !important;
    position: fixed;
    z-index: 120;
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(var(--pp-footer-h, 2.5rem) + 0.45rem);
    gap: 0.5rem;
    pointer-events: none !important;
  }
  .mobile-peek-btn {
    pointer-events: auto;
    flex: 1 1 50%;
    padding: 0.7rem 0.75rem !important;
    font-size: 0.88rem !important;
    font-weight: 500;
    background: rgba(246, 243, 238, 0.97) !important;
    border: 1px solid var(--line) !important;
    box-shadow: var(--shadow);
  }
  .mobile-peek-btn[aria-pressed="true"] {
    border-color: var(--accent) !important;
    color: var(--accent);
  }
  body.mobile-sheet-filters .mobile-peek,
  body.mobile-sheet-tools .mobile-peek,
  body.mobile-sheet-map .mobile-peek {
    bottom: auto;
    top: 0.5rem;
    opacity: 0.92;
  }
  /* Product map switcher lives in Map sheet, not inside Filters */
  .studio-card .tab-nav {
    display: none !important;
  }

  /* Compact top: brand only */
  .chrome.top {
    padding: 0.5rem 0.75rem !important;
    gap: 0.4rem !important;
    max-height: none !important;
    overflow: visible !important;
    background: linear-gradient(
      180deg,
      rgba(246, 243, 238, 0.97) 0%,
      rgba(246, 243, 238, 0.82) 75%,
      transparent 100%
    ) !important;
  }
  .chrome.top .brand-text .tagline {
    display: none;
  }
  .chrome.top .brand-text h1 {
    font-size: 1.15rem;
  }
  /* Filters relocated into sheet via JS; hide empty chrome nav slot */
  .chrome.top > .filters {
    display: none !important;
  }

  /* Collapsed season banner */
  .season-banner {
    padding: 0 !important;
    font-size: 0.72rem;
    background: rgba(246, 243, 238, 0.97) !important;
  }
  .season-banner-toggle {
    display: flex !important;
    pointer-events: auto !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin: 0;
    padding: 0.4rem 0.85rem;
    border: 0;
    background: transparent;
    font: inherit;
    color: var(--ink-soft);
    text-align: left;
    cursor: pointer;
  }
  .season-banner-summary {
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
    color: var(--ink);
  }
  .season-banner-chevron {
    flex: 0 0 auto;
    opacity: 0.7;
  }
  .season-banner.is-collapsed .season-banner-inner {
    display: none;
  }
  .season-banner:not(.is-collapsed) .season-banner-inner {
    display: block;
    padding: 0 0.85rem 0.55rem;
    color: var(--ink-soft);
    line-height: 1.4;
  }
  body:has(.season-banner) .chrome.top {
    top: 2.15rem !important;
  }
  body:has(.season-banner:not(.is-collapsed)) .chrome.top {
    top: auto;
    /* leave absolute; banner expands over map — ok */
  }

  /* Studio card = filters bottom sheet (hidden by default) */
  .studio-card,
  #atlasApp .studio-card,
  body.atlas #atlasApp > .studio-card {
    top: auto !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-height: min(72vh, 560px) !important;
    border-radius: 14px 14px 0 0 !important;
    transform: translateY(110%);
    transition: transform 0.28s ease;
    z-index: 110 !important;
    padding: 0.65rem 1rem 1rem !important;
    box-shadow: 0 -8px 28px rgba(28, 27, 25, 0.14) !important;
  }
  body.mobile-sheet-filters .studio-card,
  body.mobile-sheet-filters #atlasApp .studio-card {
    transform: translateY(0);
  }
  .mobile-sheet-head-card {
    display: flex !important;
    /* Base rule sets pointer-events:none so desktop never hits chrome; restore on mobile */
    pointer-events: auto !important;
    align-items: center;
    justify-content: space-between;
    gap: 0.35rem;
    margin: 0 0 0.5rem;
    padding-bottom: 0.4rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.85rem;
  }
  .mobile-sheet-head-card > strong {
    flex: 0 0 auto;
  }
  .mobile-sheet-head-actions {
    display: flex;
    pointer-events: auto !important;
    flex: 1 1 auto;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.3rem;
    min-width: 0;
  }
  .mobile-sheet-head-actions .mobile-head-action,
  .mobile-sheet-head-actions .ghost,
  .mobile-sheet-head-actions #fitBtn,
  .mobile-sheet-head-actions #clearRefineBtn {
    pointer-events: auto !important;
  }
  .mobile-sheet-head-actions .mobile-head-action,
  .mobile-sheet-head-actions .ghost {
    flex: 0 0 auto;
    padding: 0.28rem 0.45rem !important;
    font-size: 0.72rem !important;
    white-space: nowrap;
  }
  .mobile-sheet-head-actions #clearRefineBtn {
    width: auto !important;
  }
  .studio-card.studio-card--docked {
    max-height: min(78vh, 620px) !important;
  }
  .studio-card.studio-card--docked .studio-top .lede,
  .studio-card.studio-card--docked .studio-top .lede-tight {
    display: none; /* room for metrics + filters in sheet */
  }
  .studio-card h2 {
    font-size: 1.2rem;
  }
  .metric-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .mobile-filters-mount {
    margin-bottom: 0.5rem;
  }
  .mobile-filters-mount .filters {
    display: flex !important;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
  }
  .mobile-filters-mount .field,
  .mobile-filters-mount .field.grow {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .mobile-filters-mount .map-toggles {
    display: none; /* layers live in tools sheet */
  }

  /* Tools / layers sheet */
  .mobile-tools-sheet,
  .mobile-map-sheet {
    display: block !important;
    pointer-events: auto !important;
    position: fixed;
    z-index: 110;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: min(48vh, 360px);
    padding: 0.75rem 1rem 1.1rem;
    background: rgba(246, 243, 238, 0.98);
    border-radius: 14px 14px 0 0;
    border-top: 1px solid var(--line);
    box-shadow: 0 -8px 28px rgba(28, 27, 25, 0.14);
    transform: translateY(110%);
    transition: transform 0.28s ease;
    overflow: auto;
  }
  body.mobile-sheet-tools .mobile-tools-sheet,
  body.mobile-sheet-map .mobile-map-sheet {
    transform: translateY(0);
  }
  .mobile-map-nav {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
  }
  .mobile-map-link {
    display: block;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: #fff;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
  }
  .mobile-map-link.is-current {
    border-color: var(--accent);
    background: rgba(42, 74, 92, 0.08);
    color: var(--accent);
  }
  .mobile-sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    font-size: 0.85rem;
  }
  .mobile-tools-mount {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }
  .mobile-tools-mount .map-toggles {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    width: 100%;
    margin: 0;
  }
  .mobile-tools-mount .user-bar {
    margin-left: 0;
    border-left: 0;
    padding-left: 0;
  }
  .mobile-tools-mount .icon-btn,
  .mobile-tools-mount .ghost {
    flex: 1 1 auto;
    min-width: 5.5rem;
    justify-content: center;
  }

  /* Footer slim */
  .chrome.bottom {
    max-height: none;
    padding: 0.35rem 0.75rem 0.45rem;
  }
  .chrome.bottom .disclaimer-body {
    display: none;
  }
  .chrome.bottom details[open] .disclaimer-body {
    display: block;
    max-height: 28vh;
    overflow: auto;
  }

  /* Favorites above peek bar */
  .fav-table-host {
    bottom: calc(var(--pp-footer-h, 2.5rem) + 3.4rem) !important;
  }
  body.fav-table-open .studio-card {
    bottom: 0 !important;
  }
  body.map-app .maplibregl-ctrl-bottom-right,
  #atlasApp .maplibregl-ctrl-bottom-right {
    bottom: calc(var(--pp-footer-h, 2.5rem) + 3.6rem) !important;
  }
  body.mobile-sheet-filters .maplibregl-ctrl-bottom-right,
  body.mobile-sheet-tools .maplibregl-ctrl-bottom-right,
  body.mobile-sheet-map .maplibregl-ctrl-bottom-right {
    bottom: 0.5rem !important;
  }

  .brand-text .tagline {
    display: none;
  }
}

@media (min-width: 721px) {
  /* Ensure mobile-only chrome never appears on desktop */
  .mobile-backdrop,
  .mobile-peek,
  .mobile-tools-sheet,
  .mobile-map-sheet,
  .mobile-sheet-head-card {
    display: none !important;
  }
  .mobile-filters-mount:empty {
    display: none;
  }
}

@media (max-width: 420px) {
  .brand-text h1 {
    font-size: 1.1rem;
  }
  .chrome.bottom {
    padding: 0.3rem 0.65rem 0.4rem;
  }
  .mobile-peek-btn {
    font-size: 0.82rem !important;
  }
}
