/* 首页广告位静态预览（占位，未接后台） */

.home-ads-preview {
    position: relative;
    margin: 0 0 24px;
}

.cms-home-page .home-ads-preview {
    margin: 0;
}

.home-ads-preview__note {
    margin: 0 0 12px;
    padding: 8px 12px;
    font-size: 13px;
    color: #666;
    background: #fff8e6;
    border: 1px solid #ffe58f;
    border-radius: 4px;
}

.home-ads-preview__note strong {
    color: #d48806;
}

/* 左右固定侧栏（左 2×2 图格，右 2 个竖条广告） */
.home-ads-preview__rail {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 90;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 90px;
    pointer-events: none;
}

.home-ads-preview__rail--left {
    width: var(--side-rail-w, 220px);
    left: max(8px, calc((100vw - var(--home-main-max, 1800px)) / 2 - var(--side-rail-offset, 240px)));
}

.home-ads-preview__rail--right {
    right: max(8px, calc((100vw - var(--home-main-max, 1800px)) / 2 - 110px));
}

.home-ads-preview__side-grid {
    display: grid;
    gap: 12px;
    pointer-events: none;
}

/* 左侧 2×2：每格 110×200，按可见广告收缩宽高 */
.home-ads-preview__side-grid--left {
    position: relative;
    grid-template-columns: repeat(var(--side-cols, 2), 110px);
    grid-template-rows: repeat(var(--side-rows, 2), 200px);
    width: var(--side-rail-w, 220px);
    height: var(--side-rail-h, 412px);
}

.home-ad-slot--side {
    min-height: 200px;
    pointer-events: auto;
}

.home-ads-preview__side-grid--left .home-ad-slot--side {
    min-height: 0;
    height: 100%;
    width: 110px;
}

.home-ads-preview__side-close {
    position: absolute;
    top: -10px;
    right: -10px;
    z-index: 3;
    width: 22px;
    height: 22px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 12px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    pointer-events: auto;
    opacity: 0;
    transition: opacity 0.2s ease, background 0.2s ease;
}

.home-ads-preview__side-grid--left:hover .home-ads-preview__side-close,
.home-ads-preview__side-close:focus-visible {
    opacity: 1;
}

.home-ads-preview__side-close:hover {
    background: rgba(0, 0, 0, 0.75);
}

.home-ads-preview__side-reopen {
    position: fixed;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 91;
    display: none;
    width: 22px;
    height: 58px;
    padding: 0;
    border: none;
    border-right: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 0 12px 12px 0;
    background: linear-gradient(165deg, #5b7cfa 0%, #194bf1 100%);
    color: #fff;
    cursor: pointer;
    box-shadow: 4px 0 14px rgba(25, 75, 241, 0.35);
    pointer-events: auto;
}

.home-ads-preview__side-reopen .fa {
    font-size: 14px;
}

.home-ads-preview__rail--left.is-closed .home-ads-preview__side-grid {
    display: none;
}

.home-ads-preview__rail--left.is-closed {
    width: 0;
    overflow: visible;
}

.home-ads-preview__rail--left.is-closed .home-ads-preview__side-reopen {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* 中部：图片格 + 文字链 */
.home-ads-preview__main {
    background: #fff;
    padding: 16px 20px 20px;
    box-sizing: border-box;
    border-top: 3px solid #194bf1;
}

.home-ads-preview__section-title {
    margin: 0 0 12px;
    font-size: 15px;
    font-weight: bold;
    color: #333;
    border-left: 4px solid #1949f1;
    padding-left: 10px;
}

/* 顶部横屏横幅（图格上方） */
.home-ads-preview__banner-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.home-ad-slot--banner {
    width: 100%;
    height: 72px;
    min-height: 0;
    overflow: hidden;
}

.home-ads-preview__grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.home-ad-slot--tile {
    aspect-ratio: 2.4 / 1;
    min-height: 52px;
    border-radius: 0;
    font-size: 12px;
    overflow: hidden;
    padding: 0;
}

.home-ads-preview__text-sections {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    margin-top: 0;
}

/* 文字链配图：与顶部横屏同规格，独占一行 */
.home-ads-preview__text-banner-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* 纯文字链：固定 5 列，不足 5 个时仍各占 1/5 宽（不拉伸） */
.home-ads-preview__text-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    overflow: hidden;
}

.home-ads-preview__text-grid > .home-ad-slot--text {
    min-width: 0;
    box-sizing: border-box;
}

.home-ad-slot--text {
    flex: none;
    width: auto;
    padding: 0;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.35;
    background: transparent;
    border: none;
    border-radius: 0;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    text-decoration: none;
    overflow: hidden;
    text-shadow: none;
    cursor: pointer;
}

/* 纯文字链：黄底红框，单行横排；超出格子宽度时从右向左滚动 */
.home-ad-slot--text.home-ad-slot--text-plain {
    height: 36px;
    min-height: 0;
    padding: 0 6px;
    background: #ffffcc;
    outline: 1px solid #e08080;
    outline-offset: -1px;
}

.home-ad-text-marquee {
    flex: 1;
    min-width: 0;
    width: 100%;
}

.home-ad-text-marquee__viewport {
    overflow: hidden;
    width: 100%;
}

.home-ad-text-marquee__track {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
}

.home-ad-text-marquee__text {
    display: inline-block;
    white-space: nowrap;
    line-height: 1.35;
}

.home-ad-slot--text-plain.is-marquee .home-ad-text-marquee__text {
    padding-right: 2rem;
}

.home-ad-slot--text-plain.is-marquee .home-ad-text-marquee__track {
    animation: home-ad-text-marquee-scroll var(--home-ad-marquee-duration, 12s) linear infinite;
}

.home-ad-slot--text-plain.is-marquee:hover .home-ad-text-marquee__track {
    animation-play-state: paused;
}

.home-ad-slot--text-plain:not(.is-marquee) .home-ad-text-marquee__text[aria-hidden="true"] {
    display: none;
}

.home-ad-slot--text-plain:not(.is-marquee) .home-ad-text-marquee__track {
    display: flex;
    width: 100%;
    justify-content: center;
}

@keyframes home-ad-text-marquee-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

.home-ad-slot--text.home-ad-text--blue,
.home-ad-slot--text.home-ad-text--blue:hover {
    color: #0000ee;
}

.home-ad-slot--text.home-ad-text--red,
.home-ad-slot--text.home-ad-text--red:hover {
    color: #ee0000;
}

.home-ad-slot--text:hover {
    text-decoration: none;
    opacity: 0.85;
}

/* 底部横屏横幅（5 窗上下各 1 条） */
.home-ads-preview__footer-banner-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e8e8e8;
}

.home-ads-preview__footer-banner-row--bottom {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.home-ads-preview--footer-only .home-ads-preview__footer-banner-row:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* 底部 5 窗（功能页样式预览） */
.home-ads-preview__footer-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.home-ads-preview--footer-only .home-ads-preview__footer-banner-row + .home-ads-preview__footer-row {
    margin-top: 12px;
    padding-top: 0;
    border-top: none;
}

.home-ad-slot--footer {
    min-height: 72px;
    aspect-ratio: 3 / 1;
}

/* 通用占位块 */
.home-ad-slot {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: rgba(255, 255, 255, 0.95);
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
    /* border: 1px solid rgba(0, 0, 0, 0.08); */
    box-sizing: border-box;
    cursor: default;
    user-select: none;
}

.home-ad-slot--placeholder {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.home-ad-slot--c1 { background: linear-gradient(135deg, #f12711, #f5af19); }
.home-ad-slot--c2 { background: linear-gradient(135deg, #11998e, #38ef7d); }
.home-ad-slot--c3 { background: linear-gradient(135deg, #4776e6, #8e54e9); }
.home-ad-slot--c4 { background: linear-gradient(135deg, #c31432, #240b36); }
.home-ad-slot--c5 { background: linear-gradient(135deg, #00c6ff, #0072ff); }
.home-ad-slot--c6 { background: linear-gradient(135deg, #f7971e, #ffd200); }
.home-ad-slot--c7 { background: linear-gradient(135deg, #654ea3, #eaafc8); }
.home-ad-slot--c8 { background: linear-gradient(135deg, #2193b0, #6dd5ed); }
.home-ad-slot--c9 { background: linear-gradient(135deg, #ee0979, #ff6a00); }
.home-ad-slot--c10 { background: linear-gradient(135deg, #56ab2f, #a8e063); }
.home-ad-slot--c11 { background: linear-gradient(135deg, #834d9b, #d04ed6); }
.home-ad-slot--c12 { background: linear-gradient(135deg, #373b44, #4286f4); }

.home-ad-slot--text.home-ad-slot--placeholder,
.home-ad-slot--text.home-ad-slot--text-plain.home-ad-slot--placeholder {
    color: #999;
    text-shadow: none;
    background: #ffffcc;
    outline: 1px solid #e08080;
    outline-offset: -1px;
    font-weight: bold;
    cursor: default;
}

.home-ad-slot--side.home-ad-slot--placeholder,
.home-ad-slot--footer.home-ad-slot--placeholder {
    background: #f0f2f5;
    color: #999;
    text-shadow: none;
    border: 1px dashed #bbb;
    font-weight: normal;
    font-size: 11px;
}

.home-ad-slot--side a,
.home-ad-slot--tile a,
.home-ad-slot--banner a,
.home-ad-slot--footer a {
    display: block;
    width: 100%;
    height: 100%;
}

.home-ad-slot--side img,
.home-ad-slot--tile img,
.home-ad-slot--banner img,
.home-ad-slot--footer img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.home-ad-slot--side:has(img),
.home-ad-slot--tile:has(img),
.home-ad-slot--banner:has(img),
.home-ad-slot--footer:has(img) {
    display: block;
    position: relative;
    padding: 0;
    background: #f0f2f5 !important;
    color: inherit;
    text-shadow: none;
}

.home-ad-slot--side:has(img) a,
.home-ad-slot--side:has(img) > img,
.home-ad-slot--tile:has(img) a,
.home-ad-slot--tile:has(img) > img,
.home-ad-slot--banner:has(img) a,
.home-ad-slot--banner:has(img) > img,
.home-ad-slot--footer:has(img) a,
.home-ad-slot--footer:has(img) > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
}

.home-ads-preview--footer-only {
    margin-top: 0;
    padding-bottom: 24px;
}

@media (max-width: 1500px) {
    .home-ads-preview__rail {
        display: none;
    }
}

@media (max-width: 1199px) {
    .home-ads-preview__grid {
        grid-template-columns: repeat(4, 1fr);
    }

    .home-ads-preview__footer-row {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 767px) {
    .home-ads-preview__grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .home-ads-preview__footer-row {
        grid-template-columns: repeat(2, 1fr);
    }

    .home-ads-preview__text-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-ad-slot--text-plain {
        height: 32px;
        font-size: 12px;
        padding: 0 4px;
    }
}
