/*
 * 轩玮导航 - 首页广告位（图片 + 文字卡）
 * @package XuWbk
 * @author 轩玮
 * @version 1.1.0
 * @description 位于首个分类标题上方的广告专区：提示条 + 大横幅 + AD 文字卡片
 *              宽度完全跟随页面内容区（.content-site），不设固定宽或最大宽
 * @contact QQ:6050640 邮箱：6050640@qq.com 网址：www.xuwbk.com
 * @copyright Copyright (c) 2026 by XuWbk.Com, All Rights Reserved.
 */
.ad-zone {
    width: 100%;
    max-width: none;
    margin: 0 0 22px;
    padding: 0;
    box-sizing: border-box;
}

/* ---------- 顶部提示条 ---------- */
.ad-zone .ad-tips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
    font-size: 13px;
}

.ad-zone .ad-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    margin-right: 10px;
    border-radius: 4px;
    background: linear-gradient(135deg, #ff8a3d, #ff5c00);
    color: #fff;
    font-size: 12px;
    line-height: 1.6;
    white-space: nowrap;
}

.ad-zone .ad-badge i {
    margin-right: 4px;
    font-size: 13px;
}

.ad-zone .ad-tip-text {
    color: #8a9099;
    white-space: nowrap;
}

.ad-zone .ad-join {
    position: relative;
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border: 1px solid #ff5c00;
    border-radius: 20px;
    color: #ff5c00;
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: all .25s ease;
}

/* ---------- 右上角标：圆形玫红 + 白色文字 ---------- */
.ad-zone .ad-corner-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: linear-gradient(135deg, #ff5473 10%, #fb6bea 100%);
    box-shadow: 0 2px 7px rgba(255, 84, 115, .45);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
    pointer-events: none;
}

/* 按钮上的小角标：略微溢出右上角 */
.ad-zone .ad-corner-badge-sm {
    top: -9px;
    right: -9px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-width: 1px;
    font-size: 10px;
    box-shadow: 0 1px 5px rgba(255, 84, 115, .5);
}

.ad-zone .ad-join i {
    margin-right: 5px;
    font-size: 14px;
}

.ad-zone .ad-join:hover {
    background: #ff5c00;
    color: #fff;
}

/* ---------- 大横幅：宽高随容器等比缩放 ---------- */
.ad-zone .ad-banners {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.ad-zone .ad-banner {
    position: relative;
    display: block;
    overflow: hidden;
    border-radius: 10px;
    background: #f2f4f7;
    min-height: 64px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, .06);
    transition: transform .25s ease, box-shadow .25s ease;
}

.ad-zone .ad-banner img {
    display: block;
    width: 100%;
    height: auto;
}

.ad-zone .ad-banner:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, .12);
}

/* ---------- AD 文字卡片 ---------- */
.ad-zone .ad-cards {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
}

.ad-zone .ad-card {
    position: relative;
    display: block;
    padding: 10px;
    border: 1px solid #eaedf1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    text-decoration: none;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.ad-zone .ad-card:hover {
    transform: translateY(-2px);
    border-color: #40e0d0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .1);
}

.ad-zone .ad-card-head {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
}

.ad-zone .ad-card-tag {
    display: inline-block;
    padding: 1px 7px;
    margin-right: 7px;
    border-radius: 3px;
    background: #e6f7f5;
    color: #22a79a;
    font-size: 11px;
    line-height: 1.7;
}

.ad-zone .ad-card-title {
    color: #333;
    font-size: 13px;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ad-zone .ad-card-pic {
    display: block;
    overflow: hidden;
    border-radius: 6px;
    background: #f2f4f7;
    min-height: 48px;
}

.ad-zone .ad-card-pic img {
    display: block;
    width: 100%;
    height: auto;
}

.ad-zone .ad-card-desc {
    display: block;
    margin-top: 9px;
}

.ad-zone .ad-card-desc i {
    display: block;
    height: 8px;
    margin-bottom: 6px;
    border-radius: 4px;
    background: #eef0f3;
}

.ad-zone .ad-card-desc i:last-child {
    width: 62%;
    margin-bottom: 0;
}

/* ---------- 文字广告：文本链接广告组 ---------- */
.ad-zone .ad-text-group {
    --at-cols: 4;
    --at-cols-m: 2;
    margin: 0 0 14px;
}

/* 纯文字广告位紧跟上方横幅，避免重复间距 */
.ad-zone.ad-zone-textonly {
    margin-top: -10px;
}

.ad-zone .ad-text-links {
    display: grid;
    grid-template-columns: repeat(var(--at-cols, 4), minmax(0, 1fr));
    gap: 14px;
}

.ad-zone .ad-text-link {
    display: block;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #eaedf1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
    text-decoration: none;
    color: var(--at-color, var(--key-color, #333));
    font-size: 13px;
    line-height: 1.5;
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.ad-zone .ad-text-link:hover {
    transform: translateY(-2px);
    border-color: #fb6bea;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .1);
}

.ad-zone .ad-text-head {
    display: flex;
    align-items: center;
    min-width: 0;
}

.ad-zone .ad-text-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ff5473 10%, #fb6bea 100%);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.ad-zone .ad-text-icon i {
    font-size: 12px;
}

/* 链接名称：与 zibll .auto-name 一致的弹性省略规则 */
.ad-zone .ad-text-label.auto-name {
    margin-left: 0.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
}

/* 卡片下方灰色骨架占位（纯装饰） */
.ad-zone .ad-text-desc {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 9px;
}

.ad-zone .ad-text-desc i {
    display: block;
    height: 8px;
    border-radius: 4px;
    background: #eef0f3;
}

.ad-zone .ad-text-desc i:first-child {
    flex: 0 0 auto;
    width: 14px;
    height: 12px;
    border-radius: 3px;
}

.ad-zone .ad-text-desc i:last-child {
    flex: 0 0 auto;
    width: 62%;
}

/* ---------- 响应式：所有广告位在任何设备上完整显示、自适应列数 ---------- */
@media (min-width: 768px) and (max-width: 1199.98px) {
    .ad-zone .ad-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 991.98px) {
    .ad-zone .ad-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 手机：横幅单列、图片卡两列、文字卡按后台移动端列数；不再隐藏任何广告位 */
@media (max-width: 767.98px) {
    .ad-zone { margin-bottom: 16px; }
    .ad-zone .ad-tips { gap: 6px 8px; margin-bottom: 10px; font-size: 12px; }
    .ad-zone .ad-badge { margin-right: 6px; padding: 2px 8px; font-size: 11px; }
    .ad-zone .ad-tip-text {
        flex: 1 1 120px;
        min-width: 0;
        white-space: normal;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .ad-zone .ad-join { padding: 4px 12px; font-size: 12px; }
    .ad-zone .ad-corner-badge-sm { top: -6px; right: 0; min-width: 16px; height: 16px; font-size: 10px; }
    .ad-zone .ad-banners,
    .ad-zone .ad-cards { gap: 10px; margin-bottom: 10px; }
    .ad-zone .ad-banners { grid-template-columns: minmax(0, 1fr); }
    .ad-zone .ad-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ad-zone .ad-card { padding: 8px; }
    .ad-zone .ad-card-pic { min-height: 0; }
    .ad-zone .ad-text-links {
        grid-template-columns: repeat(var(--at-cols-m, 2), minmax(0, 1fr));
        gap: 8px;
    }
    .ad-zone .ad-text-link { min-width: 0; padding: 8px; font-size: 12px; }
    .ad-zone .ad-text-desc i { width: 55%; }
    .ad-zone.ad-zone-textonly { margin-top: -4px; }
}

/* 窄屏列数上限：后台配置过大时自动收敛，防止文字卡被压坏 */
@media (max-width: 430px) {
    .ad-zone .ad-text-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 359.98px) {
    .ad-zone .ad-banners,
    .ad-zone .ad-cards,
    .ad-zone .ad-text-links { grid-template-columns: minmax(0, 1fr); }
    .ad-zone .ad-tip-text { flex-basis: 100%; }
}

/* 横屏矮屏：压缩广告高度，使用桌面列数，避免遮挡正文 */
@media (orientation: landscape) and (max-height: 520px) {
    .ad-zone { margin-bottom: 10px; }
    .ad-zone .ad-tips { margin-bottom: 6px; }
    .ad-zone .ad-banner img { max-height: 120px; object-fit: contain; }
    .ad-zone .ad-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .ad-zone .ad-text-links { grid-template-columns: repeat(var(--at-cols, 4), minmax(0, 1fr)); }
}

/* 触屏无悬停：关闭位移/变色，避免点按后样式粘滞 */
@media (hover: none) {
    .ad-zone .ad-banner:hover,
    .ad-zone .ad-card:hover,
    .ad-zone .ad-text-link:hover,
    .ad-zone .ad-join:hover { transform: none; box-shadow: none; }
}

/* ---------- 夜间模式 ---------- */
.io-black-mode .ad-zone .ad-tip-text {
    color: #9aa5b1;
}

.io-black-mode .ad-zone .ad-banner,
.io-black-mode .ad-zone .ad-card-pic {
    background: #2b2f36;
}

.io-black-mode .ad-zone .ad-card {
    border-color: #33383f;
    background: #252a31;
}

.io-black-mode .ad-zone .ad-card-title {
    color: #e0e4ea;
}

.io-black-mode .ad-zone .ad-card-desc i {
    background: #3a4048;
}

.io-black-mode .ad-zone .ad-text-link {
    border-color: #33383f;
    background: #252a31;
}

.io-black-mode .ad-zone .ad-text-link:hover {
    border-color: #fb6bea;
}

.io-black-mode .ad-zone .ad-text-desc i {
    background: #3a4048;
}
