/* ============================================================
   首页样式 - 焦点图轮播 + 倒计时 + 10宫格 + 公告
   政务蓝主调，紧凑信息密度
   ============================================================ */

/* ---------- 焦点图轮播区（替代原 Hero） ---------- */
.banner-wrap {
    position: relative;
    width: 100%;
    /* 容器尺寸由焦点图控制（16:9），未配置时使用默认蓝色 Hero */
}

.banner-carousel {
    position: relative;
    width: 100%;
    min-height: 220px;
    max-height: 460px;  /* PC 端限制最大高度，避免大屏过高 */
    overflow: hidden;
    background: linear-gradient(135deg, #001529 0%, #003a8c 40%, #0050b3 70%, #1890ff 100%);
    margin: 0 auto;
}

/* 16:9 宽高比：采用 ::before padding-top 方案，
   兼容性优于 aspect-ratio，且避免部分浏览器在 aspect-ratio + max-height
   同时生效时错误缩减容器宽度导致焦点图两侧留白 */
.banner-carousel::before {
    content: '';
    display: block;
    padding-top: 56.25%; /* 9 / 16 = 56.25% */
}

/* PC 端：焦点图居中限制最大宽度，避免大屏过宽 */
@media (min-width: 768px) {
    .banner-carousel {
        max-width: 1200px;
    }
}

.banner-slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    pointer-events: none;
}

.banner-slide.active {
    opacity: 1;
    pointer-events: auto;
}

.banner-slide a,
.banner-slide .banner-image-wrap {
    position: absolute;
    inset: 0;
    display: block;
    /* 绝对定位 + inset:0 确保填满 .banner-slide，
       不依赖父级高度链的百分比解析，跨浏览器更稳定 */
}

.banner-slide img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;  /* 覆盖全局 img{max-width:100%}，确保图片可填满容器 */
    object-fit: cover;
    display: block;
}

.banner-slide .banner-caption {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    padding: 16px;
    background: linear-gradient(to top, rgba(0,0,0,0.55), rgba(0,0,0,0));
    color: #fff;
    font-size: 14px;
    pointer-events: none;
}
.banner-slide .banner-caption .banner-caption-title {
    font-weight: 600;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 默认 Hero（后台未配置焦点图时的蓝色占位） */
.banner-default-hero {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    padding: 40px var(--space-md);
    color: #fff;
    overflow: hidden;
}
.banner-default-hero::before {
    content: '';
    position: absolute;
    top: 30%;
    right: -50px;
    width: 400px;
    height: 400px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 50%;
}
.banner-default-hero::after {
    content: '';
    position: absolute;
    bottom: -100px;
    left: -100px;
    width: 300px;
    height: 300px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 50%;
}
.banner-default-title {
    position: relative;
    z-index: 2;
    font-size: 36px;
    font-weight: 700;
    letter-spacing: 2px;
    margin: 0 0 var(--space-sm);
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}
.banner-default-subtitle {
    position: relative;
    z-index: 2;
    font-size: 14px;
    opacity: 0.85;
    margin: 0;
    letter-spacing: 1px;
}

/* 圆点指示器 */
.banner-dots {
    position: absolute;
    bottom: 12px;
    left: 0; right: 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    z-index: 5;
    pointer-events: none;
}
.banner-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    transition: all 0.3s;
    pointer-events: auto;
}
.banner-dots .dot.active {
    background: #fff;
    transform: scale(1.15);
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
}

/* ---------- 倒计时独立区（移出焦点图，参考 home.php） ---------- */
.countdown-wrap {
    padding: 12px var(--space-md);
    background: linear-gradient(to right, #eff6ff, #dbeafe);
    border-bottom: 1px solid #dbeafe;
}

/* 加载态：默认隐藏占位，避免刷新时"加载中..."文字闪烁；JS 渲染完成后淡入 */
.countdown-wrap,
.notice-list {
    opacity: 0;
    transition: opacity 0.2s ease;
}
body.loaded .countdown-wrap,
body.loaded .notice-list {
    opacity: 1;
}

/* 倒计时区现为 .app-container 子元素，全宽显示即可，不再单独限宽 */

.countdown-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;  /* PC 端内容居中，与焦点图对齐 */
    flex-wrap: wrap;
    gap: var(--space-sm);
}

.countdown-label {
    font-size: 14px;
    font-weight: 600;
    color: #1e3a8a;
}

.countdown-numbers {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    color: #1d4ed8;
    letter-spacing: 1px;
}

.countdown-numbers .unit {
    font-size: 12px;
    font-weight: 400;
    opacity: 0.7;
    margin: 0 4px 0 1px;
}

/* ---------- 10 宫格 ---------- */
.section {
    padding: 10px 8px;
    max-width: 1200px;
    margin: 0 auto;
}

/* PC 与大屏水平内边距对齐 ycnxw.cn（px-4 / 更宽时与导航对齐） */
@media (min-width: 768px) {
    .section { padding: 14px 16px; }
}
@media (min-width: 1200px) {
    .section { padding: 14px var(--space-lg); }
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 18px;
    background: var(--c-primary);
    border-radius: 2px;
}

.menu-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: var(--space-sm);
    text-align: center;
}

.menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    color: var(--c-text);
}

.menu-icon {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 6px;
    font-size: 20px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s, box-shadow 0.3s;
}

.menu-icon svg {
    width: 1em;
    height: 1em;
    display: block;
}

/* 图标配色语义类：与 api/home.php $menus 配置一一对应（index.html 静态菜单使用）。
   注意：JS 兜底渲染（home.js renderMenus）仍生成内联样式，二者视觉保持一致 */
.menu-icon-teal {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.10), rgba(20, 184, 166, 0.20));
    color: #14b8a6;
}

.menu-icon-yellow {
    background: linear-gradient(135deg, rgba(234, 179, 8, 0.10), rgba(234, 179, 8, 0.20));
    color: #eab308;
}

.menu-icon-amber {
    background: linear-gradient(135deg, rgba(202, 138, 4, 0.10), rgba(202, 138, 4, 0.20));
    color: #ca8a04;
}

.menu-icon-indigo {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.10), rgba(99, 102, 241, 0.20));
    color: #6366f1;
}

.menu-icon-cyan {
    background: linear-gradient(135deg, rgba(6, 182, 212, 0.10), rgba(6, 182, 212, 0.20));
    color: #06b6d4;
}

.menu-icon-blue {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.10), rgba(59, 130, 246, 0.20));
    color: #3b82f6;
}

.menu-icon-green {
    background: linear-gradient(135deg, rgba(22, 163, 74, 0.10), rgba(22, 163, 74, 0.20));
    color: #16a34a;
}

.menu-icon-rose {
    background: linear-gradient(135deg, rgba(244, 63, 94, 0.10), rgba(244, 63, 94, 0.20));
    color: #f43f5e;
}

.menu-icon-solid {
    background: linear-gradient(135deg, #3b82f6, #0ea5e9);
    color: #fff;
}

.menu-item:hover .menu-icon {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.10);
}

.menu-item:active .menu-icon {
    transform: scale(0.9);
}

.menu-label {
    font-size: 10px;
    color: var(--c-text-2);
    font-weight: 600;
    line-height: 1.3;
}

.menu-item.highlight .menu-label {
    color: var(--c-danger);
    font-weight: 600;
}

/* ---------- 公告区 ---------- */
.notice-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.notice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    border-bottom: 1px solid var(--c-bg);
}

.notice-header h3 {
    font-size: 15px;
    color: var(--c-text);
    font-weight: 600;
}

/* 每条文章容器：统一大容器 + 底部分割线，连续排列 */
.notice-list li.notice-item {
    display: block;
    padding: 12px var(--space-md);
    border-bottom: 1px solid var(--c-bg);
    cursor: pointer;
    transition: background 0.2s;
}

.notice-list li.notice-item:last-child {
    border-bottom: none;
}

.notice-list li.notice-item:hover {
    background: var(--c-primary-light);
}

/* 第一行：标签 + 标题 */
.notice-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.notice-title-text {
    flex: 1;
    min-width: 0;  /* 配合 overflow:hidden 保证省略号生效 */
    font-size: 15px;
    font-weight: 500;
    color: var(--c-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* 第二行：日期 tag + 阅读数 */
.notice-meta-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 蓝色圆角日期标签（参考图片） */
.notice-date-tag {
    display: inline-block;
    font-size: 11px;
    color: var(--c-primary);
    background: var(--c-primary-light);
    padding: 2px 8px;
    border-radius: 4px;
    line-height: 1.4;
}

.notice-views {
    font-size: 12px;
    color: var(--c-text-3);
}

/* 置顶 / 加精标签（与原有样式一致） */
.notice-list .top-tag {
    color: #fff;
    background: var(--c-danger);
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.notice-list .featured-tag {
    color: #fff;
    background: #faad14;
    font-size: 11px;
    line-height: 1;
    padding: 3px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.notice-empty {
    padding: var(--space-xl);
    text-align: center;
    color: var(--c-text-3);
    font-size: 14px;
}

/* "下拉显示更多 / 收起" 按钮 */
.notice-more-btn {
    display: block;
    width: 100%;
    padding: 12px 0;
    text-align: center;
    font-size: 14px;
    color: var(--c-primary);
    background: var(--c-surface);
    border: none;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.notice-more-btn:hover {
    background: var(--c-primary-light);
    color: var(--c-primary-dark);
}

.notice-more-btn:active {
    background: #bae7ff;
}

.notice-more-btn .fa-icon {
    margin-left: 4px;
    font-size: 12px;
    transition: transform 0.2s;
}

.notice-more-btn.collapsed .fa-icon {
    transform: rotate(180deg);
}

/* ---------- 公告与 10 宫格布局（单栏全宽）---------- */
.home-grid {
    display: grid;
    /* minmax(0, 1fr)：允许轨道收缩到内容 min-content 以下，
       避免公告标题（white-space:nowrap）的 min-content 沿网格向上传播撑宽整页 */
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-lg);
    margin-top: var(--space-md);
}

/* ---------- 新手入门（对齐 ycnxw.cn 首页卡片） ---------- */
.beginner-entry {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.beginner-entry-title {
    margin: 0;
    padding: 14px var(--space-md);
    font-size: 16px;
    font-weight: 700;
    color: var(--c-text);
    border-bottom: 1px solid var(--c-bg);
}

.beginner-entry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 12px;
}

.beginner-entry-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px 8px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 10px;
    text-decoration: none;
    text-align: center;
    transition: border-color .25s, box-shadow .25s, transform .25s;
}

.beginner-entry-item:hover {
    border-color: var(--c-primary);
    box-shadow: 0 2px 10px rgba(24, 144, 255, .14);
    transform: translateY(-1px);
}

.beginner-entry-item:active {
    transform: scale(.98);
}

.beginner-entry-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    flex-shrink: 0;
    transition: transform .25s;
}

.beginner-entry-icon svg {
    width: 18px;
    height: 18px;
    display: block;
}

.beginner-entry-item:hover .beginner-entry-icon {
    transform: scale(1.1);
}

.beginner-entry-icon-green {
    background: linear-gradient(135deg, #34d399, #14b8a6);
}

.beginner-entry-icon-orange {
    background: linear-gradient(135deg, #fb923c, #ef4444);
}

.beginner-entry-icon-blue {
    background: linear-gradient(135deg, #3b82f6, #4f46e5);
}

.beginner-entry-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--c-text);
    line-height: 1.3;
}

/* ---------- PC 端响应式 ---------- */
@media (min-width: 768px) {
    .banner-carousel {
        min-height: 320px;
    }
    .banner-default-title {
        font-size: 48px;
    }
    .countdown-numbers {
        font-size: 26px;
    }
    .menu-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: var(--space-md);
    }
    .menu-icon {
        width: 64px;
        height: 64px;
        border-radius: 24px;
        margin-bottom: 10px;
        font-size: 24px;
    }
    .menu-label {
        font-size: 14px;
    }
    .home-grid {
        grid-template-columns: minmax(0, 1fr);
    }
    .beginner-entry-title {
        font-size: 18px;
        padding: 18px var(--space-lg);
    }
    .beginner-entry-grid {
        gap: 12px;
        padding: 16px;
    }
    .beginner-entry-item {
        padding: 22px 12px;
        border-radius: 14px;
        gap: 10px;
    }
    .beginner-entry-icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
    }
    .beginner-entry-icon svg {
        width: 22px;
        height: 22px;
    }
    .beginner-entry-label {
        font-size: 14px;
    }
}

/* ---------- 响应式 ---------- */
@media (min-width: 992px) {
    .banner-default-title {
        font-size: 56px;
    }
    .menu-grid {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

/* ============================================================
   暗黑模式适配
   ============================================================ */
html[data-theme="dark"] .countdown-wrap {
    background: linear-gradient(to right, rgba(22, 104, 220, 0.12), rgba(22, 104, 220, 0.2));
    border-bottom-color: var(--c-border);
}
html[data-theme="dark"] .countdown-wrap[style],
html[data-theme="dark"] .countdown-inner {
    border-color: transparent;
}
html[data-theme="dark"] .countdown-label {
    color: #8ab8f0;
}
html[data-theme="dark"] .countdown-numbers {
    color: #6d9ee8;
}
