/* ══ GALERIA ═══════════════════════════════════════════════════════════ */
.imovel-galeria { margin-bottom: 32px; }
.galeria-main {
    position: relative;
    aspect-ratio: 21/9;
    border-radius: 20px;
    overflow: hidden;
    background: var(--surface-2);
    box-shadow: var(--shadow-lg);
    margin-bottom: 10px;
}
.galeria-main img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: opacity .18s ease;
}
/* Trilho da galeria: rolagem horizontal nativa com encaixe por foto, igual a do
   painel do corretor. Sem JavaScript no arrasto, a imagem acompanha o dedo. */
.gal-track {
    display: flex;
    width: 100%; height: 100%;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
    cursor: zoom-in;
}
.gal-track::-webkit-scrollbar { display: none; }
.gal-track img {
    flex: 0 0 100%;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    user-select: none;
    -webkit-user-drag: none;
}
.galeria-main .cover-tag {
    position: absolute;
    top: 16px; left: 16px;
    background: rgba(255,255,255,.92);
    color: var(--text);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    backdrop-filter: blur(10px);
}
.galeria-counter {
    position: absolute;
    bottom: 14px; right: 14px;
    background: rgba(15,23,42,.65);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    backdrop-filter: blur(6px);
}
/* Setas de navegação */
.galeria-nav {
    position: absolute;
    top: 50%; transform: translateY(-50%);
    width: 44px; height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    border: 0;
    cursor: pointer;
    font-size: 22px;
    font-weight: 300;
    display: grid; place-items: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    transition: background .15s, transform .15s, opacity .15s;
    z-index: 10;
    color: var(--text);
    line-height: 1;
}
.galeria-nav:hover {
    background: #fff;
    transform: translateY(-50%) scale(1.07);
}
.galeria-nav--prev { left: 14px; }
.galeria-nav--next { right: 14px; }
/* Miniaturas */
.galeria-thumbs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-strong) transparent;
}
.galeria-thumbs::-webkit-scrollbar { height: 4px; }
.galeria-thumbs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
.galeria-thumb {
    flex-shrink: 0;
    width: 88px; height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color .15s, opacity .15s;
    opacity: .65;
}
.galeria-thumb.active {
    border-color: var(--primary);
    opacity: 1;
}
.galeria-thumb:hover { opacity: .9; }
.galeria-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Miniaturas de vídeo — overlay de play */
.video-thumb { position: relative; }
.video-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.38);
    color: #fff;
    transition: background .15s;
    pointer-events: none;
}
.video-thumb.active .video-thumb-play { background: rgba(0,0,0,.15); }
.video-thumb:hover .video-thumb-play  { background: rgba(0,0,0,.22); }
/* Sem imagem */
.galeria-vazia {
    aspect-ratio: 21/9;
    border-radius: 20px;
    background: var(--surface-2);
    display: grid; place-items: center;
    color: var(--text-subtle);
    position: relative;
    margin-bottom: 32px;
}
.galeria-vazia svg { width: 80px; height: 80px; }
@media (max-width: 900px) {
    .galeria-main { aspect-ratio: 16/10; border-radius: 14px; }
    .galeria-thumb { width: 68px; height: 50px; }
}
@media (max-width: 560px) {
    .galeria-main { aspect-ratio: 4/3; border-radius: 10px; }
    .galeria-nav  { width: 36px; height: 36px; font-size: 18px; }
}

/* ══ TAG DESTAQUE ════════════════════════════════════════════════════════ */
/* ══ TAG DESTAQUE — one-shot entrance, estático premium depois ════════════ */
@keyframes dst-tag-once{from{opacity:0;transform:translateX(20px)}to{opacity:1;transform:translateX(0)}}
@keyframes dst-tag-flash{0%{box-shadow:0 2px 8px rgba(249,115,22,.35)}45%{box-shadow:0 4px 22px rgba(245,158,11,.85),0 0 0 2px rgba(251,191,36,.45)}100%{box-shadow:0 2px 8px rgba(249,115,22,.35)}}
@keyframes dst-star-once{0%{transform:rotate(-20deg) scale(.8)}60%{transform:rotate(10deg) scale(1.2)}100%{transform:rotate(0deg) scale(1)}}

.cover-tag-destaque {
    position: absolute;
    top: 16px; right: 16px;
    background: linear-gradient(135deg, #f59e0b 0%, #f97316 100%);
    color: #fff;
    padding: 6px 14px 6px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    box-shadow: 0 2px 8px rgba(249,115,22,.35);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.cover-tag-destaque .dst-star { flex-shrink: 0; display: block; }
/* Uma única vez: desliza + flash de brilho + estrela gira */
.cover-tag-destaque.tag-anim { animation: dst-tag-once .4s ease-out 1 both, dst-tag-flash 1s ease-out .4s 1 forwards; }
.cover-tag-destaque.tag-anim .dst-star { animation: dst-star-once .65s ease-out .15s 1 forwards; }

/* ══ TAGS RÁPIDAS ════════════════════════════════════════════════════════ */
.imovel-tag-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.imovel-tag {
    display: inline-flex; align-items: center;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px; font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}
.imovel-tag--aluguel   { background: #dbeafe; color: #1e40af; border-color: #bfdbfe; }
.imovel-tag--temporada { background: #d1fae5; color: #065f46; border-color: #a7f3d0; }
.imovel-tag--mobiliado { background: #f3e8ff; color: #6b21a8; border-color: #e9d5ff; }
.imovel-tag--novo      { background: #dcfce7; color: #14532d; border-color: #bbf7d0; }
.imovel-tag--reformar  { background: #fef3c7; color: #92400e; border-color: #fde68a; }

/* ══ FEATURE PILLS COM ÍCONES ════════════════════════════════════════════ */
.imovel-features-row {
    display: flex; flex-wrap: wrap;
    gap: 0;
    margin-bottom: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.feature-pill {
    flex: 1; min-width: 90px;
    display: flex; flex-direction: column; align-items: center;
    gap: 4px;
    padding: 16px 12px;
    text-align: center;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
    border-right: 1px solid var(--border);
    transition: background .15s;
}
.feature-pill:last-child { border-right: 0; }
.feature-pill:hover { background: var(--surface-2); }
.pill-icon {
    width: 34px; height: 34px;
    border-radius: 9px;
    background: var(--surface-2);
    display: grid; place-items: center;
    margin-bottom: 4px;
    transition: background .15s;
}
.feature-pill:hover .pill-icon { background: var(--primary-soft); }
.pill-icon svg { width: 18px; height: 18px; }
.feature-pill strong {
    display: block;
    font-size: 17px; font-weight: 800;
    color: var(--text);
    line-height: 1;
}

/* ══ SEÇÕES ══════════════════════════════════════════════════════════════ */
.imovel-section { margin-bottom: 28px; }
.imovel-section-title {
    font-size: 15px; font-weight: 700;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 8px;
    color: var(--text);
}
.imovel-section-title::before {
    content: '';
    width: 3px; height: 16px;
    background: var(--primary);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ══ AMENIDADES COM ÍCONES ═══════════════════════════════════════════════ */
.amenidades-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 10px;
}
.amenidade-badge {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 11px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px; font-weight: 500;
    color: var(--text);
    transition: border-color .15s, box-shadow .15s, background .15s;
    line-height: 1.3;
}
.amenidade-badge:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,.07);
}
.amenidade-badge svg { flex-shrink: 0; }
.amenidade-badge--cond {
    background: var(--primary-soft);
    border-color: rgba(79,70,229,.2);
}
.amenidade-badge--cond:hover { border-color: var(--primary); }

/* ══ VALORES E TAXAS ═════════════════════════════════════════════════════ */
.valores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
}
.valor-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
}
.valor-label {
    display: block;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.valor-value {
    font-size: 18px; font-weight: 700;
    color: var(--text);
}

/* ══ INFORMAÇÕES ADICIONAIS ══════════════════════════════════════════════ */
.info-adicional-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(195px, 1fr));
    gap: 10px;
}
.info-adicional-item {
    display: flex; align-items: center; gap: 10px;
    padding: 13px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    color: var(--text-muted);
}
.info-adicional-item--ok {
    background: #f0fdf4;
    border-color: #bbf7d0;
    color: #14532d;
}
.info-adicional-item svg { flex-shrink: 0; }
.info-adicional-item strong { color: inherit; }

/* ══ DESCRIÇÃO TRUNCADA ══════════════════════════════════════════════════ */
.imovel-desc {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 28px;
}
.imovel-desc h2 {
    font-size: 15px; font-weight: 700;
    margin-bottom: 12px;
    display: flex; align-items: center; gap: 8px;
}
.imovel-desc h2::before {
    content: '';
    width: 3px; height: 16px;
    background: var(--primary);
    border-radius: 2px;
    display: inline-block;
}
.desc-text {
    color: var(--text-muted);
    line-height: 1.75;
    white-space: pre-wrap;
    font-size: 14px;
    transition: none;
}
.desc-collapsed .desc-text {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.btn-ver-mais {
    display: none;
    margin-top: 12px;
    background: none;
    border: 1px solid var(--border);
    color: var(--primary);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    padding: 7px 16px;
    border-radius: 8px;
    font-family: inherit;
    transition: background .15s, border-color .15s;
}
.btn-ver-mais:hover { background: var(--primary-soft); border-color: var(--primary); }

/* ══ SIDEBAR RESUMO ══════════════════════════════════════════════════════ */
.sidebar-resumo {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    margin-top: 16px;
    overflow: hidden;
}
.sidebar-resumo-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 11px 16px;
    font-size: 13px;
    border-bottom: 1px solid var(--border);
}
.sidebar-resumo-item:last-child { border-bottom: 0; }
.sidebar-resumo-item span { color: var(--text-muted); }
.sidebar-resumo-item strong { font-weight: 700; color: var(--text); }

/* ══ CENTRAL DE MÍDIA — OVERLAYS ════════════════════════════════════════ */
.galeria-sem-midia {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    color: var(--text-muted);
    background: var(--surface-2);
}
.galeria-sem-midia svg { width: 52px; height: 52px; opacity: .35; }
.galeria-sem-midia p   { font-size: 14px; opacity: .55; }

.galeria-midia-overlay {
    position: absolute;
    inset: 0;
    background: #000;
}
.galeria-midia-overlay iframe {
    width: 100%; height: 100%;
    border: 0; display: block;
}

/* Slides da galeria de vídeos */
.video-slide {
    position: absolute;
    inset: 0;
}
.video-slide iframe {
    width: 100%; height: 100%;
    border: 0; display: block;
}

/* ══ MAPA — SISTEMA DE INTERAÇÃO ═══════════════════════════════════════ */
.galeria-mapa-wrap { position: absolute; inset: 0; }

/* Overlay "clique para ativar" — resolve desktop E mobile de uma vez */
.mapa-ativar-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity .3s;
}
.mapa-ativar-hint {
    background: rgba(255,255,255,.93);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 12px;
    padding: 13px 22px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    box-shadow: 0 4px 20px rgba(0,0,0,.18);
    pointer-events: none;
    user-select: none;
}

/* Tags somem quando mapa está ativo */
.cover-tag, .cover-tag-destaque { transition: opacity .25s ease; }
.mapa-ativo .cover-tag,
.mapa-ativo .cover-tag-destaque { opacity: 0; pointer-events: none; }

/* ══ PAINEL DO MAPA (fora do iframe) ════════════════════════════════════ */
.mapa-painel {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-top: none;
    border-radius: 0 0 14px 14px;
    padding: 10px 12px 12px;
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-bottom: 6px;
}
.mapa-painel-local {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
    min-width: 0;
}
.mapa-painel-local svg { color: var(--c, #4f46e5); flex-shrink: 0; }
.mapa-painel-local span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mapa-painel-acoes {
    display: flex;
    gap: 8px;
    align-items: center;
}
.btn-mapa-dist {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    transition: background .15s, border-color .15s, transform .1s;
    white-space: nowrap;
    min-width: 0;
}
.btn-mapa-dist:hover   { background: #f3f4f6; border-color: #d1d5db; }
.btn-mapa-dist:active  { transform: scale(.97); }
.btn-mapa-dist:disabled { opacity: .65; cursor: default; transform: none; }
.btn-mapa-rota-ext {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    background: var(--c, #4f46e5);
    color: #fff;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: opacity .18s, transform .1s;
    white-space: nowrap;
}
.btn-mapa-rota-ext:hover  { opacity: .88; color: #fff; }
.btn-mapa-rota-ext:active { transform: scale(.97); }
.btn-mapa-rota-ext:disabled { opacity: .65; cursor: default; transform: none; }
.btn-mapa-expand {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    border-radius: 8px;
    border: 1.5px solid #e5e7eb;
    background: #f9fafb;
    color: #6b7280;
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
}
.btn-mapa-expand:hover { background: #f3f4f6; color: #374151; border-color: #d1d5db; }

/* ══ CENTRAL DE MÍDIA — ABAS ════════════════════════════════════════════ */
.media-tabs {
    display: flex;
    gap: 7px;
    margin: 10px 0 4px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 2px 1px;
}
.media-tabs::-webkit-scrollbar { display: none; }

.media-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 15px;
    border-radius: 999px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color .15s, color .15s, background .15s;
    line-height: 1;
}
.media-tab:hover {
    border-color: var(--c, var(--primary));
    color: var(--c, var(--primary));
}
.media-tab.is-active {
    background: var(--c, var(--primary));
    border-color: var(--c, var(--primary));
    color: #fff;
}
.media-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    background: rgba(0,0,0,.10);
    color: inherit;
    margin-left: 1px;
}
.media-tab.is-active .media-tab-count {
    background: rgba(255,255,255,.25);
}
/* Ícone do YouTube mantém cor vermelha mesmo no estado inativo */
.media-tab--yt svg { fill: #ff0000; }
.media-tab--yt.is-active svg { fill: #fff; }
/* Tour: cor roxa */
.media-tab--tour svg { stroke: #7c3aed; }
.media-tab--tour.is-active { background: #7c3aed; border-color: #7c3aed; }
.media-tab--tour.is-active svg { stroke: #fff; }

/* ══ CENTRAL DE MÍDIA — MODAL TOUR ══════════════════════════════════════ */
.tour-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.tour-modal-bd {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.78);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}
.tour-modal-box {
    position: relative;
    width: 100%;
    max-width: 1100px;
    height: min(82vh, 720px);
    background: #111;
    border-radius: 20px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 30px 80px rgba(0,0,0,.6);
}
.tour-modal-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 18px;
    background: rgba(255,255,255,.05);
    border-bottom: 1px solid rgba(255,255,255,.08);
    flex-shrink: 0;
}
.tour-modal-title {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}
.tour-modal-acts {
    display: flex;
    align-items: center;
    gap: 10px;
}
.btn-tour-ext {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: rgba(255,255,255,.7);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.2);
    transition: color .15s, border-color .15s;
}
.btn-tour-ext:hover { color: #fff; border-color: rgba(255,255,255,.5); }
.tour-modal-close {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,.12);
    border: 0;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
}
.tour-modal-close:hover { background: rgba(255,255,255,.22); }
.tour-modal-body {
    flex: 1;
    position: relative;
}
.tour-modal-body iframe {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    border: 0;
}
.tour-modal-footer {
    padding: 14px 20px;
    background: #f8f8f8;
    border-top: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.tour-modal-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
    text-align: center;
}
.btn-tour-nova-aba {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 24px;
    background: var(--c, #4f46e5);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    text-decoration: none;
    transition: opacity .18s;
    white-space: nowrap;
}
.btn-tour-nova-aba:hover { opacity: .85; color: #fff; }
.btn-tour-nova-aba svg { flex-shrink: 0; }

/* ══ RESPONSIVO ADICIONAL ════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .amenidades-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
    .info-adicional-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .feature-pill { min-width: 70px; padding: 12px 8px; }
    .feature-pill strong { font-size: 15px; }
    .pill-icon { width: 28px; height: 28px; }
    .pill-icon svg { width: 14px; height: 14px; }
    .amenidades-grid { grid-template-columns: 1fr 1fr; }
    .valores-grid { grid-template-columns: 1fr 1fr; }
    .info-adicional-grid { grid-template-columns: 1fr; }
    .imovel-desc { padding: 16px; }
}

/* ── Mobile: remove backdrop-filter (melhoria de performance geral) ─────── */
@media (max-width: 768px) {
    .galeria-counter,
    .galeria-main .cover-tag {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }
    .galeria-counter         { background: rgba(15,23,42,.82); }
    .galeria-main .cover-tag { background: rgba(255,255,255,.97); }

    .mapa-ativar-hint {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255,255,255,.99);
    }

    .cover-tag-destaque.tag-anim,
    .cover-tag-destaque.tag-anim .dst-star {
        animation: none !important;
        box-shadow: 0 2px 8px rgba(249,115,22,.35);
    }

    /* Bordas transparentes + transitions em grid causam overflow de VRAM no Android antigo */
    .amenidade-badge {
        transition: none;
    }
    .amenidade-badge--cond {
        border-color: #c7d2fe; /* equivalente sólido de rgba(79,70,229,.2) sobre #e0e7ff */
    }
}
/* ══ TELA CHEIA (galeria) ══════════════════════════════════════════════ */
#img-principal { cursor: zoom-in; }

/* Canto inferior esquerdo: os outros três cantos já são do cover-tag,
   do selo de destaque e do contador. */
.galeria-expandir {
    position: absolute;
    bottom: 14px; left: 14px;
    width: 38px; height: 38px;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.92);
    color: var(--text);
    display: grid; place-items: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0,0,0,.18);
    backdrop-filter: blur(6px);
    transition: background .15s, transform .15s;
    z-index: 10;
}
.galeria-expandir:hover { background: #fff; transform: scale(1.06); }

body.sem-scroll { overflow: hidden; }

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(8,11,20,.96);
    display: flex;
    align-items: center;
    justify-content: center;
    /* Respeita o notch: o body::before da safe area tem z-index maior */
    padding: calc(60px + env(safe-area-inset-top, 0px)) 16px calc(60px + env(safe-area-inset-bottom, 0px));
    -webkit-tap-highlight-color: transparent;
}
.lightbox[hidden] { display: none; }

.lightbox-palco {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
}
/* Em tela cheia o palco tambem e um trilho: mesma rolagem com encaixe. */
.lightbox-img {
    display: flex;
    width: 100%; height: 100%;
    overflow-x: auto; overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    touch-action: pan-x pan-y;
    overscroll-behavior-x: contain;
}
.lightbox-img::-webkit-scrollbar { display: none; }
.lightbox-img img {
    flex: 0 0 100%;
    width: 100%; height: 100%;
    object-fit: contain;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
}
.lightbox-img[hidden] { display: none; }
.lightbox-video {
    width: min(100%, 1280px);
    max-height: 100%;
    aspect-ratio: 16/9;
}
.lightbox-video[hidden] { display: none; }
.lightbox-video iframe { width: 100%; height: 100%; border: 0; border-radius: 6px; }

.lightbox-fechar,
.lightbox-nav {
    position: absolute;
    border: 0;
    border-radius: 50%;
    background: rgba(255,255,255,.14);
    color: #fff;
    line-height: 1;
    cursor: pointer;
    display: grid; place-items: center;
    transition: background .15s;
}
.lightbox-fechar:hover,
.lightbox-nav:hover { background: rgba(255,255,255,.3); }

.lightbox-fechar {
    top: calc(14px + env(safe-area-inset-top, 0px)); right: 16px;
    width: 42px; height: 42px;
    font-size: 26px;
}
.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 48px; height: 48px;
    font-size: 26px;
    font-weight: 300;
}
.lightbox-nav--prev { left: 16px; }
.lightbox-nav--next { right: 16px; }
.lightbox-nav[hidden] { display: none; }

.lightbox-counter {
    position: absolute;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px)); left: 50%;
    transform: translateX(-50%);
    background: rgba(255,255,255,.14);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    padding: 5px 14px;
    border-radius: 20px;
}
.lightbox-counter[hidden] { display: none; }

@media (max-width: 768px) {
    .lightbox { padding: calc(56px + env(safe-area-inset-top, 0px)) 8px calc(56px + env(safe-area-inset-bottom, 0px)); }
    .lightbox-nav { width: 40px; height: 40px; font-size: 22px; }
    .lightbox-nav--prev { left: 8px; }
    .lightbox-nav--next { right: 8px; }
    .galeria-expandir { bottom: 10px; left: 10px; width: 34px; height: 34px; }
}

/* ══ COLUNA DE MÍDIA E LARGURA EM TELA GRANDE ═══════════════════════════════
   Duas situações, sem meio-termo:
     até 1399px  — só as abas de mídia, exatamente como sempre foi;
     1400px+     — a coluna vai para o lado direito da galeria.
   Não existe faixa intermediária empilhando vídeo e mapa abaixo da galeria: isso
   empurra o conteúdo do imóvel para muito longe da dobra e o botão resolve melhor.
   A galeria tem teto de largura de propósito: sem isso ela cresceria junto com a
   tela e engoliria o espaço que o vídeo e o mapa deveriam ocupar. */

.imovel-lateral { display: none; }

@media (min-width: 1400px) {
    body.pagina-imovel .container { max-width: 95%; }

    .imovel-midia {
        display: grid;
        grid-template-columns: minmax(0, 1150px) minmax(320px, 1fr);
        gap: 0 24px;
        align-items: start;
        /* Sem teto proprio: o bloco tem de comecar e terminar exatamente onde comecam e
           terminam o titulo, o preco e o card do corretor logo abaixo. Um max-width aqui
           centralizava a midia dentro do container e desalinhava as bordas com o resto
           da pagina. Quem limita a largura ja e o container (95%). */
        margin: 0 0 44px;
    }

    /* display: contents dissolve a caixa da galeria e entrega os filhos dela direto
       a esta grade. E o que permite a coluna parar exatamente onde a FOTO termina:
       a foto principal ocupa a linha 1, e abas e miniaturas caem nas linhas
       seguintes, sozinhas na coluna da esquerda. Sem isso a coluna esticava ate o
       fim das miniaturas e ainda passava da margem, invadindo o titulo. */
    .imovel-midia > .imovel-galeria { display: contents; }

    .imovel-midia .galeria-main,
    .imovel-midia .mapa-painel,
    .imovel-midia .media-tabs,
    .imovel-midia .galeria-thumbs { grid-column: 1; }

    .imovel-lateral {
        grid-column: 2;
        grid-row: 1;          /* mesma linha da foto principal */
        align-self: stretch;  /* e exatamente a altura dela */
        display: flex;
        flex-direction: column;
        gap: 14px;
        /* min-height: 0 em toda a cadeia — sem isso um item flex se recusa a
           encolher abaixo do seu conteudo e a coluna estoura a altura da foto. */
        min-height: 0;
    }

    /* Video e mapa dividem a altura que sobra. Com o tour presente cada um fica
       mais baixo, que e o comportamento pedido: os tres cabem sem ultrapassar. */
    .lat-bloco { min-height: 0; }
    .lat-bloco--fill { flex: 1 1 0; }

    .lat-bloco--fill .lat-video,
    .lat-bloco--fill .lat-mapa {
        /* Solta a proporcao 16/9: aqui quem manda e a altura disponivel. */
        aspect-ratio: auto;
        flex: 1 1 auto;
        min-height: 130px;
    }

    /* Miniaturas menores: elas roubam altura da galeria, e em tela larga cabe
       mais foto por linha mesmo reduzidas. */
    .imovel-midia .galeria-thumb { width: 72px; height: 52px; }

    /* O conteúdo dessas abas já está visível na coluna — manter os botões seria
       oferecer dois caminhos para a mesma coisa. A aba "Fotos" fica, porque ela
       também informa a quantidade. Só quando há fotos: sem elas o palco depende
       das abas e escondê-las deixaria a página sem saída. */
    .media-tabs.tem-fotos .media-tab[data-mode="video"],
    .media-tabs.tem-fotos .media-tab[data-mode="tour"],
    .media-tabs.tem-fotos .media-tab[data-mode="mapa"] { display: none; }
}

/* ── Blocos da coluna ────────────────────────────────────────────────────── */
.lat-bloco { display: flex; flex-direction: column; gap: 10px; }


.lat-video,
.lat-mapa {
    position: relative;
    aspect-ratio: 16 / 9;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-2);
}

.lat-video iframe,
.lat-mapa iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.lat-video-capa {
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    display: block;
    position: relative;
}

.lat-video-capa img { width: 100%; height: 100%; object-fit: cover; display: block; }

.lat-play {
    position: absolute;
    inset: 0;
    margin: auto;
    width: 62px;
    height: 62px;
    border-radius: 50%;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    display: grid;
    place-items: center;
    transition: background .15s ease, transform .15s ease;
}

.lat-video-capa:hover .lat-play { background: #e11d2e; transform: scale(1.06); }
.lat-video-capa:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Miniaturas — só quando o imóvel tem mais de um vídeo */
.lat-minis { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }

.lat-mini {
    flex: none;
    width: 74px;
    height: 44px;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 8px;
    overflow: hidden;
    background: none;
    cursor: pointer;
    opacity: .62;
    transition: opacity .15s ease, border-color .15s ease;
}

.lat-mini img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lat-mini:hover { opacity: 1; }
.lat-mini.is-active { opacity: 1; border-color: var(--primary); }

/* O mapa aparece desenhado desde o começo; a camada por cima é transparente e existe
   só para o primeiro clique. Sem ela, rolar a página com o cursor sobre o mapa dá zoom
   em vez de rolar — mesma proteção que a aba de mapa já usa. */
.lat-mapa-guarda {
    position: absolute;
    inset: 0;
    width: 100%;
    border: 0;
    background: transparent;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.lat-mapa-guarda span {
    margin-bottom: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: rgba(17, 24, 39, .74);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    opacity: 0;
    transition: opacity .15s ease;
}

.lat-mapa-guarda:hover span,
.lat-mapa-guarda:focus-visible span { opacity: 1; }

.lat-mapa.is-ativo .lat-mapa-guarda { display: none; }


.lat-tour {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 14px;
    border: 1px solid var(--border-strong, #d1d5db);
    border-radius: 14px;
    background: var(--surface, #fff);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: border-color .15s ease, color .15s ease;
}

.lat-tour:hover { border-color: var(--primary); color: var(--primary); }
