/**
 * Smart News — Interstitial Ad (v7.6.13)
 *
 * পেছনে স্বচ্ছ ওভারলে + মাঝখানে (বা ফুল-স্ক্রিনে) বিজ্ঞাপন + উপরে-ডানে
 * × বাটন। রং/মাপ inc/interstitial-ad.php থেকে CSS ভ্যারিয়েবল হিসেবে আসে।
 */

.sn-int {
    position: fixed;
    inset: 0;
    z-index: var(--sn-int-z, 1000000);
    /* JS .is-visible যোগ না করা পর্যন্ত লুকানো — ফ্রিকোয়েন্সি/ডিলে ঠিকমতো
       কাজ করে এবং পেজ লোডের সময় কোনো ঝলক (flash) হয় না। */
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .25s ease;
}

.sn-int.is-visible {
    display: flex;
}

.sn-int:focus {
    outline: none;
}

.sn-int.is-shown {
    opacity: 1;
}

/* স্বচ্ছ ওভারলে */
.sn-int-backdrop {
    position: absolute;
    inset: 0;
    background: var(--sn-int-overlay, #000);
    opacity: var(--sn-int-overlay-opacity, .7);
}

/* বিজ্ঞাপনের বক্স — Center মোড */
.sn-int-box {
    position: relative;
    width: var(--sn-int-width-desktop, 600px);
    max-width: 92vw;
    max-height: 90vh;
    max-height: 90dvh;
    background: var(--sn-int-bg, transparent);
    border-radius: var(--sn-int-radius, 4px);
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
    transform: scale(.94);
    transition: transform .25s ease;
    /* × বাটন বক্সের কোণ থেকে একটু বাইরে বের হয়, তাই overflow: visible */
}

.sn-int.is-shown .sn-int-box {
    transform: scale(1);
}

.sn-int-content {
    border-radius: inherit;
    overflow: auto;
    max-height: 90vh;
    max-height: 90dvh;
    line-height: 0;
    -webkit-overflow-scrolling: touch;
}

.sn-int-ad {
    width: 100%;
}

.sn-int-ad .sn-ad-box {
    margin: 0;
    max-width: 100%;
}

.sn-int-ad a {
    display: block;
}

.sn-int-ad img {
    display: block;
    width: 100%;
    max-width: 100%;
    /* ছবি কখনোই স্ক্রিনের উচ্চতার বাইরে যাবে না — অনুপাত ঠিক থাকবে। */
    max-height: 90vh;
    max-height: 90dvh;
    height: auto;
    object-fit: contain;
    border-radius: inherit;
}

/* AdSense / iframe / embed কোড যেন বক্স ছাপিয়ে না যায়। */
.sn-int-ad iframe,
.sn-int-ad ins,
.sn-int-ad video,
.sn-int-ad embed,
.sn-int-ad object {
    max-width: 100%;
}

/* × বাটন — বিজ্ঞাপনের উপরে-ডানে কোণায় */
.sn-int-close {
    position: absolute;
    top: calc(-1 * var(--sn-int-close-size, 26px) / 2);
    right: calc(-1 * var(--sn-int-close-size, 26px) / 2);
    z-index: 3;
    width: var(--sn-int-close-size, 26px);
    height: var(--sn-int-close-size, 26px);
    min-width: 0;
    padding: 0;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--sn-int-close-bg, #4a4a4a);
    color: var(--sn-int-close-icon, #fff);
    border: 0;
    border-radius: 50%;
    font-family: Arial, Helvetica, sans-serif;
    font-size: calc(var(--sn-int-close-size, 26px) * .75);
    line-height: 1;
    font-weight: 400;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0, 0, 0, .35);
    transition: transform .18s ease, filter .18s ease;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: transparent;
}

.sn-int-close span {
    display: block;
    margin-top: -.06em;
}

.sn-int-close:hover {
    transform: scale(1.1);
    filter: brightness(1.15);
}

.sn-int-close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

/* ------------------------------------------------------------------
   Full Screen মোড — বিজ্ঞাপন পুরো স্ক্রিন জুড়ে; ছবি অনুপাত ঠিক রেখে
   (contain) মাঝখানে বসে, × বাটন স্ক্রিনের ভেতরে উপরে-ডানে।
   ------------------------------------------------------------------ */
.sn-int-full .sn-int-box {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: none;
}

.sn-int-full .sn-int-content {
    width: 100%;
    height: 100%;
    max-height: none;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0;
}

.sn-int-full .sn-int-ad {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sn-int-full .sn-int-ad .sn-ad-box,
.sn-int-full .sn-int-ad a {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sn-int-full .sn-int-ad img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    border-radius: 0;
}

.sn-int-full .sn-int-close {
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
}

/* ------------------------------------------------------------------
   রেসপনসিভ
   ------------------------------------------------------------------ */
@media (max-width: 767px) {
    .sn-int-desktop-only {
        display: none !important;
    }

    .sn-int-ad-desktop {
        display: none !important;
    }

    .sn-int-box {
        width: var(--sn-int-width-mobile, 90vw);
        max-width: 96vw;
    }

    .sn-int-full .sn-int-box {
        width: 100vw;
        max-width: none;
    }
}

@media (min-width: 768px) {
    .sn-int-mobile-only {
        display: none !important;
    }

    .sn-int-ad-mobile {
        display: none !important;
    }
}

/* ল্যান্ডস্কেপ মোবাইলে কম উচ্চতা — বক্স যেন স্ক্রিনে আটকে যায়। */
@media (max-height: 480px) {
    .sn-int-box,
    .sn-int-content,
    .sn-int-ad img {
        max-height: 86vh;
    }
}

/* স্ক্রল-লক: বিজ্ঞাপন খোলা থাকলে পেছনের পেজ স্ক্রল হবে না। */
html.sn-int-lock,
html.sn-int-lock body {
    overflow: hidden !important;
}

@media (prefers-reduced-motion: reduce) {
    .sn-int,
    .sn-int-box,
    .sn-int-close {
        transition: none;
    }
}

@media print {
    .sn-int {
        display: none !important;
    }
}
