
/* home/static/home/css/home_page.css */

/* ===== CSS 自定义属性 ===== */
:root {
    --primary-color: #3273dc;
    --text-muted: #7a7a7a;

    /* 背景色系 - 青少年编程主题 */
    --bg-white: #ffffff;
    --bg-light-blue: #f0f4ff;
    --bg-light-purple: #f5f0ff;
    --bg-light-cyan: #e8f8ff;

    --border-light: rgba(0, 0, 0, 0.05);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --white-alpha-20: rgba(255, 255, 255, 0.2);
    --white-alpha-40: rgba(255, 255, 255, 0.4);
    --white-alpha-80: rgba(255, 255, 255, 0.8);
    --white-alpha-90: rgba(255, 255, 255, 0.9);
    --accent-yellow: #ffdd57;

    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    --radius-md: 0.75rem;

    --container-max-width: 1400px;

    --transition-base: all 0.3s;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-xl) 0;
}

.stat-card {
    background: white;
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-base);
    border: 1px solid var(--border-light);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stat-number {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-label {
    color: var(--text-muted);
    margin-top: var(--spacing-xs);
    font-size: 0.9rem;
    font-weight: 500;
}

/* ===== 频道入口卡片 ===== */
.channel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.channel-card {
    text-align: center;
    padding: var(--spacing-lg) var(--spacing-sm);
    border-radius: var(--radius-md);
    transition: var(--transition-base);
    cursor: pointer;
    color: white;
    box-shadow: var(--shadow-sm);
}

.channel-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.channel-icon {
    font-size: 3rem;
    margin-bottom: var(--spacing-sm);
}

.channel-card .title {
    color: white;
    font-size: 1.3rem;
}

/* ===== 关于我们区块 =====
   配合下方暖沙渐变背景，文字统一用暖棕色系，
   避免冷灰字浮在暖底上、破坏这一段的温馨氛围；
   整块是「标语式」版块，上下留白比通用的 3rem 收紧到 2rem */
.about-section {
    padding: var(--spacing-lg) 0;
}

/* 字号与字重由下方「版块标题统一规格」给出，这里只管暖棕色 */
.about-section .title {
    color: #3d2f22;
}

/* 字号跟着标题一起收：Bulma 的 is-5 是 1.25rem，标题降到 1.75rem 后
   副标题与标题几乎同量级，层级不清；1.1rem 略大于正文（1.05rem）、
   明显小于标题，靠弱化的暖棕底色体现主次 */
.about-section .subtitle {
    color: #8a7a68;
    margin-top: 0.5rem;
    font-size: 1.1rem;
    font-weight: 400;
}

/* 正文上边距原为行内 2rem，收到 1.5rem；宽度限制一并挪到样式表 */
.about-section .content {
    max-width: 1000px;
    margin: 1.5rem auto 0;
    font-size: 1.05rem;
    line-height: 1.8;
    color: #4d4237;
}

/* 按钮容器原用 Bulma 的 mt-5（1.5rem），收到 1rem */
.about-cta {
    margin-top: 1rem;
}

/* ===== 关于我们全宽背景 =====
   这一段是站点的「宣传标语」，改用暖白 → 暖沙的柔和渐变，
   既与上方中性灰的编程分享区分开，又比原来的浅青更温馨；
   自上而下形成「灰 → 暖 → 紫色页脚」的自然过渡 */
.about-fullwidth {
    background: linear-gradient(180deg, #fffdf8 0%, #fdf3e4 100%);
    width: 100%;
    padding-bottom: 0;
}

/* ===== 主容器样式 ===== */
.main-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--spacing-sm);
}

/* ===== 轮播图全宽样式 ===== */
.swiper-fullwidth {
    width: 100%;
    margin: 0;
    padding: 0;
    background: var(--bg-white);
}

.swiper-fullwidth .swiper {
    border-radius: 0;
}

/* ===== 响应式设计 ===== */
@media (max-width: 768px) {
    .about-section {
        padding: var(--spacing-md) 0;
    }

    .about-section .content {
        font-size: 0.95rem;
    }

    /* 版块标题窄屏统一缩小（含「关于我们」） */
    .section-title-wrapper .title,
    .about-section .title {
        font-size: 1.5rem;
    }

    /* 副标题随标题同步缩小，保持与正文（0.95rem）的层级差 */
    .about-section .subtitle {
        font-size: 1rem;
    }

    .channel-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: var(--spacing-sm);
    }

    .channel-card {
        padding: var(--spacing-md) 0.5rem;
    }

    .channel-icon {
        font-size: 2.5rem;
    }

    .channel-card .title {
        font-size: 1.1rem;
    }
}

/* ===== 网站公告区块 ===== */
.announcement-section {
    background: #ffffff;
    padding: var(--spacing-xl) 0;
}

.announcement-section .section-title-wrapper {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: var(--spacing-md);
}

.announcement-content {
    background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
    border-radius: 1rem;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
}

.announcement-content ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.announcement-content li {
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
    background: white;
    border-radius: 0.75rem;
    border-left: 4px solid #ffc107;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    line-height: 1.8;
    color: #333;
    transition: all 0.3s ease;
    position: relative;
}

.announcement-content li::before {
    content: '📌';
    position: absolute;
    left: -2.5rem;
    top: 1.25rem;
    font-size: 1.2rem;
}

.announcement-content li:last-child {
    margin-bottom: 0;
}

.announcement-content li:hover {
    transform: translateX(8px);
    box-shadow: 0 6px 16px rgba(255, 193, 7, 0.25);
    border-left-color: #ff9800;
}

.announcement-content p {
    margin: 0.5rem 0;
    line-height: 1.8;
}

.announcement-content strong {
    color: #856404;
    font-weight: 600;
}

.announcement-content a {
    color: #ff9800;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px dashed #ff9800;
}

.announcement-content a:hover {
    color: #f57c00;
    border-bottom-style: solid;
}

/* ===== 通用区块样式 ===== */
.content-section {
    padding: var(--spacing-xl) 0;
    position: relative;
}

/* 最新真题区块 - 浅蓝色背景
   区块内容是三行场次卡，本身不高，上下留白比通用区块的 3rem 收紧到 2rem，
   避免整块看着空、把页面拉长（其余区块仍用 .content-section 默认内边距） */
.content-section[aria-label="最新真题"] {
    background: #e3f2fd;
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    margin-bottom: 0;
}

/* 该区块的「标题 → 内容」间距同步收紧 */
.content-section[aria-label="最新真题"] .section-title-wrapper {
    margin-bottom: var(--spacing-md);
    padding-bottom: 0;
}

/* 最新文章区块 - 近中性浅灰背景
   原先用浅紫 #f3e5f5，与「编程技术」标签色 #ede7f6 几乎同色，标签会"陷"进背景；
   改为中性浅灰后四种分类标签都能读出来，同时在相邻的浅蓝（真题）、浅青（关于我们）
   之间形成一条干净的留白带；内容只有「头条 + 条目列表」，上下留白取与内容相称的值 */
.content-section.article-section {
    background: #f6f7f9;
    padding-top: var(--spacing-lg);
    padding-bottom: var(--spacing-lg);
    margin-bottom: 0;
}

/* 该区块的「标题 → 内容」间距同步收紧 */
.article-section .section-title-wrapper {
    margin-bottom: var(--spacing-md);
    padding-bottom: 0;
}

.section-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
    padding-bottom: var(--spacing-sm);
    border-bottom: none;
}

.section-title-wrapper .title {
    margin-bottom: 0;
    flex: 1;
    text-align: center;
}

/* 版块标题统一规格：首页各版块标题（含「关于我们」）共用同一字号 + 字重。
   两处各写一份容易漂移；且 Bulma 的 .title 默认字重是 800（extrabold），
   比这里要的 600 更重——同字号下也会显得大一号，所以字重要一起管住。 */
.section-title-wrapper .title,
.about-section .title {
    font-size: 1.75rem;
    font-weight: 600;
}

.section-title-wrapper .button {
    font-weight: 600;
    border-width: 2px;
}

@media (max-width: 768px) {
    .section-title-wrapper {
        flex-direction: column;
        gap: var(--spacing-sm);
    }

    /* 窄屏左对齐；字号由上面的「版块标题窄屏统一缩小」规则给出 */
    .section-title-wrapper .title {
        text-align: left;
    }
}

/* 「最新真题」场次行 + 等级胶囊的样式已抽到
   lemon_oj/css/exam_sessions.css（在线题库页共用），本文件不再重复定义。 */

/* ===== 最新文章模块：头条 + 条目列表 =====
   与上方「最新真题」的卡片网格刻意区分：左侧一张头条大卡承载摘要，
   右侧是扁平的条目列表（无卡片底、无阴影、无徽标），
   避免两个区块都是同规格白card而显得雷同。 */
.article-showcase {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    gap: var(--spacing-lg);
}

/* ---- 左侧头条卡 ---- */
.article-featured {
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    padding: var(--spacing-md) var(--spacing-lg);
    background: white;
    border-radius: var(--radius-md);
    /* 区块底色改为浅灰后，白卡靠阴影维持边缘清晰度 */
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.07);
    color: inherit;
    text-decoration: none;
    transition: var(--transition-base);
}

.article-featured:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 26px rgba(102, 126, 234, 0.22);
}

/* 分类标签：头条卡与条目列表共用，配色与编程分享列表页的 .tag-category 一致，
   让「分类 → 颜色」在站内形成稳定识别 */
.article-cat {
    flex-shrink: 0;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    white-space: nowrap;
    background: #eef1ff;
    color: var(--primary-color);
}

.article-cat.tool { background: #e3f2fd; color: #1976d2; }
.article-cat.news { background: #e8f5e9; color: #388e3c; }
.article-cat.share { background: #ede7f6; color: #5e35b1; }
.article-cat.tip { background: #fff3e0; color: #f57c00; }

/* 头条卡的分类标签与右上角权限角标：显式定高 + 内容居中，
   两者高度一致才能在同一水平线上（否则会是两个不同高度的盒子顶部对齐，文字肉眼错位） */
.article-featured .article-cat,
.article-featured .post-badge {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    height: 1.7rem;
    padding: 0 0.7rem;
    font-size: 0.75rem;
    line-height: 1;
}

/* 头条卡里的分类标签：单独占一行，左对齐 */
.article-featured .article-cat {
    align-self: flex-start;
    margin-bottom: var(--spacing-sm);
}

/* 头条卡的权限角标固定右上角（与编程分享卡片一致），不占文字流 */
.article-featured .post-badge {
    position: absolute;
    top: var(--spacing-md); /* 与 .article-featured 的 padding 对齐 */
    right: var(--spacing-lg);
}

/* 查看权限角标（会员 / 高级会员 / VIP会员）：与编程分享列表页 .post-badge 同款，
   让「会员内容」在首页也能一眼识别。
   locked = 当前用户看不了 → 橙色实心 + 锁图标；open = 已有权限 → 浅色弱化 */
.post-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.14rem 0.45rem;
    border-radius: 0;
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}

/* 条目列表的「会员专享」标记：锁图标 + 悬停提示（原文案放在 title 属性里），
   不再用彩色角标。原因：角标是 flex 流内元素、宽度随文案变化，会把本行标题
   往右挤——定宽的分类单元格只保证「分类列」对齐，标题列仍会错位。
   位置放在标题之后、日期之前：标题起点对每一行都一致，日期依旧右对齐，
   锁定状态也落在统一的列位上，纵向扫读时位置稳定。 */
.article-brief-lock {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    line-height: 1;
    color: #c5cad3; /* 有权限：淡灰，只作「这是会员内容」的弱提示 */
    cursor: help;
}

/* 当前用户看不了这篇：橙锁，提示需要更高等级的会员 */
.article-brief-lock.is-locked {
    color: #ef6c00;
}

/* 条目列表里的分类标签列：用定宽容器包住标签，标题起点由容器宽度决定，
   与分类名长短、字体度量彻底解耦。
   （只给标签本身设 min-width 不够：6 字的「编程工具及资源」自身就比 min-width 宽，
   仍会把标题顶开——部分中文字体的全宽字宽略大于 1em。）
   标签本身保持自然宽度、左对齐，不拉长变形。 */
.article-brief .article-cat-cell {
    flex: 0 0 6.4rem;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* 标签高度与同行的权限角标一致（1.5rem），有无角标的行高也就统一了 */
.article-brief .article-cat-cell .article-cat {
    display: inline-flex;
    align-items: center;
    box-sizing: border-box;
    height: 1.5rem;
}

.post-badge-locked {
    background: #fff3e0;
    color: #ef6c00;
}

.post-badge-open {
    background: #f1f3f6;
    color: #6b7280;
}

.article-featured-title {
    font-size: 1.4rem;
    font-weight: 700;
    line-height: 1.45;
    color: #2c3e50;
    margin-bottom: var(--spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s;
}

.article-featured:hover .article-featured-title {
    color: var(--primary-color);
}

.article-featured-lead {
    font-size: 0.92rem;
    line-height: 1.75;
    color: #6b7280;
    margin-bottom: var(--spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.article-featured-meta {
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--spacing-sm);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.article-featured-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.article-featured-meta i {
    color: var(--primary-color);
    font-size: 0.75rem;
}

/* 「阅读全文」推到最右，形成行动引导 */
.article-featured-more {
    margin-left: auto;
    font-weight: 600;
    color: var(--primary-color);
}

.article-featured-more i {
    transition: var(--transition-base);
}

.article-featured:hover .article-featured-more i {
    transform: translateX(3px);
}

/* ---- 右侧条目列表 ---- */
.article-brief-panel {
    display: flex;
    flex-direction: column;
}

.article-brief-list {
    flex: 1;
    list-style: none;
    margin: 0;
    padding: 0;
}

.article-brief {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.7rem 0.75rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: 0.5rem;
    color: inherit;
    text-decoration: none;
    transition: var(--transition-base);
}

/* 末行也保留分割线：列表底部需要一条线收口，否则最后一条看起来是"断"的 */

.article-brief:hover {
    background: white;
    transform: translateX(4px);
    box-shadow: var(--shadow-sm);
}

.article-brief-title {
    flex: 1;
    min-width: 0;
    font-size: 0.98rem;
    font-weight: 500;
    color: #333;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    transition: color 0.3s;
}

.article-brief:hover .article-brief-title {
    color: var(--primary-color);
    font-weight: 600;
}

.article-brief-date {
    flex-shrink: 0;
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ---- 区块右下角的「查看全部」文字入口（真题 / 编程分享共用视觉） ---- */
.showcase-more {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition-base);
}

.showcase-more:hover {
    gap: 0.7rem;
}

/* 编程分享区：入口在右栏（flex 列）里，直接右对齐 */
.article-brief-panel .showcase-more {
    align-self: flex-end;
    margin-top: var(--spacing-sm);
}

/* 真题区：入口做成卡片堆栈的「尾条」——与 .exam-session 同宽、同圆角、同阴影，
   间距也取列表的 0.75rem（见 lemon_oj/css/exam_sessions.css），成为列表的一行。
   原先它直接浮在区块浅蓝底上，与上面的白卡不成一体；对比编程分享区的入口
   在列表所在容器内，就自然得多。 */
.showcase-more-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--spacing-md);
    margin-top: 0.75rem;
    padding: 0.85rem var(--spacing-md);
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.12);
}

/* 尾条左侧引导：沿用场次行的语法（渐变方块 + 主标题 + 弱化说明），
   让这条入口和上面的卡片同属一套视觉；同时补上「这块是什么、怎么用」，
   右侧只挂一个链接时左半边不再空旷。 */
.showcase-more-lead {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.showcase-more-icon {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 0.6rem;
    /* 与 .exam-session-date 同一渐变，一眼看出是同组卡片 */
    background: linear-gradient(135deg, #3298dc 0%, #3273dc 100%);
    color: white;
    font-size: 1.05rem;
}

.showcase-more-text {
    min-width: 0;
}

.showcase-more-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #2c3e50;
    line-height: 1.3;
}

.showcase-more-hint {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--text-muted, #7a7a7a);
    line-height: 1.4;
}

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: var(--spacing-xl);
    color: var(--text-muted);
}

.empty-state i {
    color: #ddd;
    margin-bottom: var(--spacing-sm);
}

.empty-state p {
    font-size: 1rem;
    margin: 0;
}

/* ===== 响应式适配 ===== */
/* 平板及以下：头条与条目列表上下堆叠，避免两栏各自被挤窄 */
@media (max-width: 1024px) {
    .article-showcase {
        grid-template-columns: 1fr;
        gap: var(--spacing-md);
    }
}

@media (max-width: 768px) {
    .section-title-wrapper {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--spacing-sm);
    }

    .article-featured {
        padding: var(--spacing-md);
    }

    /* 真题区入口尾条：内边距跟着场次行的窄屏规则收窄（exam_sessions.css 用 1rem）；
       引导区 + 链接放不下时允许换行，链接始终靠右 */
    .showcase-more-bar {
        flex-wrap: wrap;
        gap: 0.6rem;
        padding: 0.7rem var(--spacing-sm);
    }

    .showcase-more-bar .showcase-more {
        margin-left: auto;
    }

    .showcase-more-icon {
        width: 2.2rem;
        height: 2.2rem;
        font-size: 0.95rem;
    }

    .showcase-more-title {
        font-size: 0.95rem;
    }

    .showcase-more-hint {
        font-size: 0.75rem;
    }

    /* 窄屏头条卡内边距收窄，角标同步贴角 */
    .article-featured .post-badge {
        top: var(--spacing-md);
        right: var(--spacing-md);
    }

    .article-featured-title {
        font-size: 1.2rem;
    }

    /* 窄屏下分类标签列同步收窄、字号再小一号，给标题留出宽度且保持标题列对齐 */
    .article-brief .article-cat-cell {
        flex-basis: 5.6rem;
    }

    .article-brief .article-cat {
        padding: 0.15rem 0.45rem;
        font-size: 0.66rem;
    }
}

/* ===== 底部样式 ===== */
.footer-fullwidth {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin-top: 0;
    width: 100%;
}
