/* ===================================
   mjdbjgs.com - 广告位样式 v2.0
   2026-09-18 重构：数据驱动 + 手动兜底
   =================================== */

.ad-slot {
    width: 100%;
    margin: 24px auto;
    display: flex;
    justify-content: center;
    position: relative;
}

.ad-slot[data-loading="1"] { display: none; }

/* 内嵌插槽（文章列表里） */
.ad-slot.ad-inline { margin: 18px 0; }

/* 广告卡片 */
.ad-card {
    position: relative;
    display: block;
    width: 100%;
    border-radius: var(--radius-md, 12px);
    overflow: hidden;
    text-decoration: none;
    transition: transform .2s ease, box-shadow .2s ease;
    border: 1px solid var(--bg-tertiary, #f1f5f9);
    background: var(--bg-secondary, #f8fafc);
}

.ad-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg, 0 10px 15px rgba(0,0,0,.1));
}

/* 图片型 */
.ad-card.ad-image img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 180px;
    object-fit: cover;
}

/* 文字/HTML 型 */
.ad-card.ad-text {
    padding: 18px 22px;
}
.ad-card.ad-text .ad-title {
    font-size: 1.02rem;
    font-weight: 700;
    margin-bottom: 6px;
    line-height: 1.4;
}
.ad-card.ad-text .ad-desc {
    font-size: .88rem;
    line-height: 1.7;
    opacity: .85;
    margin: 0;
}
.ad-card.ad-text .ad-cta {
    display: inline-block;
    margin-top: 10px;
    font-size: .85rem;
    font-weight: 600;
    opacity: .9;
}

/* 广告角标（合规要求：必须可识别） */
.ad-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: .68rem;
    line-height: 1;
    padding: 4px 7px;
    border-radius: 4px;
    background: rgba(0,0,0,.42);
    color: #fff;
    letter-spacing: .5px;
    z-index: 2;
    backdrop-filter: blur(2px);
}
.ad-card.ad-text .ad-badge {
    background: rgba(0,0,0,.08);
    color: inherit;
    opacity: .6;
}

/* 侧边栏方图 */
.ad-slot.ad-sidebar .ad-card { max-width: 300px; }
.ad-slot.ad-sidebar .ad-card.ad-image img { max-height: 250px; }

/* 悬停关闭按钮（悬浮角标用） */
.ad-close {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0,0,0,.55);
    color: #fff;
    font-size: 13px;
    line-height: 1;
    cursor: pointer;
    z-index: 3;
    display: none;
}
.ad-dismissible:hover .ad-close { display: block; }

@media (max-width: 640px) {
    .ad-card.ad-text { padding: 14px 16px; }
    .ad-card.ad-text .ad-title { font-size: .95rem; }
    .ad-card.ad-text .ad-desc { font-size: .82rem; }
}

/* 侧边悬浮广告容器（宽屏显示，窄屏自动隐藏） */
.ad-float-wrap {
    display: none;
}
/* 只在正文（最宽 840px 居中）两侧确实有余量时才显示，
   用 left: calc(50% + 440px) 锚定在正文右边缘之外，杜绝压字 */
@media (min-width: 1500px) {
    .ad-float-wrap {
        display: block;
        position: fixed;
        left: calc(50% + 440px);
        right: auto;
        top: 110px;
        width: 300px;
        z-index: 40;
    }
    .ad-float-wrap .ad-slot { margin: 0; }
}
