/* circuit-board · 电路板 —— 紫色阻焊板 + 金色走线：每篇文章是一颗带引脚的芯片，丝印写分类与位号（U + 文章 ID） */
:root {
    --pcb-board: #3b2160;
    --pcb-board-dark: #2a1646;
    --pcb-trace: #7a5aa8;
    --pcb-gold: #d4a537;
    --pcb-gold-light: #ecc96b;
    --pcb-chip: #ffffff;
    --pcb-ink: #1c1328;
    --pcb-soft: #574a68;
    --pcb-silk: #f3eefb;
    --pcb-link: #5b2a9c;
    --pcb-display: Oxanium, "Segoe UI", system-ui, sans-serif;
    --pcb-body: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pagination-accent: #5b2a9c;
    --pcb-pins-v: repeating-linear-gradient(180deg, var(--pcb-gold) 0 6px, transparent 6px 16px);
    --pcb-pins-h: repeating-linear-gradient(90deg, var(--pcb-gold) 0 6px, transparent 6px 16px);
}

body.theme-circuit {
    margin: 0; color: var(--pcb-silk); font-family: var(--pcb-body); font-size: 16px;
    background-color: var(--pcb-board);
    background-image: linear-gradient(90deg, rgba(122, 90, 168, .35) 2px, transparent 2px), linear-gradient(rgba(122, 90, 168, .35) 2px, transparent 2px), radial-gradient(circle, rgba(212, 165, 55, .45) 3px, transparent 4px);
    background-size: 160px 160px, 160px 160px, 160px 160px;
    background-position: 40px 0, 0 100px, 33px 93px;
}
:where(.theme-circuit) a { color: inherit; text-decoration: none; }
.theme-circuit :focus-visible { outline: 3px solid var(--pcb-gold-light); outline-offset: 3px; }
.pcb-skip { position: absolute; left: -9999px; }
.pcb-skip:focus { left: 12px; top: 12px; z-index: 50; padding: 10px 14px; background: var(--pcb-chip); color: var(--pcb-ink); font-weight: 700; }
.pcb-board:focus { outline: none; }

/* ---------- 丝印与位号 ---------- */
.pcb-chip-silk { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-width: 0; }
.pcb-chip-cat { min-width: 0; font-family: var(--pcb-display); font-weight: 600; font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcb-chip-ref { flex: none; padding: 1px 6px; border: 1.5px solid currentColor; border-radius: 3px; font-family: var(--pcb-display); font-weight: 600; font-size: .74rem; white-space: nowrap; }

/* ---------- 顶栏 ---------- */
.pcb-head { background: var(--pcb-board-dark); border-bottom: 3px solid var(--pcb-gold); }
.pcb-head-inner { display: flex; align-items: center; gap: 24px; max-width: 1320px; margin: 0 auto; padding: 12px 24px; }
.pcb-brand { display: inline-flex; align-items: center; gap: 14px; margin-right: auto; min-width: 0; }
.pcb-brand-chip { flex: none; width: 26px; height: 26px; border-radius: 3px; background: #1c1328; box-shadow: 0 0 0 4px var(--pcb-board-dark), 0 0 0 6px var(--pcb-gold); }
.pcb-brand-name { min-width: 0; font-family: var(--pcb-display); font-weight: 800; font-size: 1.5rem; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcb-nav { display: flex; gap: 6px; }
.pcb-nav a { padding: 8px 12px; font-weight: 500; border: 1.5px solid transparent; border-radius: 4px; }
.pcb-nav a:hover { border-color: var(--pcb-trace); }
.pcb-nav a.is-on { border-color: var(--pcb-gold); color: var(--pcb-gold-light); font-weight: 700; }
.pcb-menu-toggle { display: none; color: inherit; }

/* ---------- 版心 ---------- */
.pcb-board { min-height: 60vh; padding-bottom: 40px; }
.pcb-layout { max-width: 1320px; margin: 0 auto; padding: 24px 24px 0; }
.pcb-crumb { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; font-size: .9rem; color: var(--pcb-silk); }
.pcb-crumb a { color: var(--pcb-gold-light); font-weight: 700; }
.pcb-empty { margin: 32px 0; padding: 24px; background: var(--pcb-chip); color: var(--pcb-ink); border-radius: 6px; text-align: center; list-style: none; }
.pcb-pager { margin-top: 32px; padding: 8px 12px; background: var(--pcb-chip); color: var(--pcb-ink); border-radius: 6px; }
.pcb-page-title { margin: 8px 0 20px; font-family: var(--pcb-display); font-weight: 800; font-size: clamp(1.8rem, 3.4vw, 2.5rem); color: #fff; }

.pcb-bus { margin-top: 36px; }
.pcb-bus-head { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; font-family: var(--pcb-display); font-weight: 800; font-size: 1.2rem; color: #fff; }
.pcb-bus-head::before { content: ""; flex: none; width: 14px; height: 14px; border-radius: 50%; background: var(--pcb-board); box-shadow: 0 0 0 4px var(--pcb-gold); }
.pcb-bus-head::after { content: ""; flex: 1; height: 3px; background: var(--pcb-gold); }

/* ---------- 芯片卡：两侧金色引脚 + 顶部缺口 ---------- */
.pcb-chips { display: grid; gap: 28px 24px; }
.pcb-chips-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pcb-chips-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pcb-chip { min-width: 0; padding: 0 10px; background: var(--pcb-pins-v) left 0 top 18px / 10px calc(100% - 36px) no-repeat, var(--pcb-pins-v) right 0 top 18px / 10px calc(100% - 36px) no-repeat; }
.pcb-chip-link { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr auto; height: 100%; box-sizing: border-box; background: var(--pcb-chip); color: var(--pcb-ink); border-radius: 4px; overflow: hidden; }
.pcb-chip-link::before { content: ""; position: absolute; left: 50%; top: -10px; width: 20px; height: 20px; margin-left: -10px; border-radius: 50%; background: var(--pcb-board); }
.pcb-chip-link:hover { box-shadow: 0 0 0 3px var(--pcb-gold-light); }
.pcb-chip-link > .pcb-chip-silk { padding: 14px 14px 10px; color: var(--pcb-link); }
.pcb-chip-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: #ddd3ea; }
.pcb-chip-title { padding: 12px 14px 8px; font-family: var(--pcb-display); font-weight: 600; font-size: 1.12rem; line-height: 1.3; }
.pcb-chip-link:hover .pcb-chip-title { text-decoration: underline; }
.pcb-chip-date { padding: 0 14px 14px; font-size: .82rem; color: var(--pcb-soft); white-space: nowrap; }

/* ---------- 首页头条：四边引脚的大芯片 ---------- */
.pcb-cpu { padding: 12px; background: var(--pcb-pins-h) left 24px top 0 / calc(100% - 48px) 12px no-repeat, var(--pcb-pins-h) left 24px bottom 0 / calc(100% - 48px) 12px no-repeat,
    var(--pcb-pins-v) left 0 top 24px / 12px calc(100% - 48px) no-repeat, var(--pcb-pins-v) right 0 top 24px / 12px calc(100% - 48px) no-repeat; }
.pcb-cpu-link { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); background: #1c1328; color: #fff; border-radius: 6px; overflow: hidden; }
.pcb-cpu-link:hover { box-shadow: 0 0 0 3px var(--pcb-gold-light); }
.pcb-cpu-link img { display: block; width: 100%; height: 100%; min-height: 320px; aspect-ratio: 16 / 9; object-fit: cover; background: #2a1646; }
.pcb-cpu-text { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 14px; padding: 26px 28px; }
.pcb-cpu-text .pcb-chip-silk { color: var(--pcb-gold-light); }
.pcb-cpu-title { font-family: var(--pcb-display); font-weight: 800; font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.12; }
.pcb-cpu-link:hover .pcb-cpu-title { text-decoration: underline; text-decoration-color: var(--pcb-gold); }
.pcb-cpu-excerpt { line-height: 1.6; color: #ddd3ea; }
.pcb-cpu-text .pcb-chip-date { padding: 0; color: #ddd3ea; }

/* ---------- 分类页：平躺的芯片，引脚在上下两边 ---------- */
.pcb-cat-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; max-width: 1000px; margin: 0; padding: 0; list-style: none; }
.pcb-dip { min-width: 0; padding: 10px 0; background: var(--pcb-pins-h) left 18px top 0 / calc(100% - 36px) 10px no-repeat, var(--pcb-pins-h) left 18px bottom 0 / calc(100% - 36px) 10px no-repeat; }
.pcb-dip-link { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 18px; align-items: start; padding: 12px; background: var(--pcb-chip); color: var(--pcb-ink); border-radius: 4px; }
.pcb-dip-link:hover { box-shadow: 0 0 0 3px var(--pcb-gold-light); }
.pcb-dip-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 2px; background: #ddd3ea; }
.pcb-dip-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.pcb-dip-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: .84rem; color: var(--pcb-soft); }
.pcb-dip-meta .pcb-chip-ref { color: var(--pcb-link); }
.pcb-dip-title { font-family: var(--pcb-display); font-weight: 600; font-size: 1.22rem; line-height: 1.28; }
.pcb-dip-link:hover .pcb-dip-title { text-decoration: underline; }
.pcb-dip-excerpt { color: var(--pcb-soft); line-height: 1.55; }
.pcb-cat-list > .pcb-ad { list-style: none; }
.pcb-cat-list > .pcb-ad:not(:has(.ad)) { display: none; }

/* ---------- 分类索引：丝印封装框 ---------- */
.pcb-footprints { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; margin: 0; padding: 0; list-style: none; }
.pcb-footprint { min-width: 0; }
.pcb-footprint a { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; height: 100%; box-sizing: border-box; padding: 22px 26px; border: 2px dashed var(--pcb-silk); border-radius: 4px; background: rgba(42, 22, 70, .85); }
.pcb-footprint a:hover { border-style: solid; border-color: var(--pcb-gold-light); }
.pcb-pad { position: absolute; width: 12px; height: 12px; background: var(--pcb-gold); border-radius: 2px; }
.pcb-pad-a { left: 6px; top: 6px; }
.pcb-pad-b { right: 6px; bottom: 6px; }
.pcb-footprint-name { font-family: var(--pcb-display); font-weight: 800; font-size: 1.2rem; color: #fff; }
.pcb-footprint-desc { color: #ddd3ea; font-size: .93rem; line-height: 1.5; }

/* ---------- 广告壳：无广告时塌陷 ---------- */
.pcb-ad:has(.ad) { margin: 24px 0; }
.pcb-ad:has(.ad) .ad { min-height: 250px; margin: 0 !important; }

/* ---------- 页脚：金手指 ---------- */
.pcb-foot { margin-top: 32px; padding: 28px 24px 96px; background: var(--pcb-board-dark); border-top: 3px solid var(--pcb-gold); }
.pcb-foot-inner { display: grid; gap: 18px; max-width: 1320px; margin: 0 auto; }
.pcb-foot-silk { margin: 0; font-family: var(--pcb-display); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; }
.pcb-fingers { display: flex; flex-wrap: wrap; gap: 10px; margin: 0; padding: 0; list-style: none; }
.pcb-fingers a { display: grid; justify-items: center; gap: 8px; padding: 10px 16px 12px; background: linear-gradient(var(--pcb-gold-light), var(--pcb-gold)); color: var(--pcb-ink); border-radius: 0 0 8px 8px; font-weight: 700; font-size: .9rem; }
.pcb-fingers a:hover { background: #fff; }
.pcb-finger-pad { width: 10px; height: 10px; border-radius: 50%; background: var(--pcb-board-dark); }
.pcb-foot-edge { height: 6px; background: repeating-linear-gradient(90deg, var(--pcb-gold) 0 18px, transparent 18px 24px); }

/* 文字容器显式写列宽、丝印允许收缩：超长标题或分类名不撑宽隐式列 */
.pcb-chip-silk > *, .pcb-dip-meta > * { min-width: 0; }

/* ---------- 共享页面：白色面板（正文不落在走线底纹上） ---------- */
.theme-circuit .site-menu, .theme-circuit .site-search, .theme-circuit .static-page, .theme-circuit .theme-error { --menu-accent: #5b2a9c; background: var(--pcb-chip); color: var(--pcb-ink); border-radius: 6px; }

/* ---------- 断点 ---------- */
@media (min-width: 1600px) {
    .pcb-layout, .pcb-head-inner, .pcb-foot-inner { max-width: 1540px; }
    .pcb-chips-four { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .pcb-footprints { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
    .pcb-cpu-link { grid-template-columns: minmax(0, 1fr); }
    .pcb-cpu-link img { min-height: 0; aspect-ratio: 24 / 9; }
    .pcb-cpu-text { padding: 20px 22px; }
    .pcb-chips-four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pcb-footprints { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pcb-dip-link { grid-template-columns: 170px minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .pcb-head-inner { min-height: 56px; padding: 2px 12px; gap: 10px; }
    .pcb-brand { gap: 12px; }
    .pcb-brand-chip { width: 20px; height: 20px; box-shadow: 0 0 0 3px var(--pcb-board-dark), 0 0 0 5px var(--pcb-gold); }
    .pcb-brand-name { font-size: 1.2rem; }
    .pcb-menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1.5px solid var(--pcb-gold); border-radius: 4px; box-sizing: border-box; }
    .pcb-layout { padding: 12px 12px 0; }
    .pcb-cpu { padding: 8px; background-size: calc(100% - 32px) 8px, calc(100% - 32px) 8px, 8px calc(100% - 32px), 8px calc(100% - 32px); background-position: left 16px top 0, left 16px bottom 0, left 0 top 16px, right 0 top 16px; }
    .pcb-cpu-link img { aspect-ratio: 16 / 9; }
    .pcb-cpu-text { gap: 8px; padding: 12px 14px 14px; }
    .pcb-cpu-title { font-size: 1.4rem; }
    .pcb-cpu-excerpt { display: none; }
    .pcb-bus { margin-top: 26px; }
    .pcb-chips { gap: 14px; }
    .pcb-chips-three, .pcb-chips-four { grid-template-columns: minmax(0, 1fr); }
    .pcb-chip { padding: 0 8px; background-size: 8px calc(100% - 24px), 8px calc(100% - 24px); background-position: left 0 top 12px, right 0 top 12px; }
    .pcb-chip-link { grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: auto 1fr auto; }
    .pcb-chip-link::before { display: none; }
    .pcb-chip-link > .pcb-chip-silk { grid-column: 2; padding: 10px 12px 2px; }
    .pcb-chip-link img { grid-column: 1; grid-row: 1 / span 3; height: 100%; min-height: 92px; aspect-ratio: auto; }
    .pcb-chip-title { grid-column: 2; padding: 4px 12px; font-size: 1rem; }
    .pcb-chip-date { grid-column: 2; padding: 0 12px 10px; }
    .pcb-cat-list { gap: 12px; }
    .pcb-dip { padding: 8px 0; background-size: calc(100% - 24px) 8px, calc(100% - 24px) 8px; background-position: left 12px top 0, left 12px bottom 0; }
    .pcb-dip-link { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 8px; }
    .pcb-dip-link img { height: 84px; aspect-ratio: auto; }
    .pcb-dip-title { font-size: 1rem; }
    .pcb-dip-excerpt { display: none; }
    .pcb-footprints { grid-template-columns: minmax(0, 1fr); }
    .pcb-foot { padding: 24px 16px 96px; }
}

/* 移动端：分类导航只在 /menu 出现，隐藏规则放在全局规则之后 */
@media (max-width: 767px) {
    .pcb-nav { display: none; }
}
