/* pegboard-hooks · 洞洞板 —— 打孔墙板、钢挂钩与挂片贯穿全站 */
:root {
    --pg-board: #e9edf1;
    --pg-hole: #b7c1cb;
    --pg-steel: #6e7a87;
    --pg-card: #ffffff;
    --pg-ink: #1e2731;
    --pg-soft: #4c5864;
    --pg-tab: #f2b705;
    --pg-red: #b8321f;
    --pg-slate: #34404c;
    --pg-display: Chivo, system-ui, -apple-system, "Segoe UI", sans-serif;
    --pg-body: "Noto Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pagination-accent: #b8321f;
}

body.theme-pegboard {
    margin: 0;
    color: var(--pg-ink);
    font-family: var(--pg-body);
    font-size: 16px;
    background-color: var(--pg-board);
    background-image: radial-gradient(circle, var(--pg-hole) 3px, transparent 3.5px);
    background-size: 28px 28px;
    background-position: 14px 14px;
}
:where(.theme-pegboard) a { color: inherit; text-decoration: none; }
.theme-pegboard :focus-visible { outline: 3px solid var(--pg-red); outline-offset: 3px; }
.pg-skip { position: absolute; left: -9999px; }
.pg-skip:focus { left: 12px; top: 12px; z-index: 50; padding: 10px 14px; background: var(--pg-card); font-weight: 700; }
.pg-wall:focus { outline: none; }

/* ---------- 母题：挂钩、挂片、主题标签 ---------- */
.pg-topic { display: inline-block; justify-self: start; max-width: 100%; padding: 2px 8px; border-radius: 3px; background: var(--pg-tab); color: var(--pg-ink); font-size: .76rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pg-date { font-size: .84rem; font-weight: 600; color: var(--pg-soft); }
.pg-hook { position: absolute; left: calc(50% - 4px); top: 0; width: 14px; height: 26px; border: 3px solid var(--pg-steel); border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }
.pg-hook::before { content: ""; position: absolute; left: -7px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--pg-slate); }
.pg-slot { justify-self: center; width: 34px; height: 10px; margin-bottom: 10px; border-radius: 5px; background: var(--pg-board); box-shadow: inset 0 2px 2px rgba(0, 0, 0, .25); }

/* ---------- 顶栏：金属横档 ---------- */
.pg-rail { background: linear-gradient(#4a5663, var(--pg-slate)); color: #fff; border-bottom: 4px solid var(--pg-steel); }
.pg-rail-inner { display: flex; align-items: center; gap: 20px; max-width: 1360px; margin: 0 auto; padding: 10px 24px; }
.pg-logo { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.pg-logo-tab { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 6px; background: var(--pg-tab); }
.pg-logo-tab::before { content: ""; width: 16px; height: 6px; border-radius: 3px; background: var(--pg-slate); }
.pg-logo-name { font-family: var(--pg-display); font-weight: 900; font-size: 1.45rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-drawers { display: flex; gap: 6px; }
.pg-drawers a { padding: 8px 14px; border-radius: 4px; background: rgba(255, 255, 255, .08); font-weight: 700; font-size: .93rem; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.pg-drawers a:hover { background: rgba(255, 255, 255, .16); }
.pg-drawers a.is-on { background: var(--pg-tab); color: var(--pg-ink); }
.pg-menu-toggle { display: none; color: inherit; }

/* ---------- 版心 ---------- */
.pg-wall { min-height: 60vh; padding-bottom: 40px; }
.pg-wall-frame { max-width: 1360px; margin: 0 auto; padding: 24px 24px 0; }
.pg-crumb { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-self: start; width: fit-content; max-width: 100%; margin: 0 0 8px; padding: 4px 10px; border-radius: 4px; background: var(--pg-card); font-size: .9rem; color: var(--pg-soft); }
.pg-crumb a { color: var(--pg-red); font-weight: 700; }
.pg-empty { margin: 32px 0; padding: 24px; border-radius: 8px; background: var(--pg-card); text-align: center; }
.pg-pager { margin-top: 32px; padding: 12px; border-radius: 8px; background: var(--pg-card); }

.pg-row { margin-top: 28px; }
.pg-row-label { display: inline-block; margin: 0 0 6px; padding: 4px 12px; border-radius: 4px; background: var(--pg-slate); color: #fff; font-family: var(--pg-display); font-weight: 900; font-size: 1rem; letter-spacing: .03em; }

/* ---------- 挂在钩上的卡片 ---------- */
.pg-pegs { display: grid; gap: 8px 20px; }
.pg-pegs-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.pg-pegs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.pg-hang { position: relative; min-width: 0; padding-top: 22px; }
.pg-hang-link { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; height: calc(100% - 4px); padding: 8px 10px 14px; border-radius: 10px 10px 6px 6px; background: var(--pg-card); box-shadow: 0 6px 12px rgba(30, 39, 49, .14), 0 1px 0 rgba(30, 39, 49, .2); }
.pg-hang-link:hover { transform: rotate(-1deg); }
.pg-hang-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 4px; background: var(--pg-board); }
.pg-hang-body { display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding-top: 12px; }
.pg-hang-title { overflow-wrap: anywhere; font-family: var(--pg-display); font-weight: 700; font-size: 1.08rem; line-height: 1.3; }
.pg-hang-link:hover .pg-hang-title { color: var(--pg-red); }

/* ---------- 首页头条：两个钩子吊着的招牌 ---------- */
.pg-sign { position: relative; padding-top: 26px; }
.pg-sign-wire { position: absolute; left: 0; right: 0; top: 0; height: 26px; background:
    linear-gradient(var(--pg-steel), var(--pg-steel)) 12% 0 / 3px 100% no-repeat,
    linear-gradient(var(--pg-steel), var(--pg-steel)) 88% 0 / 3px 100% no-repeat; }
.pg-sign-link { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); overflow: hidden; border-radius: 12px; background: var(--pg-card); border-top: 8px solid var(--pg-tab); box-shadow: 0 10px 20px rgba(30, 39, 49, .16); }
.pg-sign-link img { display: block; width: 100%; height: 100%; aspect-ratio: 8 / 3; object-fit: cover; background: var(--pg-board); }
.pg-sign-body { display: grid; gap: 14px; align-content: center; padding: 24px 28px; }
.pg-sign-title { font-family: var(--pg-display); font-weight: 900; font-size: clamp(1.6rem, 2.6vw, 2.3rem); line-height: 1.12; }
.pg-sign-link:hover .pg-sign-title { color: var(--pg-red); }
.pg-sign-excerpt { color: var(--pg-soft); line-height: 1.6; }

/* ---------- 分类页：带铆眼的吊牌 ---------- */
.pg-cat-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.pg-tag { min-width: 0; }
.pg-tag-link { display: grid; grid-template-rows: auto auto 1fr; height: 100%; padding: 12px 12px 14px; background: var(--pg-card); clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%, 0 18px); filter: drop-shadow(0 1px 0 rgba(30, 39, 49, .25)); }
.pg-eyelet { justify-self: center; width: 16px; height: 16px; margin-bottom: 10px; border-radius: 50%; background: var(--pg-board); box-shadow: 0 0 0 4px var(--pg-tab), inset 0 2px 2px rgba(0, 0, 0, .25); }
.pg-tag-link img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; object-fit: cover; background: var(--pg-board); }
.pg-tag-text { display: grid; grid-template-rows: auto 1fr auto; gap: 8px; padding-top: 12px; }
.pg-tag-title { overflow-wrap: anywhere; font-family: var(--pg-display); font-weight: 700; font-size: 1.12rem; line-height: 1.28; }
.pg-tag-link:hover .pg-tag-title { color: var(--pg-red); }
.pg-tag-excerpt { color: var(--pg-soft); font-size: .93rem; line-height: 1.5; }
.pg-tag-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.pg-cat-list > .pg-ad { margin: 4px 0; }
.pg-cat-list > .pg-ad:not(:has(.ad)) { display: none; }

/* ---------- 分类索引：工具轮廓板 ---------- */
.pg-wall-title { display: inline-block; margin: 8px 0 20px; padding: 6px 16px; border-radius: 6px; background: var(--pg-card); font-family: var(--pg-display); font-weight: 900; font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
.pg-shadow-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.pg-outline { display: grid; gap: 8px; }
.pg-peg-pair { display: flex; justify-content: center; gap: 28px; }
.pg-peg-pair i { width: 10px; height: 18px; border-radius: 5px 5px 2px 2px; background: var(--pg-steel); }
.pg-outline-link { display: grid; gap: 8px; align-content: start; height: 100%; padding: 16px; border: 3px dashed var(--pg-slate); border-radius: 18px; background: rgba(255, 255, 255, .86); }
.pg-outline-link:hover { border-style: solid; border-color: var(--pg-red); }
.pg-outline-name { font-family: var(--pg-display); font-weight: 900; font-size: 1.2rem; }
.pg-outline-desc { color: var(--pg-soft); font-size: .93rem; line-height: 1.5; }
.pg-outline-go { font-weight: 700; color: var(--pg-red); font-size: .9rem; }

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

/* ---------- 页脚：零件抽屉 ---------- */
.pg-bench { background: var(--pg-slate); color: #fff; border-top: 6px solid var(--pg-steel); }
.pg-bench-inner { max-width: 1360px; margin: 0 auto; padding: 20px 24px 96px; }
.pg-bench-label { margin: 0 0 12px; font-family: var(--pg-display); font-weight: 900; letter-spacing: .06em; text-transform: uppercase; color: var(--pg-tab); }
.pg-bins { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.pg-bin { display: grid; place-items: center; min-height: 64px; padding: 10px; border-radius: 4px 4px 14px 14px; background: #2b5d8c; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .25); }
.pg-bin-card { padding: 4px 10px; border-radius: 2px; background: var(--pg-card); color: var(--pg-ink); font-weight: 700; font-size: .9rem; text-align: center; }
.pg-bin:hover .pg-bin-card { color: var(--pg-red); }
.pg-bench-note { margin: 16px 0 0; font-size: .86rem; color: #d3dae1; }

/* 文字容器显式写列宽、标签允许收缩：否则超长标题或分类名会撑宽 grid 的隐式列（浏览器闸门 2026-10-21） */
.pg-hang-body, .pg-sign-body, .pg-tag-text, .pg-outline-link, .pg-paper-head { grid-template-columns: minmax(0, 1fr); }
.pg-topic { min-width: 0; }

/* ---------- 共享页面调色 ---------- */
.theme-pegboard .site-menu, .theme-pegboard .site-search, .theme-pegboard .static-page, .theme-pegboard .theme-error { --menu-accent: var(--pg-red); background: var(--pg-card); border-radius: 10px; }

/* ---------- 断点 ---------- */
@media (min-width: 1600px) {
    .pg-wall-frame, .pg-rail-inner, .pg-bench-inner { max-width: 1560px; }
    .pg-pegs-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 1023px) {
    .pg-sign-link { grid-template-columns: minmax(0, 1fr); }
    .pg-sign-link img { aspect-ratio: 16 / 7; }
    .pg-pegs-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .pg-tag-excerpt { display: none; }
    .pg-bins { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 767px) {
    .pg-rail-inner { min-height: 56px; padding: 4px 12px; gap: 10px; }
    .pg-logo-tab { width: 28px; height: 28px; }
    .pg-logo-name { font-size: 1.2rem; }
    .pg-menu-toggle { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 4px; background: rgba(255, 255, 255, .12); }
    .pg-wall-frame { padding: 10px 10px 0; }
    .pg-sign { padding-top: 16px; }
    .pg-sign-wire { height: 16px; }
    .pg-sign-link img { aspect-ratio: 16 / 9; }
    .pg-sign-body { padding: 14px; gap: 10px; }
    .pg-sign-title { font-size: 1.4rem; }
    .pg-sign-excerpt { display: none; }
    .pg-row { margin-top: 18px; }
    .pg-pegs { gap: 10px; }
    .pg-pegs-three, .pg-pegs-grid { grid-template-columns: minmax(0, 1fr); }
    .pg-hang { padding-top: 0; padding-left: 18px; }
    .pg-hook { left: 0; top: 18px; width: 18px; height: 14px; border: 3px solid var(--pg-steel); border-right: 0; border-bottom: 0; border-radius: 10px 0 0 0; }
    .pg-hook::before { left: -4px; top: -6px; width: 8px; height: 8px; }
    .pg-hang-link { grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto; gap: 12px; height: auto; padding: 8px; border-radius: 6px 10px 10px 6px; }
    .pg-slot { display: none; }
    .pg-hang-link img { height: 100%; min-height: 80px; aspect-ratio: auto; }
    .pg-hang-body { padding-top: 0; gap: 6px; }
    .pg-hang-title { font-size: 1rem; }
    .pg-cat-list { grid-template-columns: minmax(0, 1fr); gap: 10px; }
    .pg-tag-link { grid-template-columns: 22px 88px minmax(0, 1fr); grid-template-rows: auto; gap: 10px; align-items: center; padding: 8px 10px 8px 8px; clip-path: polygon(16px 0, 100% 0, 100% 100%, 16px 100%, 0 calc(100% - 16px), 0 16px); }
    .pg-eyelet { margin: 0; width: 12px; height: 12px; box-shadow: 0 0 0 3px var(--pg-tab), inset 0 2px 2px rgba(0, 0, 0, .25); }
    .pg-tag-link img { width: 88px; height: 88px; aspect-ratio: auto; }
    .pg-tag-text { padding-top: 0; gap: 6px; }
    .pg-tag-title { font-size: 1rem; }
    .pg-shadow-board { grid-template-columns: minmax(0, 1fr); gap: 14px; }
    .pg-bench-inner { padding: 16px 12px 96px; }
    .pg-bins { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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