/*
Theme Name: Yutang Notes
Theme URI: https://xianyu.chenglou.net/
Author: Yutang
Description: 鱼塘笔记 —— 闲鱼卖家运营百科。轻量、移动优先、无插件依赖。
Version: 1.0.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: yutang
*/

:root {
    --ink: #161513;
    --ink-2: #3d3a34;
    --muted: #75706a;
    --bg: #fbfaf7;
    --surface: #ffffff;
    --line: #e9e4da;
    --brand: #f0a500;
    --brand-soft: #fff4d6;
    --brand-ink: #1a1408;
    --green: #16794a;
    --green-soft: #e8f5ee;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 1px 2px rgba(22, 21, 19, .04), 0 8px 30px rgba(22, 21, 19, .05);
    --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    --font-serif: "Noto Serif SC", "Songti SC", "SimSun", Georgia, serif;
    --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html, body { max-width: 100%; overflow-x: hidden; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.75;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink-2); }
button { font: inherit; cursor: pointer; }

.wrap { width: min(var(--wrap), calc(100% - 40px)); margin: 0 auto; }

.screen-reader-text {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

.skip-link {
    position: absolute; left: 12px; top: -60px;
    background: var(--ink); color: #fff;
    padding: 10px 16px; border-radius: 8px; z-index: 999;
}
.skip-link:focus { top: 12px; }

.dot {
    display: inline-block;
    width: 3px; height: 3px;
    border-radius: 50%;
    background: currentColor;
    opacity: .45;
    vertical-align: middle;
    margin: 0 8px;
}

/* ---------- 按钮 / 标签 ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 999px;
    padding: 12px 22px;
    font-size: 15px; font-weight: 700;
    line-height: 1.2;
    border: 1px solid transparent;
    transition: transform .15s ease, background .15s ease, color .15s ease;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary { background: var(--brand); color: var(--brand-ink); }
.btn--primary:hover { background: #ffb81a; color: var(--brand-ink); }
.btn--ghost { background: transparent; color: #fff; border-color: rgba(255, 255, 255, .45); }
.btn--ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.btn--sm { padding: 9px 16px; font-size: 14px; }

.chip {
    display: inline-block;
    padding: 4px 11px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: #8a5a00;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: .02em;
}
.chip--ghost { background: transparent; color: var(--muted); padding: 0; }

/* ---------- 头部 ---------- */
.site-header {
    position: sticky; top: 0; z-index: 50;
    background: rgba(251, 250, 247, .92);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--line);
}

.topbar {
    background: var(--ink);
    color: rgba(255, 255, 255, .78);
    font-size: 12.5px;
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 34px; }
.topbar__left { display: flex; align-items: center; gap: 10px; }
.topbar__tag { color: rgba(255, 255, 255, .55); }
.topbar a { color: rgba(255, 255, 255, .7); }

.masthead__inner {
    display: flex; align-items: center; gap: 28px;
    height: 74px;
}

.brand { display: flex; align-items: center; gap: 11px; flex: 0 0 auto; }
.brand__mark { display: inline-flex; }
.brand__text { display: flex; flex-direction: column; line-height: 1.15; }
.brand__name { font-family: var(--font-serif); font-size: 23px; font-weight: 800; letter-spacing: .02em; }
.brand__sub { font-size: 11.5px; color: var(--muted); letter-spacing: .06em; }

.nav { flex: 1 1 auto; }
.nav__list { display: flex; align-items: center; gap: 4px; list-style: none; margin: 0; padding: 0; }
.nav__list a {
    display: inline-block; padding: 8px 12px;
    border-radius: 9px;
    font-size: 15px; font-weight: 600; color: var(--ink-2);
}
.nav__list a:hover { background: #f1ede5; }
.nav__list a.is-current { background: var(--ink); color: #fff; }

.header-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px;
    border: 1px solid transparent; border-radius: 10px;
    background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: #f1ede5; }
.nav-toggle { display: none; }

.search-panel { border-top: 1px solid var(--line); background: var(--surface); }
.search-panel[hidden] { display: none; }
.search-panel .wrap { padding: 14px 0; }

.search-form { display: flex; gap: 10px; }
.search-form input {
    flex: 1 1 auto;
    min-width: 0;
    border: 1px solid var(--line);
    background: var(--bg);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 15px;
    color: var(--ink);
    outline: none;
}
.search-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(240, 165, 0, .15); }
.search-form button {
    border: 0; border-radius: 10px;
    background: var(--ink); color: #fff;
    padding: 0 22px; font-weight: 700;
}

/* ---------- 今日条 ---------- */
.today-bar { background: var(--brand); color: var(--brand-ink); }
.today-bar__inner {
    display: flex; align-items: center; gap: 14px;
    min-width: 0;
    min-height: 40px; padding: 6px 0;
    font-size: 13.5px;
}
.today-bar__badge {
    background: var(--ink); color: #fff;
    padding: 3px 10px; border-radius: 999px;
    font-weight: 700; white-space: nowrap;
}
.today-bar__date { font-weight: 700; white-space: nowrap; }
.today-bar__link {
    flex: 1 1 auto; min-width: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-weight: 600; opacity: .85;
}
.today-bar__link:hover { opacity: 1; color: var(--brand-ink); }

/* ---------- 首页 ---------- */
.hero {
    display: grid;
    grid-template-columns: 1.55fr 1fr;
    gap: 24px;
    padding-top: 30px;
}
.hero__side { display: flex; flex-direction: column; gap: 14px; }

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card__body { padding: 20px 22px 22px; }
.card__thumb { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #f0ece3; }
.card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.card__title {
    margin: 10px 0 8px;
    font-size: 19px;
    line-height: 1.45;
    font-weight: 800;
    letter-spacing: -.01em;
}
.card__title a:hover { color: #000; }
.card__title--lead { font-size: 30px; line-height: 1.32; margin-top: 12px; }
.card__desc { margin: 0 0 12px; color: var(--muted); font-size: 14.5px; line-height: 1.7; }
.card--lead .card__body { padding: 24px 28px 28px; }
.card--side .card__body { padding: 16px 20px 18px; }
.card--side .card__title { font-size: 16.5px; margin: 6px 0; }

.meta { display: flex; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta--article { margin-top: 14px; }

.section { padding-top: 46px; }
.section__head {
    display: flex; align-items: baseline; justify-content: space-between;
    gap: 16px; margin-bottom: 18px;
}
.section__title {
    margin: 0;
    font-family: var(--font-serif);
    font-size: 25px;
    font-weight: 800;
    letter-spacing: .01em;
}
.section__more { color: var(--muted); font-size: 14px; font-weight: 600; }
.section__more:hover { color: var(--ink); }

.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.post-grid--archive { grid-template-columns: repeat(3, 1fr); }

/* ---------- 工具卡 ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tool-card {
    display: flex; flex-direction: column; gap: 6px;
    padding: 20px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.tool-card:hover { border-color: var(--brand); transform: translateY(-2px); box-shadow: var(--shadow); }
.tool-card__icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 10px;
    background: var(--brand-soft); color: #8a5a00;
    font-weight: 800; font-size: 17px;
    margin-bottom: 4px;
}
.tool-card strong { font-size: 16px; }
.tool-card span:last-child { color: var(--muted); font-size: 13px; line-height: 1.65; }

/* ---------- CTA ---------- */
.cta-band {
    display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
    background: linear-gradient(120deg, #fff3cf, #ffe9a8);
    border: 1px solid #f3d98a;
    border-radius: 22px;
    padding: 28px;
}
.cta-band__item strong { display: block; font-family: var(--font-serif); font-size: 22px; margin-bottom: 6px; }
.cta-band__item p { margin: 0 0 16px; color: #6b5a2a; font-size: 14.5px; }
.cta-band__item--dark {
    background: var(--ink); color: #fff;
    border-radius: 16px; padding: 22px;
}
.cta-band__item--dark p { color: rgba(255, 255, 255, .7); }

.cta-box {
    display: flex; align-items: center; gap: 22px; justify-content: space-between;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin: 30px 0;
}
.cta-box__body strong { display: block; font-size: 17px; margin-bottom: 4px; }
.cta-box__body p { margin: 0; color: var(--muted); font-size: 14px; }
.cta-box--software { border-left-color: var(--green); }
.cta-box--software .btn { background: var(--green); color: #fff; }

/* ---------- 文章 ---------- */
.article { padding-top: 26px; max-width: 100%; }
.breadcrumbs { color: var(--muted); font-size: 13px; margin-bottom: 18px; }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs .sep { margin: 0 7px; opacity: .5; }

.article__head { max-width: 820px; }
.article__title {
    margin: 12px 0 12px;
    font-family: var(--font-serif);
    font-size: 38px;
    line-height: 1.32;
    letter-spacing: -.015em;
    font-weight: 800;
}
.article__lede { margin: 0; color: var(--ink-2); font-size: 17px; line-height: 1.7; }

.article__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: 44px;
    margin-top: 30px;
    align-items: start;
}

.entry-content { min-width: 0; font-size: 17.5px; line-height: 1.85; color: var(--ink-2); overflow-wrap: anywhere; }
.entry-content > *:first-child { margin-top: 0; }
.entry-content p { margin: 0 0 1.3em; }
.entry-content h2 {
    margin: 2.2em 0 .7em;
    font-family: var(--font-serif);
    font-size: 26px;
    line-height: 1.4;
    color: var(--ink);
    scroll-margin-top: 110px;
}
.entry-content h3 {
    margin: 1.8em 0 .6em;
    font-size: 20px;
    color: var(--ink);
    scroll-margin-top: 110px;
}
.entry-content ul, .entry-content ol { margin: 0 0 1.3em; padding-left: 1.4em; }
.entry-content li { margin: .4em 0; }
.entry-content a { color: #a36a00; text-decoration: underline; text-underline-offset: 3px; }
.entry-content a:hover { color: var(--ink); }
.entry-content blockquote {
    margin: 1.6em 0; padding: 16px 20px;
    border-left: 3px solid var(--brand);
    background: var(--brand-soft);
    border-radius: 0 10px 10px 0;
    color: #5f4a12;
}
.entry-content table {
    width: 100%; border-collapse: collapse;
    margin: 1.4em 0; font-size: 15px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
}
.entry-content th, .entry-content td { padding: 11px 14px; border-bottom: 1px solid var(--line); text-align: left; }
.entry-content th { background: #f7f3ea; font-weight: 700; color: var(--ink); }
.entry-content tr:last-child td { border-bottom: 0; }
.entry-content img { border-radius: 12px; margin: 1.4em 0; }
.entry-content hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.entry-content code {
    background: #f1ede5; padding: .15em .4em; border-radius: 5px;
    font-size: .9em;
}
.entry-content--page { max-width: 860px; }

.article__rail { position: sticky; top: 104px; display: flex; flex-direction: column; gap: 16px; }
.rail-box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
}
.rail-box__title { font-size: 13px; letter-spacing: .08em; color: var(--muted); text-transform: uppercase; }
.toc { display: flex; flex-direction: column; gap: 2px; margin-top: 10px; }
.toc a {
    display: block; padding: 6px 0 6px 12px;
    border-left: 2px solid var(--line);
    font-size: 13.5px; color: var(--muted); line-height: 1.5;
}
.toc a:hover, .toc a.is-active { color: var(--ink); border-left-color: var(--brand); }
.article__rail .cta-box {
    flex-direction: column; align-items: flex-start;
    margin: 0; padding: 18px 20px;
}

.article__tags { margin: 26px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.article__tags a {
    display: inline-block; padding: 5px 12px;
    background: #f1ede5; border-radius: 999px;
    font-size: 13px; color: var(--ink-2);
}
.article__tags a:hover { background: var(--brand-soft); }

.article__nav {
    display: grid; grid-template-columns: 1fr 1fr; gap: 18px;
    border-top: 1px solid var(--line);
    padding: 22px 0;
    font-size: 14.5px;
}
.article__nav a { color: var(--ink-2); font-weight: 600; }
.article__nav a:hover { color: var(--ink); }
.article__nav-next { text-align: right; }

.related { border-top: 1px solid var(--line); margin-top: 20px; padding-top: 34px; }
.related .section__title { margin-bottom: 18px; }

/* ---------- 归档 / 单页 ---------- */
.archive { padding-top: 36px; }
.archive__head { margin-bottom: 26px; max-width: 780px; }
.archive__title {
    margin: 0 0 8px;
    font-family: var(--font-serif);
    font-size: 34px; line-height: 1.3; font-weight: 800;
}
.archive__desc { color: var(--muted); font-size: 15px; }
.archive__desc p { margin: 0; }

.page { padding-top: 26px; }
.page__head { margin-bottom: 24px; max-width: 820px; }
.page__title {
    margin: 0 0 10px;
    font-family: var(--font-serif);
    font-size: 36px; line-height: 1.32; font-weight: 800;
}
.page__lede { margin: 0; color: var(--muted); font-size: 16px; }

.pagination { display: flex; flex-wrap: wrap; gap: 8px; margin: 34px 0 10px; }
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 40px; height: 40px; padding: 0 12px;
    border: 1px solid var(--line); border-radius: 10px;
    background: var(--surface); font-size: 14px; color: var(--ink-2);
}
.pagination .current { background: var(--ink); color: #fff; border-color: var(--ink); }
.pagination a:hover { border-color: var(--brand); }

.empty { color: var(--muted); padding: 40px 0; }
.empty a { color: #a36a00; text-decoration: underline; }

.notfound { text-align: center; padding: 70px 0 90px; max-width: 560px; }
.notfound__code { font-family: var(--font-serif); font-size: 96px; font-weight: 800; color: var(--brand); line-height: 1; }
.notfound__title { margin: 10px 0; font-size: 28px; }
.notfound__desc { color: var(--muted); margin-bottom: 22px; }
.notfound .search-form { margin-bottom: 18px; }

/* ---------- 页脚 ---------- */
.site-footer { margin-top: 70px; background: var(--ink); color: rgba(255, 255, 255, .72); }
.footer__grid {
    display: grid;
    grid-template-columns: 1.6fr 1fr 1fr 1fr;
    gap: 36px;
    padding: 52px 0 34px;
}
.footer__name { font-family: var(--font-serif); font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 10px; }
.footer__brand p { margin: 0 0 12px; font-size: 14px; line-height: 1.75; }
.footer__note { color: rgba(255, 255, 255, .42); font-size: 12.5px; }
.footer__col h3 { margin: 0 0 12px; font-size: 13px; letter-spacing: .1em; color: rgba(255, 255, 255, .45); font-weight: 700; text-transform: uppercase; }
.footer__col a { display: block; padding: 4px 0; font-size: 14px; color: rgba(255, 255, 255, .72); }
.footer__col a:hover { color: var(--brand); }
.footer__bottom {
    display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, .12);
    padding: 18px 0 26px;
    font-size: 12.5px; color: rgba(255, 255, 255, .42);
}

/* ---------- 响应式 ---------- */
@media (max-width: 1000px) {
    .hero { grid-template-columns: 1fr; }
    .hero__side { display: grid; grid-template-columns: 1fr 1fr; }
    .card--lead .card__title { font-size: 26px; }
    .tool-grid { grid-template-columns: 1fr 1fr; }
    .post-grid, .post-grid--archive { grid-template-columns: 1fr 1fr; }
    .article__layout { grid-template-columns: 1fr; gap: 28px; }
    .article__rail { position: static; flex-direction: row; flex-wrap: wrap; }
    .article__rail .rail-box, .article__rail .cta-box { flex: 1 1 260px; }
    .footer__grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .wrap { width: calc(100% - 28px); }
    .topbar__tag, .topbar__right { display: none; }
    .masthead__inner { height: 64px; gap: 12px; }
    .brand__name { font-size: 20px; }
    .brand__sub { font-size: 10.5px; }
    .nav {
        position: fixed; inset: 64px 0 auto 0;
        display: none;
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        padding: 10px 14px 16px;
        box-shadow: 0 20px 30px rgba(0, 0, 0, .08);
    }
    .nav.is-open { display: block; }
    .nav__list { flex-direction: column; align-items: stretch; gap: 2px; }
    .nav__list a { padding: 12px 12px; font-size: 16px; }
    .nav-toggle { display: inline-flex; }
    .header-cta { display: none; }

    .hero { padding-top: 20px; gap: 16px; }
    .hero__side { grid-template-columns: 1fr; }
    .card__title--lead { font-size: 23px; }
    .card__body { padding: 16px 18px 18px; }
    .card--lead .card__body { padding: 18px 20px 20px; }

    .tool-grid, .post-grid, .post-grid--archive { grid-template-columns: 1fr; }
    .section { padding-top: 34px; }
    .section__title { font-size: 22px; }

    .cta-band { grid-template-columns: 1fr; padding: 18px; }
    .cta-box { flex-direction: column; align-items: flex-start; }

    .article__title { font-size: 27px; }
    .entry-content { font-size: 16.5px; }
    .entry-content h2 { font-size: 22px; }
    .entry-content table { font-size: 13.5px; display: block; overflow-x: auto; }
    .article__nav { grid-template-columns: 1fr; }
    .article__nav-next { text-align: left; }

    .archive__title, .page__title { font-size: 26px; }
    .footer__grid { grid-template-columns: 1fr 1fr; gap: 26px; padding-top: 34px; }
    .footer__brand { grid-column: 1 / -1; }
}
