/* toy-bricks · 积木颗粒 —— 每篇文章是一块积木：顶边一排分类色圆颗粒，头条是八颗粒长条，分类页是侧边带颗粒的平板 */
:root {
    --tb-plate: #e2e6ea;
    --tb-brick: #ffffff;
    --tb-ink: #1b1f2a;
    --tb-soft: #4a5263;
    --tb-line: #c9cfd7;
    --tb-red: #c4161c;
    --tb-display: Fredoka, "Segoe UI", system-ui, sans-serif;
    --tb-body: Urbanist, system-ui, -apple-system, "Segoe UI", sans-serif;
    --pagination-accent: #c4161c;
}

.tb-c0 { --tb-c: #c4161c; --tb-c-dark: #8f0f14; }
.tb-c1 { --tb-c: #1e56c8; --tb-c-dark: #163f93; }
.tb-c2 { --tb-c: #1d7a43; --tb-c-dark: #145630; }
.tb-c3 { --tb-c: #b8500a; --tb-c-dark: #863a07; }
.tb-c4 { --tb-c: #6b3fb8; --tb-c-dark: #4e2e86; }

body.theme-bricks { margin: 0; color: var(--tb-ink); font-family: var(--tb-body); font-size: 17px; line-height: 1.55; background: var(--tb-plate); }
:where(.theme-bricks) a { color: inherit; text-decoration: none; }
.theme-bricks :focus-visible { outline: 3px solid var(--tb-red); outline-offset: 3px; }
.tb-skip { position: absolute; left: -9999px; }
.tb-skip:focus { left: 12px; top: 12px; z-index: 50; padding: 10px 14px; background: #fff; font-weight: 600; }
.tb-baseplate { background-image: radial-gradient(circle at 12px 12px, rgba(27, 31, 42, .06) 0 5px, transparent 5.5px); background-size: 24px 24px; }
.tb-main { display: block; min-height: 60vh; padding-bottom: 40px; }
.tb-main:focus { outline: none; }

/* ---------- 母题：颗粒 ---------- */
.tb-studs { display: block; height: 10px; margin: 0 14px; background: radial-gradient(ellipse 9px 10px at 50% 100%, var(--tb-c, #c4161c) 0 8.5px, transparent 9px) 0 0 / 30px 10px repeat-x; }
.tb-studs-big { height: 14px; margin: 0 22px; background-size: 44px 14px; background-image: radial-gradient(ellipse 13px 14px at 50% 100%, var(--tb-c, #c4161c) 0 12.5px, transparent 13px); }
.tb-chip { display: inline-block; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 2px 10px; border-radius: 6px; background: var(--tb-c, #c4161c); color: #fff; font-family: var(--tb-display); font-weight: 500; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.tb-when { font-size: .86rem; color: var(--tb-soft); white-space: nowrap; }

/* ---------- 顶栏 ---------- */
.tb-top { background: var(--tb-brick); border-bottom: 4px solid var(--tb-ink); }
.tb-top-row { display: flex; align-items: center; gap: 24px; max-width: 1320px; margin: 0 auto; padding: 12px 24px; }
.tb-logo { display: inline-flex; align-items: center; gap: 12px; min-width: 0; margin-right: auto; }
.tb-logo-brick { flex: none; display: grid; grid-template-columns: repeat(2, 10px); gap: 4px; align-content: end; width: 34px; height: 30px; box-sizing: border-box; padding: 0 5px 4px; border-radius: 4px; background: var(--tb-red); }
.tb-logo-brick i { display: block; height: 8px; border-radius: 3px; background: #e8484d; transform: translateY(-12px); }
.tb-logo-name { min-width: 0; font-family: var(--tb-display); font-weight: 600; font-size: 1.55rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-menu { display: flex; gap: 6px; }
.tb-menu a { padding: 6px 14px; border-radius: 8px; font-weight: 600; }
.tb-menu a:hover { background: var(--tb-plate); }
.tb-menu a.is-here { background: var(--tb-ink); color: #fff; }
.tb-menu-toggle { display: none; }

/* ---------- 版心 ---------- */
.tb-frame { max-width: 1320px; margin: 0 auto; padding: 24px 24px 0; }
.tb-frame-cat { max-width: 1040px; }
.tb-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin: 0 0 8px; font-size: .92rem; color: var(--tb-soft); }
.tb-trail a { color: var(--tb-ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--tb-line); text-underline-offset: 3px; }
.tb-trail-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--tb-red); }
.tb-page-title { margin: 4px 0 24px; font-family: var(--tb-display); font-weight: 600; font-size: clamp(1.8rem, 3.4vw, 2.5rem); line-height: 1.15; }
.tb-heading { display: flex; align-items: center; gap: 14px; margin: 40px 0 16px; font-family: var(--tb-display); font-weight: 600; font-size: 1.3rem; }
.tb-heading-studs { flex: none; width: 52px; height: 18px; border-radius: 4px; background: radial-gradient(circle at 13px 9px, #e8484d 0 5px, transparent 5.5px), radial-gradient(circle at 39px 9px, #e8484d 0 5px, transparent 5.5px), var(--tb-red); }
.tb-none { margin: 32px 0; padding: 24px; background: #fff; border-radius: 10px; text-align: center; list-style: none; }
.tb-pages { margin-top: 32px; }

/* ---------- 积木卡片 ---------- */
.tb-row { display: grid; gap: 24px; }
.tb-row-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 24px; }
.tb-row-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tb-brick { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-width: 0; }
.tb-brick-face { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; background: var(--tb-brick); border-radius: 8px; border-top: 8px solid var(--tb-c); box-shadow: 0 4px 0 var(--tb-c-dark, #8f0f14); overflow: hidden; }
.tb-brick-face img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--tb-line); }
.tb-brick-text { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: start; gap: 8px; padding: 14px 16px 16px; }
.tb-brick-title { font-family: var(--tb-display); font-weight: 500; font-size: 1.15rem; line-height: 1.28; }
.tb-brick-face:hover .tb-brick-title { text-decoration: underline; text-decoration-color: var(--tb-c); }

/* ---------- 首页头条：八颗粒长条 ---------- */
.tb-long { display: grid; grid-template-columns: minmax(0, 1fr); }
.tb-long-face { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); background: var(--tb-brick); border-radius: 10px; border-top: 12px solid var(--tb-c); box-shadow: 0 6px 0 var(--tb-c-dark, #8f0f14); overflow: hidden; }
.tb-long-face img { display: block; width: 100%; height: 100%; min-height: 320px; object-fit: cover; background: var(--tb-line); }
.tb-long-text { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: start; gap: 14px; padding: 24px 28px; }
.tb-long-title { font-family: var(--tb-display); font-weight: 600; font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.12; }
.tb-long-face:hover .tb-long-title { text-decoration: underline; text-decoration-color: var(--tb-c); }
.tb-long-sum { color: var(--tb-soft); line-height: 1.6; }

/* ---------- 分类页：侧边颗粒平板 ---------- */
.tb-cat-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin: 0; padding: 0; list-style: none; }
.tb-plate-item { min-width: 0; }
.tb-plate-link { display: grid; grid-template-columns: 22px 220px minmax(0, 1fr); gap: 18px; padding: 12px 18px 12px 0; background: var(--tb-brick); border-radius: 8px; box-shadow: 0 4px 0 var(--tb-line); }
.tb-side-studs { margin: -12px 0; border-radius: 8px 0 0 8px; background: radial-gradient(ellipse 10px 9px at 100% 50%, var(--tb-c) 0 8.5px, transparent 9px) 0 0 / 22px 28px repeat-y, var(--tb-c-dark, #8f0f14); background-position: -8px 4px, 0 0; }
.tb-plate-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; border-radius: 6px; background: var(--tb-line); }
.tb-plate-copy { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 6px; }
.tb-plate-title { font-family: var(--tb-display); font-weight: 500; font-size: 1.3rem; line-height: 1.25; }
.tb-plate-link:hover .tb-plate-title { text-decoration: underline; text-decoration-color: var(--tb-c); }
.tb-plate-sum { color: var(--tb-soft); line-height: 1.55; }
.tb-cat-list > .tb-ad { list-style: none; }
.tb-cat-list > .tb-ad:not(:has(.ad)) { display: none; }

/* ---------- 分类索引：2×2 积木堆 ---------- */
.tb-pile { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 28px 20px; }
.tb-square { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 8px; min-width: 0; padding: 0 18px 20px; background: var(--tb-c); color: #fff; border-radius: 8px; box-shadow: 0 5px 0 var(--tb-c-dark); }
.tb-square-studs { display: flex; gap: 22px; height: 14px; margin: -14px 0 6px 10px; }
.tb-square-studs i { display: block; width: 28px; height: 14px; border-radius: 6px 6px 0 0; background: var(--tb-c); }
.tb-square-name { font-family: var(--tb-display); font-weight: 600; font-size: 1.3rem; line-height: 1.2; }
.tb-square:hover .tb-square-name { text-decoration: underline; }
.tb-square-desc { font-size: .92rem; line-height: 1.45; color: rgba(255, 255, 255, .92); }

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

/* ---------- 页脚：底板条与 1×2 小积木 ---------- */
.tb-foot { margin-top: 40px; background: var(--tb-ink); color: #e5e8ee; }
.tb-foot-studs { height: 12px; background: radial-gradient(ellipse 9px 12px at 50% 100%, #2c3242 0 8.5px, transparent 9px) 0 0 / 30px 12px repeat-x; background-color: var(--tb-plate); }
.tb-foot-inner { max-width: 1320px; margin: 0 auto; padding: 28px 24px 96px; }
.tb-foot-name { margin: 0 0 16px; font-family: var(--tb-display); font-weight: 600; font-size: 1.35rem; color: #fff; overflow-wrap: anywhere; }
.tb-foot-links { display: flex; flex-wrap: wrap; gap: 18px 14px; }
.tb-mini { position: relative; display: inline-block; padding: 6px 14px; border-radius: 6px; background: var(--tb-c); color: #fff; font-weight: 600; }
.tb-mini::before { content: ""; position: absolute; left: 10px; right: 10px; top: -7px; height: 7px; background: radial-gradient(ellipse 7px 7px at 50% 100%, var(--tb-c) 0 6.5px, transparent 7px) 0 0 / 22px 7px repeat-x; }
.tb-mini:hover { background: var(--tb-c-dark); }
.tb-foot-note { margin: 20px 0 0; font-size: .9rem; color: #c5cad4; }

/* ---------- 共享页面 ---------- */
.theme-bricks .site-menu, .theme-bricks .site-search, .theme-bricks .static-page, .theme-bricks .theme-error { --menu-accent: #c4161c; background: #fff; border-radius: 10px; }

/* ---------- 断点 ---------- */
@media (min-width: 1600px) {
    .tb-frame, .tb-top-row, .tb-foot-inner { max-width: 1540px; }
    .tb-frame-cat { max-width: 1100px; }
}

@media (max-width: 1023px) {
    .tb-long-face { grid-template-columns: minmax(0, 1fr); }
    .tb-long-face img { min-height: 0; height: auto; aspect-ratio: 24 / 9; }
    .tb-row-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tb-plate-link { grid-template-columns: 22px 170px minmax(0, 1fr); }
}

@media (max-width: 767px) {
    .tb-top { border-bottom-width: 3px; }
    .tb-top-row { min-height: 56px; padding: 2px 12px; gap: 10px; }
    .tb-logo { gap: 10px; }
    .tb-logo-brick { width: 28px; height: 24px; grid-template-columns: repeat(2, 8px); padding: 0 4px 3px; }
    .tb-logo-brick i { height: 6px; transform: translateY(-9px); }
    .tb-logo-name { font-size: 1.2rem; }
    .tb-menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--tb-plate); }
    .tb-frame { padding: 12px 12px 0; }
    .tb-long .tb-studs { display: none; }
    .tb-long-face { border-top-width: 8px; box-shadow: 0 4px 0 var(--tb-c-dark); }
    .tb-long-face img { aspect-ratio: 16 / 9; }
    .tb-long-text { gap: 8px; padding: 12px 14px 14px; }
    .tb-long-title { font-size: 1.4rem; }
    .tb-long-sum { display: none; }
    .tb-row { gap: 14px; }
    .tb-row-3, .tb-row-4 { grid-template-columns: minmax(0, 1fr); margin-top: 14px; }
    .tb-brick .tb-studs { display: none; }
    .tb-brick-face { grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto; border-top: 0; border-left: 8px solid var(--tb-c); box-shadow: 0 3px 0 var(--tb-line); }
    .tb-brick-face img { height: 100%; min-height: 88px; aspect-ratio: auto; }
    .tb-brick-text { gap: 4px; padding: 8px 10px 10px; }
    .tb-brick-text .tb-chip { font-size: .72rem; padding: 1px 8px; }
    .tb-brick-title { font-size: 1rem; }
    .tb-heading { margin-top: 26px; }
    .tb-plate-link { grid-template-columns: 12px 88px minmax(0, 1fr); gap: 10px; padding: 8px 10px 8px 0; }
    .tb-side-studs { margin: -8px 0; background-size: 12px 20px, auto; background-position: -10px 2px, 0 0; }
    .tb-plate-link img { height: 84px; aspect-ratio: auto; }
    .tb-plate-title { font-size: 1rem; }
    .tb-plate-sum { display: none; }
    .tb-pile { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
    .tb-square { padding: 0 12px 14px; }
    .tb-square-studs { gap: 14px; margin-left: 6px; }
    .tb-square-studs i { width: 22px; }
    .tb-square-name { font-size: 1.05rem; }
    .tb-foot-inner { padding: 24px 16px 96px; }
}

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