/* ==========================================================================
   站点外壳 · 页头与页脚
   --------------------------------------------------------------------------
   与 index.php 共用同一套视觉语言：同一组颜色、同一套字体栈、同一种圆角与
   投影强度。所有变量统一加 --sh- 前缀，避免与各实验页面自己的 :root 变量
   重名（模块 05 的 tech.css 就定义了 --bg/--line/--ink）。

   使用方式（页面 <body> 上加 has-shell）：
       <link rel="stylesheet" href="css/site_shell.css">
   本文件只负责"外框"和画布，页面内部的卡片/按钮在 css/module01.css 里覆盖。

   加载顺序：页面自身样式 → site_shell.css → module01.css
   ========================================================================== */

:root {
    --sh-bg: #f1f5f9;
    --sh-surface: #ffffff;
    --sh-ink: #08192a;
    --sh-ink-2: #2b4256;
    --sh-muted: #647b8f;
    --sh-faint: #97abbc;
    --sh-line: #e2eaf2;
    --sh-line-2: #cddbe8;
    --sh-accent: #0b63ce;
    --sh-accent-2: #1e8fe0;
    --sh-accent-deep: #0a52ab;
    --sh-mono: ui-monospace, SFMono-Regular, "Cascadia Mono", Consolas, "Liberation Mono", monospace;
    --sh-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --sh-r: 14px;
    --sh-w: 1200px;
    --sh-shadow-1: 0 1px 2px rgba(8, 25, 42, .05);
    --sh-shadow-2: 0 2px 5px rgba(8, 25, 42, .04), 0 14px 28px -14px rgba(8, 25, 42, .18);
    --sh-shadow-3: 0 6px 14px rgba(8, 25, 42, .06), 0 30px 56px -22px rgba(8, 25, 42, .34);
}

/* ---------- 画布 ---------- */
body.has-shell {
    margin: 0;
    padding: 0;
    background: var(--sh-bg);
    color: var(--sh-ink);
    font-family: var(--sh-sans);
    font-size: 15px;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.has-shell .wrap {
    max-width: var(--sh-w);
    margin: 0 auto;
    padding: 0 28px;
}

/* ---------- 顶栏 ---------- */
body.has-shell .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: rgba(255, 255, 255, .82);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--sh-line);
}

body.has-shell .bar {
    display: flex;
    align-items: center;
    gap: 24px;
    height: 64px;
}

body.has-shell .brand {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: none;
    text-decoration: none;
    color: var(--sh-ink);
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -.015em;
}

body.has-shell .brand:hover {
    color: var(--sh-ink);
}

body.has-shell .mark {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    flex: none;
    border-radius: 9px;
    background: linear-gradient(150deg, #12324f, #08192a 62%);
    box-shadow: 0 2px 6px rgba(8, 25, 42, .28), inset 0 1px 0 rgba(255, 255, 255, .16);
}

body.has-shell .topnav {
    display: flex;
    gap: 2px;
    margin-left: auto;
}

body.has-shell .topnav a {
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--sh-ink-2);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
    transition: background .16s, color .16s;
}

body.has-shell .topnav a:hover {
    background: #e9f1f9;
    color: var(--sh-ink);
}

/* 当前模块：与首页导航同一形状，只把字色和底色点亮 */
body.has-shell .topnav a.on {
    background: #e9f1f9;
    color: var(--sh-accent);
    font-weight: 600;
}

body.has-shell .visits {
    flex: none;
    padding-left: 22px;
    border-left: 1px solid var(--sh-line);
    font: 11.5px/1 var(--sh-mono);
    letter-spacing: .04em;
    color: var(--sh-muted);
    white-space: nowrap;
}

body.has-shell .visits b {
    color: var(--sh-ink);
    font-weight: 500;
}

/* ---------- 内容区 ---------- */
/* 各实验页原本把 .container 做成居中的白卡片；这里统一改成首页那种
   "浅灰画布 + 独立面板"的排版，卡片交给内部元素各自承担。 */
body.has-shell .container {
    max-width: var(--sh-w);
    width: auto;
    margin: 0 auto;
    padding: 52px 28px 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

/* 标题与导语：首页的编辑式排版（左对齐、紧字距、克制的字号） */
body.has-shell .container > h1,
body.has-shell .page-head > h1 {
    margin: 0 0 14px;
    color: var(--sh-ink);
    font-size: clamp(1.75rem, 3.1vw, 2.4rem);
    font-weight: 600;
    line-height: 1.18;
    letter-spacing: -.035em;
    text-align: left;
}

body.has-shell .container > p,
body.has-shell .description {
    max-width: 66ch;
    margin: 0 0 34px;
    color: var(--sh-muted);
    font-size: 15px;
    line-height: 1.8;
    text-align: left;
}

body.has-shell .container > p b,
body.has-shell .description b {
    color: var(--sh-ink-2);
    font-weight: 600;
}

/* ---------- 页脚 ---------- */
body.has-shell footer {
    margin-top: 88px;
    background: linear-gradient(180deg, #0b2033, #08192a);
    color: #a8bccd;
}

body.has-shell .foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 26px;
    padding-top: 36px;
    padding-bottom: 48px;
    font-size: 12.5px;
    color: #8ea3b6;
}

body.has-shell .foot > span:first-child {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    letter-spacing: -.01em;
}

body.has-shell .foot a {
    color: #a8bccd;
    text-decoration: none;
    border-bottom: 1px solid rgba(168, 188, 205, .3);
    transition: color .16s, border-color .16s;
}

body.has-shell .foot a:hover {
    color: #fff;
    border-color: #fff;
}

body.has-shell .foot .right {
    margin-left: auto;
    font: 11.5px/1 var(--sh-mono);
    letter-spacing: .04em;
}

body.has-shell .foot .right b {
    color: #fff;
    font-weight: 500;
}

body.has-shell .sep {
    width: 1px;
    height: 12px;
    background: rgba(168, 188, 205, .28);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1040px) {
    body.has-shell .container {
        padding-top: 42px;
    }
}

@media (max-width: 880px) {
    body.has-shell .topnav {
        display: none;
    }

    body.has-shell .visits {
        margin-left: auto;
        padding-left: 0;
        border-left: 0;
    }
}

@media (max-width: 600px) {
    body.has-shell .wrap {
        padding: 0 18px;
    }

    body.has-shell .container {
        padding: 32px 18px 0;
    }

    body.has-shell .brand span:last-child {
        display: none;
    }

    body.has-shell .foot .right {
        margin-left: 0;
        flex-basis: 100%;
    }

    body.has-shell footer {
        margin-top: 60px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body.has-shell * {
        transition: none !important;
        animation: none !important;
    }
}
