/* ==============================================================
   格物 · 界面外壳样式
   --------------------------------------------------------------
   包含三部分：
     ① 主题变量      深色为默认，浅色通过 html[data-theme="light"] 覆盖
     ② 左上角入口    汉堡按钮 + 滑出式关于抽屉
     ③ 主题切换按钮
   ============================================================== */

/* ---------------- ① 主题变量：浅色覆盖 ---------------- */
/*
 * 深色值定义在各页面的 :root 中（作为默认）。
 * 这里只覆盖浅色，选择器权重 (0,1,1) 高于 :root 的 (0,1,0)，
 * 因此无需关心样式表加载顺序。
 */
html[data-theme='light'] {
    --bg: #eef1f6;
    --bg-2: #ffffff;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-solid: #ffffff;
    --border: rgba(28, 48, 80, 0.13);
    --border-strong: rgba(28, 48, 80, 0.26);
    --text: #18202c;
    --text-dim: #55627a;
    --text-faint: #8a94a6;
    --accent: #0a7fb8;
    --accent-dim: rgba(10, 127, 184, 0.1);
    --accent-2: #5b5fd0;
    --ok: #16a34a;
    --warn: #c2740a;
    --shadow: 0 8px 28px rgba(30, 50, 80, 0.1);

    /* 顶栏 / 底栏 / 视口底色 */
    --bar-grad: linear-gradient(180deg, #ffffff 0%, #f1f4f9 100%);
    --bar-grad-up: linear-gradient(0deg, #ffffff 0%, #f1f4f9 100%);
    --viewport-bg: #e6eaf0;
    --code-bg: rgba(28, 48, 80, 0.06);
    --hover-bg: rgba(28, 48, 80, 0.05);
    --head-mask: linear-gradient(180deg, rgba(238, 241, 246, 0.96) 60%, rgba(238, 241, 246, 0));
    --card-grad: linear-gradient(165deg, #ffffff, #f6f8fc);
    --grid-line: rgba(28, 48, 80, 0.07);
    --glow-1: rgba(10, 127, 184, 0.10);
    --glow-2: rgba(91, 95, 208, 0.09);
    --modal-bg: linear-gradient(180deg, #ffffff 0%, #f4f7fb 100%);
}

/* 深色下的辅助变量（与各页面 :root 保持一致） */
:root {
    --bar-grad: linear-gradient(180deg, #151a23 0%, #0f131a 100%);
    --bar-grad-up: linear-gradient(0deg, #151a23 0%, #0f131a 100%);
    --viewport-bg: #0a0d12;
    --code-bg: rgba(0, 0, 0, 0.34);
    --hover-bg: rgba(255, 255, 255, 0.055);
    --head-mask: linear-gradient(180deg, rgba(8, 11, 16, 0.94) 60%, rgba(8, 11, 16, 0));
    --card-grad: linear-gradient(165deg, rgba(24, 30, 41, 0.92), rgba(15, 19, 26, 0.92));
    --grid-line: rgba(120, 145, 175, 0.045);
    --glow-1: rgba(56, 224, 255, 0.13);
    --glow-2: rgba(124, 140, 255, 0.11);
    --modal-bg: linear-gradient(180deg, #161c26 0%, #11161e 100%);
}

/* 主题切换的过渡（只过渡颜色，避免布局抖动） */
body, .topbar, .bottombar, .side, .viewport, .device-card, .feature,
.tree-row, .info, .guide, .pr-item, .modal-box {
    transition: background-color .28s ease, border-color .28s ease, color .28s ease;
}

/* ---------------- ② 左上角汉堡按钮 ---------------- */
.gewu-menu-btn {
    width: 34px; height: 34px; flex-shrink: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 4px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--code-bg);
    cursor: pointer;
    transition: all .16s;
    margin-right: 4px;
}
.gewu-menu-btn:hover { border-color: var(--accent); background: var(--accent-dim); }
.gewu-menu-btn i {
    display: block; width: 15px; height: 1.8px; border-radius: 1px;
    background: var(--text-dim);
    transition: background .16s, width .16s;
}
.gewu-menu-btn:hover i { background: var(--accent); }
.gewu-menu-btn:hover i:nth-child(2) { width: 11px; }
.gewu-menu-btn:hover i:nth-child(3) { width: 7px; }

/* ---------------- 关于抽屉 ---------------- */
.gewu-drawer { position: fixed; inset: 0; z-index: 900; pointer-events: none; }
.gewu-drawer.open { pointer-events: auto; }

.gd-mask {
    position: absolute; inset: 0;
    background: rgba(4, 7, 11, 0.58);
    backdrop-filter: blur(3px);
    opacity: 0; transition: opacity .3s;
}
.gewu-drawer.open .gd-mask { opacity: 1; }

.gd-panel {
    position: absolute; top: 0; left: 0; bottom: 0;
    width: min(440px, 92vw);
    display: flex; flex-direction: column;
    background: var(--panel-solid);
    border-right: 1px solid var(--border-strong);
    box-shadow: 24px 0 60px rgba(0, 0, 0, 0.35);
    transform: translateX(-102%);
    transition: transform .34s cubic-bezier(.22, .9, .3, 1);
}
.gewu-drawer.open .gd-panel { transform: none; }

/* 头部 */
.gd-head {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.gd-logo {
    width: 38px; height: 38px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 19px; color: #04121a;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 10px;
    box-shadow: 0 0 20px color-mix(in srgb, var(--accent) 35%, transparent);
}
.gd-title { flex: 1; min-width: 0; }
.gd-title h2 { font-size: 16px; font-weight: 600; letter-spacing: .6px; }
.gd-title h2 span {
    font-size: 10.5px; font-weight: 400; color: var(--text-faint);
    letter-spacing: 1.8px; margin-left: 5px;
}
.gd-title p { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.gd-close {
    width: 28px; height: 28px; border-radius: 8px;
    color: var(--text-faint); font-size: 13px;
    display: grid; place-items: center;
    transition: all .15s; cursor: pointer;
    background: none; border: none;
}
.gd-close:hover { background: var(--hover-bg); color: var(--text); }

/* 主体 */
.gd-body { flex: 1; overflow-y: auto; padding: 18px 20px 22px; }

.gd-quote {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-left: 2px solid var(--accent);
    background: var(--accent-dim);
    border-radius: 0 8px 8px 0;
}
.gd-quote p { font-size: 14px; color: var(--text); letter-spacing: 2px; line-height: 1.7; }
.gd-quote cite { display: block; margin-top: 5px; font-size: 11px; color: var(--text-faint); font-style: normal; }

.gd-intro { font-size: 12.5px; line-height: 1.95; color: var(--text-dim); margin-bottom: 18px; }

.gd-stats {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 8px; margin-bottom: 22px;
}
.gd-stats > div {
    display: flex; flex-direction: column; align-items: center;
    padding: 11px 4px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}
.gd-stats b { font-size: 19px; font-weight: 700; color: var(--accent); line-height: 1.2;
    font-variant-numeric: tabular-nums; }
.gd-stats span { font-size: 10px; color: var(--text-faint); margin-top: 3px; letter-spacing: .5px; }

.gd-h3 {
    font-size: 10.5px; font-weight: 600; letter-spacing: 1.6px;
    color: var(--text-faint); text-transform: uppercase;
    margin: 22px 0 11px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--border);
}
.gd-h3:first-of-type { margin-top: 4px; }

.gd-caps { list-style: none; }
.gd-caps li { display: flex; gap: 11px; padding: 8px 0; }
.gd-cap-i {
    width: 26px; height: 26px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 12px; color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
    border-radius: 7px;
}
.gd-caps b { font-size: 12.5px; font-weight: 600; display: block; margin-bottom: 2px; }
.gd-caps p { font-size: 11.5px; color: var(--text-dim); line-height: 1.6; }

.gd-devices { list-style: none; }
.gd-devices li {
    display: flex; flex-direction: column; gap: 2px;
    padding: 9px 11px; margin-bottom: 6px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-left: 2px solid var(--accent);
    border-radius: 0 8px 8px 0;
}
.gd-dev-name { font-size: 12.5px; font-weight: 600; color: var(--text); }
.gd-dev-meta { font-size: 10.5px; color: var(--text-faint); }

.gd-tech { display: flex; flex-wrap: wrap; gap: 6px; }
.gd-tech span {
    font-size: 10.5px; padding: 4px 10px; border-radius: 20px;
    color: var(--text-dim);
    background: var(--code-bg);
    border: 1px solid var(--border);
}

/* ---------------- 关于抽屉 · 作者区块 ---------------- */
.gd-author {
    display: flex; flex-direction: column; gap: 14px;
    padding: 14px;
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.au-head { display: flex; align-items: center; gap: 12px; }
.au-avatar {
    width: 42px; height: 42px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 17px; font-weight: 600; color: #04121a;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    border-radius: 11px;
    box-shadow: 0 0 18px color-mix(in srgb, var(--accent) 30%, transparent);
}
.au-id { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.au-name { font-size: 15px; font-weight: 600; letter-spacing: 1.2px; color: var(--text); }
.au-affil { font-size: 11px; color: var(--text-faint); letter-spacing: .3px; }
.au-affil:first-of-type { color: var(--text-dim); }

.au-list {
    list-style: none;
    display: flex; flex-direction: column;
    border-top: 1px solid var(--border);
}
.au-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}
.au-ico {
    width: 20px; height: 20px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 10.5px; line-height: 1; color: var(--accent);
    background: var(--accent-dim);
    border-radius: 6px;
}
.au-key { font-size: 11.5px; color: var(--text-faint); flex-shrink: 0; }
.au-tail { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.au-val {
    font-family: var(--mono); font-size: 12px; color: var(--text);
    letter-spacing: .3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.au-link { color: var(--accent); text-decoration: none; }
.au-link:hover { text-decoration: underline; }

.au-copy {
    flex-shrink: 0;
    font-size: 10.5px; line-height: 1;
    padding: 4px 9px; border-radius: 6px;
    color: var(--text-dim);
    background: var(--panel-solid);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all .15s;
}
.au-copy:hover { color: var(--accent); border-color: var(--accent); }
.au-copy.is-done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 55%, transparent); }

.au-note { font-size: 11px; line-height: 1.75; color: var(--text-faint); }

/* 页脚（由 ui-shell.js 追加） */
.foot-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.foot-cr { color: var(--text-faint); }
.foot-right .foot-cr::before { content: '·'; margin-right: 10px; opacity: .5; }

/* 页脚联系入口：点开关于抽屉里的完整联系方式 */
.foot-contact {
    font: inherit; font-size: 11.5px;
    padding: 3px 10px; border-radius: 20px;
    color: var(--accent);
    background: var(--accent-dim);
    border: 1px solid color-mix(in srgb, var(--accent) 26%, transparent);
    cursor: pointer;
    transition: all .16s;
}
.foot-contact:hover { border-color: var(--accent); }

.gd-ver { white-space: nowrap; }

.gd-foot {
    display: flex; align-items: center; justify-content: space-between;
    padding: 13px 20px;
    border-top: 1px solid var(--border);
    font-size: 11px; color: var(--text-faint);
    flex-shrink: 0;
}
.gd-ver {
    padding: 2px 8px; border-radius: 10px;
    background: var(--code-bg); border: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

/* ---------------- ③ 主题切换按钮 ---------------- */
.gewu-theme-btn {
    width: 32px; height: 32px; flex-shrink: 0;
    display: grid; place-items: center;
    font-size: 14px; line-height: 1;
    color: var(--text-dim);
    background: var(--code-bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all .18s;
}
.gewu-theme-btn:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-dim);
    transform: rotate(-18deg);
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 640px) {
    .gd-panel { width: 100vw; }
    .gd-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------- 顶栏布局修正 ----------------
   汉堡按钮加入后，原本的 space-between 会把品牌挤到中间。
   改为「左对齐 + 导航自动靠右」，让汉堡与品牌自然相邻。 */
.site-head { justify-content: flex-start; gap: 14px; }
.site-head .site-nav { margin-left: auto; }

.topbar { justify-content: flex-start; gap: 14px; }
.topbar .toolbar { margin-left: auto; }
.topbar .seg-mode { margin-left: 6px; }