/* UK Property Search
   Layout: full-bleed live-photo hero that folds into a sticky search bar; image-first card grid;
   a full-screen property sheet (gallery left, price/agent rail right). Motion: one drifting photo
   mosaic, staggered card reveals, a sheet that rises; everything else stays still.
   Dark-first (near-black canvas, white pill actions), with a matching light theme. */
:root {
  --bg: #0b0c0c; --bg-2: #111313; --surface: #161918; --surface-2: #1d2120; --line: rgb(255 255 255 / 0.09); --line-2: rgb(255 255 255 / 0.16);
  --text: #f1f3f2; --muted: #9ba3a0; --faint: #9ba3a0;
  --pill: #ffffff; --pill-text: #0b0c0c; --glass: rgb(22 25 24 / 0.62);
  --dusk-1: #ffb37a; --dusk-2: #c7b8ff; /* hero accent: dusk over rooftops */
  --good: #52d18f; --warn: #f4b54d; --bad: #ff7d6e;
  --rightmove: #00b39b; --onthemarket: #e2405a; --openrent: #5d8ff5; --spareroom: #a983f7;
  --display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --body: "Archivo", "Segoe UI", system-ui, sans-serif;
  --r-lg: 22px; --r-md: 14px; --r-sm: 10px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --chart-1: #d8682f; --chart-2: #8a6cf0; /* validated pair (dataviz validate_palette, dark surface) */
  --map-filter: invert(1) hue-rotate(180deg) brightness(0.92) contrast(0.88) saturate(0.55);
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f3f4f5; --bg-2: #eceef0; --surface: #ffffff; --surface-2: #f4f5f6; --line: rgb(16 18 19 / 0.09); --line-2: rgb(16 18 19 / 0.18);
    --text: #111314; --muted: #5b6366; --faint: #5b6366;
    --pill: #111314; --pill-text: #ffffff; --glass: rgb(255 255 255 / 0.72);
    --dusk-1: #e0672a; --dusk-2: #7a5cf0;
    --good: #157344; --warn: #895600; --bad: #c53b2c;
    --rightmove: #00866f; --onthemarket: #c21f3b; --openrent: #2b62d9; --spareroom: #7c4ee0;
    --map-filter: none; --chart-1: #e0672a; --chart-2: #7a5cf0;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f3f4f5; --bg-2: #eceef0; --surface: #ffffff; --surface-2: #f4f5f6; --line: rgb(16 18 19 / 0.09); --line-2: rgb(16 18 19 / 0.18);
  --text: #111314; --muted: #5b6366; --faint: #5b6366;
  --pill: #111314; --pill-text: #ffffff; --glass: rgb(255 255 255 / 0.72);
  --dusk-1: #e0672a; --dusk-2: #7a5cf0;
  --good: #157344; --warn: #895600; --bad: #c53b2c;
  --rightmove: #00866f; --onthemarket: #c21f3b; --openrent: #2b62d9; --spareroom: #7c4ee0;
  --map-filter: none; --chart-1: #e0672a; --chart-2: #7a5cf0;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--body); background: var(--bg); color: var(--text); font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
img { max-width: 100%; }
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
/* Windows draws the dropdown list with a light background unless options are styled too */
option, optgroup { background-color: var(--surface); color: var(--text); }
/* map tiles: OSM is light-only, so dark mode inverts it and turns the colours back */
.osm-tiles { filter: var(--map-filter, none); }
:focus-visible { outline: 2px solid var(--dusk-1); outline-offset: 2px; border-radius: 6px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }

/* ---- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; transition: transform .2s var(--ease), background .2s, border-color .2s; }
.btn:hover:not(:disabled) { border-color: var(--text); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: .4; cursor: default; }
.btn.primary { background: var(--pill); color: var(--pill-text); border-color: var(--pill); }
.btn.sm { height: 34px; padding: 0 13px; font-size: 13px; }
.btn.icon-only { width: 42px; padding: 0; }
.btn.sm.icon-only { width: 34px; }
.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.seg button { height: 34px; padding: 0 16px; border: 0; border-radius: 999px; background: transparent; font-weight: 600; font-size: 14px; cursor: pointer; color: var(--muted); transition: background .25s var(--ease), color .25s; }
.seg button[aria-pressed="true"] { background: var(--pill); color: var(--pill-text); }

/* ---- top nav */
.nav { position: fixed; inset: 0 0 auto; z-index: 40; padding-top: env(safe-area-inset-top, 0px); transition: background .3s, border-color .3s; border-bottom: 1px solid transparent; }
.nav .wrap { display: flex; align-items: center; gap: 12px; height: 68px; }
.brand { font: 800 21px/1 var(--display); font-stretch: 75%; letter-spacing: 0.01em; text-transform: uppercase; text-decoration: none; margin-right: auto; display: flex; align-items: center; gap: 10px; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--dusk-1), var(--dusk-2)); display: grid; place-items: center; color: #111; }
.brand-mark .icon { width: 16px; height: 16px; stroke-width: 2.4; }
body.scrolled .nav, body.searched .nav { background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-color: var(--line); }
#filtersBtn { position: relative; overflow: visible; }
.badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--dusk-1); color: #111; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.saved-count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--dusk-1); color: #111; font-size: 12px; display: inline-grid; place-items: center; }

/* ---- hero */
.hero { position: relative; overflow: hidden; padding: calc(120px + env(safe-area-inset-top, 0px)) 0 64px; min-height: min(92vh, 860px); display: flex; align-items: flex-end; isolation: isolate; }
.mosaic { position: absolute; inset: -40px 0 0; z-index: -2; display: flex; flex-direction: column; gap: 14px; transform: rotate(-4deg) scale(1.12); opacity: 0; transition: opacity 1.2s var(--ease); }
.mosaic.ready { opacity: 1; }
.mosaic .lane { display: flex; gap: 14px; width: max-content; animation: drift 90s linear infinite; }
.mosaic .lane:nth-child(2) { animation-direction: reverse; animation-duration: 110s; }
.mosaic .lane:nth-child(3) { animation-duration: 130s; }
.mosaic img { width: 340px; height: 230px; object-fit: cover; border-radius: 18px; }
@keyframes drift { to { transform: translateX(-50%); } }
.hero::before { content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 80% at 50% 10%, color-mix(in srgb, var(--bg) 35%, transparent), var(--bg) 78%), linear-gradient(to bottom, transparent 40%, var(--bg)); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); font-size: 13px; font-weight: 600; color: var(--muted); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 var(--good); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.headline { font: 900 clamp(56px, 11.5vw, 168px)/0.86 var(--display); font-stretch: 62%; text-transform: uppercase; letter-spacing: -0.01em; margin: 22px 0 18px; text-wrap: balance; }
.headline span { display: block; }
.headline .glow { background: linear-gradient(92deg, var(--dusk-1), var(--dusk-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lede { max-width: 56ch; font-size: clamp(16px, 1.6vw, 19px); color: var(--muted); margin: 0 0 30px; }

/* ---- search console (hero → sticky bar) */
.console { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 10px; border-radius: 28px; border: 1px solid var(--line-2); background: var(--glass); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); box-shadow: 0 30px 80px -30px rgb(0 0 0 / 0.6); }
.field { display: flex; align-items: center; gap: 8px; height: 46px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.field:focus-within { border-color: var(--text); }
.field input, .field select { border: 0; background: transparent; outline: none; height: 100%; min-width: 0; width: 100%; }
.field select { cursor: pointer; padding-right: 4px; }
.field.grow { flex: 1 1 240px; }
.field.fprice { flex: 0 1 190px; }
.field.fbeds { flex: 0 1 130px; }
.field .icon { color: var(--muted); }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.console .btn.primary { height: 46px; padding: 0 24px; }

/* after a search the hero folds into a sticky search bar under the nav */
body.searched { padding-top: calc(68px + env(safe-area-inset-top, 0px)); }
body.searched .hero { position: sticky; top: calc(68px + env(safe-area-inset-top, 0px)); z-index: 30; min-height: 0; overflow: visible; padding: 10px 0 14px; background: linear-gradient(var(--bg) 75%, transparent); }
body.searched .hero-copy, body.searched .mosaic, body.searched .hero::before { display: none; }
body.searched .console { box-shadow: none; animation: rise .5s var(--ease); }

/* ---- toolbar + status */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 10px 0 18px; }
.toolbar .count { font: 800 30px/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin-right: 6px; }
.toolbar .spacer { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 12px; color: var(--muted); }
.chip.err { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 50%, transparent); }
.chip .spin { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--text); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.select-pill { height: 42px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); font-weight: 600; font-size: 14px; cursor: pointer; }
.kw { height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--glass); min-width: 0; flex: 0 1 260px; }

/* ---- cards */
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 28px 22px; padding-bottom: 40px; }
.card { position: relative; display: flex; flex-direction: column; gap: 14px; cursor: pointer; animation: rise .7s var(--ease) both; animation-delay: calc(min(var(--i, 0), 12) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } }
.media { position: relative; aspect-ratio: 4 / 3; max-width: 100%; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.track { display: flex; height: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.track::-webkit-scrollbar { display: none; }
.track img { flex: 0 0 100%; width: 100%; height: 100%; object-fit: cover; scroll-snap-align: start; transition: transform .9s var(--ease); }
.card:hover .track img { transform: scale(1.035); }
.media .noimg { display: grid; place-items: center; height: 100%; color: var(--faint); font-size: 13px; }
.over { position: absolute; display: flex; gap: 6px; z-index: 2; }
.over.tl { top: 12px; left: 12px; flex-wrap: wrap; max-width: calc(100% - 70px); }
.over.tr { top: 10px; right: 10px; }
.over.bl { bottom: 12px; left: 12px; }
.over.br { bottom: 12px; right: 12px; }
.tag { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #fff; background: rgb(10 11 11 / 0.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); text-decoration: none; white-space: nowrap; }
.tag .dot { width: 7px; height: 7px; }
.tag.hot { background: var(--dusk-1); color: #111; }
.tag.auction { background: var(--dusk-2); color: #111; }
.tag .icon { width: 13px; height: 13px; }
.save { width: 38px; height: 38px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; color: #fff; background: rgb(10 11 11 / 0.45); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: transform .25s var(--ease); }
.save:active { transform: scale(0.85); }
.save[aria-pressed="true"] { color: #ff5d73; }
.save[aria-pressed="true"] .icon { fill: currentColor; }
.save-detail[aria-pressed="true"] { color: #ff7589; border-color: currentColor; }
.save-detail[aria-pressed="true"] .icon { fill: currentColor; }
.save-detail { min-height: 44px; }
.save-detail .label { display: inline !important; }
.navbtn { position: absolute; top: 50%; z-index: 2; width: 36px; height: 36px; margin-top: -18px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: rgb(255 255 255 / 0.9); color: #111; opacity: 0; transition: opacity .25s; }
.navbtn.prev { left: 10px; } .navbtn.next { right: 10px; }
.media:hover .navbtn, .navbtn:focus-visible { opacity: 1; }
.dots { display: flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.5); transition: background .2s, width .3s var(--ease); }
.dots i.on { background: #fff; width: 16px; border-radius: 3px; }
.info { display: flex; flex-direction: column; gap: 4px; padding: 0 4px; }
.row1 { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.price { font: 800 26px/1.05 var(--display); font-stretch: 80%; letter-spacing: -0.01em; }
.qual { font-size: 12px; color: var(--muted); font-weight: 500; }
.specs { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 14px; color: var(--muted); }
.specs span { display: inline-flex; align-items: center; gap: 5px; }
.specs .icon { width: 16px; height: 16px; }
.addr { margin: 2px 0 0; font-size: 16px; font-weight: 600; line-height: 1.3; }
.addr a { text-decoration: none; }
.sum { margin: 0; font-size: 13.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 4px; font-size: 12.5px; color: var(--faint); }
.score { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 700; border: 1px solid currentColor; white-space: nowrap; cursor: help; }
.score b { font-size: 13px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.also { font-weight: 600; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }

.skeleton .media, .skeleton .line { background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton .line { height: 14px; border-radius: 7px; }
@keyframes shimmer { to { background-position: -150% 0; } }

#empty { padding: 60px 0 90px; color: var(--muted); }
#empty h2 { font: 800 32px/1 var(--display); font-stretch: 70%; text-transform: uppercase; color: var(--text); margin: 0 0 10px; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; margin-top: 28px; }
.how div { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.how b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.more-row { display: flex; justify-content: center; gap: 10px; padding: 10px 0 80px; }

#map { height: calc(100vh - 230px); min-height: 420px; border-radius: var(--r-lg); border: 1px solid var(--line); margin-bottom: 40px; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: var(--surface); color: var(--text); }
.leaflet-popup-content { margin: 10px; font: 14px/1.4 var(--body); }
.pop img { width: 220px; height: 140px; object-fit: cover; border-radius: 10px; display: block; margin-bottom: 8px; }
.pop b { font-size: 17px; }

/* ---- filters drawer */
.drawer { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: min(420px, 100vw); border: 0; border-left: 1px solid var(--line); padding: 0; background: var(--bg-2); color: var(--text); }
.drawer[open] { animation: slidein .45s var(--ease); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }
dialog::backdrop { background: rgb(0 0 0 / 0.55); backdrop-filter: blur(4px); }
.drawer form { display: flex; flex-direction: column; gap: 22px; padding: 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.drawer h2 { font: 800 28px/1 var(--display); font-stretch: 70%; text-transform: uppercase; margin: 0; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; }
.group { display: flex; flex-direction: column; gap: 10px; }
.group > span { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.input { height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); width: 100%; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { cursor: pointer; }
.pills input { position: absolute; opacity: 0; pointer-events: none; }
.pills span { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-2); font-size: 14px; font-weight: 600; color: var(--muted); transition: all .2s; }
.pills input:checked + span { background: var(--pill); color: var(--pill-text); border-color: var(--pill); }
.pills input:focus-visible + span { outline: 2px solid var(--dusk-1); outline-offset: 2px; }
.drawer-foot { display: flex; gap: 10px; position: sticky; bottom: 0; padding-top: 10px; background: var(--bg-2); }
.drawer-foot .btn { flex: 1; }

/* ---- property sheet */
.sheet { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: var(--bg); color: var(--text); overflow-y: auto; }
.sheet[open] { animation: sheetin .55s var(--ease); }
@keyframes sheetin { from { transform: translateY(36px); opacity: 0; } }
.sheet-bar { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.sheet-bar .wrap { display: flex; align-items: center; gap: 10px; height: 64px; }
.sheet-bar .ttl { margin-right: auto; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gallery { display: grid; grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; gap: 10px; height: min(62vh, 620px); margin: 20px 0 14px; border-radius: var(--r-lg); overflow: hidden; }
.gallery button { border: 0; padding: 0; cursor: zoom-in; background: var(--surface-2); overflow: hidden; position: relative; }
.gallery button:first-child { grid-row: 1 / 3; }
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .8s var(--ease); }
.gallery button:hover img { transform: scale(1.03); }
.gallery .all { position: absolute; right: 14px; bottom: 14px; }
.gallery.single { grid-template-columns: 1fr; }
.media-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.sheet-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: start; padding-bottom: 80px; }
.rail { position: sticky; top: 84px; display: flex; flex-direction: column; gap: 16px; }
.panel { padding: 22px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.big-price { font: 900 46px/0.95 var(--display); font-stretch: 72%; letter-spacing: -0.01em; }
.sub-price { color: var(--muted); font-size: 14px; margin-top: 6px; }
.scores { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
.gauge { padding: 14px; border-radius: var(--r-md); background: var(--bg-2); border: 1px solid var(--line); }
.gauge small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.gauge b { font: 900 34px/1.1 var(--display); font-stretch: 75%; }
.gauge .bar { height: 5px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.gauge .bar i { display: block; height: 100%; width: var(--v); background: currentColor; transform-origin: left; animation: grow 1.1s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.agent { display: flex; gap: 14px; align-items: center; }
.agent img { width: 64px; height: 44px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.agent b { display: block; }
.agent small { color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.actions .btn { width: 100%; height: 48px; }
.phone { font: 700 20px var(--display); font-stretch: 85%; user-select: all; }
.sheet h1 { font: 800 clamp(30px, 4vw, 46px)/1 var(--display); font-stretch: 72%; text-transform: uppercase; margin: 0 0 8px; text-wrap: balance; }
.sheet .where { color: var(--muted); font-size: 17px; margin: 0 0 24px; display: flex; gap: 8px; align-items: center; }
.reel { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 36px; }
.reel div { padding: 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.reel small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.reel b { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.block { margin-bottom: 40px; }
.block > h2 { font: 800 24px/1 var(--display); font-stretch: 72%; text-transform: uppercase; margin: 0 0 16px; }
.features { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px 22px; padding: 0; margin: 0; list-style: none; }
.features li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; }
.features .icon { color: var(--good); margin-top: 3px; }
.desc { white-space: pre-line; color: color-mix(in srgb, var(--text) 82%, var(--bg)); font-size: 15.5px; line-height: 1.7; max-width: 72ch; max-height: 15em; overflow: hidden; position: relative; }
.desc.open { max-height: none; }
.desc:not(.open)::after { content: ""; position: absolute; inset: auto 0 0; height: 5em; background: linear-gradient(transparent, var(--bg)); }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 28px; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; }
.near { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 24px; }
.near h3 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.near ul { list-style: none; margin: 0; padding: 0; }
.near li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.near li span { color: var(--muted); white-space: nowrap; }
#detailMap { height: 340px; border-radius: var(--r-lg); border: 1px solid var(--line); }
.area-points { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 8px; }
.area-points li { display: flex; gap: 10px; font-size: 15px; }
.area-points li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 8px; border-radius: 50%; background: var(--good); }
.area-points li.w::before { background: var(--bad); }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; }
.note { font-size: 13px; color: var(--faint); }
.loading-line { display: flex; align-items: center; gap: 10px; color: var(--muted); }

/* ---- lightbox */
.lightbox { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; margin: 0; padding: 0; border: 0; background: rgb(5 6 6 / 0.96); color: #fff; overflow: hidden; }
.lightbox[open] { display: grid; grid-template-rows: auto 1fr auto; animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.lb-top { display: flex; align-items: center; justify-content: space-between; padding: max(14px, env(safe-area-inset-top, 0px)) 20px 10px; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 70px; }
.lb-stage img { max-height: calc(100vh - 200px); max-width: 100%; object-fit: contain; border-radius: 10px; }
.lb-stage .navbtn { opacity: 1; width: 48px; height: 48px; margin-top: -24px; }
.lb-thumbs { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 12px 20px max(16px, env(safe-area-inset-bottom, 0px)); }
.lb-thumbs button { flex: none; border: 2px solid transparent; border-radius: 8px; padding: 0; background: none; cursor: pointer; opacity: .55; }
.lb-thumbs button[aria-current="true"] { border-color: #fff; opacity: 1; }
.lb-thumbs img { width: 96px; height: 68px; object-fit: cover; border-radius: 6px; display: block; }
.lightbox .btn { color: #fff; background: rgb(255 255 255 / 0.08); border-color: rgb(255 255 255 / 0.2); }

/* ---- responsive */
@media (max-width: 1080px) {
  .sheet-grid { grid-template-columns: 1fr; gap: 10px; }
  .rail { position: static; order: -1; }
}
@media (max-width: 720px) {
  .hero { min-height: 0; padding: calc(96px + env(safe-area-inset-top, 0px)) 0 28px; }
  /* photos stay as a backdrop up top but fade out behind the copy, so the lede stays readable */
  .hero::before { background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 45%, transparent), color-mix(in srgb, var(--bg) 88%, transparent) 45%, var(--bg) 80%); }
  .brand { font-size: 17px; white-space: nowrap; gap: 8px; }
  .eyebrow { height: auto; padding: 6px 12px; border-radius: 14px; font-size: 12px; line-height: 1.35; }
  .headline { font-size: min(56px, 14.5vw); margin: 18px 0 14px; }
  .console { border-radius: 22px; }
  .field.grow { flex-basis: 100%; }
  .field.fprice, .field.fbeds { flex: 1 1 40%; }
  .console .btn.primary { flex: 1 1 0; } /* shares the last row with the filters button */
  #empty { padding-top: 32px; }
  .console .seg { flex: 1 1 100%; } .console .seg button { flex: 1; }
  .gallery { grid-template-columns: 1fr; grid-template-rows: 1fr; height: 300px; }
  .gallery button:not(:first-child) { display: none; }
  .gallery button:first-child { grid-row: auto; }
  .lb-stage { padding: 0 8px; }
  .nav .btn .label { display: none; }
  body.searched .hero { position: static; } /* a sticky console would eat a third of a phone screen */
  .kw { flex-basis: 100%; }
  #map { height: 70vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---- my situation */
.scenarios { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scenarios label { cursor: pointer; }
.scenarios input { position: absolute; opacity: 0; pointer-events: none; }
.scenarios span { display: flex; flex-direction: column; gap: 4px; height: 100%; padding: 12px; border-radius: var(--r-md); border: 1px solid var(--line-2); background: var(--surface); transition: border-color .2s, background .2s; }
.scenarios b { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.scenarios small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.scenarios input:checked + span { border-color: var(--text); background: var(--surface-2); }
.scenarios input:focus-visible + span { outline: 2px solid var(--dusk-1); outline-offset: 2px; }
[data-for][hidden] { display: none !important; }
#profileBtn[data-set="true"] { border-color: var(--dusk-1); }

/* money line on cards */
.fit { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 13px; }
.fit b { font-size: 15px; }
.fit .icon { width: 16px; height: 16px; }
.fit .v { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; }
.fit span:last-child { color: var(--muted); }
.place { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--muted); }
.place .icon { width: 14px; height: 14px; }

/* TL;DR */
.tldr { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.tldr > div { padding: 18px; border-radius: var(--r-lg); background: var(--surface); border: 1px solid var(--line); }
.tldr h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.tldr ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.tldr li { display: flex; gap: 10px; font-size: 15px; font-weight: 600; cursor: help; }
.tldr li .icon { margin-top: 2px; }
.tldr .empty { color: var(--muted); font-weight: 400; }
.one-liner { font-size: 17px; margin: 0 0 14px; max-width: 70ch; }

/* your numbers */
.money { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 18px; }
.money .headline-num { font: 900 40px/1 var(--display); font-stretch: 75%; margin: 4px 0 6px; }
.money dl { margin: 0; }
.money dl div { display: flex; justify-content: space-between; gap: 14px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; }
.money dt { color: var(--muted); } .money dd { margin: 0; text-align: right; font-weight: 600; }
.chips-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chips-row button { height: 32px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-2); background: transparent; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chips-row button[aria-pressed="true"] { background: var(--pill); color: var(--pill-text); border-color: var(--pill); }
.scheme { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.scheme b { display: block; }
.comps { list-style: none; margin: 0; padding: 0; }
.comps li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.comps a { text-decoration: none; } .comps a:hover { text-decoration: underline; }

/* crime board: one ranked bar per crime type, single hue; status chip carries the national comparison */
.crime-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 16px; margin-bottom: 16px; }
.crime-head b { font: 900 44px/1 var(--display); font-stretch: 75%; }
.crime-rows { display: flex; flex-direction: column; gap: 4px; }
.crow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.crow:hover { border-color: var(--line-2); }
.crow .ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); }
.crow .ic .icon { width: 19px; height: 19px; }
.crow .name { font-weight: 600; font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.crow .name small { color: var(--muted); font-weight: 500; font-size: 13px; }
.crow .track-bar { height: 6px; border-radius: 3px; background: var(--line); margin-top: 7px; overflow: hidden; }
.crow .track-bar i { display: block; height: 100%; border-radius: 0 3px 3px 0; background: var(--chart-1); transform-origin: left; animation: grow .9s var(--ease) both; }
.crow .risk { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.crow .risk b { display: block; font-size: 15px; color: var(--text); }
.vs { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.crime-minor { margin-top: 10px; font-size: 13.5px; color: var(--muted); }

/* who lives here */
.people { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 22px; }
.split { display: flex; height: 34px; border-radius: 10px; overflow: hidden; gap: 2px; margin: 10px 0 8px; }
.split i:first-child { color: #1a1a1a; }
.split i { display: grid; place-items: center; font-style: normal; font-size: 13px; font-weight: 700; color: #fff; min-width: 2.5em; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; }
.agebars { display: flex; flex-direction: column; gap: 6px; }
.agebar { display: grid; grid-template-columns: 150px minmax(0, 1fr) 40px; gap: 10px; align-items: center; font-size: 13.5px; }
.agebar .b { height: 14px; border-radius: 0 4px 4px 0; background: var(--chart-2); transform-origin: left; animation: grow .9s var(--ease) both; }
.agebar span:last-child { text-align: right; font-weight: 700; }
.stat-row { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.stat-row div { flex: 1 1 120px; padding: 12px 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.stat-row small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.stat-row b { font: 800 24px/1.2 var(--display); font-stretch: 80%; }
@media (max-width: 720px) {
  .money, .people { grid-template-columns: 1fr; }
  .agebar { grid-template-columns: 110px minmax(0, 1fr) 36px; }
  .crow { grid-template-columns: 30px minmax(0, 1fr); }
  .crow .risk { grid-column: 2; text-align: left; }
  .scenarios { grid-template-columns: 1fr; }
}

.profile .drawer-foot { position: static; }

#sheetBody .block, #sheetBody section { scroll-margin-top: 96px; }
/* narrowest phones: logo mark only, so both nav buttons fit; the name stays for screen readers */
@media (max-width: 379px) { .brand-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }
