/**
 * APD 49.0.0 — Twin Capture static geometry correction.
 * Reference geometry: Airbnb 1440×900 captured at browser zoom 100%.
 * Brand assets and colors remain APD.
 */

:root {
    --apd49-shell-gutter: 48px;
    --apd49-shell-max: 1329px;
    --apd49-header-row: 96px;
    --apd49-search-top: 102px;
    --apd49-search-width: 850px;
    --apd49-search-height: 66px;
    --apd49-card-gap: 12px;
    --apd49-card-radius: 14px;
}

/* -------------------------------------------------------------------------
   DESKTOP · ONE SHARED HEADER FOR TODO / ALOJAMIENTOS / EXPERIENCIAS / SERVICIOS
   ------------------------------------------------------------------------- */
@media (min-width: 1180px) {
    html body.apd49-twin-match {
        overflow-x: clip !important;
    }

    html body.apd49-twin-match #apd5-header.apd5-header,
    html body.apd49-twin-match header#apd5-header.apd5-header.is-discovery-context {
        position: sticky !important;
        top: 0 !important;
        z-index: 1800 !important;
        width: 100% !important;
        min-width: 0 !important;
        height: 192px !important;
        min-height: 192px !important;
        max-height: 192px !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: visible !important;
        background: rgba(255,255,255,.985) !important;
        border: 0 !important;
        border-bottom: 1px solid #ebebeb !important;
        box-shadow: none !important;
        transform: none !important;
        zoom: 1 !important;
    }

    html body.apd49-twin-match #apd5-header > .apd5-header-row,
    html body.apd49-twin-match .apd5-header.is-discovery-context > .apd5-header-row {
        position: relative !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: 1920px !important;
        height: var(--apd49-header-row) !important;
        min-height: var(--apd49-header-row) !important;
        max-height: var(--apd49-header-row) !important;
        margin: 0 auto !important;
        padding: 0 var(--apd49-shell-gutter) !important;
        box-sizing: border-box !important;
        display: grid !important;
        grid-template-columns: 102px minmax(0,1fr) 278px !important;
        align-items: center !important;
        column-gap: 0 !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-logo {
        position: relative !important;
        grid-column: 1 !important;
        justify-self: start !important;
        align-self: center !important;
        width: 102px !important;
        min-width: 102px !important;
        max-width: 102px !important;
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-start !important;
        overflow: visible !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-logo img {
        width: 102px !important;
        min-width: 102px !important;
        max-width: 102px !important;
        height: 36px !important;
        min-height: 36px !important;
        max-height: 36px !important;
        margin: 0 !important;
        object-fit: contain !important;
        object-position: left center !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-main-nav {
        position: absolute !important;
        top: 0 !important;
        left: 50% !important;
        width: 600px !important;
        min-width: 600px !important;
        max-width: 600px !important;
        height: 96px !important;
        min-height: 96px !important;
        max-height: 96px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 12px !important;
        transform: translateX(-50%) !important;
        overflow: visible !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-main-nav > a {
        width: auto !important;
        min-width: 88px !important;
        max-width: none !important;
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px !important;
        margin: 0 !important;
        padding: 8px 10px 7px !important;
        box-sizing: border-box !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 4px !important;
        border-radius: 12px !important;
        color: #222 !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        line-height: 20px !important;
        white-space: nowrap !important;
        transition: background-color .16s ease, transform .16s ease, color .16s ease !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:nth-child(1) { min-width: 92px !important; }
    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:nth-child(2) { min-width: 142px !important; }
    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:nth-child(3) { min-width: 132px !important; }
    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:nth-child(4) { min-width: 112px !important; }

    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:hover {
        background: #f7f7f7 !important;
        transform: translateY(-1px) scale(1.012) !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-main-nav > a:active {
        transform: scale(.97) !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-main-nav > a::after {
        left: 12px !important;
        right: 12px !important;
        bottom: 0 !important;
        height: 2px !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-header-actions {
        position: relative !important;
        grid-column: 3 !important;
        justify-self: end !important;
        align-self: center !important;
        width: 278px !important;
        min-width: 278px !important;
        max-width: 278px !important;
        height: 80px !important;
        min-height: 80px !important;
        max-height: 80px !important;
        margin: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: flex-end !important;
        gap: 12px !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-host-trigger {
        width: auto !important;
        min-width: 174px !important;
        max-width: 174px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 14px !important;
        border-radius: 20px !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        white-space: nowrap !important;
    }

    html body.apd49-twin-match #apd5-header .apd5-language-button,
    html body.apd49-twin-match #apd5-header [aria-label="Elegir idioma y moneda"],
    html body.apd49-twin-match #apd5-account-button {
        width: 40px !important;
        min-width: 40px !important;
        max-width: 40px !important;
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
    }

    /* Search: enforce the real 850px geometry on the ID itself. Previous
       rules sized only descendants, leaving the form at 680px and overflowing. */
    html body.apd49-twin-match #apd5-header > .apd5-header-search-row {
        position: absolute !important;
        top: var(--apd49-search-top) !important;
        left: 50% !important;
        right: auto !important;
        width: var(--apd49-search-width) !important;
        min-width: var(--apd49-search-width) !important;
        max-width: var(--apd49-search-width) !important;
        height: var(--apd49-search-height) !important;
        min-height: var(--apd49-search-height) !important;
        max-height: var(--apd49-search-height) !important;
        margin: 0 !important;
        padding: 0 !important;
        transform: translateX(-50%) !important;
        overflow: visible !important;
        box-sizing: border-box !important;
    }

    html body.apd49-twin-match #apd5-search.apd5-search,
    html body.apd49-twin-match form#apd5-search {
        position: relative !important;
        width: 850px !important;
        min-width: 850px !important;
        max-width: 850px !important;
        height: 66px !important;
        min-height: 66px !important;
        max-height: 66px !important;
        margin: 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        display: grid !important;
        grid-template-columns: 283px 1px 288px 1px 211px 66px !important;
        align-items: center !important;
        border: 1px solid #dedede !important;
        border-radius: 33px !important;
        background: #fff !important;
        box-shadow: 0 3px 12px rgba(0,0,0,.15) !important;
        overflow: visible !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-field,
    html body.apd49-twin-match #apd5-search .apd5-search-field > button {
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        height: 64px !important;
        min-height: 64px !important;
        max-height: 64px !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-field > button {
        padding: 0 28px !important;
        border: 0 !important;
        border-radius: 32px !important;
        background: transparent !important;
        text-align: left !important;
        transition: background-color .16s ease, box-shadow .16s ease, transform .12s ease !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-field > button:hover {
        background: #f2f2f2 !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-field.is-active > button,
    html body.apd49-twin-match #apd5-search .apd5-search-field > button[aria-expanded="true"] {
        background: #fff !important;
        box-shadow: 0 6px 20px rgba(0,0,0,.14) !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-submit {
        place-self: center !important;
        width: 48px !important;
        min-width: 48px !important;
        max-width: 48px !important;
        height: 48px !important;
        min-height: 48px !important;
        max-height: 48px !important;
        margin: 0 !important;
        padding: 0 !important;
        border-radius: 50% !important;
        box-shadow: none !important;
        transform: none !important;
        transition: transform .14s ease, box-shadow .14s ease, filter .14s ease !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-submit:hover {
        transform: scale(1.04) !important;
        box-shadow: 0 6px 16px rgba(13,43,108,.23) !important;
        filter: brightness(1.03) !important;
    }

    html body.apd49-twin-match #apd5-search .apd5-search-submit:active {
        transform: scale(.96) !important;
    }

    /* Public content shell: the Twin capture showed APD at 1280px / x72.5,
       while the reference is 1329px / x48. */
    html body.apd49-twin-match main#main-content.apd5-main,
    html body.apd49-twin-match main.apd5-main,
    html body.apd49-twin-match .apd31-catalog,
    html body.apd49-twin-match .apd5-footer-grid,
    html body.apd49-twin-match .apd24-footer-bottom {
        width: min(calc(100% - 96px), var(--apd49-shell-max)) !important;
        min-width: 0 !important;
        max-width: var(--apd49-shell-max) !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
        box-sizing: border-box !important;
    }

    /* The captured reference state was logged out and had no APD-only
       continuation strip. Keep it for authenticated users, hide it for guests. */
    html body.apd49-twin-match:not(.logged-in) .apd39-home-greeting,
    html body.apd49-twin-match:not(.logged-in) .apd29-continue-strip {
        display: none !important;
    }

    html body.apd49-twin-match:not(.logged-in) main#main-content.apd5-main {
        padding-top: 54px !important;
    }

    html body.apd49-twin-match .apd5-card-rail {
        width: 100% !important;
        max-width: 100% !important;
        grid-auto-columns: calc((100% - (6 * var(--apd49-card-gap))) / 7) !important;
        gap: var(--apd49-card-gap) !important;
        scroll-padding-left: 0 !important;
        overflow-x: auto !important;
        overflow-y: visible !important;
    }

    html body.apd49-twin-match .apd5-card {
        width: auto !important;
        min-width: 0 !important;
        max-width: none !important;
        transform: none !important;
    }

    html body.apd49-twin-match .apd5-card-media {
        width: 100% !important;
        aspect-ratio: 1.053 / 1 !important;
        border-radius: var(--apd49-card-radius) !important;
        overflow: hidden !important;
        box-shadow: none !important;
    }

    html body.apd49-twin-match .apd5-card-media img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        transition: transform .28s cubic-bezier(.2,.8,.2,1) !important;
    }

    html body.apd49-twin-match .apd5-card:hover .apd5-card-media img {
        transform: scale(1.025) !important;
    }

    /* Never let legacy compare drawers change document geometry. */
    html body.apd49-twin-match .compare-property-panel-vertical,
    html body.apd49-twin-match #compare-property-panel,
    html body.apd49-twin-match #compare-exp-property-panel {
        position: fixed !important;
        right: 0 !important;
        left: auto !important;
        max-width: min(360px, 92vw) !important;
    }

    html body.apd49-twin-match:not(.compare-property-active) #compare-property-panel,
    html body.apd49-twin-match:not(.compare-exp-property-active) #compare-exp-property-panel {
        visibility: hidden !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

/* -------------------------------------------------------------------------
   TABLET · same shared shell, scaled without browser zoom
   ------------------------------------------------------------------------- */
@media (min-width: 768px) and (max-width: 1179px) {
    html body.apd49-twin-match #apd5-header.apd5-header {
        zoom: 1 !important;
        transform: none !important;
    }

    html body.apd49-twin-match #apd5-header > .apd5-header-row {
        width: 100% !important;
        padding-left: 24px !important;
        padding-right: 24px !important;
        box-sizing: border-box !important;
    }

    html body.apd49-twin-match #apd5-header > .apd5-header-search-row,
    html body.apd49-twin-match #apd5-search.apd5-search {
        width: min(850px, calc(100vw - 48px)) !important;
        min-width: 0 !important;
        max-width: calc(100vw - 48px) !important;
    }

    html body.apd49-twin-match main#main-content.apd5-main,
    html body.apd49-twin-match main.apd5-main,
    html body.apd49-twin-match .apd5-footer-grid,
    html body.apd49-twin-match .apd24-footer-bottom {
        width: calc(100% - 48px) !important;
        max-width: none !important;
        margin-left: auto !important;
        margin-right: auto !important;
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
}

/* -------------------------------------------------------------------------
   MOBILE · preserve current mobile interaction model, only remove APD-only
   guest strip so the initial hierarchy follows the captured reference.
   ------------------------------------------------------------------------- */
@media (max-width: 767px) {
    html body.apd49-twin-match {
        zoom: 1 !important;
        transform: none !important;
    }

    html body.apd49-twin-match:not(.logged-in) .apd39-home-greeting,
    html body.apd49-twin-match:not(.logged-in) .apd29-continue-strip {
        display: none !important;
    }
}
