/* ============================================================
   DAIKU — Modal de detalle del modelo
   Shared by desktop & mobile.
   ============================================================ */

/* ── BACKDROP ─────────────────────────────────────────────── */
.dm-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 200ms ease-out;
}
.dm-modal[data-open="true"] {
  display: flex;
  opacity: 1;
}
.dm-modal[data-closing="true"] {
  opacity: 0;
}
/* Low-perf fallback (mobile) — solid semitransparent, no blur */
.dm-modal.is-lowperf {
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  background: rgba(20, 14, 10, 0.78);
}

/* ── DIALOG SHELL ─────────────────────────────────────────── */
.dm-dialog {
  position: relative;
  width: 100%;
  max-width: 1200px;
  max-height: calc(100vh - 64px);
  background: #FFFAE9;
  color: #020407;
  border-radius: 24px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.32),
              0 2px 8px rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transform: scale(0.96);
  opacity: 0;
  transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
              opacity 350ms ease-out;
  display: flex;
  flex-direction: column;
}
.dm-modal[data-open="true"] .dm-dialog {
  transform: scale(1);
  opacity: 1;
}
.dm-modal[data-closing="true"] .dm-dialog {
  transform: scale(0.96);
  opacity: 0;
  transition-duration: 200ms;
}

/* ── CLOSE BUTTON ─────────────────────────────────────────── */
.dm-close {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 5;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(91, 68, 54, 0.18);
  background: rgba(255, 250, 233, 0.9);
  color: #5B4436;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 200ms ease, transform 200ms ease;
  font-family: inherit;
}
.dm-close:hover {
  background: #5B4436;
  color: #FFFAE9;
  transform: scale(1.05);
}
.dm-close:focus-visible {
  outline: 2px solid #5B4436;
  outline-offset: 2px;
}

/* ── SCROLL CONTAINER ─────────────────────────────────────── */
.dm-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.dm-scroll::-webkit-scrollbar { width: 8px; }
.dm-scroll::-webkit-scrollbar-thumb {
  background: rgba(91, 68, 54, 0.25);
  border-radius: 4px;
}

/* ── DESKTOP LAYOUT ───────────────────────────────────────── */
.dm-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 40px;
  padding: 56px 56px 48px;
}

.dm-col-left  { display: flex; flex-direction: column; gap: 32px; min-width: 0; }
.dm-col-right { display: flex; flex-direction: column; gap: 24px; min-width: 0; }

/* Header (eyebrow + name) */
.dm-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: #5B4436;
  opacity: 0.7;
  margin: 0 0 8px;
}
.dm-title {
  font-family: inherit;
  font-weight: 800;
  font-size: 88px;
  line-height: 0.95;
  letter-spacing: -0.02em;
  color: #020407;
  margin: 0 0 6px;
}
.dm-title .it { font-style: italic; font-weight: 300; }
.dm-sub {
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.65;
}

/* Specs row (4 boxes) */
.dm-specs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 4px;
}
.dm-spec {
  background: rgba(202, 179, 158, 0.32);
  border-radius: 14px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.dm-spec__icon {
  width: 28px;
  height: 28px;
  color: #5B4436;
}
.dm-spec__icon svg { width: 100%; height: 100%; display: block; }
.dm-spec__num {
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: #020407;
  line-height: 1;
}
.dm-spec__num small { font-size: 18px; font-weight: 500; opacity: 0.7; }
.dm-spec__label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.75;
}

/* Inline info row (bodega / balcón / descripción) */
.dm-info {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  font-size: 14px;
  color: #3A2B22;
  padding-top: 8px;
}
.dm-info__pair { display: inline-flex; align-items: baseline; gap: 8px; }
.dm-info__lbl {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.7;
}
.dm-info__val { font-weight: 600; color: #020407; }

.dm-divider {
  border: 0;
  border-top: 1px solid rgba(91, 68, 54, 0.16);
  margin: 4px 0;
}

.dm-desc {
  font-size: 15px;
  line-height: 1.55;
  color: #3A2B22;
  max-width: 56ch;
}

/* Galería 2x2 */
.dm-gallery-h {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.75;
  margin: 0 0 12px;
}
.dm-gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.dm-gallery__item {
  position: relative;
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(91, 68, 54, 0.08);
  cursor: zoom-in;
  transition: transform 300ms ease, box-shadow 300ms ease;
}
.dm-gallery__item:hover {
  transform: scale(1.02);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}
.dm-gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.dm-gallery__item.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}
.dm-gallery__item.is-empty::after {
  content: 'Foto';
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.5;
}
.dm-gallery__item.is-empty img { display: none; }
.dm-gallery__item.is-empty:hover {
  transform: none;
  box-shadow: none;
}

/* Plantas (right column) */
.dm-plan {
  position: relative;
  border: 1px solid rgba(91, 68, 54, 0.18);
  border-radius: 16px;
  background: #FFFEF6;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.dm-plan__head {
  padding: 18px 20px 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.dm-plan__lbl {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.65;
}
.dm-plan__title {
  font-size: 15px;
  font-weight: 600;
  color: #020407;
  letter-spacing: -0.005em;
}
.dm-plan__media {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #FFFEF6;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.dm-plan__media img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.dm-plan__media.is-empty img { display: none; }
.dm-plan__media.is-empty::after {
  content: 'Plano no disponible';
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #5B4436;
  opacity: 0.45;
}

/* ── ENTRY STAGGER ANIMATIONS ─────────────────────────────── */
@keyframes dmFadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes dmFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes dmGalleryIn {
  from { opacity: 0; transform: scale(0.95); }
  to   { opacity: 1; transform: scale(1); }
}

.dm-modal[data-open="true"] .dm-anim {
  opacity: 0;
  animation: dmFadeUp 480ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--dm-delay, 0ms);
}
.dm-modal[data-open="true"] .dm-anim-gallery {
  opacity: 0;
  animation: dmGalleryIn 460ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
  animation-delay: var(--dm-delay, 0ms);
}

/* ── REDUCED MOTION ───────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dm-modal,
  .dm-dialog { transition: opacity 150ms linear !important; }
  .dm-dialog { transform: none !important; }
  .dm-modal[data-open="true"] .dm-anim,
  .dm-modal[data-open="true"] .dm-anim-gallery {
    animation: dmFadeIn 200ms linear forwards;
    transform: none !important;
  }
  .dm-gallery__item:hover { transform: none; }
  .dm-close:hover { transform: none; }
}

/* ── MOBILE — full-screen sheet, slide up ─────────────────── */
@media (max-width: 760px) {
  .dm-modal {
    padding: 0;
    align-items: stretch;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
  }
  .dm-dialog {
    max-width: 100%;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    border-radius: 0;
    transform: translateY(100%);
    transition: transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 200ms ease-out;
    opacity: 1;
  }
  .dm-modal[data-open="true"] .dm-dialog {
    transform: translateY(0);
    opacity: 1;
  }
  .dm-modal[data-closing="true"] .dm-dialog {
    transform: translateY(100%);
    opacity: 1;
    transition-duration: 280ms;
  }
  .dm-modal[data-dragging="true"] .dm-dialog {
    transition: none;
  }

  /* Sticky header on mobile */
  .dm-mobile-header {
    position: sticky;
    top: 0;
    z-index: 6;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 250, 233, 0.96);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(91, 68, 54, 0.1);
  }
  .dm-drag-handle {
    width: 44px;
    height: 5px;
    border-radius: 3px;
    background: rgba(91, 68, 54, 0.28);
    margin: 6px auto 8px;
    flex-shrink: 0;
  }
  .dm-mobile-header__chip {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #5B4436;
    opacity: 0.7;
  }
  .dm-close {
    position: static;
    width: 38px;
    height: 38px;
    font-size: 18px;
  }
  #dmDesktopClose { display: none !important; }

  .dm-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 8px 20px 40px;
  }
  .dm-title { font-size: 56px; }
  .dm-specs { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .dm-spec  { padding: 14px 14px; gap: 6px; }
  .dm-spec__num { font-size: 26px; }
  .dm-info  { gap: 16px; }
  .dm-plan  { width: 100%; }
  .dm-plan__media { aspect-ratio: 1 / 1; }
}
/* Hide the mobile header on desktop */
@media (min-width: 761px) {
  .dm-mobile-header,
  .dm-drag-handle { display: none; }
}

/* ── DOCUMENT — body lock when modal open ─────────────────── */
body.dm-locked { overflow: hidden; }

/* ── GALLERY LIGHTBOX (dm-glb) ────────────────────────────── */
.dm-glb {
  display: none;
  position: fixed; inset: 0; z-index: 9200;
  background: rgba(10, 8, 6, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  align-items: center; justify-content: center;
}
.dm-glb.is-open { display: flex; }
.dm-glb__inner {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%;
}
.dm-glb__img-wrap {
  width: min(88vw, 1100px);
  max-height: 78vh;
  border-radius: 16px;
  overflow: hidden;
  background: #1a1612;
}
.dm-glb__img {
  width: 100%; max-height: 78vh;
  object-fit: contain; display: block;
}
.dm-glb__caption {
  margin-top: 20px;
  color: #FFFAE9;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  font-weight: 600; opacity: 0.8; text-align: center;
}
.dm-glb__counter {
  margin-top: 6px;
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: rgba(255,250,233,0.4);
}
.dm-glb__close {
  position: absolute; top: 24px; right: 28px;
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,250,233,0.1);
  border: 1px solid rgba(255,250,233,0.2);
  color: #FFFAE9;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
  transition: background 0.2s;
}
.dm-glb__close:hover { background: rgba(255,250,233,0.2); }
.dm-glb__close svg { width: 18px; height: 18px; }
.dm-glb__arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; border-radius: 50%;
  background: rgba(255,250,233,0.1);
  border: 1px solid rgba(255,250,233,0.2);
  color: #FFFAE9;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 2;
  transition: background 0.2s;
}
.dm-glb__arrow:hover { background: rgba(255,250,233,0.2); }
.dm-glb__arrow svg { width: 22px; height: 22px; }
.dm-glb__arrow--prev { left: 20px; }
.dm-glb__arrow--next { right: 20px; }
@media (max-width: 760px) {
  .dm-glb__arrow--prev { left: 10px; }
  .dm-glb__arrow--next { right: 10px; }
  .dm-glb__img-wrap { width: 96vw; }
}
