/*
 * SNOW EXP Where-to-Stay commercial rail.
 *
 * Responsive/sticky mode selection belongs to resort-rail-layout.js.
 * This stylesheet only defines the WTS page composition for those modes.
 */

.seo-page-affiliate-rail {
    min-width: 0;

    /*
     * The commercial rail is intentionally stretched to the height
     * of the main article grid row. Without this, its sticky child is
     * trapped inside an aside only as tall as the advert itself.
     */
    align-self: stretch;
}

.seo-page-affiliate-rail__sticky,
.seo-page-affiliate-rail__support {
    display: grid;
    gap: 12px;
}

.seo-page-affiliate-rail__affiliate {
    min-width: 0;
}

/* The affiliate component already owns its card/rotation UI. */
.seo-page-affiliate-rail .snowexp-affiliate-wrap {
    width: 100%;
    margin: 0;
}

.seo-page-affiliate-rail .snowexp-affiliate-grid {
    grid-template-columns: minmax(0, 1fr);
}

.seo-page-affiliate-rail .snowexp-affiliate-card,
.seo-page-affiliate-rail .snowexp-affiliate-banner-card {
    width: 100%;
    box-sizing: border-box;
}

.seo-page-affiliate-rail .snowexp-affiliate-banner-image,
.seo-page-affiliate-rail picture,
.seo-page-affiliate-rail iframe {
    max-width: 100%;
}

.seo-page-affiliate-rail .snowexp-affiliate-banner-image {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
}

/*
 * The existing SEO body is intentionally NOT narrowed.
 *
 * Same principle as the resort rail:
 * add 320px rail + 26px gap and borrow spare desktop margin.
 */
@media (min-width: 1281px) {
    .template-seo-where-to-stay .resort-page-hero {
        margin-left: -170px;
    }

    .seo-page-commercial-columns {
        display: grid;
        grid-template-columns:
            minmax(0, 1fr)
            320px;
        gap: 26px;
        width: calc(100% + 346px);
        margin-left: -170px;
        align-items: start;
    }

    .seo-page-commercial-columns > #resort-back {
        min-width: 0;
    }

    .seo-page-affiliate-rail {
        width: 320px;
    }

    /*
     * Progressive desktop fallback.
     *
     * The shared JS normally assigns data-rail-mode. If that mode has
     * not yet been assigned, keep this simple commercial rail sticky
     * rather than silently degrading to a static advert.
     *
     * Once JS assigns stack/support-sticky/ad-sticky/flow, the normal
     * mode-specific rules below take over.
     */
    .seo-page-affiliate-rail:not([data-rail-mode])
        .seo-page-affiliate-rail__sticky {
        position: sticky;
        top: var(--snowexp-rail-top, 84px);
    }

    .seo-page-affiliate-rail[data-rail-mode="stack"]
        .seo-page-affiliate-rail__sticky {
        position: sticky;
        top: var(--snowexp-rail-top, 84px);
    }

    .seo-page-affiliate-rail[data-rail-mode="support-sticky"]
        .seo-page-affiliate-rail__support {
        position: sticky;
        top: var(--snowexp-rail-top, 84px);
    }

    .seo-page-affiliate-rail[data-rail-mode="ad-sticky"]
        .seo-page-affiliate-rail__affiliate {
        position: sticky;
        top: var(--snowexp-rail-top, 84px);
    }

    .seo-page-affiliate-rail[data-rail-mode="flow"]
        .seo-page-affiliate-rail__sticky,
    .seo-page-affiliate-rail[data-rail-mode="flow"]
        .seo-page-affiliate-rail__support,
    .seo-page-affiliate-rail[data-rail-mode="flow"]
        .seo-page-affiliate-rail__affiliate {
        position: static;
    }
}

/*
 * Tablet/mobile:
 * exactly the same responsive principle as the other rails:
 * return the rail to ordinary document flow rather than crop it.
 */
@media (max-width: 1280px) {
    .seo-page-commercial-columns {
        display: block;
        width: 100%;
        margin-left: 0;
    }

    .seo-page-affiliate-rail {
        width: 100%;
        margin-top: 22px;
    }

    .seo-page-affiliate-rail__sticky,
    .seo-page-affiliate-rail__support,
    .seo-page-affiliate-rail__affiliate {
        position: static;
        width: 100%;
    }
}


/* Resort-aware commercial context above the managed visual advert. */
.seo-page-affiliate-rail__context {
    margin: 0 0 10px;
    padding: 12px 14px;
    border: 1px solid rgba(255,255,255,0.16);
    border-radius: 14px;
    background: rgba(15, 23, 42, 0.78);
    backdrop-filter: blur(8px);
    color: #fff;
}

.seo-page-affiliate-rail__context-kicker {
    display: block;
    margin-bottom: 3px;
    color: coral;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.seo-page-affiliate-rail__context strong {
    display: block;
    margin: 0;
    color: #fff;
    font-size: 1.02rem;
    line-height: 1.25;
}

.seo-page-affiliate-rail__context small {
    display: block;
    margin-top: 4px;
    color: rgba(255,255,255,0.82);
    font-size: 0.78rem;
    line-height: 1.35;
}


/* ============================================================
 * WHERE-TO-STAY EDITORIAL ACCOMMODATION IMAGE
 *
 * The source composition is preserved: no forced fill/crop.
 * Public files are responsive Wagtail WebP renditions.
 * ============================================================ */

.where-to-stay-accommodation-media {
    margin: 4px 0 22px;
}

.where-to-stay-accommodation-media__image {
    display: block;
    width: 100%;
    height: auto;
    max-height: 390px;
    object-fit: contain;
    object-position: center;
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.08);
}

.where-to-stay-accommodation-media__credit {
    margin: 7px 4px 0;
    color: #64748b;
    font-size: 0.74rem;
    line-height: 1.4;
}

.where-to-stay-accommodation-media__credit a,
.where-to-stay-accommodation-media__credit a:visited {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 700px) {
    .where-to-stay-accommodation-media {
        margin-bottom: 18px;
    }

    .where-to-stay-accommodation-media__image {
        max-height: none;
        border-radius: 13px;
    }
}
