/* ================================================================
   Rivulet Lab · 液体流体 Footer
   ---------------------------------------------------------------
   移植自 footer-example.html（Rare UI Footer「有色液体上涌」）：
     WebGL 全屏 quad + fbm 分形噪声 + 顶部渐变遮罩
   主题色沿用主站设计令牌：
     主色 #1456F0 / 悬停 #3B7AF8 / 墨色 #0D0D0D
   ---------------------------------------------------------------
   场景变体（按页面角色分化舞台高度与信息密度）：
     .rl-footer--home  首页     完整版：高舞台 + 5 列链接矩阵
     .rl-footer--map   导航页   紧凑版：中等舞台 + 站点地图导语
     .rl-footer--news  动态页   紧凑版：中等舞台 + 目录概览导语
   窄屏（≤640px）策略：
     · 隐藏品牌字标舞台，液体只作为底部一条动态装饰带
     · 顶部行改两行网格：品牌 + 社交一行，主导航独占一行
     · 次要链接区块收进「更多站点链接」按钮折叠，默认收起（.is-open）
  低性能模式（<html class="low-perf">）：不创建 WebGL，只留静态渐变层
   ================================================================ */

.rl-footer {
    /* ---------- 令牌 ---------- */
    --rl-bg: #0D0D0D;
    --rl-bg-soft: rgba(13, 13, 13, 0.88);
    --rl-fg: #FFFFFF;
    --rl-muted: rgba(255, 255, 255, 0.52);
    --rl-faint: rgba(255, 255, 255, 0.28);
    --rl-line: rgba(255, 255, 255, 0.10);
    --rl-accent: #1456F0;
    --rl-accent-2: #7FA8FF;
    /* 液体观感：整体浓度 + 活动带厚度上限，由 js/footer.js 读取
       （改这两行即可调液体浓度/厚度，无需动脚本） */
    --rl-alpha: 1;
    --rl-band: 620px;
    --rl-stage: min(68svh, 44rem);
    --rl-fade: 10rem;
    --rl-maxw: 1200px;
    --rl-gutter: 1.5rem;
    /* 窄屏固定药丸底栏的占位高度（药丸 58px + 上内边距 6px + 底距 14px） */
    --rl-tabbar: calc(78px + env(safe-area-inset-bottom, 0px));

    position: relative;
    width: 100%;
    overflow: hidden;
    background: var(--rl-bg);
    color: var(--rl-fg);
    isolation: isolate;
    font-family: MiSans, 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
    line-height: 1.6;
}

.rl-footer *,
.rl-footer *::before,
.rl-footer *::after { box-sizing: border-box; }

.rl-footer a { text-decoration: none; }

/* ---------- 顶部地平线：主色细光线 ---------- */
.rl-footer::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    z-index: 3;
    background: linear-gradient(90deg, transparent, rgba(20, 86, 240, 0.75) 22%, rgba(127, 168, 255, 0.55) 50%, rgba(20, 86, 240, 0.75) 78%, transparent);
    pointer-events: none;
}

/* ---------- 1. 液体画布 ---------- */
.rl-footer__canvas {
    position: absolute;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

/* WebGL 不可用时的 CSS 降级（由 footer.js 打上 .is-fallback） */
.rl-footer__fallback {
    display: none;
    position: absolute;
    inset: auto 0 0 0;
    z-index: 0;
    height: 46%;
    pointer-events: none;
    background:
        radial-gradient(58% 100% at 18% 100%, rgba(20, 86, 240, 0.62), rgba(20, 86, 240, 0) 72%),
        radial-gradient(46% 92% at 52% 100%, rgba(59, 122, 248, 0.45), rgba(59, 122, 248, 0) 70%),
        radial-gradient(40% 86% at 84% 100%, rgba(127, 168, 255, 0.38), rgba(127, 168, 255, 0) 72%);
    filter: blur(26px);
    opacity: 0.85;
}

.rl-footer.is-fallback .rl-footer__fallback { display: block; }

/* 低性能模式（<html class="low-perf">）：引擎不创建 WebGL 上下文，
   只保留静态渐变层；降级层自身带 blur(26px)，在大面积元素上开销不小，一并去掉 */
.low-perf .rl-footer__fallback {
    filter: none;
    opacity: 0.75;
}

/* ---------- 2. 顶部渐变遮罩：把液体上缘溶进页脚底色 ---------- */
.rl-footer__fade {
    position: absolute;
    top: 0; left: 0; right: 0;
    z-index: 1;
    height: var(--rl-fade);
    pointer-events: none;
    background: linear-gradient(to bottom,
            var(--rl-bg) 0%,
            var(--rl-bg-soft) 42%,
            rgba(13, 13, 13, 0.42) 72%,
            rgba(13, 13, 13, 0) 100%);
}

/* ---------- 3. 内容层 ---------- */
.rl-footer__inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: var(--rl-maxw);
    margin: 0 auto;
    padding: 2.5rem var(--rl-gutter) 0;
    min-height: var(--rl-stage);
}

@media (min-width: 640px) {
    .rl-footer__inner { padding: 4rem var(--rl-gutter) 0; }
}

.rl-footer__rule {
    flex: none;
    width: 100%;
    height: 1px;
    background: var(--rl-line);
}

/* ---------- 顶部行：品牌 + 社交 + 主导航 ---------- */
.rl-footer__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem 1.75rem;
    padding-block: 1.75rem;
}

.rl-footer__brand {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    font-size: 1.125rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--rl-fg);
    transition: color 0.2s ease;
}

.rl-footer__brand:hover { color: var(--rl-accent-2); }

.rl-footer__brand img {
    width: 1.75rem;
    height: 1.75rem;
    display: block;
}

.rl-footer__brand small {
    display: block;
    margin-top: 2px;
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rl-faint);
}

.rl-footer__nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-footer__nav > li { display: flex; align-items: center; }

.rl-footer__nav a {
    font-size: 1.0625rem;
    color: var(--rl-muted);
    transition: color 0.2s ease;
}

.rl-footer__nav a:hover { color: var(--rl-fg); }

/* 社交图标（Font Awesome） */
.rl-footer__social {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-footer__social a {
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--rl-line);
    border-radius: 50%;
    color: var(--rl-muted);
    font-size: 0.95rem;
    transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease, transform 0.2s ease;
}

.rl-footer__social a:hover {
    color: var(--rl-fg);
    border-color: rgba(20, 86, 240, 0.75);
    background: rgba(20, 86, 240, 0.12);
    transform: translateY(-2px);
}

/* ---------- 液体主舞台（窄屏隐藏） ---------- */
.rl-footer__stage {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 1.25rem;
    padding-block: 2.5rem 3rem;
}

.rl-footer__wordmark {
    margin: 0;
    font-size: clamp(2.75rem, 13vw, 5.75rem);
    line-height: 0.92;
    font-weight: 800;
    letter-spacing: -0.045em;
    color: #EEF4FF;
    white-space: nowrap;
    user-select: none;
    pointer-events: none;
}

.rl-footer__tagline {
    margin: 0;
    max-width: 52ch;
    font-size: clamp(0.8125rem, 2.4vw, 1rem);
    color: var(--rl-muted);
    letter-spacing: 0.02em;
}

.rl-footer__tagline em {
    font-style: normal;
    color: inherit;
}

/* ---------- 链接矩阵 ---------- */
.rl-footer__cols {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2.5rem 2rem;
    padding-block: 2rem 2.5rem;
}

.rl-footer--home .rl-footer__cols {
    grid-template-columns: 1.7fr 1fr 1fr 1.2fr 1.4fr;
}

.rl-footer__col h4 {
    margin: 0 0 0.875rem;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--rl-faint);
}

.rl-footer__col .desc {
    margin: 0 0 1rem;
    max-width: 34ch;
    font-size: 0.8125rem;
    line-height: 1.8;
    color: var(--rl-muted);
}

.rl-footer__quick {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem 1.125rem;
}

.rl-footer__quick a {
    font-size: 0.8125rem;
    color: var(--rl-faint);
    transition: color 0.2s ease;
}

.rl-footer__quick a:hover { color: var(--rl-fg); }

.rl-footer__list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.rl-footer__list li {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    font-size: 0.8125rem;
}

.rl-footer__list i {
    flex: none;
    width: 0.875rem;
    text-align: center;
    font-size: 0.75rem;
    color: var(--rl-faint);
    transition: color 0.2s ease;
}

.rl-footer__list a {
    color: var(--rl-muted);
    transition: color 0.2s ease;
}

.rl-footer__list a:hover { color: var(--rl-fg); }
.rl-footer__list li:hover i { color: var(--rl-accent-2); }

.rl-footer__list .ext {
    font-size: 0.625rem;
    color: var(--rl-faint);
}

/* ---------- 次要区块折叠 ----------
   宽屏：display:contents 摊平回父级网格，按钮隐藏 → 等同普通区块
   窄屏：按钮切换 .is-open 展开。不用原生 <details>：浏览器对未展开
         details 的隐藏属于 UA 内部 content-visibility 行为，
         display:contents 无法摊平它，宽屏会整块消失。 */
.rl-footer__more { display: contents; }

.rl-footer__more-btn { display: none; }

.rl-footer__more > .rl-footer__col { display: block; }

/* ---------- 底部信息行 ---------- */
.rl-footer__bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    padding: 1.25rem 0 1.75rem;
    font-size: 0.75rem;
    color: var(--rl-faint);
    letter-spacing: 0.02em;
}

.rl-footer__bottom .group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
}

.rl-footer__bottom a {
    color: var(--rl-muted);
    transition: color 0.2s ease;
}

.rl-footer__bottom a:hover { color: var(--rl-fg); }

.rl-footer__bottom .dot { color: var(--rl-line); }

/* ================================================================
   场景变体
   ================================================================ */

/* 二级页面：贴底 + 与 .page-wrap 同宽（1080px / 24px 边距） */
.rl-footer--page {
    margin-top: auto;
    --rl-maxw: 1080px;
    --rl-stage: min(46svh, 30rem);
    --rl-fade: 8rem;
}

.rl-footer--page .rl-footer__inner {
    padding-left: 24px;
    padding-right: 24px;
}

/* 首页：舞台更高 */
.rl-footer--home {
    --rl-stage: min(68svh, 44rem);
}

/* ================================================================
   响应式
   ================================================================ */
@media (max-width: 1080px) {
    .rl-footer--home .rl-footer__cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rl-footer__cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
    .rl-footer--home .rl-footer__cols,
    .rl-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================================================================
   窄屏：压缩页脚
   ================================================================ */
@media (max-width: 640px) {
    .rl-footer {
        --rl-gutter: 1.125rem;
        --rl-fade: 4rem;
    }

    /* 舞台整体去掉：液体只作为底部一条动态装饰带 */
    .rl-footer__inner { min-height: 0; padding-top: 1.25rem; }
    .rl-footer--page .rl-footer__inner { padding-top: 1.25rem; }
    .rl-footer__stage { display: none; }

    /* 顶部行改两行网格：品牌 + 社交一行，主导航独占一行 */
    .rl-footer__top {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0.875rem 1rem;
        padding-block: 1.25rem;
    }

    .rl-footer__brand {
        grid-column: 1;
        grid-row: 1;
        font-size: 1rem;
    }

    .rl-footer__brand img { width: 1.5rem; height: 1.5rem; }
    .rl-footer__brand small { font-size: 0.625rem; }

    .rl-footer__social {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
    }

    .rl-footer__social a {
        width: 1.875rem;
        height: 1.875rem;
        font-size: 0.8125rem;
    }

    .rl-footer__nav {
        grid-column: 1 / -1;
        grid-row: 2;
        gap: 0.375rem 0.875rem;
    }

    .rl-footer__nav a { font-size: 0.875rem; }

    /* 链接矩阵：区块单列、每区块内部两列 */
    .rl-footer--home .rl-footer__cols,
    .rl-footer__cols {
        grid-template-columns: 1fr;
        gap: 1.375rem;
        padding-block: 1.125rem 1.5rem;
    }

    .rl-footer__col h4 {
        margin-bottom: 0.5rem;
        padding-bottom: 0.4375rem;
        border-bottom: 1px solid var(--rl-line);
    }

    .rl-footer__col .desc {
        margin-bottom: 0.625rem;
        max-width: none;
    }

    .rl-footer__quick { gap: 0.25rem 0.875rem; }

    .rl-footer__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.4375rem 0.75rem;
    }

    /* 邮箱 / QQ 长文本保持单列，避免折行错位 */
    .rl-footer__col--contact .rl-footer__list { grid-template-columns: 1fr; }

    /* 折叠区块：窄屏恢复为块级 + 按钮控制 */
    .rl-footer__more {
        display: block;
        margin-top: 0.25rem;
    }

    .rl-footer__more-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        width: 100%;
        padding: 0.6875rem 0.875rem;
        border: 1px solid var(--rl-line);
        border-radius: 12px;
        background: none;
        font: inherit;
        font-size: 0.8125rem;
        color: var(--rl-muted);
        cursor: pointer;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
        transition: color 0.2s ease, border-color 0.2s ease;
    }

    .rl-footer__more-btn:hover { color: var(--rl-fg); }

    .rl-footer__more.is-open .rl-footer__more-btn {
        color: var(--rl-fg);
        border-color: rgba(20, 86, 240, 0.55);
    }

    .rl-footer__more-btn i {
        font-size: 0.6875rem;
        transition: transform 0.25s ease;
    }

    .rl-footer__more.is-open .rl-footer__more-btn i { transform: rotate(180deg); }

    .rl-footer__more > .rl-footer__col { display: none; }

    /* 展开后：两个次要区块依次排列，各带一条分隔线 */
    .rl-footer__more.is-open > .rl-footer__col {
        display: block;
        margin-top: 1.125rem;
        padding-top: 1.125rem;
        border-top: 1px solid var(--rl-line);
    }

    .rl-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding-top: 1rem;
        padding-bottom: 0;
    }
}

/* 窄屏：为底部固定药丸导航让出安全空间（含 iPhone 安全区）。
   与 GitSource 一致：占位由页脚内容层的内边距承担，不额外插占位 div；
   页脚底色与液体画布都是 inset:0，会一起延伸到屏幕底边。
   药丸占位 = 6 + 58 + 14 + 安全区 = 78px，再留 8px 间隙。 */
@media (max-width: 767px) {
    .rl-footer__inner { padding-bottom: calc(var(--rl-tabbar) + 0.5rem); }
    .rl-footer__bottom { padding-bottom: 0; }
}

/* 减少动态偏好：仅保留静态帧，取消入场与悬浮位移 */
@media (prefers-reduced-motion: reduce) {
    .rl-footer__brand,
    .rl-footer__nav a,
    .rl-footer__list a,
    .rl-footer__quick a,
    .rl-footer__bottom a,
    .rl-footer__social a { transition: none; }

    .rl-footer__social a:hover { transform: none; }

    .rl-footer__more-btn,
    .rl-footer__more-btn i { transition: none; }
}
