/* ── Ad Slot Layout ── */

.page-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-top: 1rem;
}

@media (min-width: 1024px) {
    .page-layout {
        grid-template-columns: 1fr 300px;
    }

    .page-layout--article .page-main {
        max-width: none;
    }
}

.page-sidebar {
    display: none;
    flex-direction: column;
    gap: 1rem;
}

@media (min-width: 1024px) {
    .page-sidebar {
        display: flex;
    }
}

/* ── Ad Slot Base ── */

/* 默认不占空间，仅在有填充内容时展示 */
.ad-slot {
    display: none;
    flex-direction: column;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.ad-slot.ad-slot--filled {
    display: flex;
    margin: 1rem 0;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 0;
    opacity: 0;
    transform: translateY(6px);
    transition: opacity 0.35s ease, transform 0.35s ease;
}

.ad-slot.ad-slot--filled.ad-slot--visible {
    opacity: 1;
    transform: translateY(0);
}

/* ── Slot Variants ── */

.ad-slot--banner.ad-slot--filled {
    padding: 0.5rem 0;
    border-top: 1px solid rgba(55, 65, 81, 0.5);
    border-bottom: 1px solid rgba(55, 65, 81, 0.5);
    background: linear-gradient(180deg, rgba(17, 24, 39, 0.35) 0%, transparent 100%);
}

.ad-slot--sidebar.ad-slot--filled {
    margin: 0;
    padding: 0.25rem 0;
}

.ad-slot--native.ad-slot--filled {
    margin: 1.25rem 0;
    padding: 0.75rem 0;
    border-top: 1px solid rgba(55, 65, 81, 0.35);
    border-bottom: 1px solid rgba(55, 65, 81, 0.35);
}

.ad-slot--inline.ad-slot--filled {
    margin: 0.75rem 0;
}

@media (max-width: 639px) {
    .ad-slot.ad-slot--filled {
        margin: 0.75rem 0;
    }

    .ad-slot--banner.ad-slot--filled {
        padding: 0.375rem 0;
    }

    .ad-slot--native.ad-slot--filled {
        margin: 1rem 0;
        padding: 0.5rem 0;
    }
}

.ad-slot--desktop-only {
    display: none;
}

@media (min-width: 1024px) {
    .ad-slot--desktop-only.ad-slot--filled {
        display: flex;
    }
}

.ad-slot--sticky {
    position: sticky;
    top: calc(3.5rem + env(safe-area-inset-top, 0px) + 0.5rem);
}

.ad-label {
    display: block;
    width: 100%;
    max-width: 728px;
    text-align: center;
    font-size: 0.625rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #6b7280;
    margin-bottom: 0.375rem;
    user-select: none;
}

.ad-slot__inner {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ad-slot--banner .ad-slot__inner,
.ad-slot--native .ad-slot__inner {
    max-width: 728px;
    margin: 0 auto;
}

.ad-slot--sidebar .ad-slot__inner {
    max-width: 300px;
    margin: 0 auto;
}

.ad-slot__inner .adsbygoogle {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    line-height: 0;
}

.ad-slot__inner .adsbygoogle iframe {
    margin: 0 auto;
}

/* 开发/占位模式 */
.ad-placeholder {
    width: 100%;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    color: #4b5563;
    font-size: 0.75rem;
    font-family: monospace;
    border-radius: 0.375rem;
    text-align: center;
    padding: 1rem;
    border: 1px dashed rgba(75, 85, 99, 0.4);
}

.ad-slot--sidebar .ad-placeholder {
    min-height: 250px;
}

.ad-slot--native .ad-placeholder {
    min-height: 200px;
}

@media (max-width: 639px) {
    .ad-placeholder {
        font-size: 0.65rem;
        padding: 0.75rem 0.5rem;
        word-break: break-word;
    }
}

/* ── In-feed / In-article ── */

.ad-infeed-wrapper {
    grid-column: 1 / -1;
}

.ad-infeed-wrapper:empty {
    display: none;
}

.ad-in-article-wrapper {
    margin: 1.5rem 0;
}

.ad-in-article-wrapper:empty {
    display: none;
    margin: 0;
}

.ad-in-article-wrapper .ad-slot,
.ad-infeed-wrapper .ad-slot {
    margin: 0;
}

/* 首屏 header 广告紧贴导航 */
[data-ad-slot="header-leaderboard"].ad-slot--filled {
    margin-top: 0;
    border-top: none;
    background: transparent;
}

[data-ad-slot="footer-banner"].ad-slot--filled {
    margin-bottom: 0;
}

/* ── Legal Pages ── */

.legal-page {
    max-width: 48rem;
    margin: 0 auto;
    padding: 0.5rem 0 2rem;
}

@media (min-width: 640px) {
    .legal-page {
        padding: 1rem 0 3rem;
    }
}

.legal-body a {
    color: #e62429;
}
