/**
 * Property detail page — layout system rebuild
 * Spacing: 8 · 16 · 24 · 32 · 48
 */

.lux-detail-page {
  --lux-1: 8px;
  --lux-2: 16px;
  --lux-3: 24px;
  --lux-4: 32px;
  --lux-5: 48px;
  --lux-shell: min(1180px, calc(100vw - var(--lux-4)));
  --lux-aside: 380px;
  --lux-stat-min-h: 128px;
}

/* ═══════════════════════════════════════════
   Modern Property Gallery (Airbnb-style bento)
   ═══════════════════════════════════════════ */
.mpg {
  --mpg-gap: 4px;
  --mpg-radius: 12px;
  --mpg-shell: min(1280px, calc(100vw - 48px));
  width: 100%;
  max-width: var(--mpg-shell);
  margin: 0 auto var(--lux-4);
  padding-inline: 24px;
  direction: ltr;
}

.mpg__frame {
  position: relative;
}

.mpg__grid {
  position: relative;
  display: grid;
  grid-template-columns: 1.85fr 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: var(--mpg-gap);
  height: min(52vh, 520px);
  min-height: 320px;
  overflow: hidden;
  border-radius: var(--mpg-radius);
  background: #0a1620;
}

.mpg__grid--single {
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
}

.mpg__cell {
  position: relative;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  cursor: pointer;
  background: #0a1620;
  isolation: isolate;
}

.mpg__cell--main {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.mpg__cell--thumb:nth-child(2) { grid-column: 2; grid-row: 1; }
.mpg__cell--thumb:nth-child(3) { grid-column: 3; grid-row: 1; }
.mpg__cell--thumb:nth-child(4) { grid-column: 2; grid-row: 2; }
.mpg__cell--thumb:nth-child(5) { grid-column: 3; grid-row: 2; }

/* 2 images: main + 1 large thumb */
.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(2):last-child {
  grid-column: 2 / span 2;
  grid-row: 1 / span 2;
}

/* 3 images: main + 2 stacked thumbs */
.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(2):nth-last-child(2) {
  grid-column: 2 / span 2;
  grid-row: 1;
}

.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(3):last-child {
  grid-column: 2 / span 2;
  grid-row: 2;
}

/* 4 images: main + top wide + 2 bottom */
.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(2):nth-last-child(3) {
  grid-column: 2 / span 2;
  grid-row: 1;
}

.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(3):nth-last-child(2) {
  grid-column: 2;
  grid-row: 2;
}

.mpg__grid:not(.mpg__grid--single) .mpg__cell--thumb:nth-child(4):last-child {
  grid-column: 3;
  grid-row: 2;
}

.mpg__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transform: scale(1);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1), filter 0.35s ease;
  will-change: transform;
}

.mpg__cell::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(6, 14, 26, 0);
  transition: background 0.35s ease;
  pointer-events: none;
  z-index: 1;
}

.mpg__cell:hover .mpg__img,
.mpg__cell:focus-visible .mpg__img {
  transform: scale(1.04);
  filter: brightness(0.92);
}

.mpg__cell:hover::after,
.mpg__cell:focus-visible::after {
  background: rgba(6, 14, 26, 0.12);
}

.mpg__cell:focus-visible {
  outline: 2px solid var(--gold-mid, #c9a24d);
  outline-offset: -2px;
  z-index: 2;
}

.mpg__back {
  position: absolute;
  top: 16px;
  left: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  background: #fff;
  color: #1a1a1a;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mpg__back:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  color: #1a1a1a;
}

.mpg__back-icon {
  font-size: 16px;
  line-height: 1;
}

.mpg__view-all {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  margin: 0;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #111;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mpg__view-all:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ── Lightbox ── */
.mpg-lightbox {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s ease;
}

.mpg-lightbox.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.mpg-lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 18, 0.94);
  cursor: zoom-out;
}

.mpg-lightbox__chrome {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  pointer-events: none;
}

.mpg-lightbox__counter {
  flex: 1;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.mpg-lightbox__btn {
  pointer-events: auto;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mpg-lightbox__btn:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.05);
}

.mpg-lightbox__close {
  font-size: 28px;
}

.mpg-lightbox__zoom {
  font-size: 22px;
  font-weight: 400;
}

.mpg-lightbox__nav {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 52px;
  height: 52px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.mpg-lightbox__nav:hover {
  background: rgba(255, 255, 255, 0.22);
}

.mpg-lightbox__nav--prev { left: 16px; }
.mpg-lightbox__nav--next { right: 16px; }

.mpg-lightbox__stage {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(92vw, 1400px);
  height: min(82vh, 900px);
  overflow: hidden;
  touch-action: none;
  cursor: zoom-in;
}

.mpg-lightbox__stage.is-zoomed {
  cursor: grab;
}

.mpg-lightbox__stage.is-zoomed.is-dragging {
  cursor: grabbing;
}

.mpg-lightbox__img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transform-origin: center center;
  transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  opacity: 0;
}

.mpg-lightbox__img.is-ready {
  opacity: 1;
}

.mpg-lightbox.is-open .mpg-lightbox__img.is-ready {
  animation: mpgFadeIn 0.35s ease;
}

@keyframes mpgFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

body.mpg-lightbox-open {
  overflow: hidden;
}

/* Gallery responsive */
@media (max-width: 900px) {
  .mpg {
    --mpg-shell: min(100vw, calc(100vw - 32px));
    padding-inline: 16px;
  }

  .mpg__grid {
    grid-template-columns: 1.4fr 1fr;
    grid-template-rows: 1fr 1fr;
    height: min(42vh, 420px);
    min-height: 280px;
  }

  .mpg__cell--main {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .mpg__cell--thumb:nth-child(2) { grid-column: 2; grid-row: 1; }
  .mpg__cell--thumb:nth-child(3) { grid-column: 2; grid-row: 2; }
  .mpg__cell--thumb:nth-child(4),
  .mpg__cell--thumb:nth-child(5) {
    display: none;
  }
}

@media (max-width: 640px) {
  .mpg {
    padding-inline: 12px;
    margin-bottom: var(--lux-3);
  }

  .mpg__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: minmax(220px, 38vh) 120px;
    height: auto;
    min-height: 0;
    border-radius: 10px;
  }

  .mpg__grid--single {
    grid-template-rows: minmax(240px, 42vh);
  }

  .mpg__cell--main {
    grid-column: 1 / span 2;
    grid-row: 1;
  }

  .mpg__cell--thumb:nth-child(2) { grid-column: 1; grid-row: 2; display: block; }
  .mpg__cell--thumb:nth-child(3) { grid-column: 2; grid-row: 2; display: block; }
  .mpg__cell--thumb:nth-child(4),
  .mpg__cell--thumb:nth-child(5) {
    display: none;
  }

  .mpg__back {
    top: 12px;
    left: 12px;
    padding: 8px 12px;
    font-size: 13px;
  }

  .mpg__view-all {
    right: 10px;
    bottom: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }

  .mpg-lightbox__nav {
    width: 42px;
    height: 42px;
    font-size: 26px;
  }

  .mpg-lightbox__nav--prev { left: 8px; }
  .mpg-lightbox__nav--next { right: 8px; }

  .mpg-lightbox__stage {
    width: 100vw;
    height: 70vh;
  }
}

/* ── Shell container ── */
.lux-detail-page .lux-detail-shell {
  width: 100%;
  max-width: var(--lux-shell);
  margin-inline: auto;
  padding-inline: var(--lux-3);
}

.lux-detail-page .lux-detail-back {
  display: inline-block;
  margin-bottom: var(--lux-2);
}

/* ── Two-column body: main + sticky form ── */
.lux-detail-page .lux-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--lux-aside);
  gap: var(--lux-4);
  align-items: start;
}

.lux-detail-page .lux-detail-main {
  min-width: 0;
}

.lux-detail-page .lux-detail-aside {
  min-width: 0;
}

.lux-detail-page .lux-inquiry-panel {
  position: sticky;
  top: calc(var(--nav-h, 72px) + var(--lux-2));
}

.lux-detail-page .lux-inquiry-panel__inner {
  padding: var(--lux-4);
  border-radius: 16px;
}

/* ── Hero meta (title stack) ── */
.lux-detail-page .lux-detail-head {
  margin-bottom: var(--lux-4);
  padding-bottom: var(--lux-4);
  border-bottom: 1px solid rgba(201, 162, 77, 0.12);
}

.lux-detail-page .lux-detail-head__type {
  margin: var(--lux-1) 0 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lux-detail-page .lux-detail-head__title {
  margin: var(--lux-2) 0 0;
  line-height: 1.12;
}

.lux-detail-page .lux-detail-meta {
  display: flex;
  flex-direction: column;
  gap: var(--lux-2);
  margin-top: var(--lux-3);
}

.lux-detail-page .lux-detail-meta__item {
  margin: 0;
}

.lux-detail-page .lux-detail-meta__price {
  margin: 0;
}

.lux-detail-page .lux-detail-meta__muted {
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-soft);
}

.lux-detail-page .lux-detail-loc {
  margin: 0;
  font-size: 15px;
  color: var(--text-muted);
}

.lux-detail-page .lux-detail-price {
  margin: 0;
}

/* ── Statistics grid ── */
.lux-detail-page .lux-stats {
  width: 100%;
  margin-bottom: var(--lux-4);
}

.lux-detail-page .lux-stats__grid {
  display: grid;
  grid-template-columns: repeat(var(--lux-stats-cols, 4), minmax(0, 1fr));
  gap: var(--lux-2);
  width: 100%;
  align-items: stretch;
}

.lux-detail-page .lux-stat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--lux-1);
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  min-height: var(--lux-stat-min-h);
  height: 100%;
  padding: var(--lux-3) var(--lux-2);
  margin: 0;
  text-align: center;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(201, 162, 77, 0.18);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  overflow: hidden;
  transition: border-color 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.lux-detail-page .lux-stat-card:hover {
  border-color: rgba(201, 162, 77, 0.38);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.lux-detail-page .lux-stat-card__icon {
  flex: 0 0 auto;
  font-size: 1.25rem;
  line-height: 1;
  margin-bottom: var(--lux-1);
}

.lux-detail-page .lux-stat-card__label {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
  color: var(--text-soft, rgba(255, 255, 255, 0.55));
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lux-detail-page .lux-stat-card__value {
  flex: 0 0 auto;
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0;
  font-family: var(--fDis, Georgia, serif);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--gold-mid, #c9a24d);
  word-break: normal;
  overflow-wrap: normal;
}

.lux-detail-page .lux-stat-card__value--numeric {
  font-size: clamp(0.92rem, 1.6vw, 1.25rem);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}

.lux-detail-page .lux-stat-card__value--numeric::-webkit-scrollbar {
  height: 3px;
}

/* Kill legacy spec-card rules inside new layout */
.lux-detail-page .lux-stats .spec-card__title,
.lux-detail-page .lux-stats .spec-card__subtitle,
.lux-detail-page .lux-stats .spec-card__value,
.lux-detail-page .lux-stats .property-spec__label,
.lux-detail-page .lux-stats .property-spec__value {
  all: unset;
  display: block;
  box-sizing: border-box;
}

.lux-detail-page .lux-stats .lux-stat-card__label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.45;
  text-transform: uppercase;
  color: var(--text-soft, rgba(255, 255, 255, 0.55));
}

.lux-detail-page .lux-stats .lux-stat-card__value {
  font-family: var(--fDis, Georgia, serif);
  font-size: clamp(1.05rem, 2vw, 1.45rem);
  font-weight: 600;
  line-height: 1.3;
  color: var(--gold-mid, #c9a24d);
}

/* ── Content sections ── */
.lux-detail-page #property-overview-specs {
  margin-bottom: var(--lux-4);
}

.lux-detail-page .lux-detail-heading {
  margin: var(--lux-4) 0 var(--lux-2);
}

.lux-detail-page .lux-detail-prose {
  margin-bottom: var(--lux-3);
}

.lux-detail-page .gold-rule {
  margin: var(--lux-4) 0;
}

.lux-detail-page .lux-inquiry-title {
  margin-bottom: var(--lux-1);
}

.lux-detail-page .lux-inquiry-sub {
  margin-bottom: var(--lux-3);
}

.lux-detail-page .lux-inquiry-form .form-group {
  margin-bottom: var(--lux-2);
}

.lux-detail-page .lux-detail-related {
  padding-block: var(--lux-5) var(--lux-4);
}

.lux-detail-page .lux-detail-related__title {
  margin-bottom: var(--lux-4);
}

/* Soft government / permit numbers (above Location) */
.lux-permit-soft {
  margin-top: var(--lux-5);
  margin-bottom: var(--lux-2);
  padding: 0;
  border: 0;
  background: transparent;
}

.lux-permit-soft__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
  margin: 0 0 6px;
  padding: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-soft, rgba(255, 255, 255, 0.55));
}

.lux-permit-soft__row:last-child {
  margin-bottom: 0;
}

.lux-permit-soft__label {
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--text-muted, rgba(255, 255, 255, 0.65));
}

.lux-permit-soft__label::after {
  content: ':';
}

.lux-permit-soft__number {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  color: rgba(232, 220, 190, 0.88);
}

.lux-permit-soft + .lux-detail-heading {
  margin-top: 20px !important;
}

/* ── Responsive layout ── */
@media (max-width: 1100px) {
  .lux-detail-page .lux-detail-grid {
    grid-template-columns: 1fr;
    gap: var(--lux-4);
  }

  .lux-detail-page .lux-inquiry-panel {
    position: static;
  }

  .lux-detail-page .lux-stats__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .lux-detail-page .lux-stats__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lux-detail-page .lux-detail-shell {
    padding-inline: var(--lux-2);
  }
}

@media (max-width: 480px) {
  .lux-detail-page .lux-stats__grid {
    grid-template-columns: 1fr;
  }
}
