/* Ficha de una casa (templates/homes/detail.html). Colores del theme de la agencia
   (variables --brand-* / --pm-hero-* de agency/theme.py) con fallback. */
.hd {
    --hd-ink: var(--brand-ink, #16213e);
    --hd-accent: var(--brand-accent, #c0336d);
    --hd-btn-bg: var(--brand-btn-bg, var(--brand-accent, #c0336d));
    --hd-btn-solid: var(--brand-btn-solid, var(--brand-accent, #c0336d));
    --hd-btn-text: var(--brand-btn-text, #fff);
    --hd-muted: #5d6878;
    --hd-line: #e8ebf0;
    --hd-soft: #f6f7f9;
    --hd-ok: #067647;
    --hd-warn: #b54708;
    background: #fff;
    color: var(--hd-ink);
    padding-bottom: 40px;
}
.hd-wrap { max-width: 1180px; margin: 0 auto; padding: 0 20px; }
.hd .breadcrumbs { padding-top: 16px; }

/* ---------- encabezado ---------- */
.hd-head { margin: 10px 0 18px; }
.hd-kicker { margin: 0 0 6px; font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--hd-accent); }
.hd-title { margin: 0 0 12px; font-size: clamp(1.7rem, 3.6vw, 2.6rem); font-weight: 900; letter-spacing: -.025em; line-height: 1.08; color: var(--hd-ink); }
.hd-facts { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0; padding: 0; color: var(--hd-muted); font-size: 1rem; }
.hd-facts strong { color: var(--hd-ink); font-weight: 800; }
.hd-facts li + li::before { content: "·"; margin-right: 18px; color: #c4c9d2; }

/* ---------- galería ---------- */
.hd-gallery-wrap { position: relative; margin: 0 0 30px; }
.hd-gallery { display: grid; grid-template-columns: 2fr 1fr 1fr; grid-template-rows: 1fr 1fr; gap: 8px; height: clamp(300px, 46vw, 480px); border-radius: 20px; overflow: hidden; }
.hd-gallery__item { border: 0; padding: 0; margin: 0; background: var(--hd-soft); cursor: zoom-in; overflow: hidden; }
.hd-gallery__item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .35s ease; }
.hd-gallery__item:hover img { transform: scale(1.03); }
.hd-gallery__item--main { grid-row: 1 / span 2; }
.hd-gallery__item.is-broken { display: none; }
.hd-gallery--single { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.hd-gallery--single .hd-gallery__item--main { grid-row: auto; }
.hd-gallery__all { position: absolute; right: 16px; bottom: 16px; border: 0; background: #fff; color: var(--hd-ink); font-weight: 800; font-size: .92rem;
                   padding: 10px 16px; border-radius: 999px; box-shadow: 0 6px 20px rgba(16, 24, 40, .18); }
.hd-gallery__all:hover { background: var(--hd-soft); }

/* ---------- layout ---------- */
.hd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 48px; align-items: start; }
.hd-aside { position: sticky; top: 24px; }

.hd-alert { border-radius: 14px; padding: 14px 16px; margin: 0 0 22px; background: var(--hd-soft); display: flex; flex-direction: column; gap: 4px; font-size: .95rem; }
.hd-alert--warn { background: #fff7ed; color: #7a2e0e; border: 1px solid #fed7aa; }
.hd-alert a { color: var(--hd-accent); font-weight: 800; }

.hd-highlights { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; padding: 0 0 26px; border-bottom: 1px solid var(--hd-line); }
.hd-hl { display: inline-flex; align-items: center; gap: 8px; background: var(--hd-soft); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: .92rem; }
.hd-hl::before { content: "\2713"; color: var(--hd-ok); font-weight: 900; }

.hd-sec { padding: 26px 0; border-bottom: 1px solid var(--hd-line); }
.hd-sec:last-child { border-bottom: 0; }
.hd-sec__title { margin: 0 0 12px; font-size: 1.35rem; font-weight: 900; letter-spacing: -.01em; color: var(--hd-ink); }
.hd-sec__lead { margin: 0 0 14px; color: var(--hd-muted); line-height: 1.55; }

.hd-desc { position: relative; max-height: 260px; overflow: hidden; color: #3b4352; line-height: 1.65; }
.hd-desc::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 80px; background: linear-gradient(rgba(255, 255, 255, 0), #fff); }
.hd-desc.is-open { max-height: none; }
.hd-desc.is-open::after { display: none; }
.hd-desc p { margin: 0 0 12px; }
.hd-desc__title { font-size: 1rem; font-weight: 800; margin: 18px 0 8px; color: var(--hd-ink); }
.hd-desc__list { margin: 0 0 12px; padding-left: 20px; }
.hd-desc__list li { margin: 3px 0; }
.hd-more { border: 0; background: none; padding: 10px 0 0; font-weight: 800; color: var(--hd-ink); text-decoration: underline; text-underline-offset: 3px; }

.hd-beds { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; }
.hd-bed { border: 1px solid var(--hd-line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 2px; font-size: .95rem; }
.hd-bed strong { font-size: 1.25rem; font-weight: 900; }
.hd-bed__icon { width: 28px; height: 28px; margin-bottom: 6px; background: no-repeat left center / contain;
                background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235d6878' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 18v-7a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v7'/%3E%3Cpath d='M2 14h20'/%3E%3Cpath d='M4 9V6a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v3'/%3E%3Cpath d='M2 18v2M22 18v2'/%3E%3C/svg%3E"); }

.hd-checks { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px 20px; margin: 0; padding: 0; }
.hd-checks li { position: relative; padding-left: 28px; font-weight: 600; }
.hd-checks li::before { content: "\2713"; position: absolute; left: 0; top: 0; width: 20px; height: 20px; border-radius: 50%; background: #e7f6ec; color: var(--hd-ok);
                        font-size: .7rem; font-weight: 900; display: flex; align-items: center; justify-content: center; }

.hd-near { list-style: none; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; margin: 0 0 16px; padding: 0; }
.hd-near li { display: flex; justify-content: space-between; gap: 10px; background: var(--hd-soft); border-radius: 12px; padding: 10px 14px; font-size: .94rem; }
.hd-near strong { white-space: nowrap; }

.hd-steps { list-style: none; counter-reset: hd; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 0; padding: 0; }
.hd-steps li { counter-increment: hd; border: 1px solid var(--hd-line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.hd-steps li::before { content: counter(hd); width: 28px; height: 28px; border-radius: 50%; background: var(--hd-ink); color: #fff; font-weight: 900; font-size: .85rem;
                       display: flex; align-items: center; justify-content: center; margin-bottom: 6px; }
.hd-steps span { color: var(--hd-muted); font-size: .9rem; }

/* ---------- caja de reserva ---------- */
.hd-box { border: 1px solid var(--hd-line); border-radius: 22px; padding: 24px; box-shadow: 0 18px 40px rgba(16, 24, 40, .08); background: #fff; }
.hd-box__label { margin: 0; font-size: .85rem; font-weight: 700; color: var(--hd-muted); }
.hd-box__price { margin: 2px 0 0; font-size: 2.2rem; font-weight: 900; letter-spacing: -.03em; line-height: 1.1; color: var(--hd-ink); }
.hd-box__basis { margin: 4px 0 14px; color: var(--hd-muted); font-size: .9rem; }
.hd-box__split { list-style: none; margin: 0 0 12px; padding: 12px 0 0; border-top: 1px dashed var(--hd-line); display: flex; flex-direction: column; gap: 6px; font-size: .92rem; }
.hd-box__split li { display: flex; justify-content: space-between; gap: 12px; }
.hd-box__split span { color: var(--hd-muted); }
.hd-box__ok { margin: 0 0 14px; color: var(--hd-ok); font-weight: 800; font-size: .92rem; }
.hd-box__none { margin: 4px 0 16px; font-size: 1.2rem; font-weight: 800; line-height: 1.3; }
.hd .hs-form.hd-dates { margin: 0 0 12px; padding: 0; background: none; box-shadow: none; border: 0; border-radius: 0; max-width: none; display: flex; flex-direction: column; gap: 10px; }
.hd-dates .hs-field { width: 100%; }
.hd-wa { display: block; text-align: center; margin-top: 12px; font-weight: 800; color: var(--hd-ok); text-decoration: none; }
.hd-wa:hover { text-decoration: underline; color: var(--hd-ok); }

.hd-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 22px; border-radius: 14px; font-weight: 800; font-size: 1rem;
          border: 1.5px solid transparent; text-decoration: none; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.hd-btn--block { width: 100%; }
.hd-btn--primary { background: var(--hd-btn-bg); color: var(--hd-btn-text); box-shadow: 0 8px 20px color-mix(in srgb, var(--hd-btn-solid) 28%, transparent); }
.hd-btn--primary:hover { transform: translateY(-1px); color: var(--hd-btn-text); }
.hd-btn--ghost { background: #fff; color: var(--hd-ink); border-color: var(--hd-ink); }
.hd-btn--ghost:hover { background: var(--hd-soft); color: var(--hd-ink); }
.hd-box .hd-btn + .hd-btn, .hd-dates + .hd-btn { margin-top: 8px; }

/* ---------- formulario ---------- */
.hd-lead { max-width: 760px; margin: 36px 0 0; border: 1px solid var(--hd-line); border-radius: 22px; padding: 26px; background: var(--hd-soft); scroll-margin-top: 20px; }
.hd-form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.hd-form__row--phone { grid-template-columns: 120px 1fr; }
.hd-form__field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.hd-label { font-weight: 700; font-size: .9rem; }
.hd-input { width: 100%; height: 50px; border: 1px solid #d0d5dd; border-radius: 12px; padding: 0 14px; font-size: 1rem; background: #fff; color: var(--hd-ink); }
.hd-input:focus { outline: none; border-color: var(--hd-accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--hd-accent) 12%, transparent); }
.hd-error { color: #d92d20; font-weight: 700; margin: 0 0 10px; }
.hd-micro { margin: 10px 0 0; text-align: center; color: var(--hd-muted); font-size: .85rem; }

.hd-state { text-align: center; padding: 80px 0; }
.hd-state__title { font-size: 1.6rem; font-weight: 900; margin: 0 0 8px; }

.hd-map { height: 62vh; min-height: 320px; }

/* ---------- visor de fotos ---------- */
.hd-lightbox { position: fixed; inset: 0; z-index: 2000; background: rgba(10, 14, 22, .96); display: flex; flex-direction: column; }
.hd-lightbox[hidden] { display: none; }
.hd-lightbox__bar { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; color: #fff; font-weight: 700; }
.hd-lightbox__close { border: 0; background: none; color: #fff; font-size: 2rem; line-height: 1; }
.hd-lightbox__track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hd-lightbox__track::-webkit-scrollbar { display: none; }
.hd-lightbox__item { flex: 0 0 100%; margin: 0; display: flex; align-items: center; justify-content: center; scroll-snap-align: center; padding: 0 12px 24px; }
.hd-lightbox__item[hidden] { display: none; }
.hd-lightbox__item img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.hd-lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .14); color: #fff; font-size: 2rem; line-height: 1; }
.hd-lightbox__nav--prev { left: 18px; }
.hd-lightbox__nav--next { right: 18px; }

/* ---------- barra fija mobile ---------- */
.hd-mbar { display: none; }

@media (max-width: 991.98px) {
    .hd-grid { grid-template-columns: 1fr; gap: 0; }
    .hd-aside { position: static; order: -1; margin-bottom: 8px; }
    .hd-steps { grid-template-columns: 1fr; }
    .hd { padding-bottom: 96px; }
    .hd-mbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
               background: #fff; border-top: 1px solid var(--hd-line); box-shadow: 0 -10px 30px rgba(16, 24, 40, .08); padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); }
    .hd-mbar__price { display: flex; flex-direction: column; line-height: 1.15; }
    .hd-mbar__price strong { font-size: 1.2rem; font-weight: 900; }
    .hd-mbar__price span { font-size: .8rem; color: var(--hd-muted); }
    .hd-mbar .hd-btn { min-height: 46px; padding: 0 18px; }
}
@media (max-width: 767.98px) {
    .hd-wrap { padding: 0 16px; }
    .hd-gallery-wrap { margin: 0 -16px 22px; }
    .hd-gallery { display: flex; height: auto; border-radius: 0; overflow-x: auto; scroll-snap-type: x mandatory; gap: 4px; scrollbar-width: none; }
    .hd-gallery::-webkit-scrollbar { display: none; }
    .hd-gallery__item { flex: 0 0 88%; aspect-ratio: 3 / 2; scroll-snap-align: start; }
    .hd-gallery__all { right: 12px; bottom: 12px; padding: 8px 14px; font-size: .85rem; }
    .hd-lightbox__nav { display: none; }
    .hd-form__row { grid-template-columns: 1fr; }
    .hd-form__row--phone { grid-template-columns: 100px 1fr; }
    .hd-lead { padding: 20px; border-radius: 18px; }
    .hd-box { padding: 20px; box-shadow: none; }
}
