/* AdSense placement — consistent spacing, CLS-safe frames, theme-aware */

.ts-ad,
.ts-feed__ad {
    display: none;
    width: 100%;
    margin: 0 auto;
    padding: 0;
    clear: both;
}

.ts-ad.is-filled,
.ts-feed__ad.is-filled {
    display: block;
}

.ts-ad.is-pending,
.ts-feed__ad.is-pending,
.ts-ad.is-empty,
.ts-feed__ad.is-empty {
    display: none;
}

.ts-ad__frame {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: var(--container-max, 1200px);
    margin: 0 auto;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--color-surface-2);
    border: 1px dashed var(--color-border);
}

.ts-ad__unit {
    display: block;
    width: 100%;
    margin: 0 auto;
}

/* Zone spacing */
.ts-ad--top {
    margin-bottom: 1rem;
}

.ts-ad--top .ts-ad__frame {
    border-style: solid;
    background: var(--color-surface);
    box-shadow: var(--shadow-sm);
}

.ts-ad--content_top {
    margin: 1rem 0 1.25rem;
}

.ts-ad--content_bottom {
    margin: 1.5rem 0 0.5rem;
}

.ts-ad--in_article {
    margin: 1.75rem auto;
    max-width: 100%;
}

.ts-ad__frame--in-article {
    width: 100%;
    max-width: 100%;
    border-style: solid;
    background: var(--color-surface);
}

.ts-ad--home_mid {
    margin: 1.25rem auto;
    padding: 0 1rem;
    max-width: calc(var(--container-max, 1200px) + 2rem);
}

.ts-ad--footer {
    margin: 1.25rem auto 0.75rem;
    padding: 0 1rem;
    max-width: calc(var(--container-max, 1200px) + 2rem);
}

/* Tool pages — extra separation from interactive UI */
.article-shell--tool .ts-ad--content_top {
    margin-bottom: 1.5rem;
}

.entry-content--tool + .ts-ad,
.article-shell--tool .ts-ad--content_bottom {
    margin-top: 1.75rem;
}

/* Homepage / landing flush containers */
.section--flush .ts-ad--top,
.section--flush .ts-ad--home_mid,
.section--flush .ts-ad--footer {
    padding-left: clamp(1rem, 3vw, 1.5rem);
    padding-right: clamp(1rem, 3vw, 1.5rem);
}

/* Filled state — drop placeholder chrome */
.ts-ad.is-filled .ts-ad__frame,
.ts-feed__ad.is-filled .ts-ad__frame {
    border-color: transparent;
    background: transparent;
    box-shadow: none;
}

.ts-ad--top.is-filled .ts-ad__frame { min-height: 90px; }
.ts-ad--content_top.is-filled .ts-ad__frame,
.ts-ad--content_bottom.is-filled .ts-ad__frame,
.ts-ad--in_article.is-filled .ts-ad__frame,
.ts-ad--home_mid.is-filled .ts-ad__frame,
.ts-ad--footer.is-filled .ts-ad__frame,
.ts-feed__ad.is-filled .ts-ad__frame--in-feed { min-height: 280px; }

/* Article feeds — vertical list for AdSense in-feed detection */
.ts-feed {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.ts-feed__item {
    margin: 0;
    border-bottom: 1px solid var(--color-divider);
}

.ts-feed__item:last-child {
    border-bottom: 0;
}

.ts-feed__link {
    display: block;
    padding: 1rem 1.1rem;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.18s ease;
}

.ts-feed__link:hover {
    background: rgba(10, 124, 110, 0.06);
}

[data-theme="dark"] .ts-feed__link:hover {
    background: rgba(63, 184, 164, 0.1);
}

.ts-feed__title {
    margin: 0 0 0.35rem;
    font-family: var(--font-display);
    font-size: 1.02rem;
    line-height: 1.35;
    color: var(--color-text);
}

.ts-feed__excerpt {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--color-primary);
}

.ts-feed__ad {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--color-surface-2);
    border-bottom: 1px solid var(--color-divider);
}

.ts-feed__ad .ts-ad__frame--in-feed {
    width: 100%;
    max-width: 100%;
    border-style: solid;
}

.ts-feed-empty {
    margin: 0;
    padding: 1rem;
    color: var(--color-text-muted);
    text-align: center;
}

@media (max-width: 767px) {
    .ts-ad--top {
        margin-bottom: 0.75rem;
    }

    .ts-ad--content_top,
    .ts-ad--content_bottom {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .ts-ad--home_mid,
    .ts-ad--footer {
        padding-left: 0.85rem;
        padding-right: 0.85rem;
    }
}