:root {
    --star-ad-surface: #f5f7f6;
    --star-ad-border: #dfe7e2;
    --star-ad-ink-muted: #68736d;
    --star-ad-radius: 18px;
}

.star-ad {
    --star-ad-reserved-height: 0px;
    position: relative;
    display: grid;
    place-items: center;
    inline-size: min(100%, 1180px);
    min-inline-size: 0;
    margin: clamp(24px, 4vw, 48px) auto;
    padding: 24px 16px 16px;
    overflow: clip;
    border: 1px solid var(--star-ad-border);
    border-radius: var(--star-ad-radius);
    background: linear-gradient(145deg, #fbfcfb, var(--star-ad-surface));
    contain: layout paint;
    container-type: inline-size;
    isolation: isolate;
    box-sizing: border-box;
    transition: inline-size 180ms ease, min-block-size 180ms ease;
}

.star-ad[hidden],
.star-ad[data-state="empty"],
.star-ad[data-state="timeout"],
.star-ad[data-state="consent-required"],
.star-ad[data-state="consent-revoked"],
.star-ad[data-state="viewport-disabled"],
.star-ad[data-state="exclusive-group-disabled"],
.star-ad[data-state="configuration-error"] {
    display: none !important;
}

.star-ad--leaderboard:is([data-state="pending"], [data-state="loading"]),
.star-ad--inline:is([data-state="pending"], [data-state="loading"]),
.star-ad--sidebar:is([data-state="pending"], [data-state="loading"]),
.star-ad--feed_card:is([data-state="pending"], [data-state="loading"]) {
    min-block-size: 92px;
}

.star-ad--leaderboard:is([data-state="pending"], [data-state="loading"])::after,
.star-ad--inline:is([data-state="pending"], [data-state="loading"])::after,
.star-ad--sidebar:is([data-state="pending"], [data-state="loading"])::after,
.star-ad--feed_card:is([data-state="pending"], [data-state="loading"])::after {
    content: "";
    inline-size: min(58%, 240px);
    block-size: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, #e4ebe7 15%, #f8faf9 50%, #e4ebe7 85%);
    background-size: 220% 100%;
    animation: star-ad-loading 1.25s ease-in-out infinite;
}

@keyframes star-ad-loading {
    from { background-position: 100% 0; }
    to { background-position: -100% 0; }
}

.star-ad__label {
    position: absolute;
    inset-block-start: 7px;
    inset-inline-start: 50%;
    translate: -50% 0;
    color: var(--star-ad-ink-muted);
    font: 700 10px/1.2 system-ui, sans-serif;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.star-ad__primary {
    display: grid;
    place-items: center;
    max-inline-size: 100%;
    overflow: clip;
}

.star-ad--leaderboard {
    --star-ad-reserved-height: 296px;
    min-block-size: 296px;
}

.star-ad--inline {
    --star-ad-reserved-height: 346px;
    inline-size: min(100%, 760px);
    min-block-size: 346px;
}

.star-ad--feed_card {
    --star-ad-reserved-height: 346px;
    align-self: stretch;
    inline-size: 100%;
    min-block-size: 346px;
    margin: 0 auto;
    padding: 32px 8px 14px;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff, #f7f9f8);
    box-shadow: 0 12px 30px rgba(16, 40, 29, .04);
}

.star-ad--feed_card .star-ad__label {
    inset-block-start: 12px;
    inset-inline-start: 16px;
    translate: 0 0;
}

.star-home-mid-ad {
    inline-size: 100%;
    min-inline-size: 0;
}

.star-ad--sidebar {
	--star-ad-reserved-height: 646px;
	inline-size: min(100%, 340px);
	min-block-size: 646px;
	margin-block: 0;
	/* A desktop side rail is often exactly 300px wide. Horizontal padding or
	 * inline borders would reduce its content box and crop a 300px GAM iframe. */
	padding-inline: 0;
	border-inline-width: 0;
}

/* Homepage side rails are fixed only when both 300px creatives fit beside the
 * 1180px editorial canvas with a safety gutter. The matching JS viewport gate
 * prevents requests below the same width/height, while this CSS also protects
 * the page after a live browser resize. */
.star-desktop-side-rail {
    display: none;
}

@media (min-width: 1880px) and (min-height: 800px) {
    .star-desktop-side-rail {
        position: fixed;
        z-index: 80;
        inset-block-start: max(116px, calc(50dvh - 323px));
        display: block;
        inline-size: 300px;
        block-size: 646px;
        pointer-events: none;
    }

    .star-desktop-side-rail--left {
        inset-inline-start: max(16px, calc(50vw - 920px));
    }

    .star-desktop-side-rail--right {
        inset-inline-end: max(16px, calc(50vw - 920px));
    }

    .star-desktop-side-rail > .star-ad--sidebar {
        inline-size: 300px;
        margin: 0 auto;
        pointer-events: auto;
        box-shadow: 0 14px 38px rgba(16, 40, 29, .08);
    }
}

/* Memorial pages can opt into one quiet 300x250 side-rail only. It does not
 * reserve the tall 300x600 sidebar footprint and is never an overlay. */
.star-ad--sidebar.star-ad--sensitive {
	--star-ad-reserved-height: 296px;
	min-block-size: 296px;
	border-radius: 12px;
	background: #fbfcfb;
	box-shadow: none;
}

.star-ad--sidebar.star-ad--sensitive:is([data-state="pending"], [data-state="loading"]) {
	min-block-size: 72px;
}

/* On a single obituary this is the one expressly configured normal-flow
 * surface after the whole condolences section. It is not sticky or overlayed. */
.star-ad--inline.star-ad--sensitive {
	--star-ad-reserved-height: 296px;
	inline-size: min(100%, 980px);
	min-block-size: 296px;
	border-radius: 12px;
	background: #fbfcfb;
	box-shadow: none;
}

.star-ad--inline.star-ad--sensitive:is([data-state="pending"], [data-state="loading"]) {
	min-block-size: 72px;
}

.star-ad[data-state="filled"][data-creative-width][data-creative-height] {
    inline-size: min(100%, calc(var(--star-ad-creative-width) + 48px));
    /* Do not reduce a reserved in-flow slot after GAM has rendered it: a
     * shorter creative must never pull the article or feed upwards (CLS). */
    min-block-size: max(var(--star-ad-reserved-height), calc(var(--star-ad-creative-height) + 46px));
}

.star-ad--feed_card[data-state="filled"][data-creative-width][data-creative-height] {
    inline-size: min(100%, calc(var(--star-ad-creative-width) + 32px));
}

.star-ad[data-state="filled"][data-creative-height] .star-ad__primary > div[id^="google_ads_iframe_"] {
    block-size: var(--star-ad-creative-height) !important;
    min-block-size: var(--star-ad-creative-height) !important;
}

.star-ad[data-creative-shape="portrait"],
.star-ad[data-creative-shape="square"] {
    box-shadow: 0 16px 42px rgba(16, 40, 29, .07);
}

.star-ad--overlay {
    position: fixed;
    z-index: 100000;
    inset: 50% auto auto 50%;
    translate: -50% -50%;
    inline-size: min(calc(100% - 32px), 760px);
    max-block-size: min(90dvh, 760px);
    overflow: auto;
    overscroll-behavior: contain;
    box-shadow: 0 28px 100px rgba(5, 21, 14, .34);
}

.star-ad--overlay::before {
    content: "";
    position: fixed;
    z-index: -1;
    inset: -100vmax;
    background: rgba(4, 14, 10, .72);
    backdrop-filter: blur(7px);
}

.star-ad--mobile_sticky {
    display: none;
}

.star-ad__close {
    position: absolute;
    z-index: 2;
    inset-block-start: 10px;
    inset-inline-end: 10px;
    display: grid;
    place-items: center;
    inline-size: 40px;
    block-size: 40px;
    border: 1px solid rgba(16, 40, 29, .15);
    border-radius: 999px;
    background: #fff;
    color: #10281d;
    font: 400 28px/1 system-ui, sans-serif;
    cursor: pointer;
}

html.star-ad-scroll-lock,
html.star-ad-scroll-lock body {
    overflow: hidden;
    overscroll-behavior: none;
}

@media (max-width: 767px) {
    .star-ad {
        inline-size: min(calc(100% - 16px), 680px);
        margin-block: 24px;
        padding-inline: 8px;
        border-radius: 14px;
    }

    .star-ad--leaderboard {
        --star-ad-reserved-height: 146px;
    }

    .star-ad--leaderboard:is([data-state="pending"], [data-state="loading"]) {
        min-block-size: 146px;
        max-block-size: 146px;
        margin-block: 8px;
        padding-block: 18px 8px;
    }

    .star-ad--inline,
    .star-ad--feed_card {
        --star-ad-reserved-height: 312px;
        min-block-size: 312px;
    }

    .star-ad--inline.star-ad--sensitive {
        --star-ad-reserved-height: 0px;
    }

    .star-ad--inline.star-ad--sensitive:is([data-state="pending"], [data-state="loading"]) {
        min-block-size: 72px;
    }

    .star-ad--sidebar:not(.star-ad--sensitive) {
		display: none !important;
	}

    .star-ad--mobile_sticky {
        position: fixed;
        z-index: 100000;
        inset: auto 8px max(8px, env(safe-area-inset-bottom));
        display: grid;
        inline-size: calc(100% - 16px);
        min-block-size: 0;
        margin: 0;
        padding: 18px 8px 8px;
        border-radius: 14px;
        box-shadow: 0 16px 42px rgba(5, 21, 14, .24);
    }

    .star-ad--mobile_sticky:is([data-state="pending"], [data-state="loading"]) {
        min-block-size: 52px;
    }

    .star-ad--mobile_sticky .star-ad__close {
        inset-block-start: 4px;
        inset-inline-end: 4px;
        inline-size: 32px;
        block-size: 32px;
        font-size: 22px;
    }

    .star-ad[data-state="filled"][data-creative-width][data-creative-height] {
        inline-size: min(calc(100% - 16px), calc(var(--star-ad-creative-width) + 18px));
        min-block-size: max(var(--star-ad-reserved-height), calc(var(--star-ad-creative-height) + 46px));
    }

    .star-ad--feed_card[data-state="filled"][data-creative-width][data-creative-height] {
        inline-size: min(100%, calc(var(--star-ad-creative-width) + 18px));
    }
}

/* Opt-in: pending, loading and filled share the same vertical space. The
 * breakpoint matches GPT's mobileSizes mapping, including tablets. */
.star-ad[data-star-ad-stable-space="true"] {
    --star-ad-reserved-height: var(--star-ad-reserve-desktop);
    min-block-size: var(--star-ad-reserved-height);
    max-block-size: none;
    transition: none;
}

/* Keep an opted-in leaderboard's frame independent of the delivered
 * creative width. Shrinking the centered frame at slotRenderEnded causes
 * a horizontal layout shift even when its reserved height stays intact. */
.star-ad.star-ad--leaderboard[data-star-ad-stable-space="true"][data-state] {
    inline-size: min(100%, 1180px);
}

/* Inline placements keep their frame while the creative or local card
 * changes. A narrow article column must still fit an unscaled 300px ad. */
.star-ad.star-ad--inline[data-star-ad-stable-space="true"][data-state] {
    inline-size: min(100%, 760px);
    padding-inline: 0;
}

@media (max-width: 767px) {
    .star-ad.star-ad--leaderboard[data-star-ad-stable-space="true"][data-state] {
        inline-size: min(100%, 680px);
    }
}

@media (max-width: 1023px) {
    .star-ad[data-star-ad-stable-space="true"] {
        --star-ad-reserved-height: var(--star-ad-reserve-mobile);
    }
}

@media (max-width: 767px) {
    .star-ad--leaderboard[data-star-ad-stable-space="true"] {
        margin-block: 24px;
        padding-block: 24px 16px;
    }
}

.star-ad__fallback[hidden] { display: none !important; }

.star-ad[data-star-ad-fallback="visible"] {
    display: grid !important;
    background: linear-gradient(135deg, #edf6ef, #ffffff);
}

.star-ad[data-star-ad-fallback="visible"] > .star-ad__primary,
.star-ad[data-star-ad-fallback="visible"] > .star-ad__label,
.star-ad[data-star-ad-fallback="visible"]::after { display: none; }

.star-ad__fallback {
    display: grid;
    justify-items: center;
    gap: 18px;
    max-inline-size: 720px;
    padding: 24px 16px;
    text-align: center;
    color: #153d2a;
    font-family: system-ui, sans-serif;
}

.star-ad__fallback-kicker {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.star-ad__fallback-title {
    font-size: clamp(24px, 4vw, 32px);
    line-height: 1.15;
    text-wrap: balance;
}

.star-ad__fallback p { margin: 0; font-size: 16px; line-height: 1.5; }

.star-ad__fallback-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-block-size: 48px;
    padding: 12px 20px;
    border-radius: 999px;
    background: #076b35;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.35;
    text-decoration: none;
}

.star-ad__fallback-link:hover { background: #054e28; color: #fff; }
.star-ad__fallback-link:focus-visible { outline: 3px solid #153d2a; outline-offset: 4px; }

.star-ad__fallback-consent[hidden] { display: none !important; }
.star-ad__fallback-network[hidden] { display: none !important; }

.star-ad[data-star-ad-support-prompt="visible"] .star-ad__fallback > :not(.star-ad__fallback-network) {
    display: none !important;
}

.star-ad[data-star-ad-consent-prompt="visible"] .star-ad__fallback {
    gap: 9px;
    padding-block: 8px;
}

.star-ad__fallback-consent {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    max-inline-size: 650px;
    margin-block-start: 0;
    padding-block-start: 8px;
    border-block-start: 1px solid #cfe1d5;
    color: #355b47;
    font: 500 13px/1.4 system-ui, sans-serif;
}

.star-ad__fallback-consent button {
    appearance: none;
    min-block-size: 40px;
    padding: 8px 13px;
    border: 1px solid #08733a;
    border-radius: 999px;
    background: #fff;
    color: #075f31;
    cursor: pointer;
    font: 700 13px/1.2 system-ui, sans-serif;
}

.star-ad__fallback-consent button:hover { background: #edf7f0; }
.star-ad__fallback-consent button:focus-visible { outline: 3px solid #153d2a; outline-offset: 3px; }

.star-ad__fallback-network {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px 18px;
    width: min(760px, calc(100% - 32px));
    margin: 4px auto 0;
    padding: 16px 18px;
    border: 1px solid #bfdac8;
    border-radius: 16px;
    background: #f3faf5;
    color: #17442c;
    font: 500 14px/1.45 system-ui, sans-serif;
    text-align: left;
}

.star-ad__fallback-network-copy {
    display: grid;
    min-inline-size: 0;
    gap: 4px;
    overflow-wrap: break-word;
    word-break: normal;
}
.star-ad__fallback-network strong { color: #075f30; font-size: 17px; line-height: 1.25; }
.star-ad__fallback-network button {
    appearance: none;
    min-block-size: 40px;
    padding: 9px 14px;
    border: 1px solid #08733a;
    border-radius: 999px;
    background: #08733a;
    color: #fff;
    cursor: pointer;
    font: 700 13px/1.2 system-ui, sans-serif;
    max-inline-size: 100%;
    text-align: center;
    white-space: nowrap;
}
.star-ad__fallback-network button:hover { background: #055f31; }
.star-ad__fallback-network button:focus-visible { outline: 3px solid #153d2a; outline-offset: 3px; }

@media (max-width: 640px) {
    .star-ad__fallback-network {
        grid-template-columns: 1fr;
        justify-items: start;
        width: min(100% - 20px, 520px);
        padding: 14px;
    }

    .star-ad__fallback-network button { white-space: normal; }
}

/* Article columns can be narrow even on a wide viewport. Size the support
 * prompt against its actual fallback container, otherwise the retry button
 * can squeeze the explanation into a few characters per line. */
@container (max-width: 520px) {
    .star-ad__fallback-network {
        grid-template-columns: minmax(0, 1fr);
        justify-items: stretch;
        width: min(100% - 20px, 520px);
        padding: 14px;
    }

    .star-ad__fallback-network button {
        justify-self: start;
        white-space: normal;
    }
}

/* Compact copy fits the rectangle reserved for an inline ad. Scope these
 * rules above article typography without affecting the leaderboard card. */
.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback {
    box-sizing: border-box;
    inline-size: 100%;
    max-inline-size: 360px;
    gap: 8px;
    padding: 12px;
    text-align: center;
    overflow-wrap: anywhere;
    hyphens: none;
}

.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback-title {
    margin: 0;
    font: 700 20px/1.2 system-ui, sans-serif;
    text-align: center;
}

.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback p {
    margin: 0;
    font: 400 14px/1.4 system-ui, sans-serif;
    text-align: center;
}

.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback-link {
    margin: 4px 0 0;
    min-block-size: 44px;
    padding: 10px 14px;
    font: 700 14px/1.35 system-ui, sans-serif;
    text-decoration: none;
    text-align: center;
    color: #fff;
}

.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback-consent {
    gap: 6px;
    margin-block-start: 2px;
    padding-block-start: 8px;
    font-size: 12px;
}

.star-ad--inline[data-star-ad-stable-space="true"] .star-ad__fallback-consent button {
    min-block-size: 36px;
    padding: 7px 11px;
    font-size: 12px;
}

@media (prefers-reduced-motion: reduce) {
    .star-ad,
    .star-ad * {
        scroll-behavior: auto !important;
        animation: none !important;
        transition: none !important;
    }
}
