:root {
  --paper: #f2e8d3;
  --paper-deep: #e9dcc3;
  --ink: #30251d;
  --muted: #766657;
  --faint: #a49480;
  --rule: rgba(83, 63, 45, .23);
  --accent: #632515;
  --accent-strong: #4e1a0e;
  --panel: rgba(255, 249, 237, .28);
  --code: #2d2721;
  --max: 1160px;
}

[data-theme="dark"] {
  --paper: #211b17;
  --paper-deep: #2a211b;
  --ink: #eee3d1;
  --muted: #bba996;
  --faint: #927e6b;
  --rule: rgba(238, 227, 209, .2);
  --accent: #e2a477;
  --accent-strong: #f0b98d;
  --panel: rgba(58, 43, 32, .42);
  --code: #171310;
}

* { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }
html,
body {
  scrollbar-width: thin;
  scrollbar-color: #171310 transparent;
}
* {
  scrollbar-width: thin;
  scrollbar-color: #171310 transparent;
}
html::-webkit-scrollbar,
body::-webkit-scrollbar,
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track,
::-webkit-scrollbar-track {
  background: transparent;
}
html::-webkit-scrollbar-button,
body::-webkit-scrollbar-button,
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner,
::-webkit-scrollbar-corner {
  background: transparent;
}
html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb,
::-webkit-scrollbar-thumb {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 0;
  background: #171310;
}
html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover,
::-webkit-scrollbar-thumb:hover {
  background: #000;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Noto Serif SC", "Songti SC", "STSong", Georgia, serif;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }
button, input { font: inherit; }
.site-shell { width: min(calc(100% - 48px), var(--max)); margin: 0 auto; }

.site-header {
  border-bottom: 1px solid var(--rule);
  padding: 26px 0 20px;
}
.header-inner { display: flex; align-items: end; justify-content: space-between; gap: 24px; }
.brand { text-decoration: none; }
.brand-name { display: block; font-family: Georgia, serif; font-size: 2rem; font-weight: 700; line-height: 1; letter-spacing: .02em; }
.brand-tagline { display: block; margin-top: 8px; color: var(--muted); font-size: .9rem; }
.site-nav { display: flex; align-items: center; gap: 30px; }
.site-nav a { position: relative; padding: 7px 0; text-decoration: none; font-size: .96rem; }
.site-nav a::after { content: ""; position: absolute; right: 0; bottom: 0; left: 0; height: 2px; background: var(--accent); transform: scaleX(0); transform-origin: center; transition: transform .2s ease; }
.site-nav a:hover::after, .site-nav a[aria-current="page"]::after { transform: scaleX(1); }
.theme-toggle { width: 32px; height: 32px; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.theme-toggle svg { width: 19px; height: 19px; fill: currentColor; }

.home-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 26px; padding: 30px 0 0; }
.main-column, .sidebar { min-width: 0; }
.intro { position: relative; min-height: 310px; overflow: hidden; border: 1px solid var(--rule); background: var(--panel); padding: 38px 40% 34px 30px; }
.intro h1 { max-width: 410px; margin: 0; font-size: clamp(1.9rem, 3vw, 2.45rem); line-height: 1.35; font-weight: 700; }
.intro p { max-width: 460px; margin: 20px 0 0; font-size: 1rem; }
.intro .intro-note { margin-top: 10px; color: var(--muted); }
.intro-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 27px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 20px; border: 1px solid var(--accent); text-decoration: none; font-size: .94rem; transition: background .2s ease, color .2s ease; }
.button.primary { background: var(--accent); color: #fff8eb; }
.button.primary:hover { background: var(--accent-strong); }
.button.ghost:hover { background: var(--accent); color: #fff8eb; }
.intro-art { position: absolute; right: 20px; bottom: 0; width: 38%; max-width: 330px; opacity: .84; color: var(--accent); }
.intro-art img { display: block; width: 100%; height: auto; }

.section-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 20px; margin: 29px 0 12px; border-bottom: 1px solid var(--rule); padding-bottom: 11px; }
.section-heading h2 { margin: 0; font-size: 1.35rem; }
.section-heading a { color: var(--muted); font-size: .84rem; text-decoration: none; }
.section-heading a:hover { color: var(--ink); }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-row { display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; gap: 22px; align-items: start; padding: 22px 8px 22px 0; border-bottom: 1px dashed var(--rule); }
.post-row-skeleton { min-height: 126px; pointer-events: none; }
.post-row-skeleton .post-date,
.skeleton-line,
.skeleton-pill {
  position: relative;
  display: block;
  overflow: hidden;
  border: 1px solid rgba(83, 63, 45, .1);
  background: linear-gradient(90deg, rgba(142, 117, 88, .13) 0%, rgba(105, 82, 60, .22) 42%, rgba(142, 117, 88, .13) 84%);
  background-size: 230% 100%;
  animation: shimmer-sweep 2.2s ease-in-out infinite;
}
[data-theme="dark"] .post-row-skeleton .post-date,
[data-theme="dark"] .skeleton-line,
[data-theme="dark"] .skeleton-pill {
  border-color: rgba(238, 227, 209, .07);
  background: linear-gradient(90deg, rgba(80, 61, 47, .34) 0%, rgba(154, 126, 99, .22) 42%, rgba(80, 61, 47, .34) 84%);
  background-size: 230% 100%;
}
.post-row-skeleton .post-date { width: 62px; height: 58px; justify-self: center; }
.skeleton-line { height: 16px; margin: 4px 0 13px; }
.skeleton-line.title { width: min(78%, 360px); height: 22px; }
.skeleton-line.excerpt { width: min(92%, 520px); }
.skeleton-line.meta { width: min(42%, 220px); height: 14px; margin-bottom: 0; }
.skeleton-pill { align-self: end; width: 42px; height: 24px; }
.post-date { color: var(--muted); font-family: Georgia, serif; font-size: .8rem; line-height: 1.35; text-align: center; }
.post-date strong { display: block; color: var(--ink); font-size: 1.08rem; font-weight: 400; }
.post-date span { display: block; margin-top: 2px; }
.post-row h3 { margin: 0; font-size: 1.14rem; font-weight: 700; }
.post-row h3 a { text-decoration: none; }
.post-row h3 a:hover { color: var(--accent); }
.post-excerpt { margin: 5px 0 9px; color: var(--muted); font-size: .88rem; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; }
.tag { display: inline-block; border: 1px solid var(--rule); padding: 1px 9px; color: var(--ink); text-decoration: none; line-height: 1.7; }
.tag:hover { border-color: var(--accent); color: var(--accent); }
.read-time { align-self: end; color: var(--ink); font-size: .8rem; white-space: nowrap; }

.sidebar { display: flex; flex-direction: column; gap: 17px; }
.side-panel { border: 1px solid var(--rule); background: var(--panel); padding: 23px 24px; }
.side-panel h2 { margin: 0 0 15px; font-size: 1.15rem; }
.side-panel p { margin: 0; color: var(--muted); font-size: .88rem; }
.profile { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 16px; align-items: center; }
.profile-mark { display: grid; place-items: center; width: 66px; height: 82px; border: 1px solid var(--rule); color: var(--accent); }
.profile-mark svg { width: 42px; height: 54px; fill: none; stroke: currentColor; stroke-width: 1.25; }
.side-link { display: inline-block; margin-top: 15px; color: var(--ink); text-decoration: none; font-size: .84rem; }
.side-link:hover { color: var(--accent); }
.link-list, .archive-list { list-style: none; margin: 0; padding: 0; }
.link-list li, .archive-list li { border-bottom: 1px dashed var(--rule); }
.link-list li:last-child, .archive-list li:last-child { border-bottom: 0; }
.link-list a, .archive-list a { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; text-decoration: none; font-size: .9rem; }
.link-list a:hover, .archive-list a:hover { color: var(--accent); }
.link-icon { width: 18px; margin-right: 7px; vertical-align: -4px; }
.tag-cloud { display: flex; flex-wrap: wrap; gap: 8px; }

.site-footer { display: flex; justify-content: space-between; gap: 18px; margin: 36px auto 0; border-top: 1px solid var(--rule); padding: 20px 0 34px; color: var(--muted); font-size: .78rem; }
.page { max-width: 830px; margin: 0 auto; padding: 54px 0 80px; }
.page-header { border-bottom: 1px solid var(--rule); padding-bottom: 24px; }
.page-header h1 { margin: 0; font-size: 2.1rem; line-height: 1.35; }
.page-header p { margin: 9px 0 0; color: var(--muted); }
.content { padding-top: 30px; }
.content h2 { margin: 2.1em 0 .6em; font-size: 1.4rem; }
.content h3 { margin: 1.7em 0 .5em; font-size: 1.12rem; }
.content p { margin: 0 0 1.25em; }
.content ul, .content ol { margin: 0 0 1.25em; padding-left: 1.5em; }
.content li { margin: .35em 0; }
.content a { color: var(--accent); }
.content blockquote { margin: 1.5em 0; border-left: 3px solid var(--accent); padding: 8px 20px; color: var(--muted); }
.content img { max-width: 100%; height: auto; border: 1px solid var(--rule); }
.content table { width: 100%; border-collapse: collapse; margin: 1.5em 0; font-size: .92rem; }
.content th, .content td { border: 1px solid var(--rule); padding: 9px 11px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.content th { background: var(--paper-deep); font-weight: 700; }
.content tbody tr:nth-child(even) { background: rgba(255,249,237,.22); }
.code-wrap { position: relative; margin: 1.25em 0; }
.content pre { margin: 0; overflow: auto; background: var(--code); color: #f2e8d3; padding: 19px 21px; font-family: "Cascadia Code", Consolas, monospace; font-size: .82rem; line-height: 1.7; }
.content code { font-family: "Cascadia Code", Consolas, monospace; font-size: .88em; }
.content :not(pre) > code { border: 1px solid var(--rule); background: var(--paper-deep); padding: 2px 5px; }
.copy-code { position: absolute; top: 8px; right: 8px; border: 1px solid rgba(242, 232, 211, .35); background: transparent; color: #f2e8d3; padding: 4px 8px; cursor: pointer; font-size: .7rem; }
.copy-code:hover { background: rgba(242, 232, 211, .12); }
.article-nav { display: flex; justify-content: space-between; gap: 14px; margin-top: 44px; border-top: 1px solid var(--rule); padding-top: 18px; font-size: .86rem; }
.article-nav a { color: var(--muted); text-decoration: none; }
.article-nav a:hover { color: var(--accent); }
.search-box { display: flex; gap: 8px; margin: 25px 0; }
.search-box input { flex: 1; min-width: 0; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); padding: 10px 12px; outline: none; }
.search-box input:focus { border-color: var(--accent); }
.search-results { list-style: none; margin: 0; padding: 0; }
.search-results li { border-bottom: 1px dashed var(--rule); padding: 15px 0; }
.search-results a { text-decoration: none; }
.search-results a:hover { color: var(--accent); }
.empty { color: var(--muted); }

@keyframes shimmer-sweep {
  0% { background-position: 120% 0; }
  100% { background-position: -120% 0; }
}

@media (max-width: 880px) {
  .home-layout { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .sidebar .side-panel:first-child { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .site-shell { width: min(calc(100% - 30px), var(--max)); }
  .site-header { padding-top: 20px; }
  .header-inner { align-items: start; flex-direction: column; }
  .site-nav { width: 100%; justify-content: space-between; gap: 10px; }
  .site-nav a { font-size: .85rem; }
  .intro { min-height: 430px; padding: 28px 24px; }
  .intro-art { right: 8%; width: 62%; max-width: 270px; }
  .post-row { grid-template-columns: 55px minmax(0, 1fr); gap: 14px; }
  .read-time { grid-column: 2; }
  .sidebar { display: flex; }
  .site-footer { flex-direction: column; }
  .page { padding-top: 38px; }
  .page-header h1 { font-size: 1.8rem; }
}

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