/* ============================================================================
 * adsense.css — BEM styling for the .ad-slot partial.
 * Loaded conditionally from _Layout.cshtml only when AdSense is enabled in
 * Config. Pairs with adsense-lazy.js for the IntersectionObserver lazy push.
 *
 * v2: every display unit is responsive (data-ad-format="auto"). The container
 * here shapes the slot (vertical / banner / rectangle); AdSense fits a
 * creative to it. Reserved heights (--ad-slot-min-height set inline per slot)
 * hold space before the ad fills, so CLS stays at zero on Lighthouse.
 * ============================================================================ */

/* ─── Base block ─── */
.ad-slot {
    display: block;
    width: 100%;
    min-height: var(--ad-slot-min-height, 250px);
    margin: 1.5rem auto;
    padding: 0;
    background: var(--bs-light, #F0F8FF);
    border: 0.5px solid rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    box-sizing: border-box;
}

.ad-slot__label {
    display: block;
    font-size: 10px;
    font-weight: 400;
    color: rgba(0, 0, 0, 0.45);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 4px 8px 0 8px;
    text-align: center;
}

.ad-slot__unit {
    display: block;
    width: 100%;
}

/* ─── Variants — all responsive, container shapes the ad ─── */

/* Sidebar half-page — vertical orientation, fills up to 600px tall */
.ad-slot--half-page {
    width: 300px;
    min-height: 250px;
    max-height: 600px;
    margin: 0 auto;
    position: sticky;
    top: calc(var(--header-height, 80px) + 1rem);
}

/* Sidebar bottom rectangle — vertical orientation, 250-300px tall */
.ad-slot--sidebar-rect {
    width: 300px;
    min-height: 250px;
    max-height: 300px;
    margin: 1.5rem auto;
}

/* Top responsive banner — horizontal orientation, fills container width */
.ad-slot--top-responsive {
    width: 100%;
    min-height: 90px;
    max-height: 280px;
}

/* In-content rectangle — square/rectangle orientation */
.ad-slot--in-content {
    max-width: 336px;
    min-height: 250px;
    max-height: 300px;
    margin: 1.5rem auto;
}

/* Mobile inline rectangle */
.ad-slot--mobile-rect {
    width: 100%;
    max-width: 336px;
    min-height: 250px;
    max-height: 300px;
    margin: 1.5rem auto;
}

/* Native in-feed — matches name card */
.ad-slot--native {
    min-height: 200px;
    margin: 0;
    border-radius: 8px;
    background: var(--bs-white, #FFFFFF);
}

/* Multiplex (recommendations grid) */
.ad-slot--multiplex {
    min-height: 280px;
    margin: 2rem 0;
}

/* ─── Lazy-loading state ─── */
.ad-slot[data-ad-lazy="true"] .ad-slot__unit {
    display: none;
}

.ad-slot[data-ad-lazy="true"].ad-slot--loaded .ad-slot__unit {
    display: block;
}

/* ─── Hide chrome when AdSense returns unfilled ─── */
.ad-slot:has(.adsbygoogle[data-ad-status="unfilled"]) .ad-slot__label {
    display: none;
}
.ad-slot:has(.adsbygoogle[data-ad-status="unfilled"]) {
    min-height: 0;
    border: none;
    margin: 0;
    background: transparent;
}

/* ─── JS fallback (adsense-lazy.js): collapse when the AdSense library is
   blocked or fails to load (ad blocker / network). data-ad-status is never set
   in that case, so the :has(unfilled) rule above can't fire. Mirrors it. ─── */
.ad-slot--empty .ad-slot__label {
    display: none;
}
.ad-slot--empty {
    min-height: 0;
    border: none;
    margin: 0;
    background: transparent;
}

/* ─── Mobile anchor reservation (Auto Ads handles injection) ─── */
@media (max-width: 991.98px) {
    .adsense-anchor-placeholder {
        height: 60px;
        width: 100%;
    }
    body.has-anchor-ad {
        padding-bottom: 60px;
    }
}
