/* ============================================================
   MARA LARES — MOBILE & TABLET (UI/UX)
   ============================================================ */

:root {
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --touch-min: 44px;
    --header-mobile-h: 64px;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    padding-bottom: var(--safe-bottom);
    -webkit-tap-highlight-color: transparent;
}

.container {
    width: 92%;
}

/* ---- HEADER ---- */
@media (max-width: 968px) {
    .header {
        top: max(8px, var(--safe-top));
    }

    .header__wrapper {
        padding: 8px 14px;
        border-radius: 20px;
        gap: 10px;
    }

    .logo img {
        height: 28px;
    }

    .header__actions .btn--header {
        padding: 0;
        width: var(--touch-min);
        height: var(--touch-min);
        border-radius: 50%;
        font-size: 0;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='white' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: center;
    }

    .nav-toggle {
        width: var(--touch-min);
        height: var(--touch-min);
    }

    .nav {
        padding: max(24px, var(--safe-top)) 24px 24px;
        align-items: stretch;
        justify-content: flex-start;
        background: #061810;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .header.nav-is-open .header__wrapper {
        /* evita que o blur do header prenda o menu fixed */
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    .nav__close {
        align-self: flex-end;
        width: var(--touch-min);
        height: var(--touch-min);
        border-radius: 50%;
        border: 1px solid var(--glass-border);
        background: var(--glass-bg);
        color: var(--text-light);
        font-size: 1.5rem;
        line-height: 1;
        margin-bottom: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav__list {
        align-items: stretch;
        gap: 4px;
        width: 100%;
    }

    .nav__link {
        font-size: 1.15rem;
        padding: 14px 16px;
        border-radius: 14px;
        transition: background 0.2s ease;
    }

    .nav__link:active,
    .nav__link--active {
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-light);
    }

    .nav__cta-mobile {
        display: block;
        margin-top: 24px;
        width: 100%;
        justify-content: center;
        font-size: 1rem;
        padding: 16px;
    }
}

@media (min-width: 969px) {
    .nav__close,
    .nav__cta-mobile {
        display: none;
    }
}

/* ---- HERO ---- */
@media (max-width: 968px) {
    .hero {
        min-height: 100svh;
        min-height: 100dvh;
        padding-top: calc(var(--header-mobile-h) + 8px);
        padding-bottom: calc(20px + var(--safe-bottom));
    }

    .hero__bg-wrapper {
        top: 8px;
        left: 8px;
        width: calc(100% - 16px);
        height: calc(100% - 16px);
    }

    .hero__layout {
        justify-content: center;
        gap: 0;
        min-height: calc(100svh - var(--header-mobile-h) - 40px);
        padding-bottom: 12px;
    }

    .hero__center {
        padding: 0 8px;
        z-index: 4;
        position: relative;
        pointer-events: none;
    }

    .hero__content {
        pointer-events: auto;
        max-width: 18rem;
    }

    .hero__title {
        font-size: clamp(2.35rem, 9.5vw, 3.25rem);
        letter-spacing: -1.2px;
        text-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
        margin-bottom: 14px;
    }

    .hero__subtitle {
        font-size: 1rem;
        margin-bottom: 0;
        text-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
        max-width: 16.5rem;
    }

    .hero__tags {
        display: none;
    }

    /* Floaters — laterais, sem cobrir o texto, clicáveis */
    .hero__floaters {
        display: block;
        z-index: 5;
        pointer-events: none;
    }

    .hero__card--floater {
        max-width: 158px;
        padding: 8px 10px 8px 8px;
        gap: 8px;
        border-radius: 14px;
        align-items: center;
        pointer-events: auto;
        z-index: 6;
    }

    .hero__card--floater .hero__card-image {
        width: 42px;
        height: 42px;
        flex-shrink: 0;
        border-radius: 10px;
    }

    .hero__card--floater .hero__card-info {
        min-width: 0;
        flex: 1;
        text-align: left;
    }

    .hero__card--floater .hero__card-info h4 {
        font-size: 0.72rem;
        font-weight: 600;
        line-height: 1.2;
        margin: 0 0 2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .hero__card--floater .hero__card-info p {
        font-size: 0.62rem;
        line-height: 1.25;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        opacity: 0.85;
    }

    .hero__floater--1 { top: 12%; right: 2%; left: auto; }
    .hero__floater--2 { top: auto; bottom: 24%; left: 2%; right: auto; }
    .hero__floater--3 { top: auto; bottom: 18%; right: 3%; left: auto; }
    .hero__floater--4 { display: none; }

    .quick-search--hero {
        position: relative;
        z-index: 5;
        margin-top: 28px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        scroll-margin-top: calc(var(--header-mobile-h, 64px) + 12px);
    }

    .quick-search__toggle {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        min-height: 52px;
        padding: 0 28px;
        border: 1px solid rgba(255, 255, 255, 0.22);
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.12);
        backdrop-filter: blur(18px);
        -webkit-backdrop-filter: blur(18px);
        color: #fff;
        font: inherit;
        font-weight: 600;
        font-size: 1rem;
        cursor: pointer;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
        transition: background 0.2s ease, transform 0.2s ease;
    }

    .quick-search__toggle:active {
        transform: scale(0.98);
        background: rgba(255, 255, 255, 0.18);
    }

    .quick-search__toggle[aria-expanded="true"] {
        background: rgba(255, 255, 255, 0.2);
    }

    .quick-search__panel {
        display: grid;
        grid-template-rows: 0fr;
        opacity: 0;
        width: 100%;
        transition: grid-template-rows 0.35s ease, opacity 0.25s ease;
    }

    .quick-search__panel > .quick-search__bar {
        overflow: hidden;
        min-height: 0;
    }

    .quick-search--hero.is-open .quick-search__panel {
        grid-template-rows: 1fr;
        opacity: 1;
    }

    .quick-search--hero.is-open .quick-search__panel > .quick-search__bar {
        overflow: visible;
    }

    .quick-search__field input,
    .quick-search__field .custom-select__trigger {
        font-size: 16px;
        min-height: var(--touch-min);
    }

    .quick-search__field .custom-select__menu {
        left: -4px;
        right: -4px;
    }

    .quick-search__bar {
        flex-direction: column;
        border-radius: 20px;
        padding: 12px;
    }

    .quick-search__field {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
        padding: 12px 8px;
    }

    .quick-search__field--wide {
        padding-left: 8px;
    }

    .quick-search__btn {
        width: 100%;
        height: 48px;
        border-radius: 14px;
        margin: 8px 0 0;
    }

    .cities-inline {
        display: none;
    }
}

/* ---- SECÇÕES GERAIS ---- */
@media (max-width: 968px) {
    .section-title {
        font-size: clamp(1.5rem, 5vw, 2rem);
        text-wrap: balance;
    }

    .selected__header,
    .spotlight__header,
    .about__content,
    .sell-cta {
        text-align: center;
    }

    .selected__header {
        margin-bottom: 24px;
    }

    .selected__subtitle {
        margin-left: auto;
        margin-right: auto;
        margin-top: 6px;
    }

    .section-desc {
        text-wrap: pretty;
        margin-left: auto;
        margin-right: auto;
    }

    .selected,
    .about,
    .spotlight,
    .showcase {
        padding: 56px 0;
    }

    .selected__grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }

    .selected-card:active,
    .listing-card:active,
    .showcase__item:active {
        transform: scale(0.98);
    }

    .property__back {
        display: inline-flex;
        align-items: center;
        min-height: var(--touch-min);
        padding: 8px 0;
        margin-bottom: 8px;
    }

    .about__grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .about__img-box {
        height: 280px;
    }

    .about__badge {
        position: static;
        margin-top: 16px;
        max-width: 100%;
    }

    .about__cta,
    .btn--primary {
        width: 100%;
        justify-content: center;
        min-height: var(--touch-min);
    }

    .showcase__header,
    .showcase__grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }

    .showcase__header {
        gap: 10px;
        margin-bottom: 24px;
        text-align: center;
        align-items: center;
    }

    .showcase__item--large {
        grid-row: auto;
    }

    .showcase__item--large .showcase__img-wrapper,
    .showcase__img-wrapper {
        min-height: 260px;
    }

    .showcase__subtitle {
        justify-self: center;
        text-align: center;
        font-size: 1rem;
        margin: 0;
        max-width: 20rem;
    }
}

/* ---- SPOTLIGHT MOBILE (expand on tap) ---- */
@media (max-width: 968px) {
    .spotlight__header {
        margin-bottom: 28px;
    }

    .spotlight__gallery {
        height: 300px;
        gap: 6px;
    }

    .spotlight__item {
        border-radius: 14px;
        flex: 0.85 1 0;
    }

    .spotlight__item.is-active {
        flex: 3.6 1 0;
    }

    .spotlight__item-info {
        padding: 14px 12px;
    }

    .spotlight__item-info strong {
        font-size: 0.82rem;
    }

    .spotlight__item-info span {
        font-size: 0.72rem;
    }

    .spotlight__cta {
        margin-top: 28px;
    }
}

@media (max-width: 480px) {
    .spotlight__gallery {
        height: 260px;
        gap: 5px;
    }

    .spotlight__item {
        border-radius: 12px;
    }
}

/* ---- SELL CTA ---- */
@media (max-width: 968px) {
    .sell-cta {
        padding-bottom: 48px;
        margin-bottom: 32px;
    }

    .sell-cta__title {
        font-size: clamp(1.6rem, 6vw, 2rem);
    }

    .sell-cta__desc {
        font-size: 0.95rem;
    }

    /* Mantém o leque do desktop, só em escala menor */
    .sell-cta__gallery {
        height: 200px;
        margin: 28px auto 20px;
        max-width: 100%;
        overflow: visible;
        display: flex;
        justify-content: center;
        align-items: flex-start;
    }

    .sell-cta__gallery::before {
        inset: 30px -10% -10px;
        display: block;
    }

    .sell-cta__photo {
        position: absolute;
        left: 50%;
        top: 12px;
        width: 110px;
        height: 140px;
        margin-left: -55px;
        flex-shrink: 0;
        opacity: 0;
        transform: translate(0, 40px) rotate(0deg) scale(0.88);
    }

    .sell-cta__gallery.is-visible .sell-cta__photo {
        opacity: 1;
        transform: translate(var(--tx-m, var(--tx)), var(--ty-m, var(--ty))) rotate(var(--rot)) scale(1);
    }

    .sell-cta__photo:hover {
        transform: translate(var(--tx-m, var(--tx)), calc(var(--ty-m, var(--ty)) - 8px)) rotate(var(--rot)) scale(1.04) !important;
    }

    .sell-cta__btn {
        width: 100%;
    }

    .footer__meta {
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 16px;
    }
}

/* ---- LISTAGENS ---- */
@media (max-width: 968px) {
    .listings-page {
        padding-top: calc(var(--header-mobile-h) + 12px);
    }

    .listings-hero {
        padding: 24px 0 16px;
    }

    .listings-hero__title {
        font-size: clamp(1.6rem, 5vw, 2rem);
    }

    .listings__layout {
        grid-template-columns: 1fr;
    }

    .listings__toolbar {
        position: sticky;
        top: calc(var(--header-mobile-h) + 12px);
        z-index: 90;
        background: rgba(11, 38, 26, 0.96);
        backdrop-filter: blur(12px);
        margin: 0 -4vw;
        padding: 12px 4vw;
        border-radius: 16px;
        border: 1px solid var(--glass-border);
    }

    .filters__toggle {
        display: inline-flex;
        min-height: var(--touch-min);
        align-items: center;
        gap: 6px;
    }

    .filters__backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 997;
        opacity: 0;
        visibility: hidden;
        transition: opacity 0.35s ease, visibility 0.35s ease;
    }

    .filters__backdrop.is-visible {
        opacity: 1;
        visibility: visible;
    }

    .listings__filters {
        position: fixed;
        inset: auto 0 0 0;
        top: auto;
        max-height: 88vh;
        z-index: 998;
        border-radius: 24px 24px 0 0;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.32, 0.72, 0, 1);
        padding: 8px 24px calc(24px + var(--safe-bottom));
        overflow-y: auto;
    }

    .listings__filters.open {
        transform: translateY(0);
    }

    .filters__handle {
        display: block;
        width: 40px;
        height: 4px;
        background: rgba(255, 255, 255, 0.2);
        border-radius: 4px;
        margin: 8px auto 16px;
    }

    .filters__header {
        margin-bottom: 16px;
    }

    .filters__group input,
    .filters__group .custom-select__trigger {
        font-size: 16px;
        min-height: var(--touch-min);
    }

    .filters__submit {
        position: sticky;
        bottom: 0;
        margin-top: 16px;
        min-height: 48px;
    }

    .listings__grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .listing-card__img {
        aspect-ratio: 16/10;
    }

    .listing-card__img img {
        position: absolute;
        inset: 0;
        height: 100%;
        width: 100%;
        object-fit: cover;
        object-position: center;
    }

    .listing-card__body {
        padding: 16px;
    }
}

@media (min-width: 969px) {
    .filters__handle,
    .filters__backdrop {
        display: none;
    }
}

/* ---- PÁGINA DO IMÓVEL ---- */
@media (max-width: 968px) {
    .property-page {
        padding-top: calc(var(--header-mobile-h) + 12px);
        padding-bottom: calc(80px + var(--safe-bottom));
    }

    .property__layout {
        flex-wrap: wrap;
        gap: 20px;
    }

    .property__gallery,
    .property__sidebar {
        flex: 1 1 100%;
        width: 100%;
        max-width: 100%;
    }

    .property__main-img {
        height: min(38vh, 260px);
        min-height: 200px;
    }

    .property__gallery-hint {
        opacity: 1;
    }

    .property__thumbs {
        display: flex;
        gap: 10px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
        padding-bottom: 8px;
        scrollbar-width: none;
    }

    .property__thumbs::-webkit-scrollbar {
        display: none;
    }

    .property__thumb {
        flex-shrink: 0;
        width: 88px;
        height: 66px;
        min-width: 72px;
        scroll-snap-align: start;
    }

    .property__sidebar {
        position: static;
        padding: 24px 20px;
    }

    .property__sidebar .btn--whatsapp {
        display: none;
    }

    .property__whatsapp-note {
        display: none;
    }

    .property__amenities {
        grid-template-columns: 1fr;
    }

    .property-not-found {
        padding: 120px 0 60px;
    }
}

/* Barra fixa imóvel + FAB WhatsApp */
.mobile-bar,
.fab-whatsapp {
    display: none;
}

@media (max-width: 968px) {
    .mobile-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 900;
        padding: 12px 16px calc(12px + var(--safe-bottom));
        background: rgba(6, 24, 16, 0.95);
        backdrop-filter: blur(16px);
        border-top: 1px solid var(--glass-border);
        gap: 12px;
        align-items: center;
        transform: translateY(100%);
        transition: transform 0.35s ease;
    }

    .mobile-bar.is-visible {
        transform: translateY(0);
    }

    .mobile-bar__info {
        flex: 1;
        min-width: 0;
    }

    .mobile-bar__price {
        font-size: 1.05rem;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .mobile-bar__label {
        font-size: 0.72rem;
        color: var(--text-muted);
    }

    .mobile-bar__btn {
        flex-shrink: 0;
        display: inline-flex;
        align-items: center;
        gap: 8px;
        background: #25D366;
        color: #fff;
        padding: 12px 20px;
        border-radius: 40px;
        font-size: 0.9rem;
        font-weight: 500;
        min-height: var(--touch-min);
    }

    .fab-whatsapp {
        display: flex;
        position: fixed;
        bottom: calc(20px + var(--safe-bottom));
        right: 16px;
        z-index: 850;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background: #25D366;
        color: #fff;
        align-items: center;
        justify-content: center;
        box-shadow: 0 8px 24px rgba(37, 211, 102, 0.4);
        transition: transform 0.3s ease;
    }

    .fab-whatsapp:active {
        transform: scale(0.94);
    }

    body.has-mobile-bar .fab-whatsapp {
        bottom: calc(88px + var(--safe-bottom));
    }

    body:not(.has-mobile-bar) {
        padding-bottom: calc(72px + var(--safe-bottom));
    }

    body.filters-open,
    body.nav-open {
        overflow: hidden;
    }
}

/* ---- LIGHTBOX MOBILE ---- */
@media (max-width: 768px) {
    .lightbox__stage {
        width: 100%;
        max-width: 100%;
        height: 70vh;
        border-radius: 0;
    }

    .lightbox__close {
        top: max(12px, var(--safe-top));
        right: 12px;
    }

    .lightbox__nav {
        width: var(--touch-min);
        height: var(--touch-min);
    }

    .lightbox__nav--prev {
        left: 8px;
    }

    .lightbox__nav--next {
        right: 8px;
    }
}

@media (max-width: 640px) {
    .selected__grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .selected__grid {
        grid-template-columns: 1fr;
    }

    .hero__card--floater {
        max-width: 148px;
    }
}

/* ---- XS ---- */
@media (max-width: 380px) {
    .hero__title {
        font-size: 2.1rem;
    }
}
