/* ribbon-marks · 书签丝带 —— 每篇文章是一页纸，顶边垂下一条分类色燕尾丝带；分类页丝带沿左边距垂下 */
:root {
    --rm-desk: #e9ebf4;
    --rm-page: #ffffff;
    --rm-ink: #20233a;
    --rm-soft: #4d5170;
    --rm-line: #d3d6e6;
    --rm-indigo: #3f3cbb;
    --rm-display: "DM Serif Display", Georgia, serif;
    --rm-body: "Wix Madefor Text", system-ui, -apple-system, "Segoe UI", sans-serif;
    --pagination-accent: #3f3cbb;
}

.rm-r0 { --rm-r: #b0123b; }
.rm-r1 { --rm-r: #0e7480; }
.rm-r2 { --rm-r: #3f3cbb; }
.rm-r3 { --rm-r: #94600a; }
.rm-r4 { --rm-r: #2f6b3a; }

body.theme-ribbon { margin: 0; color: var(--rm-ink); font-family: var(--rm-body); font-size: 17px; line-height: 1.55; background: var(--rm-desk); }
:where(.theme-ribbon) a { color: inherit; text-decoration: none; }
.theme-ribbon :focus-visible { outline: 3px solid var(--rm-indigo); outline-offset: 3px; }
.rm-skip { position: absolute; left: -9999px; }
.rm-skip:focus { left: 12px; top: 12px; z-index: 50; padding: 10px 14px; background: #fff; font-weight: 600; }
.rm-pages { display: block; min-height: 60vh; padding-bottom: 40px; }
.rm-pages:focus { outline: none; }

/* ---------- 母题：燕尾丝带 ---------- */
.rm-tail { position: absolute; top: -6px; right: 22px; width: 22px; height: 46px; background: var(--rm-r, #3f3cbb); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.rm-long-tail { display: inline-block; max-width: 100%; min-width: 0; box-sizing: border-box; padding: 6px 22px 10px 12px; background: var(--rm-r, #3f3cbb); color: #fff; font-weight: 600; font-size: .84rem; letter-spacing: .04em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; clip-path: polygon(0 0, 100% 0, calc(100% - 12px) 50%, 100% 100%, 0 100%); vertical-align: top; }
.rm-mark { display: flex; align-items: center; gap: 12px; margin: 40px 0 18px; font-family: var(--rm-display); font-weight: 400; font-size: 1.6rem; line-height: 1.2; }
.rm-mark::before { content: ""; flex: none; width: 14px; height: 30px; background: var(--rm-indigo); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%); }

/* ---------- 顶栏 ---------- */
.rm-head { background: var(--rm-page); border-bottom: 1px solid var(--rm-line); }
.rm-head-in { display: flex; align-items: center; gap: 24px; max-width: 1320px; margin: 0 auto; padding: 0 24px; min-height: 72px; }
.rm-title { display: inline-flex; align-items: flex-start; gap: 14px; min-width: 0; margin-right: auto; align-self: stretch; }
.rm-title-tail { flex: none; width: 18px; height: 52px; background: var(--rm-indigo); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); }
.rm-title-text { align-self: center; min-width: 0; font-family: var(--rm-display); font-size: 1.75rem; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-nav { display: flex; gap: 22px; }
.rm-nav a { padding: 6px 0; font-weight: 600; color: var(--rm-soft); border-bottom: 3px solid transparent; }
.rm-nav a:hover { color: var(--rm-ink); }
.rm-nav a.is-marked { color: var(--rm-ink); border-bottom-color: var(--rm-indigo); }
.rm-menu-toggle { display: none; }

/* ---------- 版心 ---------- */
.rm-sheet { max-width: 1320px; margin: 0 auto; padding: 24px 24px 0; }
.rm-sheet-narrow { max-width: 1000px; }
.rm-crumbs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 8px; font-size: .92rem; color: var(--rm-soft); }
.rm-crumbs a { color: var(--rm-indigo); font-weight: 600; }
.rm-heading { margin: 4px 0 28px; font-family: var(--rm-display); font-weight: 400; font-size: clamp(2rem, 3.6vw, 2.8rem); line-height: 1.12; }
.rm-blank { margin: 32px 0; padding: 24px; background: #fff; text-align: center; }
.rm-turn { margin-top: 32px; }

/* ---------- 书页卡片 ---------- */
.rm-grid { display: grid; gap: 28px 24px; }
.rm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rm-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.rm-page { display: grid; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rm-page-link { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; gap: 10px; padding: 12px 12px 18px; background: var(--rm-page); box-shadow: 0 1px 0 var(--rm-line), 4px 4px 0 #dcdfeb; }
.rm-page-link img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: var(--rm-line); }
.rm-page-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; padding-right: 30px; font-size: .84rem; color: var(--rm-soft); }
.rm-page-meta > * { min-width: 0; }
.rm-topic { font-weight: 600; color: var(--rm-r); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-page-title { font-family: var(--rm-display); font-size: 1.3rem; line-height: 1.22; }
.rm-page-link:hover .rm-page-title { text-decoration: underline; text-decoration-color: var(--rm-r); }

/* ---------- 首页头条：摊开的跨页 ---------- */
.rm-spread { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); background: var(--rm-page); box-shadow: 0 1px 0 var(--rm-line), 6px 6px 0 #dcdfeb; }
.rm-spread-left { border-right: 1px solid var(--rm-line); }
.rm-spread-left img { display: block; width: 100%; height: 100%; min-height: 320px; object-fit: cover; background: var(--rm-line); }
.rm-spread-right { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; justify-items: start; gap: 16px; padding: 0 30px 26px; }
.rm-spread-title { font-family: var(--rm-display); font-size: clamp(1.9rem, 2.8vw, 2.7rem); line-height: 1.1; }
.rm-spread:hover .rm-spread-title { text-decoration: underline; text-decoration-color: var(--rm-r); }
.rm-spread-text { color: var(--rm-soft); line-height: 1.65; }
.rm-spread-date { font-size: .9rem; color: var(--rm-soft); }

/* ---------- 分类页：丝带沿左边距 ---------- */
.rm-cat-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.rm-leaf { display: grid; grid-template-columns: 16px minmax(0, 1fr) 240px; gap: 20px; padding: 0 16px 0 0; background: var(--rm-page); box-shadow: 0 1px 0 var(--rm-line), 4px 4px 0 #dcdfeb; }
.rm-leaf-ribbon { background: var(--rm-r); margin-left: 24px; width: 16px; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 10px), 0 100%); }
.rm-leaf-words { display: grid; grid-template-columns: minmax(0, 1fr); align-content: center; gap: 8px; padding: 16px 0 16px 24px; }
.rm-leaf-title { font-family: var(--rm-display); font-size: 1.45rem; line-height: 1.2; }
.rm-leaf:hover .rm-leaf-title { text-decoration: underline; text-decoration-color: var(--rm-r); }
.rm-leaf-text { color: var(--rm-soft); line-height: 1.55; }
.rm-leaf-date { font-size: .86rem; color: var(--rm-soft); }
.rm-leaf img { display: block; align-self: center; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; margin: 14px 0; background: var(--rm-line); }
.rm-cat-list > .rm-ad:not(:has(.ad)) { display: none; }

/* ---------- 分类索引：一排垂下的丝带 ---------- */
.rm-hangers { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 24px; margin: 0; padding: 0; list-style: none; }
.rm-hangers li { min-width: 0; }
.rm-hanger { display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 10px; min-height: 200px; padding: 20px 18px 54px; background: var(--rm-r); color: #fff; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 34px), 0 100%); }
.rm-hanger-name { font-family: var(--rm-display); font-size: 1.45rem; line-height: 1.15; }
.rm-hanger:hover .rm-hanger-name { text-decoration: underline; }
.rm-hanger-desc { font-size: .9rem; line-height: 1.45; color: rgba(255, 255, 255, .92); }

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

/* ---------- 页脚：丝带横杆 ---------- */
.rm-foot { margin-top: 48px; background: var(--rm-page); border-top: 1px solid var(--rm-line); }
.rm-foot-rail { max-width: 1320px; margin: 0 auto; padding: 0 24px; border-top: 6px solid var(--rm-ink); }
.rm-tails { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; list-style: none; }
.rm-tails a { display: block; padding: 10px 14px 22px; background: var(--rm-r); color: #fff; font-weight: 600; font-size: .92rem; clip-path: polygon(0 0, 100% 0, 100% 100%, 50% calc(100% - 10px), 0 100%); }
.rm-tails a:hover { text-decoration: underline; }
.rm-colophon { display: grid; gap: 4px; max-width: 1320px; margin: 0 auto; padding: 22px 24px 96px; color: var(--rm-soft); font-size: .9rem; }
.rm-colophon strong { font-family: var(--rm-display); font-weight: 400; font-size: 1.4rem; color: var(--rm-ink); overflow-wrap: anywhere; }

/* ---------- 共享页面 ---------- */
.theme-ribbon .site-menu, .theme-ribbon .site-search, .theme-ribbon .static-page, .theme-ribbon .theme-error { --menu-accent: #3f3cbb; background: #fff; }

/* ---------- 断点 ---------- */
@media (min-width: 1600px) {
    .rm-sheet, .rm-head-in, .rm-foot-rail, .rm-colophon { max-width: 1540px; }
    .rm-sheet-narrow { max-width: 1080px; }
}

@media (max-width: 1023px) {
    .rm-spread { grid-template-columns: minmax(0, 1fr); }
    .rm-spread-left { border-right: 0; }
    .rm-spread-left img { min-height: 0; height: auto; aspect-ratio: 24 / 9; }
    .rm-grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .rm-leaf { grid-template-columns: 16px minmax(0, 1fr) 180px; }
}

@media (max-width: 767px) {
    .rm-head-in { min-height: 58px; padding: 0 12px; gap: 10px; }
    .rm-title { gap: 10px; }
    .rm-title-tail { width: 14px; height: 40px; }
    .rm-title-text { font-size: 1.3rem; }
    .rm-menu-toggle { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 8px; background: var(--rm-desk); }
    .rm-sheet { padding: 12px 12px 0; }
    .rm-spread-left img { aspect-ratio: 16 / 9; }
    .rm-spread-right { gap: 8px; padding: 0 14px 14px; }
    .rm-spread-title { font-size: 1.45rem; }
    .rm-spread-text { display: none; }
    .rm-mark { margin: 26px 0 12px; font-size: 1.3rem; }
    .rm-grid { gap: 12px; }
    .rm-grid-3, .rm-grid-4 { grid-template-columns: minmax(0, 1fr); }
    .rm-page-link { grid-template-columns: 100px minmax(0, 1fr); grid-template-rows: auto 1fr; gap: 4px 12px; padding: 10px 34px 10px 10px; }
    .rm-page-link img { grid-row: 1 / span 2; height: 100%; min-height: 80px; aspect-ratio: auto; }
    .rm-page-meta { padding-right: 0; font-size: .78rem; }
    .rm-page-title { font-size: 1.05rem; }
    .rm-tail { right: 10px; width: 16px; height: 34px; }
    .rm-leaf { grid-template-columns: 10px minmax(0, 1fr) 88px; gap: 10px; padding-right: 10px; }
    .rm-leaf-ribbon { margin-left: 10px; width: 10px; }
    .rm-leaf-words { gap: 4px; padding: 10px 0 10px 12px; }
    .rm-leaf-title { font-size: 1.05rem; }
    .rm-leaf-text { display: none; }
    .rm-leaf img { height: 80px; aspect-ratio: auto; margin: 10px 0; }
    .rm-hangers { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .rm-hanger { min-height: 150px; padding: 14px 12px 44px; }
    .rm-hanger-name { font-size: 1.15rem; }
    .rm-foot-rail, .rm-colophon { padding-left: 16px; padding-right: 16px; }
}

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