/* ============================================================
   建站笔记 · 杂志/编辑风
   暖白纸张底 + 衬线大标题 + 墨蓝点缀
   ============================================================ */

:root {
    /* 暖白纸张色系（带微暖色调，避免纯白） */
    --paper:        #f4efe6;
    --paper-2:      #ece4d6;
    --ink:          #1f2a37;   /* 墨蓝近黑 */
    --ink-soft:     #4a5563;
    --ink-faint:    #8a8475;
    --line:         #d9cfbe;
    --accent:       #1b3a5b;   /* 墨蓝 */
    --accent-2:     #b4452f;   /* 砖红点缀 */
    --card:         #fbf8f1;
    --shadow:       16px 16px 0 rgba(31, 42, 55, 0.04);
    --serif: "Songti SC", "STSong", "SimSun", Georgia, "Times New Roman", serif;
    --sans:  -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", sans-serif;
}

:root[data-theme="dark"] {
    --paper:    #15181d;
    --paper-2:  #1d2127;
    --ink:      #ece4d6;
    --ink-soft: #b3ad9f;
    --ink-faint:#7d776a;
    --line:     #2e333b;
    --accent:   #9cc0e6;
    --accent-2: #e08a6f;
    --card:     #1b1f25;
    --shadow:   16px 16px 0 rgba(0, 0, 0, 0.25);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    transition: background .4s ease, color .4s ease;
}

::selection { background: var(--accent); color: var(--paper); }

b, strong { font-weight: 700; }

/* ---------- 顶部导航 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 200;
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(140%) blur(8px);
    border-bottom: 1px solid var(--line);
}
.bar {
    max-width: 1100px; margin: 0 auto;
    display: flex; align-items: center; gap: 24px;
    padding: 14px clamp(20px, 4vw, 40px);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; text-decoration: none; color: var(--ink); }
.brand-mark {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    background: var(--accent); color: var(--paper);
    font-family: var(--serif); font-weight: 700; font-size: 1rem;
    border-radius: 2px;
}
.brand-text { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; }
.topnav { display: flex; gap: clamp(14px, 2.4vw, 30px); margin-left: auto; }
.topnav a {
    color: var(--ink-soft); text-decoration: none;
    font-size: .9rem; font-weight: 500; cursor: pointer;
    position: relative; padding-bottom: 2px;
}
.topnav a::after {
    content: ""; position: absolute; left: 0; bottom: -2px;
    width: 0; height: 1.5px; background: var(--accent-2);
    transition: width .25s ease;
}
.topnav a:hover { color: var(--ink); }
.topnav a:hover::after { width: 100%; }
.theme-toggle {
    background: none; border: 1px solid var(--line); color: var(--ink);
    width: 34px; height: 34px; border-radius: 50%;
    cursor: pointer; font-size: 1rem; line-height: 1;
    transition: background .2s, transform .3s;
}
.theme-toggle:hover { background: var(--paper-2); transform: rotate(20deg); }

/* ---------- 刊头 ---------- */
.masthead {
    max-width: 1100px; margin: 0 auto;
    padding: clamp(48px, 9vw, 110px) clamp(20px, 4vw, 40px) 0;
}
.kicker {
    font-size: .78rem; letter-spacing: .28em;
    color: var(--ink-faint); font-weight: 600;
    text-transform: uppercase; margin-bottom: 22px;
}
.headline {
    font-family: var(--serif); font-weight: 900;
    font-size: clamp(3rem, 11vw, 7rem);
    line-height: .96; letter-spacing: .01em;
    margin-bottom: 28px;
}
.headline-em { color: var(--accent); position: relative; }
.headline-em::after {
    content: ""; position: absolute; left: -2px; right: -2px; bottom: .12em;
    height: .14em; background: var(--accent-2); opacity: .85; z-index: -1;
}
.dek {
    font-size: clamp(1rem, 1.6vw, 1.25rem);
    color: var(--ink-soft); max-width: 46ch;
    border-left: 3px solid var(--accent-2); padding-left: 18px;
}
.masthead-meta {
    display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
    margin-top: 30px; font-size: .9rem; color: var(--ink-soft);
}
.masthead-meta b { font-family: var(--serif); font-size: 1.15rem; color: var(--ink); }
.masthead-meta .dot { color: var(--line); }
.masthead-rule { max-width: 1100px; margin: clamp(48px,7vw,80px) auto 0; padding: 0 clamp(20px,4vw,40px); }
.masthead-rule::after { content: ""; display: block; height: 2px; background: var(--ink); }

main { max-width: 1100px; margin: 0 auto; padding: 0 clamp(20px, 4vw, 40px); }

/* ---------- 小节标签 ---------- */
.sec-label {
    display: flex; align-items: center; gap: 16px;
    margin: clamp(56px, 8vw, 90px) 0 28px;
}
.sec-label span {
    font-family: var(--serif); font-weight: 700; font-size: 1.05rem;
    letter-spacing: .1em; color: var(--accent-2); white-space: nowrap;
}
.sec-label i { flex: 1; height: 1px; background: var(--line); }

/* ---------- 精选 ---------- */
.feature-card {
    display: grid; grid-template-columns: 1.4fr 1fr;
    gap: clamp(24px, 4vw, 56px); align-items: center;
    background: var(--card); border: 1px solid var(--line);
    padding: clamp(28px, 4vw, 48px); cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform .3s cubic-bezier(.2,.8,.2,1), box-shadow .3s;
}
.feature-card:hover { transform: translate(-3px, -3px); box-shadow: 19px 19px 0 rgba(27,58,91,.08); }
.feature-no {
    font-family: var(--serif); font-weight: 900;
    font-size: clamp(4rem, 12vw, 9rem); line-height: .8;
    color: var(--accent); opacity: .12;
}
.feature-main .reader-tag { margin-bottom: 14px; }
.feature-main h3 {
    font-family: var(--serif); font-weight: 700;
    font-size: clamp(1.6rem, 3.5vw, 2.6rem); line-height: 1.15;
    margin-bottom: 16px; color: var(--ink);
}
.feature-main p { color: var(--ink-soft); margin-bottom: 22px; font-size: 1.02rem; }
.feature-cta { font-weight: 700; color: var(--accent-2); font-size: .95rem; letter-spacing: .04em; }

/* ---------- 工具栏：搜索 + 筛选 ---------- */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 18px; align-items: center;
    margin: clamp(48px,7vw,72px) 0 36px;
    padding-bottom: 24px; border-bottom: 1px solid var(--line);
}
.search-box {
    display: flex; align-items: center; gap: 10px;
    background: var(--card); border: 1px solid var(--line);
    padding: 10px 16px; flex: 1; min-width: 240px;
    transition: border-color .2s;
}
.search-box:focus-within { border-color: var(--accent); }
.search-icon { color: var(--ink-faint); font-size: 1.1rem; }
.search-box input {
    flex: 1; border: none; background: none; outline: none;
    font-family: var(--sans); font-size: .98rem; color: var(--ink);
}
.search-box input::placeholder { color: var(--ink-faint); }
.search-clear {
    border: none; background: none; color: var(--ink-faint);
    cursor: pointer; font-size: 1.3rem; line-height: 1; padding: 0 4px;
}
.search-clear:hover { color: var(--accent-2); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-chip {
    border: 1px solid var(--line); background: none; color: var(--ink-soft);
    padding: 6px 14px; border-radius: 100px; cursor: pointer;
    font-family: var(--sans); font-size: .82rem; font-weight: 500;
    transition: all .2s;
}
.filter-chip:hover { border-color: var(--accent); color: var(--ink); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: var(--paper); }

.no-result { text-align: center; color: var(--ink-faint); padding: 40px 0; font-size: 1rem; }

/* ---------- 分类 ---------- */
.cat { scroll-margin-top: 80px; }
.cat-head { margin: clamp(40px,6vw,68px) 0 26px; }
.cat-no {
    font-family: var(--serif); font-weight: 900; font-size: .9rem;
    color: var(--accent-2); letter-spacing: .15em;
}
.cat-head h2 {
    font-family: var(--serif); font-weight: 700;
    font-size: clamp(1.5rem, 3.5vw, 2.1rem); margin: 4px 0 6px;
}
.cat-head p { color: var(--ink-soft); font-size: .95rem; }

/* 笔记列表：编辑风列表条目，非卡片网格 */
.note-list { display: flex; flex-direction: column; }
.note-item {
    display: grid; grid-template-columns: auto 1fr auto;
    gap: clamp(16px, 3vw, 40px); align-items: baseline;
    padding: 26px 4px; border-top: 1px solid var(--line);
    cursor: pointer; position: relative;
    transition: padding-left .25s ease, background .25s ease;
}
.note-item:last-child { border-bottom: 1px solid var(--line); }
.note-item::before {
    content: ""; position: absolute; left: 0; top: 0; bottom: 0;
    width: 0; background: var(--accent-2); transition: width .25s ease;
}
.note-item:hover { padding-left: 18px; background: color-mix(in srgb, var(--card) 60%, transparent); }
.note-item:hover::before { width: 4px; }
.note-idx { font-family: var(--serif); font-weight: 700; font-size: 1.1rem; color: var(--ink-faint); }
.note-body h3 {
    font-family: var(--serif); font-weight: 700; font-size: 1.3rem;
    margin-bottom: 6px; color: var(--ink); line-height: 1.3;
    transition: color .2s;
}
.note-item:hover .note-body h3 { color: var(--accent); }
.note-body p { color: var(--ink-soft); font-size: .92rem; line-height: 1.6; }
.note-side { text-align: right; white-space: nowrap; }
.note-side .reader-tag { margin-bottom: 8px; }
.note-date { display: block; font-size: .78rem; color: var(--ink-faint); }

/* 标签胶囊（精选/列表/弹层通用） */
.reader-tag {
    display: inline-block; font-size: .72rem; font-weight: 700;
    letter-spacing: .08em; color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
    padding: 3px 10px; border-radius: 2px;
}

/* ---------- 关于 ---------- */
.about-grid {
    display: grid; grid-template-columns: 1.6fr 1fr;
    gap: clamp(28px, 5vw, 64px); align-items: start;
}
.about-text p { color: var(--ink-soft); margin-bottom: 16px; font-size: 1.05rem; }
.about-text strong { color: var(--ink); }
.about-facts { list-style: none; border-top: 2px solid var(--ink); }
.about-facts li {
    display: flex; justify-content: space-between;
    padding: 14px 2px; border-bottom: 1px solid var(--line);
    font-size: .95rem; color: var(--ink);
}
.about-facts span { color: var(--ink-faint); }

/* ---------- 阅读弹层 ---------- */
.reader {
    position: fixed; inset: 0; z-index: 1000;
    background: color-mix(in srgb, var(--ink) 55%, transparent);
    backdrop-filter: blur(3px);
    opacity: 0; visibility: hidden;
    overflow-y: auto; padding: clamp(20px, 5vh, 60px) 16px;
    transition: opacity .3s ease, visibility .3s ease;
}
.reader.active { opacity: 1; visibility: visible; }
.reader-progress { position: fixed; top: 0; left: 0; height: 3px; width: 0; background: var(--accent-2); z-index: 1001; }
.reader-sheet {
    background: var(--paper); max-width: 720px; margin: 0 auto;
    padding: clamp(32px, 5vw, 64px); position: relative;
    border: 1px solid var(--line);
    transform: translateY(20px) scale(.98); transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.reader.active .reader-sheet { transform: translateY(0) scale(1); }
.reader-close {
    position: absolute; top: 22px; right: 24px;
    border: 1px solid var(--line); background: var(--card); color: var(--ink-soft);
    padding: 6px 12px; cursor: pointer; font-family: var(--sans);
    font-size: .82rem; transition: all .2s;
}
.reader-close:hover { background: var(--accent); color: var(--paper); border-color: var(--accent); }
.reader-sheet > .reader-tag { margin-bottom: 18px; }
.reader-sheet h2 {
    font-family: var(--serif); font-weight: 900;
    font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.15;
    margin-bottom: 12px; color: var(--ink);
}
.reader-meta {
    font-size: .85rem; color: var(--ink-faint);
    padding-bottom: 22px; margin-bottom: 28px; border-bottom: 1px solid var(--line);
}
.reader-body p { color: var(--ink-soft); margin-bottom: 18px; }
.reader-body h4 {
    font-family: var(--serif); font-weight: 700; color: var(--ink);
    font-size: 1.2rem; margin: 28px 0 12px;
}
.reader-body ul { margin: 0 0 18px 22px; color: var(--ink-soft); }
.reader-body li { margin-bottom: 8px; }
.reader-body strong { color: var(--ink); }
.reader-body code {
    background: var(--paper-2); padding: 2px 7px; border-radius: 3px;
    font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .88em; color: var(--accent-2);
}
.reader-body pre {
    background: var(--ink); color: #e8e2d4; padding: 18px 20px;
    border-radius: 4px; overflow-x: auto; margin-bottom: 18px;
    font-size: .85rem; line-height: 1.6;
    border-left: 3px solid var(--accent-2);
}
.reader-body pre code { background: none; color: inherit; padding: 0; }

/* ---------- 页脚 ---------- */
.site-footer {
    margin-top: clamp(64px, 10vw, 120px);
    background: var(--ink); color: color-mix(in srgb, var(--paper) 70%, transparent);
}
.foot-inner {
    max-width: 1100px; margin: 0 auto;
    padding: 44px clamp(20px,4vw,40px);
    display: flex; flex-wrap: wrap; gap: 20px;
    justify-content: space-between; align-items: center;
}
.foot-brand { display: flex; align-items: center; gap: 10px; font-family: var(--serif); color: var(--paper); }
.foot-beian { display: flex; flex-direction: column; gap: 6px; text-align: right; font-size: .85rem; }
.foot-beian a { color: var(--paper); text-decoration: none; border-bottom: 1px solid transparent; }
.foot-beian a:hover { border-bottom-color: var(--accent-2); }

/* ---------- 建站小工具 ---------- */
.tools { scroll-margin-top: 80px; }
.tools-intro { color: var(--ink-soft); font-size: .98rem; margin-bottom: 28px; max-width: 52ch; }
.tool-grid {
    display: grid; grid-template-columns: repeat(2, 1fr);
    gap: clamp(18px, 2.5vw, 28px);
}
.tool-card {
    background: var(--card); border: 1px solid var(--line);
    padding: clamp(22px, 3vw, 30px); box-shadow: var(--shadow);
    display: flex; flex-direction: column;
}
.tool-card h3 {
    font-family: var(--serif); font-weight: 700; font-size: 1.3rem;
    margin-bottom: 6px; color: var(--ink);
}
.tool-desc { color: var(--ink-soft); font-size: .88rem; line-height: 1.6; margin-bottom: 20px; }
.tool-row { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; }
.tool-row input[type="color"] {
    width: 52px; height: 40px; padding: 0; border: 1px solid var(--line);
    background: none; cursor: pointer; border-radius: 3px;
}
.tool-row input[type="text"] {
    flex: 1; border: 1px solid var(--line); background: var(--paper);
    color: var(--ink); padding: 9px 12px; font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .92rem; outline: none; text-transform: uppercase;
}
.tool-row input[type="text"]:focus { border-color: var(--accent); }

/* 复制行 */
.copy-line {
    display: flex; align-items: center; gap: 10px;
    background: var(--paper); border: 1px solid var(--line);
    padding: 9px 12px; margin-bottom: 8px; cursor: pointer;
    transition: border-color .2s, background .2s;
}
.copy-line:hover { border-color: var(--accent); }
.copy-line code {
    flex: 1; font-family: "SFMono-Regular", Consolas, monospace;
    font-size: .85rem; color: var(--ink); background: none; padding: 0;
    word-break: break-all;
}
.copy-key { font-size: .7rem; font-weight: 700; color: var(--accent-2); letter-spacing: .08em; min-width: 30px; }
.copy-hint { font-size: .72rem; color: var(--ink-faint); white-space: nowrap; }

/* 配色梯度 */
.color-out { margin-bottom: 16px; }
.swatches { display: flex; height: 36px; border: 1px solid var(--line); overflow: hidden; }
.swatches div { flex: 1; }

/* 阴影 */
.shadow-stage { display: grid; place-items: center; padding: 30px 0; background: var(--paper); border: 1px solid var(--line); margin-bottom: 18px; }
.shadow-demo { width: 90px; height: 60px; background: var(--card); border: 1px solid var(--line); border-radius: 6px; }
.slider { margin-bottom: 12px; }
.slider label { display: block; font-size: .8rem; color: var(--ink-soft); margin-bottom: 4px; }
.slider label b { color: var(--accent); font-family: var(--serif); }
.slider input[type="range"] { width: 100%; accent-color: var(--accent); cursor: pointer; }

/* 渐变 */
.grad-stage { height: 90px; border: 1px solid var(--line); margin-bottom: 16px; border-radius: 4px; }

/* 字数 */
#count-input {
    width: 100%; border: 1px solid var(--line); background: var(--paper);
    color: var(--ink); padding: 12px; font-family: var(--sans); font-size: .92rem;
    line-height: 1.7; outline: none; resize: vertical; margin-bottom: 16px;
}
#count-input:focus { border-color: var(--accent); }
.count-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; text-align: center; }
.count-stats div { background: var(--paper); border: 1px solid var(--line); padding: 12px 6px; }
.count-stats b { display: block; font-family: var(--serif); font-size: 1.5rem; color: var(--accent); }
.count-stats span { font-size: .72rem; color: var(--ink-faint); }

/* 复制提示 toast */
.toast {
    position: fixed; left: 50%; bottom: 36px; transform: translate(-50%, 20px);
    background: var(--ink); color: var(--paper); padding: 10px 22px;
    border-radius: 4px; font-size: .88rem; z-index: 2000;
    opacity: 0; visibility: hidden; transition: opacity .25s, transform .25s;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, 0); }

/* ---------- 回顶 ---------- */
.to-top {
    position: fixed; right: 24px; bottom: 24px; z-index: 300;
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--accent); color: var(--paper); border: none;
    cursor: pointer; font-size: 1.2rem;
    box-shadow: 0 6px 20px rgba(27,58,91,.3);
    opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s;
}
.to-top.show { opacity: 1; transform: translateY(0); }

/* ---------- 入场动效 ---------- */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity .6s ease, transform .6s cubic-bezier(.2,.8,.2,1); }
.reveal.in { opacity: 1; transform: translateY(0); }

/* ---------- 响应式 ---------- */
@media (max-width: 760px) {
    .topnav { display: none; }
    .feature-card { grid-template-columns: 1fr; }
    .feature-no { font-size: 5rem; }
    .about-grid { grid-template-columns: 1fr; }
    .tool-grid { grid-template-columns: 1fr; }
    .note-item { grid-template-columns: auto 1fr; }
    .note-side { grid-column: 2; text-align: left; margin-top: 8px; }
    .note-side .reader-tag { margin-bottom: 0; margin-right: 10px; }
    .foot-inner { flex-direction: column; text-align: center; }
    .foot-beian { text-align: center; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
    * { scroll-behavior: auto !important; }
    .reveal { opacity: 1; transform: none; transition: none; }
}
