/*
 * KhabarThali Home Ads Manager — Premium Sponsor Card UI
 * Homepage-only presentation layer. Designed to sit above the old theme's
 * native ad renderer without changing its tracking, schedule or targeting.
 */

:root {
    --ktha-red: var(--kt-red, #dc0007);
    --ktha-red-dark: #b60007;
    --ktha-navy: var(--kt-navy, #031a40);
    --ktha-paper: var(--kt-paper, #ffffff);
    --ktha-ink: var(--kt-ink, #101828);
    --ktha-muted: var(--kt-muted, #667085);
    --ktha-line: var(--kt-line, #e2e8f0);
    --ktha-soft: var(--kt-soft, #f7f9fc);
    --ktha-radius: 18px;
    --ktha-inner-radius: 13px;
    --ktha-shadow: 0 12px 34px rgba(3, 26, 64, .085);
    --ktha-shadow-hover: 0 18px 44px rgba(3, 26, 64, .14);
}

/* Both the plugin fallback renderer and the old KhabarThali native renderer. */
.ktha-ad-slot,
.kt-ad-slot.ktha-integrated-slot,
body.home .kt-ad-slot-home-after-hero,
body.home .kt-ad-slot-mid,
body.home .kt-ad-slot-home-section-2,
body.home .kt-ad-slot-home-section-4,
body.home .kt-ad-slot-home-sidebar,
body.blog .kt-ad-slot-home-after-hero,
body.blog .kt-ad-slot-mid,
body.blog .kt-ad-slot-home-section-2,
body.blog .kt-ad-slot-home-section-4,
body.blog .kt-ad-slot-home-sidebar {
    position: relative;
    isolation: isolate;
    display: block;
    width: 100%;
    max-width: 100%;
    clear: both;
    margin: 26px auto;
    padding: 36px 12px 12px;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--ktha-navy) 11%, var(--ktha-line));
    border-radius: var(--ktha-radius);
    background:
        linear-gradient(135deg, color-mix(in srgb, var(--ktha-red) 4%, transparent), transparent 36%),
        var(--ktha-paper);
    box-shadow: var(--ktha-shadow);
    transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
    contain: layout paint;
}

.ktha-ad-slot::after,
.kt-ad-slot.ktha-integrated-slot::after,
body.home .kt-ad-slot-home-after-hero::after,
body.home .kt-ad-slot-mid::after,
body.home .kt-ad-slot-home-section-2::after,
body.home .kt-ad-slot-home-section-4::after,
body.home .kt-ad-slot-home-sidebar::after,
body.blog .kt-ad-slot-home-after-hero::after,
body.blog .kt-ad-slot-mid::after,
body.blog .kt-ad-slot-home-section-2::after,
body.blog .kt-ad-slot-home-section-4::after,
body.blog .kt-ad-slot-home-sidebar::after {
    content: "विज्ञापन  ·  SPONSORED";
    position: absolute;
    z-index: 3;
    top: 10px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    min-height: 19px;
    padding: 3px 8px 2px;
    border: 1px solid color-mix(in srgb, var(--ktha-red) 25%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--ktha-red) 8%, var(--ktha-paper));
    color: var(--ktha-red);
    font: 800 9px/1.2 Arial, sans-serif;
    letter-spacing: .075em;
    text-transform: uppercase;
    white-space: nowrap;
}

/* Decorative publisher mark — visual only; it never covers the ad creative. */
.ktha-ad-slot::before,
.kt-ad-slot.ktha-integrated-slot::before,
body.home .kt-ad-slot-home-after-hero::before,
body.home .kt-ad-slot-mid::before,
body.home .kt-ad-slot-home-section-2::before,
body.home .kt-ad-slot-home-section-4::before,
body.home .kt-ad-slot-home-sidebar::before,
body.blog .kt-ad-slot-home-after-hero::before,
body.blog .kt-ad-slot-mid::before,
body.blog .kt-ad-slot-home-section-2::before,
body.blog .kt-ad-slot-home-section-4::before,
body.blog .kt-ad-slot-home-sidebar::before {
    content: "KhabarThali Ads";
    position: absolute;
    z-index: 3;
    top: 12px;
    right: 13px;
    color: var(--ktha-muted);
    font: 700 9px/1.25 Arial, sans-serif;
    letter-spacing: .025em;
    opacity: .82;
}

@media (hover: hover) and (pointer: fine) {
    .ktha-ad-slot:hover,
    .kt-ad-slot.ktha-integrated-slot:hover,
    body.home .kt-ad-slot-home-after-hero:hover,
    body.home .kt-ad-slot-mid:hover,
    body.home .kt-ad-slot-home-section-2:hover,
    body.home .kt-ad-slot-home-section-4:hover,
    body.home .kt-ad-slot-home-sidebar:hover,
    body.blog .kt-ad-slot-home-after-hero:hover,
    body.blog .kt-ad-slot-mid:hover,
    body.blog .kt-ad-slot-home-section-2:hover,
    body.blog .kt-ad-slot-home-section-4:hover,
    body.blog .kt-ad-slot-home-sidebar:hover {
        transform: translateY(-2px);
        border-color: color-mix(in srgb, var(--ktha-red) 23%, var(--ktha-line));
        box-shadow: var(--ktha-shadow-hover);
    }
}

/* Hide the fallback renderer's duplicate text label; the shell owns the label. */
.ktha-ad-label {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.ktha-fallback-ad,
.kt-ad-slot.ktha-integrated-slot .kt-managed-ad,
body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad,
body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--ktha-navy) 8%, var(--ktha-line));
    border-radius: var(--ktha-inner-radius);
    background:
        linear-gradient(45deg, color-mix(in srgb, var(--ktha-navy) 2%, transparent) 25%, transparent 25%) 0 0 / 18px 18px,
        linear-gradient(-45deg, color-mix(in srgb, var(--ktha-navy) 2%, transparent) 25%, transparent 25%) 0 0 / 18px 18px,
        var(--ktha-soft);
    text-align: center;
    line-height: 0;
}

.ktha-fallback-ad > a,
.kt-ad-slot.ktha-integrated-slot .kt-managed-ad > a,
body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad > a,
body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad > a {
    display: grid;
    place-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    border-radius: inherit;
    line-height: 0;
    text-decoration: none;
}

.ktha-fallback-ad img,
.kt-ad-slot.ktha-integrated-slot img,
body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad img,
body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
    max-height: 250px;
    margin: 0 auto;
    border: 0;
    border-radius: 12px;
    object-fit: contain;
    object-position: center;
    transition: transform .28s ease, filter .28s ease;
}

@media (hover: hover) and (pointer: fine) {
    .ktha-fallback-ad > a:hover img,
    .kt-ad-slot.ktha-integrated-slot .kt-managed-ad > a:hover img,
    body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad > a:hover img,
    body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad > a:hover img {
        transform: scale(1.008);
        filter: saturate(1.025) contrast(1.01);
    }
}

/* HTML/AdSense creatives remain constrained and cannot break the news grid. */
.ktha-fallback-ad :is(iframe,video,embed,object),
.kt-ad-slot.ktha-integrated-slot .kt-managed-ad :is(iframe,video,embed,object),
body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad :is(iframe,video,embed,object),
body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad :is(iframe,video,embed,object) {
    display: block;
    max-width: 100%;
    margin-inline: auto;
    border: 0;
}

/* Sidebar gets a tighter vertical sponsor-card treatment. */
.ktha-ad-slot-home-sidebar,
.kt-ad-slot-home-sidebar.ktha-integrated-slot,
body.home .kt-ad-slot-home-sidebar,
body.blog .kt-ad-slot-home-sidebar {
    margin-block: 18px;
    padding: 34px 9px 9px;
    border-radius: 15px;
    box-shadow: 0 9px 26px rgba(3, 26, 64, .075);
}

.ktha-ad-slot-home-sidebar::after,
.kt-ad-slot-home-sidebar.ktha-integrated-slot::after,
body.home .kt-ad-slot-home-sidebar::after,
body.blog .kt-ad-slot-home-sidebar::after {
    top: 9px;
    left: 9px;
    font-size: 8px;
}

.ktha-ad-slot-home-sidebar::before,
.kt-ad-slot-home-sidebar.ktha-integrated-slot::before,
body.home .kt-ad-slot-home-sidebar::before,
body.blog .kt-ad-slot-home-sidebar::before {
    top: 11px;
    right: 10px;
    font-size: 8px;
}

.ktha-ad-slot-home-sidebar .ktha-fallback-ad img,
.kt-ad-slot-home-sidebar .kt-managed-ad img,
body.home .kt-ad-slot-home-sidebar .kt-managed-ad img,
body.blog .kt-ad-slot-home-sidebar .kt-managed-ad img {
    width: 100%;
    max-height: 600px;
    object-fit: contain;
}

/* Theme dark mode + system dark fallback. */
:root[data-theme='dark'] {
    --ktha-paper: var(--kt-paper, #101a29);
    --ktha-ink: var(--kt-ink, #f0f3f9);
    --ktha-muted: var(--kt-muted, #b5bfd0);
    --ktha-line: var(--kt-line, #2c3c52);
    --ktha-soft: var(--kt-soft, #172235);
    --ktha-shadow: 0 12px 34px rgba(0, 0, 0, .22);
    --ktha-shadow-hover: 0 18px 44px rgba(0, 0, 0, .3);
}

@media (max-width: 767px) {
    .ktha-ad-slot,
    .kt-ad-slot.ktha-integrated-slot,
    body.home .kt-ad-slot-home-after-hero,
    body.home .kt-ad-slot-mid,
    body.home .kt-ad-slot-home-section-2,
    body.home .kt-ad-slot-home-section-4,
    body.home .kt-ad-slot-home-sidebar,
    body.blog .kt-ad-slot-home-after-hero,
    body.blog .kt-ad-slot-mid,
    body.blog .kt-ad-slot-home-section-2,
    body.blog .kt-ad-slot-home-section-4,
    body.blog .kt-ad-slot-home-sidebar {
        margin: 17px auto;
        padding: 32px 7px 7px;
        border-radius: 14px;
        box-shadow: 0 8px 24px rgba(3, 26, 64, .07);
    }

    .ktha-ad-slot::after,
    .kt-ad-slot.ktha-integrated-slot::after,
    body.home .kt-ad-slot-home-after-hero::after,
    body.home .kt-ad-slot-mid::after,
    body.home .kt-ad-slot-home-section-2::after,
    body.home .kt-ad-slot-home-section-4::after,
    body.home .kt-ad-slot-home-sidebar::after,
    body.blog .kt-ad-slot-home-after-hero::after,
    body.blog .kt-ad-slot-mid::after,
    body.blog .kt-ad-slot-home-section-2::after,
    body.blog .kt-ad-slot-home-section-4::after,
    body.blog .kt-ad-slot-home-sidebar::after {
        top: 8px;
        left: 8px;
        min-height: 17px;
        padding: 2px 6px;
        font-size: 7.5px;
    }

    .ktha-ad-slot::before,
    .kt-ad-slot.ktha-integrated-slot::before,
    body.home .kt-ad-slot-home-after-hero::before,
    body.home .kt-ad-slot-mid::before,
    body.home .kt-ad-slot-home-section-2::before,
    body.home .kt-ad-slot-home-section-4::before,
    body.home .kt-ad-slot-home-sidebar::before,
    body.blog .kt-ad-slot-home-after-hero::before,
    body.blog .kt-ad-slot-mid::before,
    body.blog .kt-ad-slot-home-section-2::before,
    body.blog .kt-ad-slot-home-section-4::before,
    body.blog .kt-ad-slot-home-sidebar::before {
        top: 10px;
        right: 8px;
        font-size: 7.5px;
    }

    .ktha-fallback-ad,
    .kt-ad-slot.ktha-integrated-slot .kt-managed-ad,
    body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad,
    body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad {
        border-radius: 10px;
    }

    .ktha-fallback-ad img,
    .kt-ad-slot.ktha-integrated-slot img,
    body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad img,
    body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) .kt-managed-ad img {
        max-height: 175px;
        border-radius: 9px;
        object-fit: contain;
    }

    .ktha-ad-slot-home-sidebar .ktha-fallback-ad img,
    .kt-ad-slot-home-sidebar .kt-managed-ad img,
    body.home .kt-ad-slot-home-sidebar .kt-managed-ad img,
    body.blog .kt-ad-slot-home-sidebar .kt-managed-ad img {
        max-height: 440px;
    }
}

.ktha-fallback-ad[hidden],
.kt-managed-ad[hidden] {
    display: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .ktha-ad-slot,
    .ktha-ad-slot *,
    .kt-ad-slot.ktha-integrated-slot,
    .kt-ad-slot.ktha-integrated-slot *,
    body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar),
    body.home :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) *,
    body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar),
    body.blog :is(.kt-ad-slot-home-after-hero,.kt-ad-slot-mid,.kt-ad-slot-home-section-2,.kt-ad-slot-home-section-4,.kt-ad-slot-home-sidebar) * {
        animation: none !important;
        transition: none !important;
        scroll-behavior: auto !important;
    }
}
