/* ============================================================================
   listings.css — public listing pages.

   Consumes the tokens defined in styles.css (:root) rather than redefining
   them, so the two never drift. Kept in a separate file so the 1,900-line
   styles.css stays stable.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   Index header + filters
   -------------------------------------------------------------------------- */

.listings-head .section-head { margin-bottom: var(--space-lg); }
.listings-head h1 { margin-block: 0.25rem 0.5rem; }
.listings-head .lede { color: var(--text-secondary); max-width: 52ch; }

.filters {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.15rem 1.25rem;
  box-shadow: 0 1px 2px rgba(40, 30, 20, 0.04);
}

.filters__row {
  display: flex; flex-wrap: wrap; gap: 0.9rem; align-items: flex-end;
}

.filters__field { flex: 1 1 150px; min-width: 0; }
.filters__field--sm { flex: 0 1 100px; }

.filters__field label {
  display: block;
  font-size: 0.75rem; font-weight: 500;
  letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-muted); margin-bottom: 0.35rem;
}

.filters__input {
  width: 100%;
  padding: 0.62rem 0.8rem;
  font-family: var(--font-body, inherit);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: #fff;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.filters__input:focus {
  outline: none;
  border-color: var(--service-color, var(--accent));
  box-shadow: 0 0 0 3px var(--accent-ring);
}

select.filters__input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a5a5a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.7rem center;
  padding-right: 2rem;
}

.filters__actions { display: flex; align-items: center; gap: 0.85rem; }
.filters__clear { font-size: 0.9rem; color: var(--text-muted); }
.filters__clear:hover { color: var(--accent-deep); }

.listings-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem;
}
.listings-bar__count { font-size: 0.9rem; color: var(--text-muted); }
.listings-bar__sort { display: flex; align-items: center; gap: 0.6rem; }
.listings-bar__sort label {
  font-size: 0.75rem; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-muted);
}
.listings-bar__sort .filters__input { width: auto; padding-block: 0.45rem; }

/* ----------------------------------------------------------------------------
   Listing cards
   -------------------------------------------------------------------------- */

.listing-grid {
  display: grid; gap: 1.6rem;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.lcard {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  overflow: hidden;
  transition: transform 0.3s var(--spring, ease), box-shadow 0.3s ease, border-color 0.3s ease;
}
.lcard:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 38px rgba(40, 30, 20, 0.13);
  border-color: var(--border-medium);
}

.lcard__link { display: block; color: inherit; text-decoration: none; }

.lcard__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--bg-tertiary);
  overflow: hidden;
}
.lcard__media img,
.lcard__media picture {
  width: 100%; height: 100%; display: block;
}
.lcard__media img { object-fit: cover; transition: transform 0.6s var(--ease, ease); }
.lcard:hover .lcard__media img { transform: scale(1.045); }

.lcard__noimg {
  width: 100%; height: 100%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--bg-tertiary), var(--bg-secondary));
  color: var(--text-muted); font-size: 0.85rem;
}

.lcard__status {
  position: absolute; top: 0.85rem; left: 0.85rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.09em; text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  backdrop-filter: blur(4px);
}
.lcard__status--pending { background: var(--accent-blue, #5a6f7e); }
.lcard__status--sold    { background: var(--accent-green, #5b7a5e); }
.lcard__status--draft   { background: var(--text-muted); }

.lcard__count {
  position: absolute; right: 0.85rem; bottom: 0.85rem;
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(28, 28, 28, 0.62);
  color: #fff; font-size: 0.72rem; font-weight: 500;
}

.lcard__body { padding: 1.15rem 1.25rem 1.35rem; }

.lcard__price {
  font-family: var(--font-display, inherit);
  font-size: 1.32rem; font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 0.3rem;
}

.lcard__address {
  font-size: 1rem; font-weight: 500;
  margin: 0 0 0.15rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.lcard__where { font-size: 0.88rem; color: var(--text-muted); margin: 0; }

.lcard__specs {
  display: flex; flex-wrap: wrap; gap: 1rem;
  list-style: none; padding: 0;
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.86rem; color: var(--text-secondary);
}
.lcard__specs strong { font-weight: 600; color: var(--text-primary); }

.lcard__sold {
  margin: 0.7rem 0 0; font-size: 0.83rem;
  color: var(--accent-green-deep, #4a6550); font-weight: 500;
}

/* ----------------------------------------------------------------------------
   Empty state, pagination, CTA
   -------------------------------------------------------------------------- */

.listings-empty {
  text-align: center; padding: clamp(3rem, 6vw, 5rem) 1rem;
  max-width: 44ch; margin-inline: auto;
}
.listings-empty img { opacity: 0.35; margin-bottom: 1.2rem; }
.listings-empty h2 { margin-bottom: 0.6rem; }
.listings-empty p { color: var(--text-secondary); margin-bottom: 1.6rem; }

.pager {
  display: flex; align-items: center; justify-content: center;
  gap: 1.5rem; margin-top: 3rem;
}
.pager__link {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--border-medium);
  border-radius: 8px;
  font-size: 0.92rem; text-decoration: none;
  color: var(--text-primary);
  transition: border-color 0.2s, background 0.2s;
}
.pager__link:hover { border-color: var(--accent); background: var(--accent-bg); }
.pager__status { font-size: 0.88rem; color: var(--text-muted); }

.listings-cta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
}
.listings-cta h2 { margin-bottom: 0.4rem; font-size: clamp(1.2rem, 2.2vw, 1.55rem); }
.listings-cta p { margin: 0; color: var(--text-secondary); max-width: 52ch; }

/* ----------------------------------------------------------------------------
   Detail — breadcrumb + gallery
   -------------------------------------------------------------------------- */

.crumbs {
  padding-top: calc(var(--nav-h, 72px) + 1.4rem);
  padding-bottom: 0.9rem;
  background: var(--bg-primary);
}
.crumbs a { font-size: 0.9rem; color: var(--text-muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent-deep); }

.gallery { background: var(--bg-primary); padding-bottom: 0.5rem; }

.gallery__grid {
  position: relative;
  display: grid; gap: 8px;
  border-radius: 14px; overflow: hidden;
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: repeat(2, minmax(0, 1fr));
  aspect-ratio: 16 / 9;
}
/* The first photo always spans the tall left column; the rest fill in. */
.gallery__grid > .gallery__cell:first-child { grid-row: span 2; }

.gallery__grid--1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.gallery__grid--1 > .gallery__cell:first-child { grid-row: span 1; }
.gallery__grid--2 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.gallery__grid--2 > .gallery__cell:first-child { grid-row: span 1; }
/* 3 photos: hero spans both rows, two stacked beside it — fills exactly. */
.gallery__grid--3 { grid-template-columns: 2fr 1fr; }

/* 4 photos would leave one empty slot in a 3-column, 2-row grid (the hero
   eats two of the six). Letting the last photo span both rows closes it. */
.gallery__grid--4 { grid-template-columns: 2fr 1fr 1fr; }
.gallery__grid--4 > .gallery__cell:last-child { grid-row: span 2; }

.gallery__cell {
  position: relative; padding: 0; border: 0; cursor: pointer;
  background: var(--bg-tertiary); overflow: hidden;
}
.gallery__cell img,
.gallery__cell picture { width: 100%; height: 100%; display: block; }
.gallery__cell img { object-fit: cover; transition: transform 0.5s var(--ease, ease); }
.gallery__cell:hover img { transform: scale(1.04); }
.gallery__cell:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

.gallery__more {
  position: absolute; right: 1rem; bottom: 1rem;
  padding: 0.6rem 1.1rem;
  border: 0; border-radius: 999px;
  background: rgba(253, 252, 249, 0.94);
  color: var(--text-primary);
  font-family: inherit; font-size: 0.86rem; font-weight: 500;
  cursor: pointer;
  box-shadow: 0 3px 14px rgba(40, 30, 20, 0.2);
}
.gallery__more:hover { background: #fff; }

@media (max-width: 800px) {
  .gallery__grid {
    grid-template-columns: 1fr 1fr;
    aspect-ratio: 4 / 3;
  }
  .gallery__grid > .gallery__cell:first-child { grid-column: span 2; grid-row: span 1; }
  .gallery__grid > .gallery__cell:nth-child(n + 4) { display: none; }
}

/* ----------------------------------------------------------------------------
   Detail — body
   -------------------------------------------------------------------------- */

.detail {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 366px;
  gap: clamp(2rem, 4vw, 3.5rem);
  align-items: start;
}

.detail__head { margin-bottom: 1.75rem; }
.detail__status { position: static; display: inline-block; margin-bottom: 0.9rem; }
.detail__address {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  line-height: 1.15; margin: 0 0 0.35rem;
}
.detail__where { color: var(--text-secondary); margin: 0 0 1rem; }
.detail__price {
  font-family: var(--font-display, inherit);
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  font-weight: 600; color: var(--service-color, var(--accent-deep));
  display: flex; align-items: baseline; gap: 0.9rem; flex-wrap: wrap;
}
.detail__solddate {
  font-family: var(--font-body, inherit);
  font-size: 0.92rem; font-weight: 400; color: var(--text-muted);
}

.specs {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 1px; list-style: none; padding: 0;
  margin: 0 0 2rem;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: 12px; overflow: hidden;
}
.specs li {
  background: var(--surface);
  padding: 1.05rem 0.9rem;
  text-align: center;
}
.specs__n {
  display: block;
  font-family: var(--font-display, inherit);
  font-size: 1.4rem; font-weight: 600; line-height: 1.1;
}
.specs__l {
  display: block; margin-top: 0.2rem;
  font-size: 0.74rem; letter-spacing: 0.07em;
  text-transform: uppercase; color: var(--text-muted);
}

.detail__headline {
  font-size: clamp(1.15rem, 2.2vw, 1.45rem);
  font-weight: 500; line-height: 1.4;
  margin: 0 0 1.1rem;
}
.detail__prose p { color: var(--text-secondary); line-height: 1.75; margin: 0 0 1rem; }

.detail__block { margin-top: 2.4rem; }
.detail__block h3 {
  font-size: 0.82rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600;
  padding-bottom: 0.7rem; margin-bottom: 1.1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.feature-list {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.6rem 1.5rem; list-style: none; padding: 0; margin: 0;
}
.feature-list li {
  position: relative; padding-left: 1.4rem;
  font-size: 0.95rem; color: var(--text-secondary);
}
.feature-list li::before {
  content: ""; position: absolute; left: 0; top: 0.52em;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--service-color, var(--accent));
}

.factgrid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 0.9rem 1.5rem; margin: 0;
}
.factgrid div {
  display: flex; justify-content: space-between; gap: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border-subtle);
}
.factgrid dt { color: var(--text-muted); font-size: 0.9rem; }
.factgrid dd { margin: 0; font-size: 0.92rem; font-weight: 500; text-align: right; }

/* ----------------------------------------------------------------------------
   Inquiry panel
   -------------------------------------------------------------------------- */

.detail__side { position: sticky; top: calc(var(--nav-h, 72px) + 1.5rem); display: grid; gap: 1rem; }

.inquiry {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 1.6rem 1.5rem;
  box-shadow: 0 4px 20px rgba(40, 30, 20, 0.06);
}
.inquiry h3 { font-size: 1.15rem; margin: 0 0 0.3rem; }
.inquiry__lede { font-size: 0.88rem; color: var(--text-muted); margin: 0 0 1.25rem; }

.inquiry__row { display: flex; gap: 0.75rem; }
.inquiry__row .field { flex: 1; min-width: 0; }

.inquiry .field { margin-bottom: 0.85rem; }
.inquiry .field label {
  display: block; font-size: 0.8rem; font-weight: 500;
  margin-bottom: 0.3rem; color: var(--text-primary);
}
.inquiry .opt { color: var(--text-muted); font-weight: 400; }

.inquiry .input, .inquiry .textarea {
  width: 100%;
  padding: 0.62rem 0.75rem;
  font-family: inherit; font-size: 0.95rem;
  color: var(--text-primary); background: #fff;
  border: 1px solid var(--border-medium); border-radius: 8px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.inquiry .input:focus, .inquiry .textarea:focus {
  outline: none;
  border-color: var(--service-color, var(--accent));
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.inquiry .textarea { resize: vertical; line-height: 1.55; }

.btn--block { width: 100%; justify-content: center; }

.inquiry__result {
  margin-top: 0.9rem; padding: 0.75rem 0.9rem;
  border-radius: 8px; font-size: 0.9rem; line-height: 1.5;
  background: var(--danger-bg, rgba(194,86,61,0.08));
  border: 1px solid var(--danger-border, rgba(194,86,61,0.25));
  color: #8e3524;
}
.inquiry__result--ok {
  background: var(--accent-green-muted, rgba(91,122,94,0.1));
  border-color: var(--accent-green-border, rgba(91,122,94,0.3));
  color: #3f5844;
}

.inquiry__or {
  display: flex; align-items: center; justify-content: center;
  gap: 0.6rem; margin-top: 1.15rem;
  padding-top: 1.1rem; border-top: 1px solid var(--border-subtle);
  font-size: 0.88rem; color: var(--text-muted);
}
.inquiry__phone { font-weight: 600; color: var(--accent-deep); text-decoration: none; }

/* Honeypot — off-screen rather than display:none, which some bots skip. */
.hp {
  position: absolute; left: -9999px;
  width: 1px; height: 1px; overflow: hidden;
}

.agent-card {
  display: flex; align-items: center; gap: 0.9rem;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
}
.agent-card img { border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.agent-card strong { display: block; font-size: 0.95rem; font-weight: 600; }
.agent-card span { display: block; font-size: 0.82rem; color: var(--text-muted); margin-top: 0.1rem; }

/* ----------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.lightbox {
  position: fixed; inset: 0; z-index: 200;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.5rem;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(18, 16, 14, 0.94);
}
.lightbox[hidden] { display: none; }

.lightbox__stage {
  margin: 0; display: grid; place-items: center; gap: 0.9rem;
  min-width: 0; min-height: 0;
}
.lightbox__stage img {
  max-width: 100%; max-height: 82vh;
  object-fit: contain; border-radius: 6px;
}
.lightbox__caption { color: rgba(242, 239, 233, 0.72); font-size: 0.85rem; }

.lightbox__nav, .lightbox__close {
  border: 0; cursor: pointer;
  background: rgba(242, 239, 233, 0.1);
  color: #f2efe9;
  border-radius: 50%;
  display: grid; place-items: center;
  transition: background 0.2s;
}
.lightbox__nav { width: 52px; height: 52px; font-size: 2rem; line-height: 1; }
.lightbox__nav:hover, .lightbox__close:hover { background: rgba(242, 239, 233, 0.22); }

.lightbox__close {
  position: absolute; top: 1.1rem; right: 1.1rem;
  width: 44px; height: 44px; font-size: 1.6rem; line-height: 1;
}

@media (max-width: 700px) {
  .lightbox { grid-template-columns: 1fr; }
  .lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); }
  .lightbox__nav--prev { left: 0.6rem; }
  .lightbox__nav--next { right: 0.6rem; }
}

/* ----------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 980px) {
  .detail { grid-template-columns: 1fr; }
  .detail__side { position: static; }
}

@media (max-width: 640px) {
  .filters__field, .filters__field--sm { flex: 1 1 100%; }
  .filters__actions { width: 100%; }
  .filters__actions .btn { flex: 1; }
  /* 16px minimum stops iOS zooming the page on focus */
  .filters__input, .inquiry .input, .inquiry .textarea { font-size: 16px; }
  .listing-grid { grid-template-columns: 1fr; }
  .listings-cta { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  .lcard, .lcard__media img, .gallery__cell img { transition: none !important; }
  .lcard:hover { transform: none; }
  .lcard:hover .lcard__media img, .gallery__cell:hover img { transform: none; }
}

/* ----------------------------------------------------------------------------
   Home valuation
   -------------------------------------------------------------------------- */

.valuation-hero { padding-top: calc(var(--nav-h, 72px) + clamp(2rem, 5vw, 4rem)); }

.valuation {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 440px;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.valuation__intro h1 {
  font-size: clamp(2rem, 4.5vw, 3.1rem);
  line-height: 1.1;
  margin: 0.4rem 0 1rem;
}
.valuation__intro .lede {
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
  color: var(--text-secondary);
  line-height: 1.65;
  max-width: 46ch;
}

.valuation__points {
  list-style: none; padding: 0;
  margin: 2rem 0 0;
  display: grid; gap: 1.15rem;
  max-width: 48ch;
}
.valuation__points li {
  position: relative; padding-left: 1.7rem;
  font-size: 0.95rem; color: var(--text-secondary); line-height: 1.6;
}
.valuation__points li::before {
  content: ""; position: absolute; left: 0; top: 0.5em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
}
.valuation__points strong { display: block; color: var(--text-primary); font-weight: 600; }

.valuation__call {
  margin-top: 2rem; padding-top: 1.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.95rem; color: var(--text-muted);
}
.valuation__call a {
  font-weight: 600; color: var(--accent-deep);
  text-decoration: none; margin-left: 0.4rem;
}

.valuation__form {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: clamp(1.5rem, 3vw, 2rem);
  box-shadow: 0 8px 34px rgba(40, 30, 20, 0.09);
}
.valuation__form h2 { font-size: 1.25rem; margin: 0 0 1.35rem; }

.valuation__form .field { margin-bottom: 0.95rem; }
.valuation__form .field label {
  display: block; font-size: 0.83rem; font-weight: 500;
  margin-bottom: 0.32rem;
}
.valuation__form .opt { color: var(--text-muted); font-weight: 400; }

.valuation__form .input, .valuation__form .textarea {
  width: 100%; padding: 0.68rem 0.8rem;
  font-family: inherit; font-size: 0.95rem;
  color: var(--text-primary); background: #fff;
  border: 1px solid var(--border-medium); border-radius: 8px;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.valuation__form .input:focus, .valuation__form .textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.valuation__form select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235a5a5a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.75rem center;
  padding-right: 2rem;
}
.valuation__form .textarea { resize: vertical; line-height: 1.55; }

.valuation__fineprint {
  margin: 1.1rem 0 0; font-size: 0.8rem;
  color: var(--text-muted); line-height: 1.5; text-align: center;
}

@media (max-width: 900px) {
  .valuation { grid-template-columns: 1fr; }
  .valuation__form-wrap { order: -1; }
}
@media (max-width: 640px) {
  .valuation__form .input, .valuation__form .textarea { font-size: 16px; }
}
