/* Houses: the list in a white panel on the left, the lit island in the dark map panel on the right.
   On a phone the island fills the screen and the list becomes a bottom sheet. */

.houses__layout {
  display: grid; grid-template-columns: minmax(0, 5.7fr) minmax(0, 6.3fr); column-gap: var(--gutter); align-items: start;
  max-width: var(--container); margin: 0 auto var(--gutter);
}
.houses__list { min-width: 0; padding: var(--header-h) clamp(22px, 3vw, 52px) clamp(28px, 3vw, 48px); background: var(--panel); border-radius: var(--r-panel); --surface: var(--panel); }
.houses__head { display: grid; gap: 12px; margin-bottom: 28px; }
.houses__title { font-size: clamp(3.4rem, 1rem + 5.4vw, 6.75rem); }
.houses__status { font-family: var(--mono); font-size: 0.71875rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.houses__status [data-status], .houses__status [data-status-sun] { display: inline-block; }
.houses__status [data-status-sun] { color: var(--ink); }
.roll { animation: roll 380ms var(--ease); }
@keyframes roll { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- filters: a soft card ---------- */
.filters__sheet { display: grid; gap: 20px; padding: clamp(18px, 2vw, 28px); background: var(--panel-soft); border-radius: var(--r-card); }
.filters__grid { display: grid; grid-template-columns: minmax(170px, 200px) minmax(0, 1fr); column-gap: clamp(20px, 3vw, 40px); align-items: start; }
.filters__rose h2 { margin-bottom: 10px; }
.lines { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; display: grid; }
.lines legend { padding: 0; margin-bottom: 8px; }
.lines button {
  display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 46px; padding: 6px 2px; text-align: left;
  border-top: 1px solid var(--line); transition: padding 300ms var(--ease);
}
.lines button:last-child { border-bottom: 1px solid var(--line); }
.lines button .serif-line { font-size: 1.0625rem; transition: opacity 200ms; }
.lines button:hover .serif-line { opacity: 0.65; }
.lines .count { min-width: 30px; height: 24px; padding: 0 9px; display: inline-grid; place-items: center; border-radius: 999px; font-family: var(--mono); font-size: 0.6875rem; font-weight: 700; color: var(--ink); background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.lines button[aria-pressed="true"] { padding-left: 10px; }
.lines button[aria-pressed="true"] .count { background: var(--btn-bg); color: var(--btn-fg); box-shadow: none; }

.rose { position: relative; width: 100%; max-width: 210px; aspect-ratio: 1; }
.rose svg { width: 100%; height: 100%; overflow: visible; }
.rose__ring { fill: none; stroke: var(--line); stroke-width: 1; }
.rose__sector { fill: var(--panel); stroke: var(--line-strong); stroke-width: 1; cursor: pointer; transition: fill 220ms var(--ease), stroke 220ms; outline: none; }
.rose__sector:hover { stroke: var(--ink); }
.rose__sector[aria-checked="true"] { fill: var(--btn-bg); stroke: var(--btn-bg); }
.rose__sector:focus-visible { stroke: var(--focus); stroke-width: 3; }
.rose__sector.is-sun { fill: var(--lime); stroke: var(--ink); }
.rose__sector.is-sun[aria-checked="true"] { fill: var(--btn-bg); }
.rose__letter { font-family: var(--mono); font-size: 10px; font-weight: 700; fill: var(--ink-2); letter-spacing: 0.04em; text-anchor: middle; pointer-events: none; }
.rose__count { font-family: var(--mono); font-size: 10px; fill: var(--muted); text-anchor: middle; pointer-events: none; }
.rose__sun { fill: var(--lime); stroke: var(--ink); stroke-width: 1.5; transition: opacity 250ms; }
.rose__sun.is-down { opacity: 0; }
.rose__hub { fill: var(--panel); stroke: var(--line-strong); }
.rose__hub-text { font-family: var(--serif); font-style: italic; font-size: 15px; fill: var(--ink); text-anchor: middle; pointer-events: none; }

.price { position: relative; }
.price__toggle {
  width: 100%; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; min-height: 48px; padding: 6px 2px;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: left;
}
.price__toggle .icon { transition: transform 300ms var(--ease); }
.price__toggle[aria-expanded="true"] .icon { transform: rotate(180deg); }
.price__toggle .serif-line { text-align: right; font-size: 1.0625rem; }
.price__panel {
  display: none; position: absolute; left: 0; right: 0; top: calc(100% + 10px); z-index: 30; padding: 22px 22px 20px;
  background: var(--panel); border-radius: var(--r-card); box-shadow: 0 40px 120px -30px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--line);
}
.price.is-open .price__panel { display: block; animation: roll 320ms var(--ease); }
.price__chart { position: relative; height: 96px; }
.price__bars { position: absolute; inset: 0 0 18px 0; display: flex; align-items: flex-end; gap: 2px; }
.price__bars i { flex: 1 1 0; background: var(--line-strong); border-radius: 2px 2px 0 0; height: var(--h, 3px); transition: background-color 200ms; }
.price__bars i.is-in { background: var(--ink); }
.price__ranges { position: absolute; left: 0; right: 0; bottom: 0; height: 18px; }
.price__ranges::before { content: ""; position: absolute; left: 0; right: 0; top: 8px; height: 2px; background: var(--line-strong); }
.price__ranges::after { content: ""; position: absolute; top: 8px; height: 2px; background: var(--ink); left: var(--a, 0%); right: calc(100% - var(--b, 100%)); }
.price__ranges input {
  position: absolute; left: 0; width: 100%; top: 0; height: 18px; margin: 0; background: none; pointer-events: none;
  -webkit-appearance: none; appearance: none;
}
.price__ranges input::-webkit-slider-runnable-track { background: none; height: 18px; }
.price__ranges input::-moz-range-track { background: none; height: 18px; }
.price__ranges input::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; pointer-events: auto; width: 20px; height: 20px; border-radius: 50%;
  background: var(--lime); border: 2px solid var(--ink); cursor: grab;
}
.price__ranges input::-moz-range-thumb { pointer-events: auto; width: 16px; height: 16px; border-radius: 50%; background: var(--lime); border: 2px solid var(--ink); cursor: grab; }
.price__ranges input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--panel), 0 0 0 5px var(--focus); }
.price__ranges input:focus-visible { outline: none; }
.price__ends { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); }
.price__show { width: 100%; margin-top: 16px; }

.filters__foot { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.filters__phone-foot { display: none; }
.filters__open { display: none; }

/* ---------- the list ---------- */
.houses__cards { margin-top: 30px; }
.hcard {
  position: relative; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); column-gap: clamp(16px, 2vw, 28px); padding: 16px;
  margin-inline: -16px; border-radius: 22px; scroll-margin-top: 90px;
  transition: background-color 250ms var(--ease);
}
.hcard + .hcard::before { content: ""; position: absolute; left: 16px; right: 16px; top: 0; height: 1px; background: var(--line); }
.hcard__plate { aspect-ratio: 4 / 3; align-self: start; }
.hcard__plate--elev { background: var(--panel-soft); box-shadow: inset 0 0 0 1px var(--line); container-type: inline-size; }
.hcard__plate--elev .elev { height: calc(100% - 44px); padding: 12px 14px 0; }
@container (max-width: 300px) {
  .hcard__plate--elev .plate__title span { display: none; }
}
.hcard__body { display: grid; gap: 10px; align-content: start; min-width: 0; padding-top: 4px; }
.hcard__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.hcard__name { font-size: clamp(1.6rem, 1.1rem + 1vw, 2.2rem); font-weight: 600; letter-spacing: -0.025em; }
.hcard__name a { text-decoration: none; }
.hcard__name a::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: 22px; }
.hcard__meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-family: var(--mono); font-size: 0.65625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hcard__face { display: inline-flex; align-items: center; gap: 5px; }
.hcard__face .pin__tick { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.1; }
.hcard__face .pin__tick-dot { fill: currentColor; stroke: none; }
.hcard__line { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.3125rem; line-height: 1.2; letter-spacing: 0; max-width: 32ch; text-wrap: pretty; }
.hcard .strip { margin: 6px 0 24px; }
.hcard__foot { display: flex; justify-content: space-between; align-items: center; gap: 14px; position: relative; z-index: 2; }
.hcard__sun { display: inline-flex; align-items: center; gap: 8px; font-family: var(--mono); font-size: 0.65625rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.hcard__sun::before { content: ""; width: 8px; height: 8px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--muted); }
.hcard.is-lit .hcard__sun { color: var(--ink); }
.hcard.is-lit .hcard__sun::before { background: var(--lime); box-shadow: inset 0 0 0 1.5px var(--ink); }
.hcard.is-active { background: var(--panel-soft); }
.hcard.is-active::before, .hcard.is-active + .hcard::before { opacity: 0; }
.hcard.is-out { display: none; }
.hcard.is-folded { grid-template-columns: 1fr; padding-block: 12px; }
.hcard.is-folded .hcard__plate, .hcard.is-folded .hcard__meta, .hcard.is-folded .hcard__line, .hcard.is-folded .strip, .hcard.is-folded .hcard__foot a { display: none; }
.hcard.is-folded .hcard__name { font-size: 1.35rem; }
.hcard.is-folded .hcard__body { grid-template-columns: 1fr auto; align-items: center; gap: 0 20px; padding-top: 0; }
.hcard.is-folded .hcard__foot { justify-content: flex-end; }
.hcard.is-flash { animation: flash 1400ms var(--ease); }
@keyframes flash { 0%, 40% { background: var(--lime-wash); } 100% { background: transparent; } }
.houses__empty { padding: 36px 0; font-size: 1.4rem; font-weight: 500; display: grid; gap: 12px; justify-items: start; }

/* ---------- sold ---------- */
.sold { margin-top: 48px; padding-top: 24px; border-top: 1px solid var(--line); }
.sold__list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--gap); margin-top: 18px; }
.sold__item { display: grid; gap: 6px; align-content: start; }
.sold__item .serif-line { font-size: 1.0625rem; }
.sold__plate { position: relative; aspect-ratio: 3 / 2; background: var(--panel-soft); border-radius: 14px; overflow: hidden; }
.sold__plate::after { content: ""; position: absolute; left: -10%; right: -10%; top: 50%; height: 1px; background: var(--ink); transform: rotate(-14deg); }
.sold__plate .elev { opacity: 0.8; }
.sold__note { font-size: 0.8125rem; color: var(--muted); }
.sold__fine { margin-top: 18px; font-size: 0.8125rem; color: var(--muted); }

/* ---------- the island: the dark map panel, held in view ---------- */
.houses__map { position: sticky; top: var(--gutter); height: calc(100svh - 2 * var(--gutter)); min-height: 600px; }
.map__panel { --surface: var(--dark); position: relative; display: flex; flex-direction: column; height: 100%; background: var(--dark); border-radius: var(--r-panel); padding: 80px clamp(20px, 2.4vw, 36px) 18px; overflow: clip; }
.map__bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.map__arc { margin-top: 10px; }
.map__viewport { position: relative; flex: 1; min-height: 0; display: grid; place-items: center; container-type: size; }
.map__layer { width: min(100cqw, 100cqh * 1.3757); }
.map__credit { font-size: 0.6875rem; color: var(--muted); }
.map__credit a { color: #d7d8dc; text-underline-offset: 0.15em; }
.map__recentre { display: none; }
.houses__map .pin { height: 28px; font-size: 0.78125rem; }
.pin.is-picked { z-index: 7; box-shadow: 0 0 0 2px #ffffff, 0 10px 24px -10px rgba(0, 0, 0, 0.6); }

.peek { display: none; }

/* ====================================================== phone ====================================================== */
@media (max-width: 820px) {
  :root { --dock-h: 112px; --sheet-top: calc(var(--strip-h) + 70px); }
  body.page-houses { overflow: hidden; height: 100dvh; padding: 0; }
  .page-houses .site-footer { display: none; }
  .houses__layout { display: block; margin: 0; }

  .houses__map { position: fixed; z-index: 1; left: 0; right: 0; top: var(--strip-h); bottom: 0; height: auto; min-height: 0; }
  .map__panel { border-radius: 0; padding: 0; }
  .map__bar, .map__arc { display: none; }
  .map__viewport { position: absolute; inset: 0; display: block; overflow: hidden; touch-action: none; container-type: normal; }
  .map__layer { position: absolute; left: 0; top: 0; width: 190%; max-width: none; transform-origin: 0 0; will-change: transform; }
  .houses__map .island__orbit-letter { font-size: 22px; }
  .houses__map .pin { height: 30px; font-size: 0.8125rem; transform: translate(-50%, -50%) scale(calc(1 / var(--z, 1))); }
  /* the credit gets its own band under the controls, so it never sits on the coast or a pin */
  .map__credit { position: absolute; left: 0; right: 0; top: 64px; z-index: 2; height: 26px; padding: 0 20px; line-height: 26px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--muted); }
  .map__credit a { padding-block: 6px; }
  .map__viewport { top: 90px; }
  .map__recentre { display: inline-flex; position: absolute; right: 12px; top: 100px; z-index: 3; min-height: 36px; padding: 0 14px; font-size: 0.8125rem; }
  .map__recentre[hidden] { display: none !important; }

  .houses__list {
    position: fixed; left: 0; right: 0; bottom: var(--dock-h); z-index: 60; padding: 0;
    height: calc(100dvh - var(--sheet-top) - var(--dock-h));
    display: flex; flex-direction: column; background: var(--panel); border-radius: 22px 22px 0 0;
    transform: translate3d(0, var(--sheet-y, calc(100% - 98px)), 0); transition: transform 440ms var(--ease); will-change: transform;
    box-shadow: 0 -20px 50px -20px rgba(0, 0, 0, 0.5);
  }
  .houses__list.is-dragging { transition: none; }
  .sheet__grabber { display: grid; place-items: center; width: 100%; height: 26px; flex: none; touch-action: none; cursor: grab; }
  .sheet__grabber span { width: 44px; height: 4px; border-radius: 2px; background: var(--line-strong); }
  .houses__head { flex: none; grid-template-columns: 1fr auto; align-items: end; gap: 0 12px; margin: 0; padding: 0 var(--pad) 12px; touch-action: none; }
  .houses__head .kicker { display: none; }
  .houses__title { font-size: 2.2rem; grid-row: 1; line-height: 1; }
  .houses__status { grid-column: 1; grid-row: 2; font-size: 0.625rem; margin-top: 6px; }
  .houses__list > .filters__open { display: inline-flex; position: absolute; right: var(--pad); top: 32px; min-height: 42px; padding: 0 16px; gap: 8px; font-size: 0.875rem; }
  .filters__badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--lime); color: var(--lime-ink); font-size: 0.75rem; line-height: 20px; text-align: center; font-weight: 700; }
  .houses__cards { flex: 1; min-height: 0; overflow-y: auto; margin: 0; padding: 0 var(--pad) 24px; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; border-top: 1px solid var(--line); }
  .houses__list > .sold { display: none; }

  .hcard { grid-template-columns: 108px minmax(0, 1fr); column-gap: 14px; padding: 12px 8px; margin-inline: -8px; border-radius: 16px; }
  .hcard + .hcard::before { left: 8px; right: 8px; }
  .hcard__plate { aspect-ratio: 1; height: 108px; border-radius: 14px; }
  .hcard__plate .tag { right: 5px; bottom: 5px; height: 18px; padding: 0 6px; font-size: 0.4375rem; letter-spacing: 0.08em; }
  .hcard__plate--elev .elev { height: calc(100% - 26px); padding: 6px 4px 0; }
  .hcard__plate .plate__title { left: 5px; right: 5px; bottom: 5px; height: 18px; justify-content: center; padding: 0 6px; font-size: 0.4375rem; letter-spacing: 0.06em; }
  .hcard__plate .plate__title span { display: none; }
  .hcard__name { font-size: 1.45rem; }
  .hcard__price { height: 24px; font-size: 0.6875rem; }
  .hcard__meta { font-size: 0.5625rem; gap: 2px 10px; }
  .hcard__meta span:nth-child(3) { display: none; }
  .hcard__line { display: none; }
  .hcard .strip { margin: 2px 0 4px; height: 24px; }
  .hcard__foot a { display: none; }
  .hcard .strip__axis { display: none; }
  .hcard__body { gap: 6px; padding-top: 0; }

  .peek { position: fixed; z-index: 55; left: 12px; right: 12px; bottom: calc(var(--dock-h) + 106px); display: block; }
  .peek[hidden] { display: none !important; }
  .peek__card { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; background: var(--lime); color: var(--lime-ink); border-radius: 18px; text-decoration: none; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.6); }
  .peek__text { display: grid; gap: 2px; }
  .peek__text .display-m { font-weight: 600; }
  .peek__meta { font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.06em; text-transform: uppercase; }
  .peek .icon { width: 20px; height: 20px; }

  /* the filters become a full-height sheet, moved to the body so the sheet's transform does not trap it */
  .filters {
    position: fixed; inset: 0; z-index: 130; background: var(--panel); overflow-y: auto; overscroll-behavior: contain;
    padding: calc(var(--strip-h) + 14px) var(--pad) 0; transform: translateY(100%); visibility: hidden;
    transition: transform 460ms var(--ease), visibility 0s 460ms;
  }
  .filters.is-open { transform: none; visibility: visible; transition: transform 460ms var(--ease); }
  .filters__sheet { background: transparent; padding: 0; gap: 20px; min-height: calc(100dvh - var(--strip-h) - 14px); align-content: start; }
  .filters__bar { display: flex; justify-content: space-between; align-items: center; }
  .filters__close { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; box-shadow: inset 0 0 0 1px var(--line-strong); }
  .filters__grid { grid-template-columns: 1fr; row-gap: 14px; }
  .rose { margin-inline: auto; max-width: 240px; }
  .price__toggle { display: none; }
  .price__panel { display: block; position: static; padding: 0; box-shadow: none; background: transparent; }
  .price__panel .price__show { display: none; }
  .price::before { content: "Price"; display: block; margin-bottom: 10px; font-family: var(--mono); font-size: 0.6875rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
  .price__chart { height: 110px; }
  .filters__phone-foot { display: flex; position: sticky; bottom: 0; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 0 calc(14px + var(--safe-b)); background: var(--panel); border-top: 1px solid var(--line); margin-top: auto; }
  .filters__phone-foot .button { flex: 1; }
  .filters__foot { justify-content: flex-start; }
}
@media (max-width: 820px) {
  /* the sheet runs under the dock, so the dock's margin is filled with the sheet's own white */
  .page-houses .ribbon-dock { background: var(--panel); padding-top: 4px; }
}
