/* Listing detail pages (/listings/<slug>/). */
@layer page {
  .listing-top { padding-block: var(--space-4) var(--space-5); background: linear-gradient(var(--color-cream-deep), var(--color-cream) 70%); }

  /* Breadcrumb */
  .breadcrumb ol {
    display: flex;
    flex-wrap: wrap;
    gap: 0 .4rem;
    list-style: none;
    margin: 0 0 var(--space-4);
    padding: 0;
    font-size: .9375rem;
    color: var(--color-muted);
  }
  .breadcrumb li { margin: 0; display: inline-flex; align-items: center; gap: .4rem; min-width: 0; }
  .breadcrumb li + li::before { content: "/"; color: var(--color-line-strong); }
  .breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
  .breadcrumb [aria-current] { overflow-wrap: anywhere; }

  .listing-hero { display: grid; gap: var(--space-5); }
  @media (min-width: 960px) {
    .listing-hero { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-6); align-items: start; }
  }

  /* Gallery */
  .gallery { position: relative; min-width: 0; }
  .gallery__tags {
    position: absolute;
    z-index: 2;
    top: var(--space-3);
    left: var(--space-3);
    right: var(--space-3);
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    pointer-events: none;
  }
  .gallery__stage { position: relative; }
  .gallery__slides { position: relative; list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
  .gallery__slide { margin: 0; border-radius: var(--radius-lg); overflow: hidden; background: var(--color-cream-deep); aspect-ratio: 3 / 2; box-shadow: var(--shadow); }
  .gallery__slide img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .gallery--enhanced .gallery__slides { display: block; }
  .gallery__nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    margin-top: -22px;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / .92);
    color: var(--color-ink);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
  }
  .gallery__nav:hover { background: var(--color-surface); color: var(--color-brand); }
  .gallery__nav--prev { left: var(--space-3); }
  .gallery__nav--prev .icon { transform: rotate(90deg); }
  .gallery__nav--next { right: var(--space-3); }
  .gallery__nav--next .icon { transform: rotate(-90deg); }
  .gallery__counter {
    position: absolute;
    right: var(--space-3);
    bottom: var(--space-3);
    margin: 0;
    padding: .2rem .7rem;
    border-radius: var(--radius-pill);
    background: rgb(31 31 31 / .72);
    color: #fff;
    font-size: .875rem;
    font-weight: 700;
  }
  .gallery__thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-3); }
  .gallery__thumb {
    width: 88px;
    aspect-ratio: 3 / 2;
    padding: 0;
    border: 3px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: var(--color-cream-deep);
    cursor: pointer;
    opacity: .75;
    transition: opacity .2s var(--ease), border-color .2s var(--ease);
  }
  .gallery__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .gallery__thumb:hover { opacity: 1; }
  .gallery__thumb[aria-pressed="true"] { border-color: var(--color-brand); opacity: 1; }
  @media (min-width: 768px) { .gallery__thumb { width: 112px; } }

  /* Summary panel */
  .listing-summary {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: var(--space-5) var(--space-4);
    min-width: 0;
  }
  @media (min-width: 768px) { .listing-summary { padding: var(--space-6); } }
  @media (min-width: 960px) { .listing-summary { position: sticky; top: calc(var(--header-h) + var(--space-4)); } }
  .listing-summary__price {
    margin: 0;
    font-family: var(--font-head);
    font-weight: 700;
    font-size: var(--step-4);
    line-height: 1.05;
    color: var(--color-brand);
  }
  .listing-summary__title { margin: var(--space-2) 0 .2rem; font-size: var(--step-2); line-height: 1.2; overflow-wrap: anywhere; }
  .listing-summary__place { display: flex; align-items: center; gap: .35rem; margin: 0; color: var(--color-muted); font-weight: 600; }
  .listing-summary__place .icon { color: var(--color-brand); flex: none; }
  .listing-summary__facts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3) var(--space-5);
    list-style: none;
    margin: var(--space-4) 0;
    padding: var(--space-4) 0;
    border-block: 1px solid var(--color-line);
  }
  .listing-summary__facts li { display: inline-flex; align-items: center; gap: .45rem; margin: 0; }
  .listing-summary__facts .icon { color: var(--color-sage-text); }
  .listing-summary__facts strong { font-weight: 800; font-size: 1.125rem; }
  .listing-summary__lede { color: var(--color-muted); margin: 0 0 var(--space-5); }
  .listing-summary__actions { display: grid; gap: var(--space-3); }
  .listing-summary__actions .btn { width: 100%; justify-content: center; }

  /* Body */
  .listing-body { padding-top: var(--space-6); }
  .listing-body__grid { display: grid; gap: var(--space-7); }
  @media (min-width: 960px) { .listing-body__grid { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: var(--space-6); } }
  .listing-body__main h2 { margin-top: 0; }
  .listing-description { font-size: 1.0625rem; max-width: 42rem; }
  .listing-subhead { margin: var(--space-6) 0 var(--space-4); font-size: var(--step-1); }
  .feature-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: var(--space-3) var(--space-5);
  }
  @media (min-width: 600px) { .feature-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .feature-list li { display: flex; align-items: flex-start; gap: .6rem; margin: 0; }
  .feature-list .icon {
    flex: none;
    width: 26px;
    height: 26px;
    padding: 4px;
    border-radius: 50%;
    background: var(--color-sage-tint);
    color: var(--color-sage-text);
  }
  .facts {
    display: grid;
    margin: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
  }
  @media (min-width: 600px) { .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .facts__row {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--color-line);
    margin-bottom: -1px; /* last row's border is clipped by the dl's overflow */
  }
  .facts dt { color: var(--color-muted); font-weight: 600; }
  .facts dd { margin: 0; font-weight: 800; text-align: right; }

  .listing-body__aside { display: grid; gap: var(--space-5); align-content: start; }
  .listing-aside__block .eyebrow { margin-bottom: var(--space-3); }

  /* Static map card (town only, never a precise address) */
  .map-card {
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
  }
  .map-card__art {
    position: relative;
    height: 150px;
    display: grid;
    place-items: center;
    background:
      linear-gradient(115deg, transparent 46%, #fff 46%, #fff 50%, transparent 50%),
      linear-gradient(20deg, transparent 60%, rgb(255 255 255 / .9) 60%, rgb(255 255 255 / .9) 63%, transparent 63%),
      radial-gradient(circle at 78% 30%, rgb(107 143 113 / .35) 0 18%, transparent 19%),
      radial-gradient(circle at 18% 75%, rgb(107 143 113 / .3) 0 14%, transparent 15%),
      repeating-linear-gradient(0deg, transparent 0 27px, rgb(255 255 255 / .7) 27px 29px),
      repeating-linear-gradient(90deg, transparent 0 35px, rgb(255 255 255 / .7) 35px 37px),
      var(--color-sage-tint);
  }
  .map-card__pin {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--color-brand);
    color: #fff;
    box-shadow: 0 0 0 10px rgb(142 0 0 / .15), var(--shadow);
  }
  .map-card__body { padding: var(--space-5); }
  .map-card__heading { margin: 0 0 var(--space-2); font-size: var(--step-1); }
  .map-card__body p { margin: 0 0 var(--space-3); color: var(--color-muted); font-size: .9688rem; }
  .map-card__link { display: inline-flex; align-items: center; gap: .4rem; min-height: 44px; font-weight: 800; }

  /* More homes */
  .more-homes__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3) var(--space-5);
    margin-bottom: var(--space-5);
  }
  .more-homes__head h2 { margin: 0; }

  .listing-disclaimer p { margin: 0; max-width: 60rem; color: var(--color-muted); font-size: .875rem; }
}
