/* 首页专属样式 · 线路图即首页（Rail-map Hero） */
/*-----页面变量-----*/
:root {
    --reflection-gap: 100px;/* Hero标题倒影间距 */
    --reflection-blur: 3px;/* 倒影模糊程度（越小越清晰）*/
    --reflection-opacity: 0.9;/* 倒影透明度（0-1，越大越明显）*/
    --card-reveal-delay: 0.3s;/* 卡片逐个浮出间隔时间 */
    /* 左侧线路沿线站点三色，取自竖线渐变（紫→蓝→橙），与线条统一 */
    --station-c-main: #aa0aae;/* 主线站点：竖线起始紫 */
    --station-c-sub: #ff9800;/* 次级站点：竖线末端橙 */
    --station-c-end: #246edc;/* 终点站点：竖线中段蓝 */
}

/*-----基础节布局-----*/
/*-----各节统一锁定自身裁剪：防止滚动/惯性瞬间相邻节的 ::before竖线外溢到可视区-----*/
.snap-page {
    min-height: 100dvh;
    display: block;
    position: relative;
    scroll-snap-align: start;
    scroll-margin-top: var(--header-height);
    overflow: hidden;
    /* 各节背景与body一致（#f5f5f5），保证滚屏时上下节背景连续、无颜色断层 */
    background: #f5f5f5;
}

/*-----页脚上拉时，上方未覆盖区域模糊遮罩（位于节之上、页脚之下）-----*/
.fp-blur {
    position: fixed;
    inset: 0;
    z-index: 25;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    background: #f5f5f54d;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}
.fp-blur.fp-blur-on {
    opacity: 1;
    visibility: visible;
}

/*-----页脚上拉覆盖层（默认固定在屏幕下方外、不参与文档流，最后一节之后拉起覆盖）-----*/
site-footer {
    display: block;
    position: fixed;
    left: 0; right: 0;
    bottom: 0;
    top: auto;
    max-height: calc(100dvh - var(--header-height));
    z-index: 30;
    background: #f0f0f0;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: none;
}
site-footer.fp-footer-up {
    transform: translateY(0);
    pointer-events: auto;
}
@media (prefers-reduced-motion: reduce) {
    .fp-blur,
    site-footer {
        transition: none;
    }
}

/*-----动画关键帧（通用滚动/站点脉冲）-----*/
/* 内容从下向上浮出（默认，非暗色页用） */
@keyframes slideUpFadeIn {
    from {
        opacity: 0;
        transform: translateY(60px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
/* 暗色主题：横向滑入（从轨道方向驶出） */
@keyframes slideInFromRail {
    from {
        opacity: 0;
        transform: translateX(-40px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
/* 站点圆脉冲（进入视口激活态） */
@keyframes stationPulse {
    0% { box-shadow: 0 0 0 0 #c77bce88; }
    70% { box-shadow: 0 0 0 12px #c77bce00; }
    100% { box-shadow: 0 0 0 0 #c77bce00; }
}

/*-----滚动动画通用-----*/
.animate-on-scroll {
    opacity: 0;
    transform: translateY(50px);
}
.animate-on-scroll.in-view {
    animation: slideUpFadeIn 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}
/* 暗色主题下改用横向滑入 */
.metro-dark-scheme .animate-on-scroll.in-view {
    animation: slideInFromRail 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
}

/* 卡片交错延迟 */
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(1) { animation-delay: 0s; }
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(2) { animation-delay: var(--card-reveal-delay); }
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(3) { animation-delay: calc(var(--card-reveal-delay) * 2); }
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(4) { animation-delay: calc(var(--card-reveal-delay) * 3); }
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(5) { animation-delay: calc(var(--card-reveal-delay) * 4); }
:where(.qa-grid, .quicknav-grid) .qa-card:nth-child(6) { animation-delay: calc(var(--card-reveal-delay) * 5); }

/*-----snap-content-wrapper（各节内容容器，承接顶部留白）-----*/
/* 顶部留白由wrapper承接（而非 .snap-page）：body的padding-top（nav-load.js设置）是唯一预留点，
   若再在 .snap-page上加留白会与之叠加，凭空多出一个header高度导致底部露白。
   wrapper内容高 = 100dvh-header，加自身padding-top后整节正好满屏。 */
.snap-content-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    width: 100%;
    min-height: calc(100dvh - var(--header-height));
    padding: var(--header-height) 20px 0 80px;
}

/* Hero整幅线路图：wrapper不加顶部留白，由 .hero-banner自行铺满 */
#section-1 .snap-content-wrapper {
    min-height: 100dvh;
    padding: 0 20px 0 80px;
}

/*-----竖向主线路-----*/
/* 画在 .snap-page上而非 .snap-content-wrapper上：
   wrapper位于节的padding-top(var(--header-height)) 之下，其 ::before无法覆盖节顶部这段，
   会导致每个节交界处出现一段header高度的断口（线条接不上）。挂到节本身即可整节贯穿、跨节连续。 */
.snap-page::before {
    content: '';
    position: absolute;
    left: 30px; top: 0; bottom: 0;
    width: 4px;
    background: linear-gradient(to bottom, var(--station-c-main), var(--station-c-end), var(--station-c-sub));
    border-radius: 2px;
    z-index: 0;
}

/* 首屏Hero为整幅线路图，不需要这条竖向主线 */
#section-1::before {
    display: none;
}

/*-----第一节特殊处理：Hero不需要等待in-view-----*/
/* 高度扣掉body的padding-top(var(--header-height))，使整屏恰好=100dvh(section + body padding)不可滚动。
   关键：必须显式min-height:0，否则会继承 .snap-page的min-height:100dvh，
   实际高度被max(calc(100dvh-header), 100dvh) 撑回 100dvh，叠加body padding后总高 100dvh+header → 可向下滚动。
   overflow:hidden用于裁掉SVG地图超界内容（蓝线已收进屏内，此裁切不影响其显示）。 */
#section-1 {
    height: calc(100dvh - var(--header-height));
    min-height: 0;
    overflow: hidden;
}

#section-1 .hero-banner {
    height: 100%;
    min-height: 0;
}

/*-----站点圆 / 站名标签（亮色主线，贯穿各节）-----*/

/*-----站点圆（主线站点）-----*/
.metro-station-dot {
    position: absolute;
    left: 22px; top: 80px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: #ffffff;
    border-width: 4px;
    border-style: solid;
    border-color: var(--station-c-main);
    z-index: 2;
}
/* 站点圆激活态（进入视口时脉冲） */
.metro-station-dot.in-view {
    animation: stationPulse 2s ease-out;
}

/*-----站名标签-----*/
.metro-station-label {
    position: absolute;
    left: 56px; top: 70px;
    font-size: 18px; font-weight: 700;
    color: var(--station-c-main);
    letter-spacing: 1px;
    white-space: nowrap;
    z-index: 2;
}

/*-----按站序号（与节/站数对齐）的站点标记：第1~3站普通站取竖线起始紫，第4站终点取中段蓝-----*/
.metro-station-dot-1,
.metro-station-dot-2,
.metro-station-dot-3 {
    border-color: var(--station-c-main);
}
.metro-station-dot-4 {
    border-color: var(--station-c-end);
}
.metro-station-label-1,
.metro-station-label-2,
.metro-station-label-3 {
    color: var(--station-c-main);
}
.metro-station-label-4 {
    color: var(--station-c-end);
}

/*-----Hero线路图（section-1）-----*/

/*-----横幅区-----*/
.hero-banner {
    width: 100%;
    min-height: calc(100dvh - var(--header-height));
    position: relative;
    overflow: hidden;
    z-index: 0;
}

/*-----SVG线路图容器-----*/
.rail-hero {
    position: absolute;
    inset: 0;
    /* 与 .snap-page / body一致的 #f5f5f5，滚屏时首屏与下方各节背景连续无缝 */
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

/*-----SVG画布-----*/
.rail-map-svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    /* 裁切延伸到viewBox之外(端点出屏)的线条，配合固定设计scale(不铺满)，营造"地铁图局部"感 */
    overflow: hidden;
}

/*-----线路path（描线改由CSS驱动：pathLength=1 归一化，dash=1，
   --d为起始延迟（含RISE浮出偏移）；railDraw在延迟结束后把线"画"出来。
   默认不播放（animation-name:none），待首节容器加 .revealed（加载动画去除后）才开始，
   避免浮现动效与加载遮罩淡出重叠）-----*/
.rail-line {
    fill: none;
    stroke-width: calc(6px * var(--rail-scale, 1));
    stroke-linecap: round;
    opacity: 0.85;
    /* pathLength=1 后，dasharray/offset用 1 即表示整条路径，无需写死长度 */
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    animation-name: none;
    animation-duration: 2.5s;
    animation-timing-function: ease-out;
    animation-fill-mode: both;
    animation-delay: var(--d, 0s);
}

/* 描线动画：dashoffset 1→0 即整条路径由隐藏到完整显现 */
@keyframes railDraw {
    to { stroke-dashoffset: 0; }
}

/*-----站点圆（先浮后绘：与文字一起由stopRise淡出（opacity 0→1），
   再让线路开始描线；默认不播放，待 .revealed才浮现；reduced-motion由终态兜底）-----*/
.rail-stop {
    fill: #ffffff;
    stroke-width: calc(2.5px * var(--rail-scale, 1));
    stroke: var(--station-c-main);
    opacity: 0;
    animation-name: none;
    animation-duration: 0.6s;
    animation-timing-function: ease-out;
    animation-fill-mode: both;
    /* 站点浮出与文字对齐，延迟由 --d控制（枢纽站经index.js注入） */
    animation-delay: var(--d, 0s);
}

/* 站点浮出：仅用opacity避免SVG circle transform与toPx坐标冲突 */
@keyframes stopRise {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* 加载动画去除后，首节容器加 .revealed才播浮现/描线动效 */
.rail-hero.revealed .rail-line {
    animation-name: railDraw;
}
/* 文字（标题/起点站标签）同步改为纯淡入（复用stopRise的opacity 0→1，
   不改transform，避免破坏 .hero-title的居中定位translateX(-50%)） */
.rail-hero.revealed .hero-title,
.rail-hero.revealed .rail-stop-label {
    animation-name: stopRise;
}
.rail-hero.revealed .rail-stop {
    animation-name: stopRise;
    animation-duration: 0.6s;
    animation-fill-mode: both;
}

/* 交会枢纽站点（更大、亮色，浮出延迟由index.js经 --d注入；半径由属性r控制） */
.rail-stop--hub {
    stroke: #ffcc00;
    stroke-width: calc(3px * var(--rail-scale, 1));
}

/* 换乘站（线路交叉点）：醒目双色描边，与途经普通站(单一描边)区分 */
.rail-stop--transfer {
    stroke: #1a1a2e;
    stroke-width: calc(2.5px * var(--rail-scale, 1));
    fill: #ffffff;
}

/*-----Hero标题（保留倒影）-----*/
.hero-title {
    color: #1a1a1a;
    font-size: calc(var(--hero-banner-title-size) * 2);
    font-weight: 800;
    text-align: center;
    text-shadow: none;
    position: absolute;
    bottom: 42%;
    left: 50%;
    transform: translateX(-50%) translateY(18px);
    opacity: 0;
    /* 与站点一起"先浮"：默认不播放，待 .rail-hero.revealed（加载去除后）才 0.6s淡入，
       与 .rail-stop的stopRise对齐，随后线路再描线 */
    animation-name: none;
    animation-duration: 0.6s;
    animation-timing-function: cubic-bezier(.0,.6,.2,1);
    animation-delay: 0s;
    animation-fill-mode: forwards;
    z-index: 2;
    filter: drop-shadow(0 0 20px #9324f366);
    white-space: nowrap;
    max-width: 90vw;
    overflow: hidden;
    text-overflow: ellipsis;

    /* 水面倒影 */
    &::after {
        content: attr(data-text);
        position: absolute;
        left: 0;
        right: 0;
        top: calc(100% + var(--reflection-gap, 6px));
        transform: scaleY(-1);
        transform-origin: center top;
        font-size: inherit;
        font-weight: inherit;
        line-height: inherit;
        color: #c77bce73;
        filter: blur(var(--reflection-blur, 1px)) saturate(0.9);
        opacity: var(--reflection-opacity, 0.7);
        pointer-events: none;
        z-index: 1;
        -webkit-mask-image: linear-gradient(to bottom, #00000099, #00000000);
        mask-image: linear-gradient(to bottom, #00000099, #00000000);
    }
}

/*-----站点标注：右下角角标-----*/
.banner-label {
    position: absolute;
    right: 40px;
    bottom: 150px;
    color: #1a1a1a;
    font-size: 14px;
    background: #0000000d;
    padding: 6px 12px;
    border-radius: 4px;
}

/*-----浅色主题（非暗色页面默认样式，保留兼容）-----*/

/*-----快速查看区域（浅色）-----*/
.quick-access-section {
    width: 100%;
    background: #f5f5f5;
    padding: 40px 0;
    flex-shrink: 0;
}
.qa-header {
    text-align: center;
    margin-bottom: 28px;
}
.qa-subtitle {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1976d2;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 8px;
}
.qa-title {
    font-size: 32px;
    font-weight: 800;
    color: #1a1a1a;
    margin: 0;
}
.qa-grid,
.quicknav-grid {
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}
.qa-header--sub .qa-title {
    font-size: 20px;
    font-weight: 700;
}
.qa-header--sub .qa-subtitle {
    margin-bottom: 16px;
}

/*-----卡片基础（浅色）-----*/
.qa-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 2px 8px #0000000f;
    position: relative;
    overflow: hidden;
    transition: translate 0.2s ease, box-shadow 0.2s ease;

    /* 左侧主题色条 */
    &::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 4px;
        background: var(--card-color, #333);
    }
    &:hover {
        translate: 0 -2px;
        box-shadow: 0 4px 16px #0000001a;
    }
}
.qa-icon-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--card-color, #333);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.qa-icon {
    font-size: 24px;
}
.qa-text h3 {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}
.qa-text p {
    font-size: 13px;
    color: #888;
    margin: 0;
}

/*-----快速导航卡片-----*/
.quicknav-grid .qa-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.qa-title sup a {
    font-size: 0.55em;
    color: #0066cc;
    text-decoration: none;
}
.qa-title sup a:hover {
    text-decoration: underline;
}

/*-----响应式-----*/

/*-----Hero标题响应式-----*/
@media (max-width: 768px) {
    .hero-title {
        font-size: clamp(20px, 6vw, calc(var(--hero-banner-title-size) * 2));
        bottom: 45%;
    }
    .rail-stop-label {
        bottom: 43%;
        left: calc(50% + 140px);
        font-size: 11px;
    }
    /* 竖向主线路收窄 */
    .snap-content-wrapper {
        padding-left: 48px;
    }
    .snap-page::before {
        left: 16px;
    }
    .metro-station-dot {
        left: 8px; top: 76px;
        width: 16px; height: 16px;
        border-width: 3px;
    }
    .metro-station-label {
        left: 34px; top: 72px;
        font-size: 11px;
    }
}

@media (max-width: 600px) {
    /* 竖线隐藏，改为每节顶部横向站点徽章 */
    .snap-page::before {
        display: none;
    }
    .snap-content-wrapper {
        padding-left: 20px;
    }
    .metro-station-dot {
        position: relative;
        left: auto; top: auto;
        display: inline-block;
        margin-bottom: 8px;
    }
    .metro-station-label {
        position: relative;
        left: auto; top: auto;
        display: inline-block;
        margin-bottom: 16px;
        margin-left: 8px;
    }
    /* 横向站点徽章包裹：在header留白基础上额外加 20px */
    .snap-content-wrapper {
        padding-top: calc(var(--header-height) + 20px);
    }
}

@media (max-width: 420px) {
    .hero-title {
        font-size: clamp(18px, 7.5vw, calc(var(--hero-banner-title-size) * 2));
        bottom: 48%;
    }
    .rail-stop-label {
        /* 小屏不隐藏（避免丢失起点站信息），改为缩小并内移防止右侧溢出 */
        font-size: 10px;
        letter-spacing: 1px;
        left: calc(50% + 90px);
    }
    .metro-station-dot {
        width: 14px; height: 14px;
        border-width: 3px;
    }
    .banner-label {
        right: 16px;
        bottom: 120px;
        font-size: 12px;
    }
}

/*-----卡片网格响应式-----*/
@media (max-width: 900px) {
    .qa-grid,
    .quicknav-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (max-width: 600px) {
    .qa-grid,
    .quicknav-grid {
        grid-template-columns: 1fr;
    }
}

/*-----数据面板响应式-----*/
@media (max-width: 768px) {
    .stats-container {
        gap: 30px;
    }
    .stat-item {
        min-width: 140px;
    }
    .stat-number {
        font-size: 36px;
    }
}

/*-----减少动画偏好-----*/
@media (prefers-reduced-motion: reduce) {
    .rail-line {
        /* 直接完整显示线路，不做描线动画 */
        stroke-dasharray: 1;
        stroke-dashoffset: 0;
        animation: none;
    }
    .rail-stop {
        /* 不浮出，直接终态可见 */
        opacity: 1;
        animation: none;
    }
    /* reduced-motion下，即便 .rail-hero.revealed已启用动画也强制关闭 */
    .rail-hero.revealed .rail-line,
    .rail-hero.revealed .rail-stop,
    .rail-hero.revealed .hero-title,
    .rail-hero.revealed .rail-stop-label {
        animation: none;
    }
    .animate-on-scroll.in-view {
        animation: none;
        opacity: 1;
        transform: none;
    }
    .metro-station-dot.in-view {
        animation: none;
    }
    .fp-blur {
        transition: none;
    }
}

/*-----首页「最新文章」卡片区-----*/
.latest-posts {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.latest-post-card {
    display: block;
    padding: 18px 20px;
    border-radius: 12px;
    background: #ffffff;
    border: 1px solid #e6e6e6;
    text-decoration: none;
    color: inherit;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.latest-post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 22px #00000014;
    border-color: #c9c9c9;
}

.latest-post-meta {
    display: flex;
    gap: 12px;
    font-size: 0.8rem;
    color: #888888;
    margin-bottom: 6px;
}

.latest-post-title {
    font-size: 1.15rem;
    margin: 0 0 8px;
    color: #1a1a1a;
}

.latest-post-summary {
    font-size: 0.92rem;
    line-height: 1.6;
    color: #555555;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.latest-posts-more {
    margin-top: 18px;
    text-align: right;
}

.qa-more-link {
    color: #246edc;
    text-decoration: none;
    font-size: 0.95rem;
}

.qa-more-link:hover {
    text-decoration: underline;
}

.latest-empty {
    color: #888888;
    font-size: 0.95rem;
}

@media (max-width: 600px) {
    .latest-posts {
        grid-template-columns: 1fr;
    }
    .latest-post-card {
        padding: 14px 16px;
    }
}