/* element-tiles · 元素周期表 —— 分类是元素（两字母符号 + 族色），文章 ID 是原子序数，元素方块贯穿全站 */
:root {
    --el-lab: #f2f4f8;
    --el-tile-bg: #ffffff;
    --el-ink: #14213d;
    --el-soft: #4a5570;
    --el-rule: #d6dbe6;
    --el-accent: #0f766e;
    --el-display: Gabarito, "Segoe UI", system-ui, sans-serif;
    --el-body: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pagination-accent: #0f766e;
}

/* 族色：按分类 slug 取模 */
.el-group-0 { --el-group: #ffc2b4; }
.el-group-1 { --el-group: #ffe08a; }
.el-group-2 { --el-group: #b8e6c9; }
.el-group-3 { --el-group: #b9d4ff; }
.el-group-4 { --el-group: #e2c6ff; }

body.theme-element { margin: 0; color: var(--el-ink); font-family: var(--el-body); font-size: 16px; background: var(--el-lab); }
:where(.theme-element) a { color: inherit; text-decoration: none; }
.theme-element :focus-visible { outline: 3px solid var(--el-accent); outline-offset: 3px; }
.el-skip { position: absolute; left: -9999px; }
.el-skip:focus { left: 12px; top: 12px; z-index: 50; padding: 10px 14px; background: #fff; font-weight: 700; }
.el-table:focus { outline: none; }

/* ---------- 元素方块：左上原子序数、中间符号 ---------- */
.el-tile { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; justify-items: center; box-sizing: border-box; background: var(--el-group, #b9d4ff); color: var(--el-ink); border: 2px solid var(--el-ink); }
.el-tile-no { position: absolute; left: 6px; top: 4px; font-size: .72rem; font-weight: 700; white-space: nowrap; }
.el-tile-sym { font-family: var(--el-display); font-weight: 800; line-height: 1; }
.el-tile-name { max-width: 100%; font-size: .78rem; font-weight: 500; text-align: center; overflow-wrap: anywhere; }

/* ---------- 顶栏 ---------- */
.el-head { background: #fff; border-bottom: 2px solid var(--el-ink); }
.el-head-inner { display: flex; align-items: center; gap: 24px; max-width: 1320px; margin: 0 auto; padding: 10px 24px; }
.el-brand { display: inline-flex; align-items: center; gap: 12px; margin-right: auto; min-width: 0; }
.el-brand-tile { flex: none; display: grid; place-items: center; width: 40px; height: 40px; box-sizing: border-box; background: #b8e6c9; border: 2px solid var(--el-ink); font-family: var(--el-display); font-weight: 800; font-size: 1.1rem; }
.el-brand-name { min-width: 0; font-family: var(--el-display); font-weight: 800; font-size: 1.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el-nav { display: flex; gap: 6px; }
.el-nav a { padding: 8px 12px; font-weight: 500; border: 2px solid transparent; }
.el-nav a:hover { border-color: var(--el-rule); }
.el-nav a.is-on { border-color: var(--el-ink); background: #ffe08a; font-weight: 700; }
.el-menu-toggle { display: none; color: inherit; }

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

.el-period { margin-top: 36px; }
.el-period-head { margin: 0 0 16px; padding: 6px 0; border-top: 2px solid var(--el-ink); border-bottom: 2px solid var(--el-ink); font-family: var(--el-display); font-weight: 800; font-size: 1.15rem; letter-spacing: .02em; }

/* ---------- 卡片：图片左上角压一块元素方块 ---------- */
.el-cards { display: grid; gap: 24px; }
.el-cards-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.el-cards-four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.el-card { min-width: 0; }
.el-card-link { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; height: 100%; box-sizing: border-box; background: #fff; border: 2px solid var(--el-ink); }
.el-card-link:hover { background: color-mix(in srgb, var(--el-group) 25%, #fff); }
.el-card-photo { position: relative; display: block; }
.el-card-photo img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--el-rule); border-bottom: 2px solid var(--el-ink); }
.el-card-tile { position: absolute; left: 10px; top: 10px; width: 64px; height: 64px; }
.el-card-tile .el-tile-sym { font-size: 1.7rem; padding-top: 8px; }
.el-card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 12px 14px 0; font-size: .8rem; color: var(--el-soft); }
.el-card-cat { min-width: 0; max-width: 100%; padding: 1px 8px; background: var(--el-group); color: var(--el-ink); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.el-card-title { padding: 8px 14px 16px; font-family: var(--el-display); font-weight: 600; font-size: 1.15rem; line-height: 1.28; }
.el-card-link:hover .el-card-title { text-decoration: underline; }

/* ---------- 首页头条：大元素卡 + 照片 ---------- */
.el-lead-link { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0; background: #fff; border: 3px solid var(--el-ink); }
.el-lead-tile { gap: 10px; padding: 24px 12px; border-width: 0 3px 0 0; }
.el-lead-tile .el-tile-no { left: 12px; top: 10px; font-size: .95rem; }
.el-lead-tile .el-tile-sym { font-size: 5rem; }
.el-lead-tile .el-tile-name { font-size: .95rem; font-weight: 700; }
.el-tile-date { font-size: .82rem; white-space: nowrap; }
.el-lead-main { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 14px; padding: 16px 20px 22px; }
.el-lead-main img { display: block; width: 100%; height: auto; aspect-ratio: 24 / 9; object-fit: cover; background: var(--el-rule); }
.el-lead-title { font-family: var(--el-display); font-weight: 800; font-size: clamp(1.7rem, 2.6vw, 2.4rem); line-height: 1.12; }
.el-lead-link:hover .el-lead-title { text-decoration: underline; text-decoration-color: var(--el-accent); }
.el-lead-excerpt { color: var(--el-soft); line-height: 1.6; }

/* ---------- 分类页：每行以元素方块开头 ---------- */
.el-cat-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-width: 1040px; margin: 0; padding: 0; list-style: none; }
.el-row { min-width: 0; }
.el-row-link { display: grid; grid-template-columns: 72px 190px minmax(0, 1fr); gap: 16px; align-items: start; padding: 12px; background: #fff; border: 2px solid var(--el-ink); }
.el-row-link:hover { background: color-mix(in srgb, var(--el-group) 25%, #fff); }
.el-row-tile { width: 72px; height: 72px; }
.el-row-tile .el-tile-sym { font-size: 1.9rem; padding-top: 8px; }
.el-row-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--el-rule); }
.el-row-text { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.el-row-date { font-size: .84rem; font-weight: 500; color: var(--el-soft); }
.el-row-title { font-family: var(--el-display); font-weight: 600; font-size: 1.25rem; line-height: 1.25; }
.el-row-link:hover .el-row-title { text-decoration: underline; }
.el-row-excerpt { color: var(--el-soft); line-height: 1.55; }
.el-cat-list > .el-ad { list-style: none; }
.el-cat-list > .el-ad:not(:has(.ad)) { display: none; }

/* ---------- 分类索引：周期表网格 ---------- */
.el-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.el-grid-cell { min-width: 0; }
.el-grid-tile { height: 100%; min-height: 170px; gap: 8px; padding: 18px 12px; }
.el-grid-tile:hover { outline: 3px solid var(--el-ink); outline-offset: -6px; }
.el-grid-tile .el-tile-sym { font-size: 3rem; }
.el-grid-tile .el-tile-name { font-size: .95rem; font-weight: 700; }
.el-grid-desc { font-size: .8rem; line-height: 1.4; text-align: center; color: #2b3654; }

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

/* ---------- 页脚：图例 ---------- */
.el-foot { margin-top: 32px; padding: 28px 24px 96px; background: #fff; border-top: 3px solid var(--el-ink); }
.el-foot-inner { display: grid; gap: 16px; max-width: 1320px; margin: 0 auto; }
.el-foot-title { margin: 0; font-family: var(--el-display); font-weight: 800; font-size: 1.2rem; }
.el-legend { display: flex; flex-wrap: wrap; gap: 12px 28px; }
.el-legend a { display: inline-flex; align-items: center; gap: 10px; font-weight: 500; }
.el-legend a:hover { text-decoration: underline; }
.el-key { flex: none; display: grid; place-items: center; width: 34px; height: 34px; box-sizing: border-box; background: var(--el-group); border: 2px solid var(--el-ink); font-family: var(--el-display); font-weight: 800; font-size: .95rem; }
.el-foot-note { margin: 0; font-size: .88rem; color: var(--el-soft); }

/* 文字容器显式写列宽、标签允许收缩：超长标题或分类名不撑宽隐式列 */
.el-card-meta > *, .el-row-text > * { min-width: 0; }

/* ---------- 共享页面 ---------- */
.theme-element .site-menu, .theme-element .site-search, .theme-element .static-page, .theme-element .theme-error { --menu-accent: #0f766e; background: #fff; border: 2px solid var(--el-ink); }

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

@media (max-width: 1023px) {
    .el-lead-link { grid-template-columns: 150px minmax(0, 1fr); }
    .el-lead-tile .el-tile-sym { font-size: 3.6rem; }
    .el-cards-four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .el-row-link { grid-template-columns: 64px 150px minmax(0, 1fr); }
    .el-row-tile { width: 64px; height: 64px; }
}

@media (max-width: 767px) {
    .el-head-inner { min-height: 56px; padding: 2px 12px; gap: 10px; }
    .el-brand-tile { width: 32px; height: 32px; font-size: .95rem; }
    .el-brand-name { font-size: 1.2rem; }
    .el-menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 2px solid var(--el-ink); box-sizing: border-box; }
    .el-table-inner { padding: 12px 12px 0; }
    .el-lead-link { grid-template-columns: minmax(0, 1fr); border-width: 2px; }
    .el-lead-tile { grid-template-columns: auto minmax(0, 1fr) auto; justify-items: start; align-items: center; gap: 10px; padding: 8px 12px; border-width: 0 0 2px 0; }
    .el-lead-tile .el-tile-no { position: static; font-size: .8rem; }
    .el-lead-tile .el-tile-sym { font-size: 1.6rem; }
    .el-lead-tile .el-tile-name { text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; overflow-wrap: normal; }
    .el-tile-date { display: none; }
    .el-lead-main { gap: 10px; padding: 10px 12px 14px; }
    .el-lead-main img { aspect-ratio: 16 / 9; }
    .el-lead-title { font-size: 1.4rem; }
    .el-lead-excerpt { display: none; }
    .el-period { margin-top: 26px; }
    .el-cards { gap: 12px; }
    .el-cards-three, .el-cards-four { grid-template-columns: minmax(0, 1fr); }
    .el-card-link { grid-template-columns: 104px minmax(0, 1fr); grid-template-rows: auto 1fr; }
    .el-card-photo { grid-row: 1 / span 2; }
    .el-card-photo img { height: 100%; min-height: 92px; aspect-ratio: auto; border-bottom: 0; border-right: 2px solid var(--el-ink); }
    .el-card-tile { left: 6px; top: 6px; width: 36px; height: 36px; border-width: 1.5px; }
    .el-card-tile .el-tile-no { display: none; }
    .el-card-tile .el-tile-sym { font-size: 1rem; padding-top: 0; }
    .el-card-meta { padding: 10px 12px 0; }
    .el-card-title { padding: 4px 12px 10px; font-size: 1rem; }
    .el-cat-list { gap: 10px; }
    .el-row-link { grid-template-columns: 88px minmax(0, 1fr); gap: 12px; padding: 8px; }
    .el-row-tile { display: none; }
    .el-row-link img { height: 84px; aspect-ratio: auto; border-left: 8px solid var(--el-group); box-sizing: border-box; }
    .el-row-title { font-size: 1rem; }
    .el-row-excerpt { display: none; }
    .el-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .el-grid-tile { min-height: 140px; }
    .el-grid-tile .el-tile-sym { font-size: 2.3rem; }
    .el-foot { padding: 24px 16px 96px; }
}

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