/* The houses list under the hero (houses.js fills it). Desktop: tiles, each a finished still with the house's facts
   tagged on underneath. Phones: compact rows that open one at a time. Loaded after style.css, phone.css and quote.css. */

/* the bar stays on screen once the page scrolls, solid as soon as it leaves the top of the picture */
.full .bar { position: fixed; z-index: 6; transition: background-color 0.25s ease; }
.bar-solid .bar { background: var(--ground); }
.bar nav a[aria-current] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 9px;
}

.houses {
  --tile: color-mix(in srgb, var(--ground-2) 80%, var(--ground));
  min-height: 100svh;
  padding: 140px var(--m) 64px;
}

.houses-head { display: grid; grid-template-columns: 1fr 1fr; gap: 24px var(--m); align-items: start; }
.houses h2 { font-size: clamp(30px, 2.6vw, 40px); font-weight: 650; letter-spacing: -0.025em; line-height: 1; }
.houses-lede { font-size: clamp(17px, 1.3vw, 19px); line-height: 1.5; max-width: 44ch; }

.houses-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 32px; }
.houses-filter button {
  padding: 9px 17px;
  border: 0;
  border-radius: 999px;
  background: var(--tile);
  font-size: 15px;
  line-height: 22px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, transform 0.12s var(--ease-out);
}
.houses-filter button:hover { background: var(--ground-2); }
.houses-filter button:active { transform: scale(0.97); }
.houses-filter button[aria-pressed="true"] { background: var(--ink); color: var(--ground); font-weight: 600; }

.houses-list {
  list-style: none;
  padding: 0;
  margin-top: 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)); /* fixed columns: a filter that leaves one house keeps its size */
  gap: 32px 24px;
}
@media (min-width: 861px) and (max-width: 959px) {
  .houses-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.house { display: flex; flex-direction: column; } /* tiles in a row end level */
.house[hidden] { display: none; }

/* the still, cropped round the house (it sits right of centre in the wide renders) */
.house-pic { position: relative; overflow: hidden; aspect-ratio: 3 / 2; background: var(--frame-bg); }
.house-pic::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--pic) 83% 50% / 160% auto no-repeat;
  transition: transform 0.6s var(--ease-out);
}

/* the tag: name and price, then the facts and the VAT, then the two actions */
.house-tag {
  display: grid;
  grid-template-columns: 1fr auto;
  column-gap: 16px;
  padding: 18px 20px 0;
  background: var(--tile);
}
.house-name { grid-area: 1 / 1; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
/* room for two lines, so a tile is the same height whether its facts wrap or not, and whatever the filter leaves */
.house-facts { grid-area: 2 / 1; margin-top: 6px; font-size: 15px; line-height: 1.35; min-height: 2.7em; }
.house-price {
  grid-area: 1 / 2 / 3;
  text-align: right;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.house-price span { display: block; margin-top: 7px; font-size: 13.5px; font-weight: 400; color: var(--muted); }
.house-more { flex: 1; background: var(--tile); }
.house-more > div { padding: 14px 20px 18px; }
.house-big, .house-blurb, .house-toggle { display: none; }

.house-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 24px; }
.house-quote {
  padding: 6px 0;
  font-size: 15px;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 0.15s;
}
.house-quote:hover { color: var(--accent); }
.house-watch {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
.house-watch svg { width: 11px; height: 11px; transition: transform 0.2s var(--ease-out); }
.house-watch:hover svg { transform: translateX(2px) scale(1.15); }
.house-watch:active { transform: scale(0.97); }

.houses-close { margin-top: 56px; font-size: 16px; color: var(--muted); }
.houses-close a {
  margin-left: 14px;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 5px;
  transition: color 0.15s;
}
.houses-close a:hover { color: var(--accent); }
.houses-note { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* desktop: the picture plays the build too */
@media (hover: hover) and (pointer: fine) and (min-width: 861px) {
  .house-top .house-pic { cursor: pointer; }
  .house-top .house-pic:hover::before { transform: scale(1.04); }
}

/* ---------------------------------------------------------------- phones: compact rows */

@media (max-width: 860px) {
  .houses { min-height: calc(100svh - 64px); padding: 16px var(--m) calc(48px + env(safe-area-inset-bottom)); scroll-margin-top: 64px; }
  .houses-head { display: block; }
  .houses h2 { font-size: 30px; }
  .houses-lede { margin-top: 10px; font-size: 15px; }
  .houses-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 18px calc(-1 * var(--m)) 0; padding: 0 var(--m); }
  .houses-filter::-webkit-scrollbar { display: none; }
  .houses-filter button { flex: none; padding: 7px 14px; font-size: 14px; }
  .houses-list { grid-template-columns: 1fr; gap: 10px; margin-top: 20px; }
  .house { background: var(--tile); }

  /* the row: thumbnail, name, facts and price, and the chevron; tapping anywhere on it opens it (houses.js) */
  .house-top {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr) 24px;
    gap: 14px;
    align-items: center;
    padding-right: 10px;
    cursor: pointer;
    transition: grid-template-columns 0.35s var(--ease-out), padding 0.35s var(--ease-out), gap 0.35s var(--ease-out);
  }
  .house-top .house-pic { aspect-ratio: 4 / 3; }
  .house-top .house-pic::before { background: var(--thumb) center / cover no-repeat; }
  .house-tag { display: block; padding: 0; background: none; }
  .house-name { font-size: 16px; }
  .house-facts { margin-top: 2px; font-size: 13.5px; min-height: 0; }
  .house-price { margin-top: 2px; text-align: left; font-size: 14.5px; white-space: normal; }
  .house-price span { display: inline; margin: 0 0 0 4px; font-size: 12px; }
  .house-toggle {
    display: grid;
    place-items: center;
    width: 24px;
    height: 44px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--ink);
    opacity: 0.7;
    cursor: pointer;
  }
  .house-toggle svg { width: 8px; height: 16px; transition: transform 0.3s var(--ease-out); }

  /* open: the thumbnail gives way to the big still, the description and the actions */
  .house.open .house-top { grid-template-columns: 0 minmax(0, 1fr) 24px; gap: 0; padding: 14px 10px 12px 14px; }
  .house.open .house-top .house-pic { visibility: hidden; }
  .house.open .house-toggle svg { transform: rotate(90deg); }
  .house-more { display: grid; grid-template-rows: 0fr; background: none; transition: grid-template-rows 0.35s var(--ease-out); }
  .house.open .house-more { grid-template-rows: 1fr; }
  .house-more > div { overflow: hidden; padding: 0; visibility: hidden; transition: visibility 0s linear 0.35s; }
  .house.open .house-more > div { visibility: visible; transition: none; }
  .house-big { display: block; aspect-ratio: 16 / 10; }
  .house-blurb { display: block; padding: 12px 14px 0; font-size: 14px; line-height: 1.5; }
  .house-acts { padding: 8px 14px 12px; gap: 4px 22px; }
  .house-quote, .house-watch { font-size: 14px; }

  .houses-close { display: grid; gap: 4px; margin-top: 28px; font-size: 14px; }
  .houses-close a { margin: 0; justify-self: start; padding: 6px 0; }
  .houses-note { display: none; } /* the hero's own note sits just above, at the foot of the details sheet */
  .bar nav a[aria-current] { text-decoration: none; color: var(--accent); }
}
