@charset "utf-8";
/* ============================================================
   大笨钟的小说 · zmnas.com
   宣纸 / 朱砂 / 霞鹜文楷
   封面、目录、正文共用一套纸墨体系
   ============================================================ */

@font-face {
    font-family: "WenKai";
    src: url("fonts/wenkai-read.woff2") format("woff2");
    font-display: swap;
}

:root {
    --paper: #f4eee2;
    --paper-2: #efe6d4;
    --paper-3: #e7dcc6;
    --ink: #2a2521;
    --ink-2: #574e44;
    --ink-3: #8d8477;
    --seal: #a0352a;
    --seal-soft: rgba(160, 53, 42, .1);
    --line: rgba(42, 37, 33, .16);
    --line-soft: rgba(42, 37, 33, .08);
    --shadow: 0 18px 40px -24px rgba(42, 37, 33, .55);
    --serif: "WenKai", "Songti SC", "STSong", "SimSun", "Noto Serif CJK SC", "Source Han Serif SC", serif;
    --mono: ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;
    --measure: 34em;
    --fs: 19px;
    --ease: cubic-bezier(.22, .8, .26, 1);
}

[data-theme="dark"] {
    --paper: #14130f;
    --paper-2: #1b1a15;
    --paper-3: #24221b;
    --ink: #ddd5c5;
    --ink-2: #a9a08f;
    --ink-3: #7c7466;
    --seal: #c4655a;
    --seal-soft: rgba(196, 101, 90, .12);
    --line: rgba(221, 213, 197, .15);
    --line-soft: rgba(221, 213, 197, .07);
    --shadow: 0 18px 40px -24px rgba(0, 0, 0, .8);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    color-scheme: light;
}
[data-theme="dark"] html, html[data-theme="dark"] { color-scheme: dark; }

body {
    margin: 0;
    min-height: 100vh;
    background-color: var(--paper);
    background-image: url("bg-xuan.svg");
    background-repeat: repeat;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 17px;
    line-height: 1.85;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
[data-theme="dark"] body {
    background-image: none;
    background-color: var(--paper);
}

::selection { background: var(--seal); color: #f7f2e6; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

img { max-width: 100%; }

:focus-visible {
    outline: 2px solid var(--seal);
    outline-offset: 3px;
}

/* 跨页转场：支持的浏览器会得到一次「翻页」的淡入 */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: pg-out .22s var(--ease) both; }
::view-transition-new(root) { animation: pg-in .3s var(--ease) both; }
@keyframes pg-out { to { opacity: 0; transform: translateY(-6px); } }
@keyframes pg-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------------- 顶栏 ---------------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px max(20px, calc((100vw - 1120px) / 2));
    background: color-mix(in srgb, var(--paper) 86%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line-soft);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand-seal {
    width: 40px;
    height: 40px;
    transform: rotate(-4deg);
    filter: saturate(.95);
}

.brand-name {
    font-size: 20px;
    letter-spacing: .06em;
    white-space: nowrap;
}
.brand-name b { font-weight: 600; }
.brand-name i {
    font-style: normal;
    font-size: .78em;
    color: var(--ink-2);
    margin-left: .12em;
}

.topnav {
    display: flex;
    gap: 22px;
    font-size: 15px;
    color: var(--ink-2);
}
.topnav a {
    position: relative;
    padding: 4px 0;
}
.topnav a::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 1px;
    background: var(--seal);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .25s var(--ease);
}
.topnav a:hover::after { transform: scaleX(1); }

/* ---------------- 通用 ---------------- */

.eyebrow {
    margin: 0 0 14px;
    font-size: 12.5px;
    letter-spacing: .28em;
    color: var(--ink-3);
    text-transform: uppercase;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 20px;
    border: 1px solid var(--line);
    border-radius: 2px;
    background: transparent;
    font-size: 15px;
    letter-spacing: .04em;
    cursor: pointer;
    transition: border-color .2s, background .2s, color .2s, transform .2s;
}
.btn:hover { border-color: var(--ink-3); transform: translateY(-1px); }
.btn-primary {
    background: var(--ink);
    color: var(--paper);
    border-color: var(--ink);
}
.btn-primary:hover { background: var(--seal); border-color: var(--seal); color: #f7f2e6; }

.muted { color: var(--ink-3); }

/* ---------------- 书封 ---------------- */

.cover {
    position: relative;
    container-type: inline-size;
    aspect-ratio: 3 / 4;
    background: linear-gradient(155deg, var(--paper-2) 0%, var(--paper) 46%, var(--paper-3) 100%);
    box-shadow: var(--shadow);
    user-select: none;
}
.cover::before {
    /* 纸纹 */
    content: "";
    position: absolute;
    inset: 0;
    background-image: url("bg-xuan.svg");
    opacity: .55;
    pointer-events: none;
    mix-blend-mode: multiply;
}
[data-theme="dark"] .cover::before { opacity: .2; mix-blend-mode: normal; }

.cover-face {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: stretch;
    padding: 9% 9% 9%;
    border: 1px solid var(--line);
    outline: 1px solid var(--line-soft);
    outline-offset: 4px;
}

.cover-seal {
    position: absolute;
    top: 8%;
    left: 9%;
    width: 15%;
    height: auto;
    transform: rotate(-4deg);
    opacity: .95;
}

.cover-main {
    margin-left: auto;
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 5%;
    padding-top: 12%;
}

.cover-title {
    writing-mode: vertical-rl;
    font-size: 9.2cqw;
    line-height: 1.12;
    letter-spacing: .12em;
    font-weight: 600;
    color: var(--ink);
}
.cover-sub {
    writing-mode: vertical-rl;
    font-size: 4.6cqw;
    line-height: 1.2;
    letter-spacing: .16em;
    color: var(--ink-2);
    padding-top: 1.2em;
}

.cover-author {
    position: absolute;
    left: 9%;
    bottom: 20%;
    writing-mode: vertical-rl;
    font-size: 3.9cqw;
    letter-spacing: .22em;
    color: var(--ink-2);
}

.cover-band {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 15%;
    padding: 2.4cqw 6cqw;
    background: var(--ink);
    color: var(--paper);
}
.cover-band span {
    font-size: 3.7cqw;
    letter-spacing: .18em;
    line-height: 1.5;
    text-align: center;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cover--md { width: 100%; }
.cover--lg { width: 100%; max-width: 340px; }

/* 书脊投影，让它更像一本实体书 */
.book-card .cover::after,
.book-hero .cover::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0; left: 0;
    width: 9%;
    background: linear-gradient(90deg, rgba(42, 37, 33, .22), rgba(42, 37, 33, .04) 55%, transparent);
    pointer-events: none;
}

/* ---------------- 书架 ---------------- */

.shelf {
    max-width: 1120px;
    margin: 0 auto;
    padding: 72px 20px 40px;
    display: grid;
    grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
    gap: 72px;
    align-items: start;
}

.shelf-intro { position: sticky; top: 108px; }

.shelf-title {
    margin: 0 0 26px;
    font-size: clamp(30px, 3.4vw, 44px);
    line-height: 1.42;
    letter-spacing: .04em;
    font-weight: 600;
}

.lede {
    margin: 0 0 22px;
    color: var(--ink-2);
    font-size: 16px;
    line-height: 1.9;
    max-width: 22em;
}

.shelf-count {
    margin: 0;
    font-size: 13.5px;
    letter-spacing: .1em;
    color: var(--ink-3);
}
.shelf-count b { color: var(--seal); font-size: 16px; }

.shelf-books {
    display: grid;
    gap: 40px;
}

.book-card {
    display: grid;
    grid-template-columns: 190px minmax(0, 1fr);
    gap: 30px;
    align-items: center;
    padding: 6px;
    transition: transform .3s var(--ease);
}
.book-card:hover { transform: translateY(-3px); }
.book-card:hover .card-meta h2 { color: var(--seal); }

.card-meta h2 {
    margin: 0 0 6px;
    font-size: 26px;
    letter-spacing: .06em;
    font-weight: 600;
    transition: color .25s;
}
.card-sub {
    margin: 0 0 14px;
    font-size: 15px;
    color: var(--ink-2);
    letter-spacing: .04em;
}
.card-tagline {
    margin: 0 0 18px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--ink-2);
    max-width: 24em;
}
.card-stats {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 12.5px;
    letter-spacing: .1em;
    color: var(--ink-3);
}

.empty { color: var(--ink-3); }

/* ---------------- 关于 ---------------- */

.about {
    max-width: 1120px;
    margin: 40px auto 0;
    padding: 48px 20px 20px;
    border-top: 1px solid var(--line-soft);
}
.about h2 {
    margin: 0 0 18px;
    font-size: 15px;
    letter-spacing: .28em;
    font-weight: 500;
    color: var(--ink-3);
}
.about p {
    margin: 0 0 12px;
    max-width: 38em;
    color: var(--ink-2);
    font-size: 15.5px;
}

/* ---------------- 书页 ---------------- */

.bookpage {
    max-width: 1120px;
    margin: 0 auto;
    padding: 64px 20px 0;
}

.book-hero {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: 64px;
    align-items: start;
}

.book-hero .cover { position: sticky; top: 110px; }

.book-title {
    margin: 0 0 8px;
    font-size: clamp(32px, 4vw, 46px);
    line-height: 1.2;
    letter-spacing: .1em;
    font-weight: 600;
}
.book-subtitle {
    margin: 0 0 18px;
    font-size: 19px;
    letter-spacing: .1em;
    color: var(--ink-2);
}
.book-author {
    margin: 0 0 26px;
    font-size: 14px;
    letter-spacing: .18em;
    color: var(--ink-3);
}
.book-tagline {
    margin: 0 0 24px;
    padding-left: 16px;
    border-left: 2px solid var(--seal);
    font-size: 16.5px;
    line-height: 1.9;
    color: var(--ink-2);
}
.book-intro p {
    margin: 0 0 12px;
    font-size: 15.5px;
    line-height: 1.95;
    color: var(--ink-2);
    max-width: 34em;
}
.book-stats {
    margin: 26px 0 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 18px;
    font-size: 13px;
    letter-spacing: .1em;
    color: var(--ink-3);
}
.book-stats b { color: var(--ink); font-weight: 600; }
.tag {
    padding: 3px 10px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 12px;
    letter-spacing: .12em;
}

.book-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* 目录 */

.toc { margin-top: 84px; padding-bottom: 40px; }

.toc-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--ink);
}
.toc-head h2 {
    margin: 0;
    font-size: 22px;
    letter-spacing: .22em;
    font-weight: 600;
}
.toc-sub {
    margin: 0;
    font-size: 12.5px;
    letter-spacing: .12em;
    color: var(--ink-3);
}

.toc-vol {
    margin: 40px 0 8px;
    display: flex;
    align-items: baseline;
    gap: 12px;
    font-size: 15px;
    letter-spacing: .2em;
    font-weight: 600;
    color: var(--ink-2);
}
.toc-vol em {
    font-style: normal;
    font-size: 12px;
    letter-spacing: .1em;
    color: var(--ink-3);
    font-weight: 400;
}

.toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 56px;
}
.toc-list li { border-bottom: 1px dotted var(--line-soft); }

.toc-list a {
    display: grid;
    grid-template-columns: 2.6em minmax(0, 1fr) auto;
    align-items: baseline;
    gap: 10px;
    padding: 11px 2px;
    transition: background .2s, color .2s;
}
.toc-list a:hover { background: var(--seal-soft); }
.toc-list a:hover .toc-title { color: var(--seal); }

.toc-no {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--ink-3);
    letter-spacing: .04em;
}
.toc-title {
    font-size: 15.5px;
    line-height: 1.6;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    transition: color .2s;
}
.toc-words {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--ink-3);
    opacity: .8;
}

/* ---------------- 阅读页 ---------------- */

.readbar-wrap {
    position: sticky;
    top: 0;
    z-index: 40;
    background: color-mix(in srgb, var(--paper) 90%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line-soft);
}

.read-progress {
    position: absolute;
    left: 0; right: 0; bottom: -1px;
    height: 2px;
    background: transparent;
}
.read-progress i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--seal);
    transition: width .1s linear;
}

.readbar {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 13.5px;
    color: var(--ink-2);
}
.readbar-back { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.back-arrow { font-size: 18px; line-height: 1; color: var(--ink-3); }
.readbar-book {
    max-width: 11em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: .06em;
}
.readbar-sep { color: var(--line); }
.readbar-ch { color: var(--ink-3); letter-spacing: .08em; white-space: nowrap; }

.readbar-tools {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
}
.readbar-tools button,
.readbar-toc {
    padding: 5px 9px;
    border: 1px solid transparent;
    border-radius: 2px;
    background: transparent;
    font-size: 12.5px;
    letter-spacing: .06em;
    color: var(--ink-2);
    cursor: pointer;
    transition: border-color .2s, color .2s, background .2s;
}
.readbar-tools button:hover,
.readbar-toc:hover {
    border-color: var(--line);
    color: var(--ink);
}
.readbar-tools button.is-on { color: var(--seal); border-color: var(--seal-soft); }

.chapter {
    max-width: calc(var(--measure) + 40px);
    margin: 0 auto;
    padding: 56px 20px 20px;
}

.chapter-head { margin-bottom: 40px; }
.ch-kicker {
    margin: 0 0 12px;
    font-size: 12.5px;
    letter-spacing: .3em;
    color: var(--seal);
}
.ch-title {
    margin: 0 0 16px;
    font-size: clamp(26px, 3.2vw, 34px);
    line-height: 1.4;
    letter-spacing: .06em;
    font-weight: 600;
}
.ch-meta {
    margin: 0;
    font-size: 12px;
    letter-spacing: .12em;
    color: var(--ink-3);
}

.ch-body {
    font-size: var(--fs);
    line-height: 1.95;
    letter-spacing: .012em;
    color: var(--ink);
}
.ch-body p {
    margin: 0 0 .62em;
    text-indent: 2em;
    word-break: break-word;
}
.ch-body blockquote {
    margin: 1.4em 0;
    padding: 0 0 0 1.1em;
    border-left: 2px solid var(--line);
    color: var(--ink-2);
}
.ch-body blockquote p { text-indent: 0; margin: 0; }
.ch-body strong { font-weight: 600; color: var(--ink); }
.ch-body em { font-style: normal; color: var(--ink-2); }

.scene {
    display: flex;
    justify-content: center;
    margin: 2.4em 0;
}
.scene i {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--seal);
    opacity: .55;
    box-shadow: -13px 0 0 var(--seal), 13px 0 0 var(--seal);
}

.chapter-nav {
    margin: 64px 0 0;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 12px;
    align-items: stretch;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 2px;
    transition: border-color .22s, background .22s, transform .22s;
}
.nav-btn:hover { border-color: var(--ink-3); background: var(--seal-soft); }
.nav-next { text-align: right; align-items: flex-end; }
.nav-toc {
    justify-content: center;
    align-items: center;
    padding: 14px 22px;
    font-size: 13px;
    letter-spacing: .2em;
    color: var(--ink-2);
}
.nav-dir { font-size: 11.5px; letter-spacing: .2em; color: var(--ink-3); }
.nav-name {
    font-size: 14.5px;
    line-height: 1.5;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.nav-btn.is-off { opacity: .45; }
.nav-btn.is-off:hover { border-color: var(--line); background: transparent; }

.chapter-foot {
    margin: 56px 0 0;
    padding: 28px 0 0;
    border-top: 1px solid var(--line-soft);
    text-align: center;
    font-size: 13px;
    letter-spacing: .1em;
    color: var(--ink-2);
}
.chapter-foot .muted { font-size: 11.5px; letter-spacing: .16em; margin-top: 6px; }

/* ---------------- 页脚 ---------------- */

.sitefoot {
    margin-top: 72px;
    padding: 36px 20px 44px;
    text-align: center;
    font-size: 12.5px;
    letter-spacing: .14em;
    color: var(--ink-3);
}
.sitefoot p { margin: 0 0 6px; }
.sitefoot-sub { font-size: 11px; opacity: .8; }

/* ---------------- 404 ---------------- */

.notfound {
    min-height: 52vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    text-align: center;
}
.notfound h1 { margin: 0; font-size: 28px; letter-spacing: .08em; font-weight: 600; }

/* ---------------- 响应式 ---------------- */

@media (max-width: 1000px) {
    .shelf { grid-template-columns: 1fr; gap: 48px; padding-top: 48px; }
    .shelf-intro { position: static; }
    .book-hero { grid-template-columns: 260px minmax(0, 1fr); gap: 40px; }
    .toc-list { column-gap: 32px; }
}

@media (max-width: 760px) {
    :root { --fs: 18px; }

    .topbar { padding: 14px 16px; }
    .brand-seal { width: 34px; height: 34px; }
    .brand-name { font-size: 17.5px; }
    .topnav { gap: 16px; font-size: 14px; }

    .shelf { padding: 36px 16px 24px; gap: 36px; }
    .shelf-title { font-size: 28px; line-height: 1.5; }
    .shelf-title br { display: none; }
    .lede { font-size: 15px; }

    .book-card {
        grid-template-columns: 128px minmax(0, 1fr);
        gap: 18px;
        align-items: start;
    }
    .card-meta h2 { font-size: 21px; }
    .card-sub { font-size: 13.5px; margin-bottom: 10px; }
    .card-tagline { display: none; }
    .card-stats { gap: 10px; font-size: 11.5px; }

    .about { padding: 32px 16px 16px; margin-top: 24px; }
    .about p { font-size: 14.5px; }

    .bookpage { padding: 36px 16px 0; }
    .book-hero {
        grid-template-columns: 148px minmax(0, 1fr);
        gap: 22px;
        align-items: start;
    }
    .book-hero .cover { position: static; max-width: 148px; }
    .book-title { font-size: 26px; }
    .book-subtitle { font-size: 15px; margin-bottom: 12px; }
    .book-author { margin-bottom: 16px; font-size: 12.5px; }
    .book-tagline { font-size: 14px; padding-left: 10px; margin-bottom: 16px; }
    .book-intro { grid-column: 1 / -1; }
    .book-intro p { font-size: 14.5px; }
    .book-stats { margin: 20px 0 22px; gap: 12px; }
    .book-actions .btn { flex: 1; }

    .toc { margin-top: 48px; }
    .toc-head h2 { font-size: 19px; }
    .toc-list { grid-template-columns: 1fr; }
    .toc-list a { grid-template-columns: 2.4em minmax(0, 1fr) auto; padding: 10px 2px; }
    .toc-title { font-size: 15px; }

    .readbar { padding: 10px 14px; gap: 8px; }
    .readbar-book { max-width: 7.5em; }
    .readbar-tools button, .readbar-toc { padding: 5px 7px; font-size: 12px; }
    .readbar-tools button[data-act="size-down"],
    .readbar-tools button[data-act="size-up"] { display: none; }

    .chapter { padding: 34px 18px 16px; }
    .chapter-head { margin-bottom: 30px; }
    .ch-title { font-size: 25px; }
    .ch-body { line-height: 1.92; }

    .chapter-nav {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    .nav-toc { display: none; }
    .nav-name { font-size: 13.5px; }
    .chapter-foot { margin-top: 44px; }
}

@media (max-width: 420px) {
    .book-hero { grid-template-columns: 120px minmax(0, 1fr); }
    .book-hero .cover { max-width: 120px; }
    .book-title { font-size: 23px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation: none !important; transition: none !important; }
    html { scroll-behavior: auto; }
}
