/**
 * Property Details V3 — premium full-width layout (owner-approved direction).
 * Scoped under .ld-v3. Sun + Moon via data-dg-theme. No rejected sidebar.
 */
.ld-v3 {
  --ld-max: 1180px;
  --ld-radius: 16px;
  --ld-radius-sm: 12px;
  --ld-gap: 6px;
  --ld-line: color-mix(in srgb, var(--ps-color-outline, #8aa4bc) 22%, transparent);
  --ld-surface: var(--ps-color-surface-container-lowest, #121418);
  --ld-muted: var(--ps-color-on-surface-variant, #9aa3ad);
  --ld-text: var(--ps-color-on-surface, #E8EAED);
  --ld-champagne: #B89A63;
  --ld-champagne-soft: rgba(184, 154, 99, 0.16);
  --ld-header-offset: 88px;
}

html[data-dg-theme="light"] .ld-v3 {
  --ld-surface: #FFFFFF;
  --ld-muted: #6B7280;
  --ld-text: #1C1F24;
  --ld-line: rgba(40, 48, 60, 0.12);
  --ld-champagne: #A8894F;
  --ld-champagne-soft: rgba(168, 137, 79, 0.14);
}

.ld-v3-shell {
  width: 100%;
  max-width: var(--ld-max);
  margin-inline: auto;
  padding-bottom: 48px;
}

/* —— Top utility bar —— */
.ld-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.ld-topbar-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ld-muted);
  text-decoration: none;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  min-height: 44px;
}

.ld-topbar-back:hover { color: var(--ld-text); }

.ld-topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.ld-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  min-width: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ld-line);
  background: transparent;
  color: var(--ld-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.ld-icon-btn:hover {
  background: color-mix(in srgb, var(--ld-champagne) 8%, transparent);
}

.ld-icon-btn .material-symbols-outlined { font-size: 18px; }

.ld-icon-btn.is-active {
  border-color: color-mix(in srgb, var(--ld-champagne) 45%, var(--ld-line));
  color: var(--ld-champagne);
}

/* —— Mosaic gallery —— */
.ld-gallery {
  position: relative;
  border-radius: var(--ld-radius);
  overflow: hidden;
  background: color-mix(in srgb, var(--ps-color-surface-container, #1A1C20) 88%, transparent);
  margin-bottom: 22px;
}

.ld-gallery-mosaic {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--ld-gap);
  min-height: 420px;
  height: clamp(380px, 48vw, 520px);
}

.ld-gallery-main-wrap {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
  overflow: hidden;
  display: block;
  width: 100%;
  height: 100%;
}

.ld-gallery-main-wrap img,
.ld-gallery-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ld-gallery-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--ld-gap);
  min-height: 0;
}

.ld-gallery-tile {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: color-mix(in srgb, var(--ps-color-surface-container, #1A1C20) 70%, transparent);
  cursor: zoom-in;
  overflow: hidden;
  min-height: 0;
}

.ld-gallery-tile[hidden],
.ld-gallery-side:empty { display: none !important; }

/* Count-based layout adaptations */
.ld-gallery[data-count="0"] .ld-gallery-mosaic,
.ld-gallery[data-empty="1"] .ld-gallery-mosaic { display: none; }

.ld-gallery[data-count="1"] .ld-gallery-mosaic {
  grid-template-columns: 1fr;
}
.ld-gallery[data-count="1"] .ld-gallery-side { display: none; }

.ld-gallery[data-count="2"] .ld-gallery-mosaic {
  grid-template-columns: 1fr 1fr;
}
.ld-gallery[data-count="2"] .ld-gallery-side {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.ld-gallery[data-count="3"] .ld-gallery-side {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr 1fr;
}

.ld-gallery-fallback {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 280px;
  color: var(--ld-muted);
  font-size: 13px;
  padding: 32px;
}

.ld-gallery[data-empty="1"] .ld-gallery-fallback { display: flex; }

.ld-gallery-badge {
  position: absolute;
  z-index: 3;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ld-gallery-badge--deal {
  inset-inline-start: 14px;
  bottom: 14px;
  background: rgba(18, 20, 24, 0.72);
  color: #F4F6F8;
}

.ld-gallery-badge--sold {
  inset-inline-start: 14px;
  top: 14px;
  background: rgba(28, 32, 38, 0.88);
  color: #F4F6F8;
}

.ld-gallery-badge--verified {
  inset-inline-end: 14px;
  top: 14px;
  background: color-mix(in srgb, var(--ld-champagne) 22%, rgba(18, 20, 24, 0.75));
  color: #F4F6F8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Beat component display rules when Tailwind .hidden is applied */
.ld-gallery-badge.hidden,
.ld-note.hidden,
.ld-map-note.hidden,
.ld-gallery-seeall.hidden,
.ld-gallery-counter.hidden,
.ld-more.hidden {
  display: none !important;
}

.ld-gallery-seeall {
  position: absolute;
  inset-inline-end: 14px;
  bottom: 14px;
  z-index: 3;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(18, 20, 24, 0.7);
  color: #F4F6F8;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.ld-gallery-seeall[hidden] { display: none !important; }

.ld-gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(18, 20, 24, 0.55);
  color: #F4F6F8;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.ld-gallery-nav--prev { inset-inline-start: 12px; }
.ld-gallery-nav--next { inset-inline-end: 12px; }
.ld-gallery-nav[hidden] { display: none !important; }

.ld-gallery-counter {
  display: none;
  position: absolute;
  inset-inline-end: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(18, 20, 24, 0.7);
  color: #F4F6F8;
  font-size: 12px;
  font-weight: 600;
}

/* —— Price / facts strip —— */
.ld-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr) auto;
  gap: 18px 28px;
  align-items: end;
  padding: 4px 2px 20px;
  border-bottom: 1px solid var(--ld-line);
  margin-bottom: 0;
}

.ld-hero-price {
  margin: 0;
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--ld-text);
}

.ld-hero-loc {
  margin: 8px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  color: var(--ld-muted);
  font-size: 14px;
  line-height: 1.45;
}

.ld-hero-loc .material-symbols-outlined {
  font-size: 18px;
  margin-top: 1px;
  flex: none;
}

.ld-hero-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ld-text);
  font-size: 14.5px;
  font-weight: 550;
}

.ld-hero-facts li {
  display: inline-flex;
  align-items: center;
}

.ld-hero-facts li[hidden] { display: none !important; }

/* Dividers only between visible facts (ignore hidden trailing nodes) */
.ld-hero-facts li:not([hidden]) + li:not([hidden])::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 14px;
  margin-inline: 12px;
  background: var(--ld-line);
}

.ld-hero-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-self: end;
  text-align: end;
}

.ld-hero-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--ld-line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ld-champagne);
  flex: none;
}

.ld-hero-brand-k {
  display: block;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ld-muted);
  margin-bottom: 2px;
}

.ld-hero-brand-v {
  display: block;
  font-size: 14px;
  font-weight: 650;
  color: var(--ld-text);
}

.ld-hero-notes {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ld-note {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--ld-line);
  background: color-mix(in srgb, var(--ld-champagne) 6%, transparent);
  font-size: 12.5px;
  color: var(--ld-muted);
}

.ld-note[hidden] { display: none !important; }

/* —— Section navigation —— */
.ld-secnav {
  position: sticky;
  top: var(--ld-header-offset);
  z-index: 20;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  margin: 0 0 28px;
  padding: 10px 0;
  border-bottom: 1px solid var(--ld-line);
  background: color-mix(in srgb, var(--ps-color-background, #0D0F12) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  scrollbar-width: none;
}

html[data-dg-theme="light"] .ld-secnav {
  background: color-mix(in srgb, #F7F3EB 92%, transparent);
}

.ld-secnav::-webkit-scrollbar { display: none; }

.ld-secnav a {
  flex: none;
  padding: 10px 14px;
  color: var(--ld-muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 550;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}

.ld-secnav a:hover { color: var(--ld-text); }

.ld-secnav a.is-active {
  color: var(--ld-text);
  border-bottom-color: var(--ld-champagne);
}

/* —— Content sections —— */
.ld-section {
  scroll-margin-top: calc(var(--ld-header-offset) + 48px);
  margin-bottom: 36px;
}

.ld-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.ld-section-head h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ld-text);
}

.ld-title {
  margin: 0 0 6px;
  font-size: clamp(1.35rem, 2.4vw, 1.7rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ld-text);
}

.ld-id {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--ld-muted);
  font-variant-numeric: tabular-nums;
}

.ld-id[hidden] { display: none !important; }

.ld-desc {
  margin: 0;
  font-size: 15px;
  line-height: 1.7;
  color: var(--ld-text);
  white-space: pre-wrap;
}

.ld-empty {
  margin: 0;
  font-size: 13.5px;
  color: var(--ld-muted);
}

/* Facts grid */
.ld-facts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--ld-line);
}

.ld-facts-grid > li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid var(--ld-line);
}

.ld-facts-grid > li[hidden] { display: none !important; }

.ld-fact-k {
  font-size: 13px;
  color: var(--ld-muted);
}

.ld-fact-v {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ld-text);
  text-align: end;
}

.ld-features {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 18px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.ld-features li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ld-text);
}

.ld-features .material-symbols-outlined {
  font-size: 18px;
  color: var(--ld-champagne);
  flex: none;
  margin-top: 1px;
}

.ld-features.is-collapsed li:nth-child(n + 9) { display: none; }

.ld-more {
  margin-top: 14px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ld-line);
  background: transparent;
  color: var(--ld-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.ld-more[hidden] { display: none !important; }

/* Inquiry strip — single coherent CTA, not a tall sidebar stack */
.ld-inquire {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  margin: 22px 0 0;
  padding: 16px 18px;
  border-radius: var(--ld-radius-sm);
  border: 1px solid var(--ld-line);
  background: color-mix(in srgb, var(--ld-champagne) 6%, transparent);
}

.ld-inquire-copy {
  flex: 1 1 200px;
  margin: 0;
  font-size: 13.5px;
  color: var(--ld-muted);
  line-height: 1.45;
}

.ld-inquire-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ld-btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  border: 0;
  background: var(--ld-text);
  color: var(--ld-surface);
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: 0.02em;
  cursor: pointer;
  text-decoration: none;
}

html[data-dg-theme="dark"] .ld-btn-primary {
  background: #F1F3F5;
  color: #121418;
}

html[data-dg-theme="light"] .ld-btn-primary {
  background: #1C1F24;
  color: #FFFFFF;
}

.ld-btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--ld-line);
  background: transparent;
  color: var(--ld-text);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

/* Map */
.ld-map-wrap {
  border-radius: var(--ld-radius-sm);
  overflow: hidden;
  border: 1px solid var(--ld-line);
  height: 340px;
}

.ld-map-wrap #listingMap { width: 100%; height: 100%; }

.ld-map-note {
  margin: 10px 0 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ld-muted);
}

.ld-map-note[hidden] { display: none !important; }
.ld-map-note .material-symbols-outlined { font-size: 16px; margin-top: 1px; }

/* Similar — keep homele styles; ensure spacing */
.ld-v3 .listing-similar-section {
  margin-top: 8px;
  padding-top: 28px;
}

/* —— Responsive —— */
@media (max-width: 960px) {
  .ld-hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 14px;
  }
  .ld-hero-brand { justify-self: start; text-align: start; }
  .ld-gallery-mosaic {
    height: clamp(300px, 52vw, 420px);
    min-height: 300px;
  }
}

@media (max-width: 720px) {
  .ld-gallery-mosaic {
    grid-template-columns: 1fr !important;
    height: min(58vw, 360px);
    min-height: 240px;
  }
  .ld-gallery-side { display: none !important; }
  .ld-gallery-nav:not([hidden]) { display: inline-flex; }
  .ld-gallery-counter:not([hidden]) { display: inline-flex; }
  .ld-gallery-seeall { display: none !important; }
  .ld-facts-grid,
  .ld-features { grid-template-columns: 1fr; }
  .ld-icon-btn span:not(.material-symbols-outlined) {
    /* keep label on mobile for Save/Share clarity */
  }
  .ld-secnav { top: 72px; }
  .ld-v3 { --ld-header-offset: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  .ld-secnav { scroll-behavior: auto; }
}
