/* =========================================================
   人民艺术 · 首页专属样式（只有 index.html 引用）
   配色变量在 style.css 的 :root 里，这里只写首页的版式尺寸。

   【首页参数速查 · 想快速改就看这张表】
   · 顶部介绍区厚度 .......... .top-section 的 padding（第 1 段）
   · 大标题字号 .............. .intro-content h1 的 font-size
   · 介绍正文 .............. .intro-content p 的 font-size / line-height / max-width
   · 右上动图框的大小 ........ .hero-gif-box 的 flex-basis(宽) / height(高)
   · 左文右图占比 ............ .text-frame 的 flex : .image-frame 的 flex（现在是 1.3 : 1.7）
   · 首页图片比例 ............ .img-wrapper 的 aspect-ratio（16 / 9，可改成 4 / 3）
   · 顶部动图框的留白 ........ .hero-gif-box 的 padding（0 = 图铺满）
   · 动图怎么换 .............. 直接替换 assets/images/hero.gif（建议 480×192 左右）
   · 顶部距屏幕顶端距离 ...... 不在这里，在 style.css 的 :root 变量 --page-gap-top
   · 文字区左右留白 .......... .text-frame 的 padding
   · 两条文字的间距 .......... .text-rows 的 gap
   · 正文显示几行 ............ .article-content 的 -webkit-line-clamp（现在是 4）
   · 图像区留白 .............. .image-frame 的 padding
   · 图像圆角 ................ .img-wrapper 的 border-radius
   · 图片说明条 .............. .img-caption 的字号与渐变
   · 整页是否压在一屏内 ...... 文件末尾「一屏布局」那段
   · 文字 / 图像多久换一条 .... 在 js/app.js 里搜 TEXT_INTERVAL（8000ms）与 IMAGE_INTERVAL
   ========================================================= */

/* ---------------- 1. 顶部介绍区（左侧大标语 + 右侧视频） ---------------- */
.top-section {
    display: flex;
    flex-wrap: wrap;
    padding: 5px  1.5rem 0;           /* 上 5px、下 0，内容尽量贴顶 */
    gap: 1.2rem;                     /* 左侧文字与右侧视频之间的距离 */
    position: relative;
    overflow: hidden;
}

.intro-content {
    flex: 2;                         /* 与右侧视频的宽度比例，2 : 1 */
    min-width: 280px;                /* 窄屏时允许的最小宽度，再窄就换行 */
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.intro-content h1 {
    font-size: 1.5rem;               /* 首页大标题字号：想更醒目可调到 1.8rem */
    font-weight: 700;
    color: #e8eeff;
    margin-bottom: 0.45rem;          /* 标题与正文的距离 */
    line-height: 1.2;
    text-shadow: 0 0 20px rgba(120, 160, 255, 0.3); /* 标题发光，最后一位是强度，0 即关闭 */
}

.intro-content p {
    font-size: 0.82rem;              /* 介绍文字字号 */
    line-height: 1.6;                /* 行距：1.6 倍字号 */
    color: #a8b4d4;
    max-width: 780px;                /* 一行最长多少，太宽会不好读 */
}

/* 顶部简介的打字机光标（app.js 的 typewriter() 生成） */
.intro-content p .type-text { white-space: pre-wrap; }        /* 保留空格，中文正常断行 */

.intro-content p .type-cursor {
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 2px;
    background: #9db4e8;              /* 光标颜色 */
    vertical-align: -0.12em;
    animation: typeBlink 1s steps(1) infinite;
}

.intro-content p .type-cursor.done { animation-duration: 1.6s; opacity: 0.7; }

@keyframes typeBlink {
    0%, 49%   { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.intro-content .intro-lead {
    color: #c3cfe8;                  /* 第一行固定文字：比正文亮一点 */
    margin-bottom: 0.35rem;          /* 与下面打字内容的间距 */
}

.intro-content .intro-type {
    min-height: 1.6em;               /* 打字机占位，避免第二行还没开始打时高度塌掉 */
}

.hero-gif-box {
    flex: 0 0 420px;                 /* 固定宽度 420px（不随内容伸缩） */
    max-width: 420px;
    height: 168px;                   /* 图片框高度：改小整块更矮，改大更气派 */
    background: transparent;         /* 底色透明：让 GIF 的透明区域透出后面的星空 */
    border: 0;                       /* 不显示边框 */
    border-radius: 0;                /* 不要圆角；想恢复改 1.2rem */
    box-shadow: none;                /* 不要投影 */
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;              /* 与左侧文字垂直居中 */
    position: relative;
}

/* GIF 按原比例完整显示（contain 不裁切、不变形）；想让它裁满改 cover */
.hero-gif {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: transparent;
    border-radius: 0;
    mix-blend-mode: screen;          /* 让亮部叠在星空上更自然；想纯原图显示把这行删掉 */
    pointer-events: none;            /* 只是装饰，不挡鼠标 */
}

/* ---------------- 2. 图文区（左文字 / 右图像） ---------------- */
.content-section {
    display: flex;
    flex-wrap: wrap;                 /* 窄屏放不下时换行；大屏被末尾的 nowrap 覆盖成一行 */
    gap: 1.1rem;                     /* 文字区与图像区的距离 */
    align-items: stretch;            /* 两者等高 */
}

.text-frame {
    flex: 1.3;                       /* ★ 与右侧图像的分宽比（现在是 1.3 : 1.7，原来 1 : 2）；想让文字再宽就继续调大 */
    min-width: 360px;
    padding: 1.05rem 1.2rem;         /* 文字区留白：上 / 左右 / 下，改小能放下更多字 */
    display: flex;
    flex-direction: column;
    position: relative;
}

.text-rows {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;                    /* 上下两条文字之间的空隙 */
    flex: 1;                         /* 占满文字区高度，两条平分 */
    min-height: 0;                   /* 允许被压缩，否则一屏装不下 */
}

.text-row { flex: 1; position: relative; overflow: hidden; } /* 单条的位置容器，超出裁掉 */
.text-stage { position: relative; width: 100%; height: 100%; }

/* 文字流星飞出：进场从上方旋转落下，退场向下甩出 */
.text-slide {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-150%) rotateX(10deg) scale(0.7);   /* 起始位置：上方 150% 处 */
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1); /* 0.9s = 入场时长，改小更快 */
    will-change: transform, opacity;
}

.text-slide.active { opacity: 1; transform: translateY(0) rotateX(0deg) scale(1); pointer-events: auto; } /* 停稳状态 */
.text-slide.exit {
    opacity: 0;
    transform: translateY(150%) rotateX(-10deg) scale(0.7);   /* 退场：向下 150% */
    transition: opacity 0.75s cubic-bezier(0.55, 0, 0.78, 0.42), transform 0.75s cubic-bezier(0.55, 0, 0.78, 0.42); /* 0.75s = 退场时长 */
}

.article-header {
    margin-bottom: 0.4rem;           /* 标题块与正文的距离 */
    padding-bottom: 0.35rem;
    border-bottom: 1px solid rgba(120, 160, 255, 0.15); /* 标题下的细分隔线（装饰线，不是容器边框） */
}

.article-title { font-size: 1.02rem; font-weight: 700; color: #e8eeff; margin-bottom: 0.35rem; } /* 条目标题字号 */

.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.7rem;              /* 作者 / 日期 / 分类之间的间距 */
    font-size: 0.68rem;              /* 信息行字号 */
    color: #7a8ab0;
}

.article-category {
    padding: 0.06rem 0.5rem;         /* 分类小标签的内边距 */
    background: rgba(120, 160, 255, 0.12);
    border: 1px solid rgba(120, 160, 255, 0.25); /* 标签描边（标签不是容器，保留） */
    border-radius: 20px;             /* 胶囊圆角 */
    color: #9ab4ff;
    font-size: 0.64rem;              /* 标签字号 */
}

.article-body { flex: 1; overflow: hidden; } /* 正文区占满剩余高度 */

.article-content {
    font-size: 0.78rem;              /* 首页正文字号（比内页小，为了一屏放下） */
    line-height: 1.55;
    color: #a8b4d4;
    display: -webkit-box;
    -webkit-line-clamp: 4;           /* 最多显示几行，多出的显示省略号：改 3 更省高度，改 5 更满 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.show-more-wrap { display: flex; justify-content: flex-end; margin-top: 0.25rem; } /* “阅读全文”按钮靠右 */

/* ---------------- 3. 图像区（右滑出轮播） ---------------- */
.image-frame {
    flex: 1.7;                       /* ★ 与左侧文字的分宽比（1.7 : 1.3）；调大图片更宽、文字更窄 */
    min-width: 400px;
    padding: 1rem 1.1rem;            /* 图像区留白 */
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-grid {
    flex: 1;
    display: flex;
    align-items: center;             /* 图片在可用高度内垂直居中，不顶到上边 */
    justify-content: center;
    position: relative;
    min-height: 0;
}

.img-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;            /* ★ 图片固定为 16:9（横图）；想改成 4:3 把这里写成 4 / 3 */
    max-height: 100%;                /* 高度不够时以容器高度为准，比例会略被压扁，但不会溢出 */
    height: auto;
    border-radius: 1.6rem;           /* 图片圆角：改小更方正 */
    overflow: hidden;
    background: transparent;         /* 图片加载前的底色改为透明（原来是 #1c1c38） */
    border: 0;                       /* 不显示边框（原来是 1px 淡蓝描边） */
    transition: transform 0.8s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.8s; /* 0.8s = 图片切换动画时长 */
}

/* 图片轮播的进出方向：diag 斜向、vert 竖向、horiz 横向（由 app.js 随机选一个） */
.img-wrapper.hidden { opacity: 0; }
.img-wrapper.exit-diag { opacity: 0; transform: translate(120%, 120%) rotate(15deg) scale(0.6); }
.img-wrapper.exit-vert { opacity: 0; transform: translateY(150%) rotateX(-15deg) scale(0.7); }
.img-wrapper.exit-horiz { opacity: 0; transform: translateX(-150%) rotateY(15deg) scale(0.7); }
.img-wrapper.enter-diag { transform: translate(-120%, -120%) rotate(-15deg) scale(0.6); opacity: 0; }
.img-wrapper.enter-vert { transform: translateY(-150%) rotateX(15deg) scale(0.7); opacity: 0; }
.img-wrapper.enter-horiz { transform: translateX(150%) rotateY(-15deg) scale(0.7); opacity: 0; }
.img-wrapper.active { opacity: 1; transform: translate(0, 0) rotate(0deg) scale(1); }

.img-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;               /* cover 裁满；想完整显示改成 contain */
    transition: opacity 0.35s;
}

.img-caption {
    position: absolute;
    bottom: 0; left: 0; right: 0;    /* 说明条贴图片底部 */
    padding: 1.5rem 1rem 1rem;       /* 上留白多，是为了让渐变过渡自然 */
    background: linear-gradient(transparent, rgba(10, 10, 30, 0.88)); /* 底部渐变压暗，让文字看得清 */
    color: #c8d4f0;
    font-size: 0.85rem;              /* 图片说明字号 */
}

/* ---------------- 4. 窄屏（≤900px）：上下排列 ---------------- */
@media (max-width: 900px) {
    .content-section { flex-direction: column; }            /* 文字在上、图片在下 */
    .text-frame, .image-frame { width: 100%; min-width: auto; }
    .top-section { flex-direction: column; }                /* 介绍区与视频上下叠 */
    .hero-gif-box { align-self: stretch; max-width: none; height: auto; aspect-ratio: 5 / 2; }
    .image-grid { min-height: 280px; }                      /* 窄屏图片区最小高度 */
    .text-rows { min-height: 420px; }                       /* 窄屏文字区最小高度 */
    .intro-content h1 { font-size: 1.6rem; }                /* 窄屏标题反而放大，因为屏窄需要更醒目 */
}

/* ---------------- 5. 首页一屏布局（≥981px 才生效） ----------------
   目的：整页（顶部区 + 广播条 + 图文区 + 播放器 + 联系我们）在
   1440×900、1600×1000 这类屏幕上不用滚动就能全部看到。
   做法：主容器锁成「一屏高度」，图文区吃掉剩余空间，内部超出裁掉。
   如果哪天想回到「内容多就往下滚」，把这一整段删掉即可。
   --------------------------------------------------------------- */
@media (min-width: 981px) {
    /* 一屏高度 = 视口高度 - body 上下各 2rem 留白（body padding 在 style.css 里改，这里跟着改） */
    body[data-page="home"] .main-wrapper { height: calc(100vh - var(--page-gap-v)); } /* 与 style.css 的顶部/底部留白联动 */

    body[data-page="home"] .top-section { flex: 0 0 auto; }  /* 顶部区固定自身高度，不被压缩 */

    /* 图文区 = 剩余全部高度；nowrap 保证左文右图在同一行，overflow 防溢出出滚动条 */
    body[data-page="home"] .content-section { flex: 1 1 auto; flex-wrap: nowrap; min-height: 320px; max-height: none; overflow: hidden; }
    body[data-page="home"] .text-frame,
    body[data-page="home"] .image-frame { min-height: 0; overflow: hidden; }
    body[data-page="home"] .text-row { min-height: 0; }                            /* 两条平分文字区高度，按内容居中排 */
    body[data-page="home"] .text-slide { height: auto; }     /* 文字按内容高度排，不强行撑满 */
    body[data-page="home"] .image-grid { min-height: 0; }
    body[data-page="home"] .img-wrapper { height: auto; max-height: 100%; } /* 图片按 16:9 撑开，超出容器才缩 */
    body[data-page="home"] .article-body { flex: none; }      /* 正文不再把“阅读全文”推到卡片最底 */
    body[data-page="home"] .img-caption { font-size: 0.76rem; padding: 1rem 1rem 0.7rem; } /* 压缩后说明条也收一点 */
}

/* ---------------- 5b. 矮屏微调（视口高度 ≤860px，比如 1280×800 的笔记本） ----------------
   这个尺寸下空间不够，把顶部区、字号、正文行数一起收一收，
   同样保证一屏放得下；想让它保持大字号就把这一整段删掉，改成允许滚动。
   ------------------------------------------------------------------------- */
@media (min-width: 981px) and (max-height: 860px) {
    body[data-page="home"] .top-section { padding: 0.45rem 1.3rem 0.85rem; gap: 1rem; }  /* 顶部区更薄 */
    body[data-page="home"] .hero-gif-box { flex: 0 0 340px; max-width: 340px; height: 136px; } /* 图片框缩小 */
    body[data-page="home"] .intro-content h1 { font-size: 1.32rem; }              /* 标题缩小 */
    body[data-page="home"] .intro-content p { font-size: 0.76rem; line-height: 1.55; }
    body[data-page="home"] .text-frame { padding: 0.85rem 1rem; }                 /* 文字区留白收窄 */
    body[data-page="home"] .image-frame { padding: 0.85rem 1rem; }                /* 图像区留白收窄 */
    body[data-page="home"] .article-title { font-size: 0.96rem; }
    body[data-page="home"] .article-content { font-size: 0.74rem; line-height: 1.5; -webkit-line-clamp: 3; } /* 正文只显示 3 行 */
}

/* ---------------- 6. 平板竖屏 / 手机（≤980px）：恢复上文字下图 ---------------- */
@media (max-width: 980px) {
    body[data-page="home"] .content-section { flex-wrap: wrap; }
    body[data-page="home"] .text-rows { min-height: 0; gap: 1rem; }
    body[data-page="home"] .text-row { flex: none; height: 240px; }  /* 手机上每条文字的固定高度 */
    body[data-page="home"] .image-grid { min-height: 240px; }        /* 手机上图片区最小高度 */
    body[data-page="home"] .hero-gif-box { flex: 1 1 auto; max-width: none; height: auto; aspect-ratio: 5 / 2; } /* 手机上图片按 5:2 自适应宽度 */
    body[data-page="home"] .text-slide { height: 100%; }
}


/* ---------------- 首页空状态（没有内容时不留空框） ---------------- */
.home-empty {
    display: flex; align-items: center; justify-content: center;
    min-height: 120px; padding: 1rem 1.2rem;
    font-size: 0.82rem; line-height: 1.8; color: #8797bb; text-align: center;
}
