/* Discover + "What's Around" for a community page. Layout from the Trevalli
   Homes neighbourhood block, in WrightHaven's type and olive. See wh-around.js. */

.wha {
  --wha-olive: var(--whh-olive, #494F25);
  --wha-ink: var(--text-heading, #23231E);
  --wha-muted: var(--text-muted, #6B6A5F);
  --wha-tile: #F0EBE1;
  --wha-line: rgba(35, 35, 30, 0.12);
  --wha-sans: var(--font-sans, Montserrat, sans-serif);
  --wha-serif: var(--font-serif, "Cormorant Garamond", Georgia, serif);
  box-sizing: border-box;
  width: 100%;
  /* Same two edges as every other section: the site rail and its gutter. */
  --wha-gutter: var(--gutter, clamp(24px, 5vw, 80px));
  max-width: var(--container-wide, 1440px);
  margin: 0 auto;
  padding: clamp(48px, 6vw, 80px) var(--wha-gutter) 0;
  font-family: var(--wha-sans);
  color: var(--wha-ink);
  text-align: left;
}
.wha *, .wha *::before, .wha *::after { box-sizing: border-box; }
.wha h2.wha-title {
  margin: 0;
  font-family: var(--wha-serif);
  font-size: clamp(2.4rem, 4.6vw, 4rem);
  font-weight: 500;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--wha-ink);
  text-wrap: balance;
}
.wha p { margin: 0; }
.wha-kicker {
  margin: 0 0 12px !important;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--wha-muted);
}
.wha-lede { max-width: 62ch; margin-top: 18px !important; font-size: 1rem; line-height: 1.7; }
.wha-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px !important;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* --- Discover mosaic ---------------------------------------------------- */

.wha-mosaic { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.wha-intro { display: flex; flex-direction: column; justify-content: center; padding-right: clamp(0px, 2vw, 28px); }
.wha-intro .wha-lede { margin-top: 20px !important; font-size: 0.96rem; }
.wha-intro .wha-lede + .wha-lede { margin-top: 12px !important; }
.wha .wha-textlink {
  align-self: flex-start;
  margin-top: 22px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--wha-ink) !important;
  text-decoration: underline !important;
  text-underline-offset: 5px;
}
.wha-cards { display: contents; }
.wha-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  margin: 0;
  isolation: isolate;
  background: var(--wha-ink);
}
.wha-card--lead { grid-column: span 2; aspect-ratio: auto; min-height: 460px; }
.wha .wha-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  z-index: -2;
  object-fit: cover;
  transition: transform 500ms ease-out;
}
.wha-card:hover img { transform: scale(1.03); }
.wha-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(to top, rgba(20, 18, 14, 0.88) 0%, rgba(20, 18, 14, 0.5) 42%, transparent 72%);
}
.wha-card__body { padding: 24px; color: #fff; }
.wha-card--lead .wha-card__body { padding: clamp(24px, 3vw, 40px); }
.wha .wha-card h3 {
  margin: 0;
  font-family: var(--wha-serif);
  font-size: 1.7rem;
  font-weight: 600;
  line-height: 1.1;
  text-transform: none;
  letter-spacing: 0;
  color: #fff;
}
.wha .wha-card--lead h3 { font-size: clamp(1.9rem, 3vw, 2.7rem); }
.wha-card p { margin-top: 8px !important; max-width: 52ch; font-size: 0.86rem; line-height: 1.55; color: rgba(255, 255, 255, 0.9); }
.wha .wha-card__map {
  appearance: none;
  display: inline-block !important;
  margin-top: 14px;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: none !important;
  box-shadow: none !important;
  font: 600 0.84rem/1.4 var(--wha-sans) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: #fff !important;
  -webkit-text-fill-color: currentColor !important;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}
/* the whole card is the target */
.wha .wha-card__map::before { content: ""; position: absolute; inset: 0; z-index: 2; }
.wha-card:has(.wha-card__map:focus-visible) { outline: 3px solid var(--wha-olive); outline-offset: 2px; }

/* --- Chips -------------------------------------------------------------- */

.wha-explorer { margin-top: 28px; min-height: 700px; }
.wha-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.wha .wha-chip {
  appearance: none;
  display: inline-flex !important;
  flex: none;
  align-items: center;
  gap: 8px;
  height: 44px;
  margin: 0;
  padding: 0 16px !important;
  border: 1px solid transparent !important;
  border-radius: 0 !important;
  background: var(--wha-tile) !important;
  box-shadow: none !important;
  font: 600 0.82rem/1 var(--wha-sans) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: nowrap;
  color: var(--wha-ink) !important;
  -webkit-text-fill-color: currentColor !important;
  cursor: pointer;
  transition: background-color 180ms ease;
}
.wha .wha-chip:hover { background: #E7E0D1 !important; }
.wha .wha-chip[aria-pressed="true"] { background: var(--wha-olive) !important; color: #fff !important; }
.wha-chip__count { font-weight: 500; opacity: 0.7; }
.wha .wha-chip:focus-visible,
.wha .wha-showall:focus-visible,
.wha .wha-drive__link:focus-visible { outline: 2px solid var(--wha-olive); outline-offset: 2px; }

/* --- List + map --------------------------------------------------------- */

.wha-box {
  display: grid;
  grid-template-columns: 22rem minmax(0, 1fr);
  height: min(40rem, 78vh);
  min-height: 520px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--wha-line);
  background: #fff;
  scroll-margin-top: 110px;
}
.wha-side { display: flex; flex-direction: column; min-width: 0; min-height: 0; border-right: 1px solid var(--wha-line); }
.wha .wha-search { position: relative; display: block; margin: 0; border-bottom: 1px solid var(--wha-line); }
.wha .wha-search[hidden] { display: none; }
.wha-search svg { position: absolute; top: 50%; left: 16px; transform: translateY(-50%); color: var(--wha-muted); pointer-events: none; }
.wha .wha-search input {
  width: 100%;
  height: 52px;
  margin: 0;
  padding: 0 14px 0 44px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #fff;
  box-shadow: none;
  font: 400 1rem var(--wha-sans);
  color: var(--wha-ink);
}
.wha .wha-search input:focus-visible { outline: 2px solid var(--wha-olive); outline-offset: -2px; }
.wha-listhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 0 16px; border-bottom: 1px solid var(--wha-line); }
.wha-listtitle { font-size: 0.7rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--wha-muted); }
.wha .wha-showall {
  appearance: none;
  flex: none;
  margin: 0;
  padding: 4px 0 !important;
  border: 0 !important;
  background: none !important;
  box-shadow: none !important;
  font: 600 0.78rem var(--wha-sans) !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--wha-ink) !important;
  -webkit-text-fill-color: currentColor !important;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.wha .wha-showall[hidden] { display: none; }
.wha ul.wha-list {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
  scrollbar-width: thin;
}
.wha .wha-list li { margin: 0; padding: 0; border-bottom: 1px solid var(--wha-line); }
.wha .wha-item {
  appearance: none;
  display: flex !important;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 12px 16px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  font: inherit !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
  white-space: normal !important;
  text-align: left;
  color: var(--wha-ink) !important;
  -webkit-text-fill-color: currentColor !important;
  cursor: pointer;
}
.wha .wha-item--static { cursor: default; }
.wha button.wha-item:hover,
.wha button.wha-item[aria-pressed="true"] { background: var(--wha-tile) !important; }
.wha button.wha-item:focus-visible { outline: 2px solid var(--wha-olive); outline-offset: -2px; }
.wha-mark { display: grid; flex: none; place-items: center; width: 36px; height: 36px; border: 1px solid var(--wha-line); background: #fff; color: var(--wha-muted); }
.wha .wha-mark img { width: 26px; height: 26px; object-fit: contain; }
.wha-item__text { flex: 1; min-width: 0; }
.wha-item__name { display: block; font-size: 0.86rem; font-weight: 600; line-height: 1.4; }
.wha-item__note { display: block; margin-top: 2px; font-size: 0.74rem; line-height: 1.45; color: var(--wha-muted); }
.wha-item__dist { flex: none; padding-top: 2px; font-size: 0.74rem; color: var(--wha-muted); font-variant-numeric: tabular-nums; }
.wha-item__time { flex: none; max-width: 7rem; padding-top: 2px; font-size: 0.84rem; font-weight: 700; text-align: right; }
.wha-drive { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px; padding: 0 16px 12px 64px; background: var(--wha-tile); }
.wha-drive__time { font-size: 0.82rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.wha .wha-drive__link { display: inline-flex; align-items: center; min-height: 28px; font-size: 0.8rem; font-weight: 600; color: var(--wha-olive) !important; text-decoration: underline !important; text-underline-offset: 4px; }
.wha-empty { padding: 14px 16px !important; font-size: 0.85rem; }
.wha-fail { display: grid; place-items: center; height: 100%; padding: 24px; font-size: 0.9rem; text-align: center; }

.wha-mapwrap { position: relative; min-width: 0; min-height: 0; background: #e9e7e2; }
.wha-map { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.wha .wha-map button { box-shadow: none; text-transform: none; }
.wha .wha-map .maplibregl-ctrl-group button { width: 44px; height: 44px; padding: 0 !important; border-radius: 0 !important; background-color: #fff !important; }

.wha .wha-map .wha-pin {
  appearance: none;
  display: grid !important;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0 !important;
  border: 2px solid #fff !important;
  border-radius: 50% !important;
  background: var(--wha-ink) !important;
  box-shadow: 0 6px 16px rgba(35, 35, 30, 0.28) !important;
  color: #fff !important;
  -webkit-text-fill-color: currentColor !important;
  line-height: 0;
  cursor: pointer;
}
.wha .wha-map .wha-pin--brand { width: 36px; height: 36px; background: #fff !important; }
.wha .wha-map .wha-pin--brand img { width: 24px; height: 24px; object-fit: contain; }
.wha .wha-map .wha-pin--home { z-index: 3; width: 48px; height: 48px; background: var(--wha-olive) !important; cursor: default; }
.wha .wha-map .wha-pin__logo { position: absolute; left: 50%; bottom: calc(100% + 6px); width: max-content; padding: 5px 7px; transform: translateX(-50%); background: #fff; border: 2px solid var(--wha-olive); border-radius: 8px; box-shadow: 0 6px 16px rgba(35, 35, 30, 0.28); pointer-events: none; }
.wha .wha-map .wha-pin__logo img { display: block; width: auto; height: auto; max-width: 132px; max-height: 52px; }
.wha .wha-map .wha-pin--end { width: 20px; height: 20px; background: var(--wha-olive) !important; cursor: default; }
.wha .wha-map .wha-pin.is-active { z-index: 2; box-shadow: 0 0 0 3px var(--wha-olive), 0 8px 20px rgba(35, 35, 30, 0.35) !important; }
.wha .wha-map .wha-pin.is-active:not(.wha-pin--brand) { background: var(--wha-olive) !important; }

/* --- Smaller screens ---------------------------------------------------- */

@media (max-width: 1023px) {
  .wha-mosaic {
    display: block;
  }
  .wha-intro { padding: 0 0 28px; }
  .wha-cards {
    display: flex;
    gap: 12px;
    margin: 0 calc(-1 * var(--wha-gutter));
    padding: 0 var(--wha-gutter) 8px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--wha-gutter);
    scrollbar-width: none;
  }
  .wha-card, .wha-card--lead { flex: 0 0 min(80%, 420px); min-height: 0; aspect-ratio: 4 / 5; scroll-snap-align: start; }
  .wha .wha-card--lead h3 { font-size: 1.7rem; }
  .wha-card--lead .wha-card__body { padding: 24px; }

  .wha-explorer { min-height: 900px; }
  /* one row of chips that scrolls, not a wrapped block */
  .wha-chips {
    flex-wrap: nowrap;
    margin: 0 calc(-1 * var(--wha-gutter));
    padding: 0 var(--wha-gutter) 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .wha-box { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .wha-mapwrap { order: -1; height: 26rem; }
  .wha-side { border-right: 0; border-top: 1px solid var(--wha-line); }
  .wha ul.wha-list { max-height: 22rem; }
}

/* Phones: chips, map and list fit one screen, so a tapped place is seen on the map. */
@media (max-width: 699px) {
  .wha-explorer { --wha-map-h: clamp(220px, 36svh, 320px); --wha-list-h: clamp(150px, 27svh, 250px); min-height: calc(var(--wha-map-h) + var(--wha-list-h) + 156px); scroll-margin-top: 72px; }
  .wha-mapwrap { height: var(--wha-map-h); }
  .wha .wha-search input { height: 48px; }
  .wha-listhead { min-height: 44px; }
  .wha ul.wha-list { flex: none; height: var(--wha-list-h); max-height: none; }
  .wha-drive { padding: 0 16px; justify-content: space-between; }
  .wha .wha-map .wha-pin--home { width: 40px; height: 40px; }
  .wha .wha-map .wha-pin__logo { padding: 4px 6px; }
  .wha .wha-map .wha-pin__logo img { max-width: 100px; max-height: 36px; }
}
.wha .wha-map .wha-pin--cluster { width: 38px; height: 38px; font: 700 0.82rem/1 var(--wha-sans) !important; }
.wha .wha-map .wha-pin.is-hidden { display: none !important; }
@media (pointer: coarse) {
  .wha .wha-showall, .wha .wha-drive__link { min-height: 44px; }
}

.wha.wha-around { padding-bottom: clamp(48px, 6vw, 80px); }

@media (prefers-reduced-motion: reduce) {
  .wha .wha-card img, .wha .wha-chip { transition: none; }
  .wha-card:hover img { transform: none; }
}
