/* La estructura compartida mantiene el espacio de la ficha durante la consulta. */
:root { scrollbar-gutter: stable; }
body[data-page="detail"] .detail-layout { margin-top: 12px; gap: 18px; }
body[data-page="detail"] .detail-topbar {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
body[data-page="detail"] .detail-topbar .detail-back {
  flex: 1 1 auto;
  min-width: 0;
  white-space: normal;
  overflow: visible;
}
body[data-page="detail"] .detail-topbar .detail-price {
  flex: 0 0 auto;
  min-width: 0;
  margin-left: auto;
  align-self: center;
  text-align: right;
}
body[data-page="detail"] .detail-heading { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 761px) {
  body[data-page="detail"] .detail-layout {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "back back" "copy price" "main main";
    column-gap: 24px;
  }
  body[data-page="detail"] .detail-topbar { display: contents; }
  body[data-page="detail"] .detail-topbar .detail-back,
  body[data-page="detail"] .detail-topbar > .detail-skeleton__back { grid-area: back; }
  body[data-page="detail"] .detail-topbar .detail-price { grid-area: price; align-self: start; }
  body[data-page="detail"] .detail-copy { grid-area: copy; }
  body[data-page="detail"] .detail-main { grid-area: main; }
  body[data-page="detail"] .detail-copy h1 { min-height: 0; }
}
@media (max-width: 760px) {
  body[data-page="detail"] .detail-topbar { gap: 8px; }
  body[data-page="detail"] .detail-topbar .detail-back { font-size: clamp(13px, 3.6vw, 18px); }
  body[data-page="detail"] .detail-topbar .detail-price strong { font-size: clamp(20px, 6.2vw, 28px); }
}

body[data-page="detail"] .detail-map-embed {
  position: relative;
  width: 100%;
  height: 340px;
  overflow: hidden;
  border-radius: 20px;
}
body[data-page="detail"] .detail-map-embed--office { border-radius: 16px; }
body[data-page="detail"] .detail-map-embed iframe {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  max-width: none;
  min-height: 0;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  transform-origin: top left;
}

body[data-page="detail"] .detail-skeleton__block {
  display: block;
  width: 100%;
  height: 16px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--text) 9%, var(--surface));
  animation: detail-skeleton-breathe 1.8s ease-in-out infinite alternate;
}
body[data-page="detail"] .detail-skeleton .detail-gallery__primary,
body[data-page="detail"] .detail-skeleton .detail-gallery__thumb { height: auto; }
@media (max-width: 560px), (hover: none) and (pointer: coarse) {
  body[data-page="detail"] .detail-skeleton .detail-gallery__primary {
    height: clamp(220px, 68vw, 300px);
  }
}

/* Dos renglones reservados evitan que los títulos cortos muevan la galería. */
@media (max-width: 760px) {
  body[data-page="detail"] .detail-copy h1 { min-height: 2.3em; }
}
.detail-skeleton .detail-heading { align-items: start; }
.detail-skeleton__title {
  min-height: 2.3em;
  font-size: clamp(28px, 2.2vw, 38px);
  display: grid;
  align-content: center;
  gap: 0.3em;
}
body[data-page="detail"] .detail-skeleton__title > span { height: 0.8em; }
body[data-page="detail"] .detail-skeleton__title > span:last-child { width: 62%; }
body[data-page="detail"] .detail-skeleton__back { width: 170px; height: 23px; }
body[data-page="detail"] .detail-skeleton__address { width: 68%; height: 26px; }
body[data-page="detail"] .detail-skeleton__price { width: 190px; height: 38px; }
@media (max-width: 760px) {
  body[data-page="detail"] .detail-skeleton__price { width: clamp(135px, 40vw, 170px); height: 28px; }
}
body[data-page="detail"] .detail-skeleton__chip { width: 100px; height: 40px; border-radius: 999px; }
body[data-page="detail"] .detail-skeleton__subtitle { width: 45%; height: 34px; margin-bottom: 20px; }
.detail-skeleton__description > span + span { margin-top: 12px; }
.detail-skeleton__description > span:last-child { width: 70%; }
.detail-skeleton__sidebar { display: grid; gap: 18px; }
body[data-page="detail"] .detail-skeleton__button { height: 48px; border-radius: 999px; }

/* Los marcos ya tienen altura en el diseño original; la foto no decide su tamaño. */
body[data-page="detail"] .detail-image-placeholder {
  position: absolute;
  inset: 0;
  height: 100%;
  border-radius: inherit;
  pointer-events: none;
}
.detail-image-error {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 4;
  padding: 18px;
  align-items: center;
  justify-content: center;
  color: var(--text-soft);
  background: var(--surface-strong);
  font: 500 14px/1.5 "Bricolage Grotesque", sans-serif;
  text-align: center;
}
body[data-page="detail"] .is-image-loaded > .detail-image-placeholder,
body[data-page="detail"] .is-image-error > .detail-image-placeholder { display: none; }
.is-image-error > .detail-image-error { display: flex; }
body[data-page="detail"] .gallery-open.is-image-error { cursor: pointer; }
body[data-page="detail"] .detail-gallery__image { transition: none; }

@keyframes detail-skeleton-breathe { from { opacity: 0.55; } to { opacity: 0.9; } }
@media (prefers-reduced-motion: reduce) {
  body[data-page="detail"] .detail-skeleton__block { animation: none; }
}
