/*!
 * ink — a minimal Hexo theme
 * Two-column layout · serif body · mono meta · four palettes · light/dark
 */
/* ───────── fonts ───────── */
/* CJK quotes: route “ ” ‘ ’ to a CJK font so they get full width next to Chinese text. */
@font-face {
  font-family: "CJK Quotes";
  src: local("Songti SC"), local("STSong"), local("Noto Serif CJK SC"), local("Source Han Serif SC"), local("SimSun");
  unicode-range: U+2018-2019, U+201C-201D;
}
:root {
  --font-latin: "Source Serif 4";
  --font-zh: "Noto Serif SC";
  --serif: "CJK Quotes", var(--font-latin), var(--font-zh), "Songti SC", serif;
  --ui: "Space Grotesk", "PingFang SC", "Hiragino Sans GB", system-ui, sans-serif;
  --meta: "Space Mono", "JetBrains Mono", "PingFang SC", monospace;
  --code: "JetBrains Mono", "PingFang SC", monospace;
  --wrap: 74rem;
  --side: 15rem;
  --gap: 5rem;
  --prose: 46rem;
}

/* ───────── palettes ───────── */
:root {
  --bg: #faf9f5; --bg-elev: #f3f1ea; --text: #1f1e1b; --text-2: #4d4b45;
  --muted: #8b887f; --faint: #cdcabf; --line: #ebe8df; --accent: #c96442; --code-bg: #f4f2eb;
  --c-type: #3f6f86; --c-str: #5f7d3c; --c-num: #8a5c94; --c-fn: #8a6420; --c-add: #4f7a3a; --c-del: #b0493a;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --bg: #1a1918; --bg-elev: #232220; --text: #ebe8e0; --text-2: #c2beb4;
  --muted: #8e8a81; --faint: #4a4743; --line: #2c2a27; --accent: #e0896a; --code-bg: #201f1d;
  --c-type: #86b4c4; --c-str: #a8bf80; --c-num: #c4a3d4; --c-fn: #dcc08a; --c-add: #9cc27f; --c-del: #e58b7c;
  color-scheme: dark;
}
:root[data-palette="indigo"] {
  --bg: #fbfbf9; --bg-elev: #f2f3f1; --text: #1d2025; --text-2: #474c55;
  --muted: #888d96; --faint: #c9ccd2; --line: #e7e9ec; --accent: #3d5a99; --code-bg: #f3f4f4;
}
:root[data-palette="indigo"][data-mode="dark"] {
  --bg: #14161a; --bg-elev: #1b1e23; --text: #e3e5e9; --text-2: #b6bbc4;
  --muted: #7f8590; --faint: #3d424b; --line: #252930; --accent: #8ea9e0; --code-bg: #191c21;
}
:root[data-palette="bamboo"] {
  --bg: #f8f8f4; --bg-elev: #f0f0ea; --text: #1f231f; --text-2: #4a524b;
  --muted: #868d86; --faint: #c7ccc5; --line: #e5e8e1; --accent: #3e7a5a; --code-bg: #f0f1eb;
}
:root[data-palette="bamboo"][data-mode="dark"] {
  --bg: #131613; --bg-elev: #1a1e1a; --text: #dfe4dc; --text-2: #b3bcb1;
  --muted: #7f897e; --faint: #3a4239; --line: #232923; --accent: #82c09a; --code-bg: #171b17;
}
:root[data-palette="mono"] {
  --bg: #ffffff; --bg-elev: #f5f5f5; --text: #141414; --text-2: #454545;
  --muted: #8c8c8c; --faint: #d0d0d0; --line: #ededed; --accent: #141414; --code-bg: #f7f7f7;
  --c-type: #141414; --c-str: #6b6b6b; --c-num: #6b6b6b; --c-fn: #141414; --c-add: #141414; --c-del: #8c8c8c;
}
:root[data-palette="mono"][data-mode="dark"] {
  --bg: #0f0f0f; --bg-elev: #181818; --text: #ececec; --text-2: #bcbcbc;
  --muted: #7d7d7d; --faint: #3a3a3a; --line: #212121; --accent: #ffffff; --code-bg: #151515;
  --c-type: #ececec; --c-str: #9a9a9a; --c-num: #9a9a9a; --c-fn: #ececec; --c-add: #ececec; --c-del: #7d7d7d;
}
:root { --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent); }

/* ───────── base ───────── */
* { box-sizing: border-box; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
@media (max-width: 640px) { html { font-size: 16px; } }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--serif); font-optical-sizing: auto; line-height: 1.9;
  text-rendering: optimizeLegibility; -webkit-font-smoothing: antialiased;
  text-autospace: normal; text-spacing-trim: normal;
  transition: background-color .3s, color .3s;
}
::selection { background: var(--accent-soft); }
a { color: inherit; text-decoration: none; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 3rem 6rem; }
@media (max-width: 640px) { .wrap { padding: 0 1.4rem 4rem; } }

/* ───────── header ───────── */
.site-header { display: flex; align-items: center; justify-content: space-between; gap: 2rem; padding: 2.6rem 0 4.5rem; }
.brand { display: flex; align-items: baseline; gap: .6em; white-space: nowrap; }
.brand-name { font-weight: 600; font-size: 1.1rem; letter-spacing: .05em; }
.brand-path { font-family: var(--meta); font-size: .76rem; color: var(--muted); }
.nav { display: flex; align-items: center; gap: 1.1rem; }
.icon-btn { display: flex; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; transition: color .15s; }
.icon-btn:hover { color: var(--accent); }
.icon-btn svg { width: 16px; height: 16px; }
@media (max-width: 640px) {
  .site-header { padding: 2rem 0 3rem; }
}

/* ───────── two-column layout ───────── */
.split { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); gap: 0 var(--gap); align-items: start; }
.side { position: sticky; top: 2.5rem; max-height: calc(100vh - 5rem); overflow: auto; scrollbar-width: none; }
.main { max-width: var(--prose); min-width: 0; }
.filter { margin-top: 2.4rem; }
.filter + .filter { margin-top: 1.5rem; }
.filter h3 { margin: 0 0 .4rem; font-family: var(--meta); font-size: .68rem; font-weight: 400; color: var(--muted); letter-spacing: .1em; }
.chips { display: flex; flex-wrap: wrap; gap: .2rem .95rem; font-family: var(--meta); font-size: .78rem; line-height: 1.8; }
.chips a { color: var(--text-2); transition: color .15s; }
.chips a:hover, .chips a.on { color: var(--accent); }
@media (max-width: 1080px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
}
.post-meta-inline { display: none; }
.meta-block { font-family: var(--meta); font-size: .74rem; color: var(--muted); line-height: 2; padding-top: .9rem; }
.meta-block a:hover { color: var(--accent); }
.meta-block .tags { display: flex; flex-wrap: wrap; gap: 0 .9em; margin-top: .4rem; }
@media (max-width: 1080px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; max-height: none; overflow: visible; margin-bottom: 3rem; }
  .post-side { display: none; }
  .post-meta-inline { display: flex; }
}

/* ───────── home / lists ───────── */
.motto { margin: 0; font-size: 1.45rem; line-height: 1.6; letter-spacing: .1em; }
.motto-en { margin: .5rem 0 0; font-style: italic; color: var(--muted); font-size: 1rem; letter-spacing: .02em; }
.year-group { margin-bottom: 2.6rem; }
.year-group:first-child .year { padding-top: .35rem; }
.year { font-family: var(--meta); font-size: .76rem; font-weight: 400; color: var(--muted); letter-spacing: .1em; margin: 0 0 1.1rem; }
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li a { display: grid; grid-template-columns: 4.6rem 1fr; align-items: baseline; gap: 1rem; padding: .5rem 0; }
.post-list time { font-family: var(--meta); font-size: .76rem; color: var(--muted); }
.post-list .title { font-size: 1.06rem; transition: color .15s; }
.post-list a:hover .title { color: var(--accent); }

/* ───────── post ───────── */
.post-head { margin-bottom: 3.2rem; }
.post-title { font-size: 2.2rem; line-height: 1.35; font-weight: 600; letter-spacing: .01em; margin: 0 0 1rem; }
.lede { font-size: 1.1rem; color: var(--text-2); margin: 0 0 1.6rem; }
.post-meta-inline { font-family: var(--meta); font-size: .74rem; color: var(--muted); flex-wrap: wrap; gap: .3rem 1.2rem; }
.post-meta-inline a:hover { color: var(--accent); }
.post-meta-inline .tags a + a { margin-left: .8em; }

.prose { overflow-wrap: break-word; }
.prose > :first-child { margin-top: 0; }
.prose p { margin: 0 0 1.4em; }
.prose a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .25em; text-decoration-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.prose a:hover { color: var(--accent); }
.prose strong { font-weight: 650; }
.prose em { font-style: italic; }
.prose del { color: var(--muted); }
.prose mark { background: var(--accent-soft); color: inherit; padding: 0 .15em; border-radius: 2px; }
.prose kbd {
  font-family: var(--meta); font-size: .76em; background: var(--bg-elev);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: .05em .45em;
}
.prose sup, .prose sub { line-height: 0; font-size: .75em; }

.prose h1, .prose h2, .prose h3, .prose h4, .prose h5, .prose h6 { position: relative; line-height: 1.45; font-weight: 600; scroll-margin-top: 2rem; }
.prose h1 { font-size: 1.6rem; margin: 2.8em 0 .9em; }
.prose h2 { font-size: 1.45rem; margin: 2.8em 0 .9em; }
.prose h3 { font-size: 1.2rem; margin: 2.2em 0 .7em; }
.prose h4 { font-size: 1.04rem; margin: 2.2em 0 .6em; }
.prose h5, .prose h6 { font-size: .96rem; margin: 2em 0 .5em; color: var(--text-2); }
.prose h1::before, .prose h2::before, .prose h3::before, .prose h4::before, .prose h5::before, .prose h6::before {
  position: absolute; right: 100%; margin-right: .6em; font-family: var(--meta); font-weight: 400; color: var(--faint);
}
.prose h1::before { content: "#"; }
.prose h2::before { content: "##"; }
.prose h3::before { content: "###"; }
.prose h4::before { content: "####"; }
.prose h5::before { content: "#####"; }
.prose h6::before { content: "######"; }
@media (max-width: 1080px) {
  .prose h1::before, .prose h2::before, .prose h3::before, .prose h4::before, .prose h5::before, .prose h6::before {
    position: static; margin-right: .45em; font-size: .8em;
  }
}

.prose ol, .prose ul { padding-left: 1.7em; margin: 0 0 1.5em; }
.prose li { margin: .45em 0; padding-left: .25em; }
.prose li > ul, .prose li > ol { margin: .3em 0 .5em; }
.prose ol li::marker { font-family: var(--meta); font-size: .8em; color: var(--muted); }
.prose ul li::marker { color: var(--muted); }
.prose .task-list-item { list-style: none; margin-left: -1.45em; }
.prose .task-list-item input {
  appearance: none; -webkit-appearance: none; position: relative; width: .85em; height: .85em;
  margin: 0 .7em 0 0; vertical-align: -.05em; border: 1.5px solid var(--muted); border-radius: 3px; opacity: 1;
}
.prose .task-list-item input:checked { background: var(--accent); border-color: var(--accent); }
.prose .task-list-item input:checked::after {
  content: ""; position: absolute; left: .2em; top: .02em; width: .2em; height: .42em;
  border: solid var(--bg); border-width: 0 2px 2px 0; transform: rotate(45deg);
}

.prose blockquote { margin: 2em 0; padding: 0 0 0 1.3em; border-left: 2px solid var(--faint); color: var(--text-2); }
.prose blockquote p:last-child { margin-bottom: 0; }

.prose :not(pre) > code {
  font-family: var(--code); font-size: .84em; background: var(--code-bg);
  border-radius: 4px; padding: .1em .38em; font-variant-ligatures: none;
}
.prose .katex { font-size: 1.06em; }
.prose .katex-display { margin: 1.8em 0; padding: .2em 0; overflow-x: auto; overflow-y: hidden; }

.code { position: relative; margin: 2.2em 0; }
.code pre {
  margin: 0; padding: 1.3em 1.5em; overflow-x: auto; background: var(--code-bg); border-radius: 10px;
  font-family: var(--code); font-size: .8rem; line-height: 1.75; tab-size: 4; font-variant-ligatures: none;
}
.code pre code { font-family: inherit; }
.code .copy {
  position: absolute; top: .7rem; right: .8rem; font-family: var(--meta); font-size: .68rem; color: var(--muted);
  background: var(--code-bg); border: 0; cursor: pointer; opacity: 0; transition: opacity .15s;
}
.code:hover .copy { opacity: 1; }
.code .copy:hover { color: var(--accent); }
.hljs-keyword, .hljs-built_in, .hljs-literal, .hljs-selector-tag { color: var(--accent); }
.hljs-type, .hljs-title.class_, .hljs-params { color: var(--c-type); }
.hljs-string, .hljs-regexp { color: var(--c-str); }
.hljs-number, .hljs-symbol { color: var(--c-num); }
.hljs-comment, .hljs-meta, .hljs-doctag { color: var(--muted); font-style: italic; }
.hljs-meta .hljs-string { color: var(--c-str); font-style: normal; }
.hljs-title.function_, .hljs-title, .hljs-section { color: var(--c-fn); }
.hljs-addition { color: var(--c-add); }
.hljs-attr, .hljs-attribute { color: var(--c-type); }
.hljs-bullet { color: var(--muted); }
.hljs-deletion { color: var(--c-del); }

.table-wrap { margin: 2.2em 0; overflow-x: auto; }
.prose table { width: 100%; border-collapse: collapse; font-size: .92rem; line-height: 1.6; }
.prose th {
  font-family: var(--ui); font-weight: 500; font-size: .78rem; color: var(--muted);
  padding: 0 1.2em .7em 0; border-bottom: 1px solid var(--faint); white-space: nowrap;
}
.prose td { padding: .7em 1.2em .7em 0; border-bottom: 1px solid var(--line); }
.prose th:last-child, .prose td:last-child { padding-right: 0; }

.prose figure { margin: 2.6em 0; }
.prose img { display: block; max-width: 100%; margin: 0 auto; border-radius: 8px; }
.prose figcaption { margin-top: .9em; text-align: center; font-size: .86rem; color: var(--muted); }

.prose hr { border: 0; margin: 3.2em 0; text-align: center; overflow: visible; }
.prose hr::after { content: "* * *"; font-family: var(--meta); color: var(--faint); letter-spacing: .6em; }

.prose details { margin: 2em 0; padding: .9em 1.2em; background: var(--bg-elev); border-radius: 10px; }
.prose summary { cursor: pointer; font-family: var(--ui); font-size: .92rem; color: var(--text-2); }
.prose details[open] summary { margin-bottom: 1em; }
.prose details > :last-child { margin-bottom: 0; }

.prose .footnote-ref a, .prose a.footnote-backref { text-decoration: none; font-family: var(--meta); color: var(--accent); }
.prose .footnote-ref a { font-size: .9em; }
.prose .footnotes-sep { display: none; }
.prose .footnotes { margin-top: 4.5em; padding-top: 1.6em; border-top: 1px solid var(--line); font-size: .9rem; color: var(--text-2); }
.prose .footnotes ol { margin: 0; }
.prose .footnotes p { margin: 0; display: inline; }

.post-foot { margin-top: 4.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.pager { display: flex; justify-content: space-between; gap: 2rem; }
.pager a { display: block; max-width: 48%; }
.pager .next { margin-left: auto; text-align: right; }
.pager .dir { display: block; font-family: var(--meta); font-size: .72rem; color: var(--muted); margin-bottom: .3rem; }
.pager .t { font-size: 1rem; transition: color .15s; }
.pager a:hover .t { color: var(--accent); }

/* ───────── toc ───────── */
.toc { margin-top: 2.4rem; font-family: var(--ui); font-size: .8rem; line-height: 1.6; }
.toc ol { list-style: none; margin: 0; padding: 0; }
.toc .toc-list-child a { padding-left: 1rem; }
.toc li a { display: block; padding: .3rem 0; color: var(--muted); transition: color .15s; }
.toc li a:hover { color: var(--text-2); }
.toc li a.active { color: var(--accent); }

/* ───────── pages ───────── */
.friends { list-style: none; margin: 0; padding: 0; }
.friends a { display: grid; grid-template-columns: 2.8rem 1fr; gap: 0 1.2rem; align-items: center; padding: 1.1rem 0; }
.friends img { grid-row: span 2; width: 2.8rem; height: 2.8rem; border-radius: 50%; object-fit: cover; }
.friends .n { font-size: 1.04rem; line-height: 1.4; transition: color .15s; }
.friends a:hover .n { color: var(--accent); }
.friends .d { font-size: .9rem; color: var(--muted); line-height: 1.5; }
.kv { display: grid; grid-template-columns: 7rem 1fr; gap: .6rem 1rem; margin: 0 0 1.4em; font-size: .95rem; }
.kv dt { font-family: var(--meta); font-size: .74rem; color: var(--muted); padding-top: .3em; }
.kv dd { margin: 0; }
.nf-code { font-family: var(--meta); font-size: 3.6rem; line-height: 1; color: var(--faint); margin: 0; letter-spacing: .05em; }
.nf h1 { font-size: 1.45rem; font-weight: 600; margin: 0 0 .8rem; line-height: 1.4; }
.nf p { color: var(--text-2); margin: 0 0 2.4rem; }
.nf-links { display: flex; gap: 2rem; font-family: var(--ui); font-size: .9rem; }
.nf-links a { color: var(--muted); }
.nf-links a:hover { color: var(--accent); }

/* friends */
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 1rem; }
.friend {
  display: grid; grid-template-columns: 3.2rem minmax(0, 1fr); gap: .1rem 1.1rem; align-items: center;
  padding: 1.2rem 1.3rem; border: 1px solid var(--line); border-radius: 12px; transition: border-color .2s, background-color .2s;
}
.friend:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--bg-elev); }
.friend img { grid-row: span 3; width: 3.2rem; height: 3.2rem; border-radius: 50%; object-fit: cover; background: var(--bg-elev); }
.friend .avatar-empty { grid-row: span 3; width: 3.2rem; height: 3.2rem; border-radius: 50%; background: var(--bg-elev); }
.friend .n { font-size: 1.06rem; line-height: 1.4; }
.friend:hover .n { color: var(--accent); }
.friend .d { font-size: .9rem; color: var(--text-2); line-height: 1.5; }
.friend .u { font-family: var(--meta); font-size: .7rem; color: var(--muted); line-height: 1.6; }

.prose .friend-grid { margin: 0 0 1.6em; }
.prose a.friend { text-decoration: none; }
.prose .friend img { margin: 0; border-radius: 50%; }

/* about */
.avatar { display: block; width: 4.6rem; height: 4.6rem; border-radius: 50%; object-fit: cover; margin-bottom: 1.6rem; }

/* ───────── search ───────── */
.search { position: fixed; inset: 0; z-index: 50; display: none; background: color-mix(in srgb, var(--bg) 75%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.search.open { display: block; }
.search-box { max-width: 34rem; margin: 16vh auto 0; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .25); }
.search-box input { display: block; width: 100%; border: 0; outline: 0; background: none; color: var(--text); font-family: var(--serif); font-size: 1.05rem; padding: 1.1rem 1.3rem; border-bottom: 1px solid var(--line); }
.search-box ul { list-style: none; margin: 0; padding: .5rem; max-height: 50vh; overflow: auto; }
.search-box li a { display: block; padding: .6rem .8rem; border-radius: 8px; }
.search-box li a:hover, .search-box li a.sel { background: var(--bg-elev); }
.search-box li small { display: block; font-family: var(--meta); font-size: .7rem; color: var(--muted); }
.search-box .empty { padding: 1rem .8rem; font-family: var(--meta); font-size: .76rem; color: var(--muted); }
