/* ============================================================
   ERPDATAHUB — ADS.CSS
   AdSense container styles: layout, spacing, labels,
   responsive overflow, sticky sidebar, lazy fade-in
   ============================================================ */

/* ----------------------------------------------------------
   1. BASE AD CONTAINER
   ---------------------------------------------------------- */
.erph-ad {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    overflow: hidden;
    /* Prevent layout shift — reserve space before ad loads */
    min-height: 10px;
    /* Breathing room — never let ads touch surrounding content */
    margin-block: 28px;
    position: relative;
}

/* Policy requirement: every ad must be labelled */
.erph-ad__label {
    font-family: var(--font-sans, sans-serif);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-light, #94A3B8);
    text-align: center;
    width: 100%;
    margin: 0 0 4px 0;
    line-height: 1;
    user-select: none;
    pointer-events: none;
}

/* Make sure the ins element is always block */
.erph-ad ins.adsbygoogle {
    display: block !important;
    margin: 0 auto;
}

/* Collapse empty ad slots (when no fill) */
.erph-ad:empty,
.erph-ad ins.adsbygoogle:empty {
    display: none !important;
    margin: 0;
}

/* ----------------------------------------------------------
   2. SLOT SIZE VARIANTS
   ---------------------------------------------------------- */

/* --- Leaderboard: 728×90 / 970×90 --- */
.erph-ad--leaderboard {
    min-height: 100px;
    background: transparent;
}
.erph-ad--leaderboard ins.adsbygoogle {
    width: 100%;
    max-width: 970px;
    min-height: 90px;
}

/* --- Medium Rectangle: 300×250 --- */
.erph-ad--rectangle {
    min-height: 260px;
}
.erph-ad--rectangle ins.adsbygoogle {
    width: 300px;
    height: 250px;
}

/* --- Half-Page: 300×600 --- */
.erph-ad--halfpage {
    min-height: 610px;
}
.erph-ad--halfpage ins.adsbygoogle {
    width: 300px;
    height: 600px;
}

/* --- In-Content (fluid / in-article) --- */
.erph-ad--in-content {
    width: 100%;
    max-width: 720px;
    margin-block: 36px;
    padding: 0;
    min-height: 120px;
    /* Subtle separator so ad doesn't bleed into prose */
    border-top: 1px solid var(--border, #E2E8F0);
    border-bottom: 1px solid var(--border, #E2E8F0);
    padding-block: 16px;
}
.erph-ad--in-content ins.adsbygoogle {
    width: 100%;
}

/* --- Multiplex / Related Content --- */
.erph-ad--multiplex {
    min-height: 200px;
    width: 100%;
    margin-block: 40px;
}
.erph-ad--multiplex ins.adsbygoogle {
    width: 100%;
}

/* ----------------------------------------------------------
   3. PLACEMENT-SPECIFIC LAYOUT
   ---------------------------------------------------------- */

/* After-header leaderboard — full bleed within container */
.erph-after-header-ad {
    background: var(--bg-white, #fff);
    border-bottom: 1px solid var(--border, #E2E8F0);
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.erph-after-header-ad .erph-ad {
    margin-block: 0;
}

/* Footer ad strip */
.erph-footer-ad {
    background: var(--bg-white, #fff);
    border-top: 1px solid var(--border, #E2E8F0);
    padding: 10px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}
.erph-footer-ad .erph-ad {
    margin-block: 0;
}

/* Homepage mid-page ad */
.erph-homepage-mid-ad {
    padding: 12px var(--space-6, 24px);
    max-width: var(--max-w, 1200px);
    margin: 0 auto;
}

/* Before related articles */
.erph-before-related-ad {
    padding-bottom: 8px;
}

/* ----------------------------------------------------------
   4. SIDEBAR AD WRAPPERS
   ---------------------------------------------------------- */
.erph-sidebar-ad-top {
    /* 300×250 — top of sidebar, always visible */
    margin-bottom: 24px;
}

.erph-sidebar-ad-sticky-wrap {
    /* Outer wrapper that receives the sticky position */
    position: sticky;
    top: calc(var(--nav-h, 68px) + 16px);
    margin-top: 24px;
    /* Prevent overflow on mobile */
    max-width: 300px;
    width: 100%;
}

.erph-sidebar-ad-sticky-wrap .erph-ad {
    margin-block: 0;
}

/* ----------------------------------------------------------
   5. LAZY LOAD — FADE IN ON VIEWPORT ENTER
   ---------------------------------------------------------- */
.erph-ad--lazy {
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.erph-ad--lazy.erph-ad--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ----------------------------------------------------------
   6. ABOVE-THE-FOLD AD PLACEHOLDER
   Prevents CLS (Cumulative Layout Shift) before ad renders
   ---------------------------------------------------------- */
.erph-ad[data-ad-slot-name="after-header"] {
    min-height: 110px;
}
.erph-ad[data-ad-slot-name="sidebar-top"] {
    min-height: 270px;
}
.erph-ad[data-ad-slot-name="sidebar-sticky"] {
    min-height: 620px;
}
.erph-ad[data-ad-slot-name="in-content-1"],
.erph-ad[data-ad-slot-name="in-content-2"] {
    min-height: 130px;
}

/* ----------------------------------------------------------
   7. VISUAL TREATMENT — premium feel, not intrusive
   ---------------------------------------------------------- */

/* Leaderboard ads get a very subtle background on hover / active */
.erph-ad--leaderboard:has(ins:not(:empty)) {
    background: transparent;
}

/* In-content ads: distinguish from content without heavy borders */
.erph-ad--in-content {
    background: linear-gradient(
        to bottom,
        transparent 0%,
        rgba(248,250,252,0.6) 30%,
        rgba(248,250,252,0.6) 70%,
        transparent 100%
    );
}

/* ----------------------------------------------------------
   8. RESPONSIVE OVERRIDES
   ---------------------------------------------------------- */

/* Below 768px: leaderboards become responsive auto units */
@media (max-width: 767px) {
    .erph-ad--leaderboard ins.adsbygoogle {
        /* Force responsive mode — AdSense handles sizing */
        width: 100%;
        max-width: 100%;
        min-height: 50px;
    }

    .erph-ad--rectangle ins.adsbygoogle,
    .erph-ad--halfpage ins.adsbygoogle {
        width: 100%;
        max-width: 100%;
        height: auto;
        min-height: 100px;
    }

    .erph-ad--in-content {
        margin-inline: 0;
    }

    /* Don't show sticky half-page on mobile — wastes space */
    .erph-sidebar-ad-sticky-wrap .erph-ad--halfpage {
        display: none;
    }

    /* Compact label on small screens */
    .erph-ad__label {
        font-size: 9px;
    }
}

/* Tablet: cap rectangle/halfpage width */
@media (min-width: 768px) and (max-width: 1100px) {
    .erph-ad--rectangle ins.adsbygoogle {
        width: 300px;
        height: 250px;
    }
}

/* ----------------------------------------------------------
   9. ANCHOR AD (Mobile sticky footer)
   Handled mostly by AdSense but ensure no z-index conflict
   ---------------------------------------------------------- */
.adsbygoogle[data-ad-format="anchor"] {
    z-index: 150 !important;
}

/* ----------------------------------------------------------
   10. PRINT — never print ads
   ---------------------------------------------------------- */
@media print {
    .erph-ad,
    .erph-after-header-ad,
    .erph-footer-ad,
    .erph-homepage-mid-ad,
    .erph-sidebar-ad-top,
    .erph-sidebar-ad-sticky-wrap,
    .erph-before-related-ad,
    ins.adsbygoogle {
        display: none !important;
    }
}

/* ----------------------------------------------------------
   11. DARK MODE — label contrast
   ---------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
    .erph-ad__label {
        color: rgba(255,255,255,0.3);
    }
}
