/* ads.css — 广告位渲染样式（v2.3）
   原则：占位空态零盒模型（无 CLS）；「广告」角标强制显示（运营不可关，合规要求）；
   各位尺寸独立控制；移动端按位限高 + object-fit 裁剪，无横向滚动。 */

.ad-slot { min-width: 0; }

/* 渲染后的容器 */
.ad-slot .ad-box {
    position: relative;
    display: block;
    max-width: 100%;
    overflow: hidden;
    border-radius: 8px;
    background: #f4f6f8;
    text-decoration: none;
}

.ad-slot .ad-box img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* 「广告」角标：合规硬要求，伪元素保证运营无法通过内容关闭 */
.ad-slot .ad-box::after {
    content: "广告";
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    font-size: 11px;
    line-height: 1;
    padding: 3px 7px;
    color: #fff;
    background: rgba(0, 0, 0, 0.38);
    border-radius: 0 8px 0 8px;
    pointer-events: none;
}

/* ---------- 各位尺寸（桌面） ---------- */

/* A · 首页通栏 1100×90 */
.ad-slot[data-ad-slot="home_banner"] { margin: 0 0 22px; }
.ad-slot[data-ad-slot="home_banner"] .ad-box img { max-height: 90px; }

/* B · 首页侧栏卡 300×250（手机不渲染，由 data-device 控制） */
.ad-slot[data-ad-slot="home_side"] { margin: 12px 0; }
.ad-slot[data-ad-slot="home_side"] .ad-box img { max-height: 250px; }

/* D · 技术资料详情侧栏 300×250 */
.ad-slot[data-ad-slot="doc_detail_side"] { margin: 14px 0; }
.ad-slot[data-ad-slot="doc_detail_side"] .ad-box img { max-height: 250px; }

/* E · 文库阅读器详情面板 640×80（面板折叠时不可见，曝光自然不计数） */
.ad-slot[data-ad-slot="lib_reader_info"] { margin: 10px 0 0; }
.ad-slot[data-ad-slot="lib_reader_info"] .ad-box img { max-height: 80px; }

/* F · 资讯详情正文间 680×90 */
.ad-slot[data-ad-slot="news_detail_foot"] { margin: 18px 0; }
.ad-slot[data-ad-slot="news_detail_foot"] .ad-box img { max-height: 90px; }

/* G · 话题广场侧栏尾 300×250（手机不渲染） */
.ad-slot[data-ad-slot="square_side"] { margin: 12px 0; }
.ad-slot[data-ad-slot="square_side"] .ad-box img { max-height: 250px; }

/* H · 文库阅读器顶部（阅读内容之前常显横幅） */
.ad-slot[data-ad-slot="lib_reader_foot"] { margin: 6px 0 18px; }
.ad-slot[data-ad-slot="lib_reader_foot"] .ad-box img { max-height: 90px; }

/* ---------- 移动端（≤768px） ---------- */

@media (max-width: 768px) {
    .ad-slot .ad-box { border-radius: 6px; }
    .ad-slot .ad-box img { max-height: 80px; }
    .ad-slot[data-ad-slot="home_banner"] { margin: 0 0 14px; }
    .ad-slot[data-ad-slot="home_banner"] .ad-box img { max-height: 80px; }
    /* 300×250 方图不限 80px（被 cover 裁成横条=显示不全），放行到 300px 完整展示 */
    .ad-slot[data-ad-slot="doc_detail_side"] .ad-box img { max-height: 300px; }
    .ad-slot[data-ad-slot="lib_reader_info"] { margin: 8px 0 0; }
    .ad-slot[data-ad-slot="lib_reader_info"] .ad-box img { max-height: 70px; }
    .ad-slot[data-ad-slot="news_detail_foot"] { margin: 14px 0; }
    .ad-slot[data-ad-slot="news_detail_foot"] .ad-box img { max-height: 70px; }
    .ad-slot[data-ad-slot="lib_reader_foot"] { margin: 4px 0 14px; }
    .ad-slot[data-ad-slot="lib_reader_foot"] .ad-box img { max-height: 70px; }
}
