/* ============================================================
   trace — dark-first terminal aesthetic
   信号绿 + 琥珀 / JetBrains Mono / 出版物节奏
   ============================================================ */

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("../fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- design tokens ---------- */

:root {
  color-scheme: dark;
  --bg: #0b0f13;
  --bg-raise: #121921;
  --bg-hover: #182229;
  --bg-header: rgb(11 15 19 / 0.8);
  --text: #d4dfe7;
  --muted: #7f919e;
  --faint: #4f606b;
  --line: #1d2831;
  --line-strong: #33454f;
  --accent: #3fd68f;
  --accent-ink: #07130d;
  --accent-soft: rgb(63 214 143 / 0.14);
  --amber: #d9a44a;
  --code-bg: #0e151c;
  --code-text: #c9dbd2;
  --code-line: #4e5f58;
  --backdrop: rgb(3 6 8 / 0.6);

  --container: 1080px;
  --article: 760px;
  --gutter: 24px;
  --font: "Noto Sans SC", "Source Han Sans SC", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5ef;
  --bg-raise: #fdfcf8;
  --bg-hover: #edebe2;
  --bg-header: rgb(246 245 239 / 0.82);
  --text: #222b30;
  --muted: #5f707a;
  --faint: #93a0a7;
  --line: #e1dfd3;
  --line-strong: #c6c3b4;
  --accent: #157a49;
  --accent-ink: #ffffff;
  --accent-soft: rgb(21 122 73 / 0.13);
  --amber: #96680d;
  --backdrop: rgb(30 34 30 / 0.35);
}

/* ---------- base ---------- */

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

html {
  scroll-behavior: smooth;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  transition: background-color 200ms ease, color 200ms ease;
}

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

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

button,
input {
  color: inherit;
  font: inherit;
}

button {
  padding: 0;
  border: 0;
}

img {
  max-width: 100%;
}

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

.container {
  width: min(calc(100% - (2 * var(--gutter))), var(--container));
  margin-inline: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  padding: 8px 12px;
  color: var(--accent-ink);
  background: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 0;
  height: 2px;
  background: var(--accent);
}

@keyframes blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: var(--bg-header);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.site-header__inner {
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: space-between;
}

.site-name {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.site-name::before {
  content: "$ ";
  color: var(--accent);
}

.site-nav {
  display: flex;
  gap: 24px;
  align-items: center;
  font-family: var(--mono);
  font-size: 12.5px;
}

.site-nav a,
.site-nav button {
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  transition: color 150ms ease;
}

.site-nav a:hover,
.site-nav button:hover {
  color: var(--accent);
}

.theme-toggle {
  padding: 2px 8px;
  border: 1px solid var(--line-strong);
  font-family: var(--mono);
  font-size: 11px;
}

.theme-toggle:hover {
  border-color: var(--accent);
}

/* ---------- hero ---------- */

.hero {
  border-bottom: 1px solid var(--line);
}

.hero__inner {
  padding-block: clamp(34px, 5vw, 60px) clamp(24px, 3.5vw, 40px);
}

.hero__prompt {
  margin: 0 0 16px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 14px;
}

.hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(28px, 4.6vw, 42px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.04em;
  text-wrap: balance;
}

.hero h1::after {
  content: "_";
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

.hero__desc {
  max-width: 560px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 15.5px;
  line-height: 1.7;
}

.hero__status {
  display: flex;
  max-width: 640px;
  padding-top: 14px;
  margin-top: 22px;
  border-top: 1px solid var(--line);
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px 32px;
  font-family: var(--mono);
  font-size: 12.5px;
}

.hero__status p {
  margin: 0;
  color: var(--muted);
}

.hero__status span {
  display: inline-block;
  width: 84px;
  color: var(--amber);
  font-size: 11.5px;
  letter-spacing: 0.04em;
}

.hero__status a {
  color: var(--text);
  border-bottom: 1px solid var(--line-strong);
  transition: color 150ms ease, border-color 150ms ease;
}

.hero__status a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

/* ---------- section title ---------- */

.home-section {
  padding-block: clamp(26px, 4vw, 38px);
}

.section-title {
  display: flex;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
  align-items: baseline;
  justify-content: space-between;
}

.section-title h2 {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.section-title a {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  transition: color 150ms ease;
}

.section-title a:hover {
  color: var(--accent);
}

/* ---------- featured post ---------- */

.featured {
  display: block;
  padding-block: clamp(26px, 4vw, 40px);
  border-bottom: 1px solid var(--line);
}

.featured__label {
  display: flex;
  margin: 0 0 14px;
  align-items: center;
  gap: 8px;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.featured__label::before {
  content: "▲";
  font-size: 8px;
}

.featured h3 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(24px, 3.2vw, 33px);
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.025em;
  text-wrap: balance;
  transition: color 150ms ease;
}

.featured:hover h3,
.featured:focus-within h3 {
  color: var(--accent);
}

.featured__excerpt {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.72;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.featured__meta {
  display: flex;
  margin: 18px 0 0;
  align-items: baseline;
  gap: 8px 18px;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.featured__meta time {
  color: var(--accent);
}

.featured__meta a {
  color: var(--muted);
}

.featured__meta a:hover {
  color: var(--accent);
}

.featured__read {
  margin-left: auto;
  color: var(--accent);
}

/* ---------- post rows ---------- */

.post-row {
  display: grid;
  padding: 15px 12px;
  margin-inline: -12px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 108px minmax(0, 1fr) auto;
  gap: 4px 26px;
  align-items: baseline;
  transition: background-color 150ms ease;
}

.post-row:hover,
.post-row:focus-within {
  background: var(--bg-raise);
}

.post-row time {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.post-row__main {
  min-width: 0;
}

.post-row h3 {
  position: relative;
  margin: 0;
  font-size: 16.5px;
  font-weight: 500;
  line-height: 1.5;
}

.post-row h3 a::before {
  content: "▸";
  position: absolute;
  left: -1.1em;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.85em;
  opacity: 0;
  transition: opacity 150ms ease;
}

.post-row:hover h3 a::before,
.post-row:focus-within h3 a::before {
  opacity: 1;
}

.post-row:hover h3,
.post-row:focus-within h3 {
  color: var(--accent);
}

.post-row__excerpt {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.post-row__tag {
  overflow: hidden;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-row__tag::before {
  content: "#";
  color: var(--faint);
}

/* ---------- projects ---------- */

.project-grid {
  display: grid;
  padding-block: 18px 4px;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.project-card {
  position: relative;
  display: flex;
  padding: 18px 20px 16px;
  border: 1px solid var(--line);
  flex-direction: column;
  gap: 8px;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.project-card:hover,
.project-card:focus-visible {
  border-color: var(--accent);
  background: var(--bg-raise);
}

.project-card__name {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
}

.project-card__name::after {
  content: " ↗";
  color: var(--faint);
  transition: color 150ms ease;
}

.project-card:hover .project-card__name,
.project-card:focus-visible .project-card__name {
  color: var(--accent);
}

.project-card:hover .project-card__name::after {
  color: var(--accent);
}

.project-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.6;
}

/* ---------- footer ---------- */

.site-footer {
  margin-top: 36px;
  border-top: 1px solid var(--line);
}

.site-footer__inner {
  display: flex;
  min-height: 78px;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
}

.site-footer__inner div {
  display: flex;
  gap: 20px;
}

.site-footer a:hover {
  color: var(--accent);
}

/* ---------- post page ---------- */

.post-page {
  width: min(calc(100% - (2 * var(--gutter))), 980px);
}

.post-header {
  width: min(100%, var(--article));
  padding-block: clamp(38px, 6vw, 60px) 26px;
  margin-inline: auto;
  border-bottom: 1px solid var(--line);
}

.post-header h1 {
  margin: 0;
  font-size: clamp(29px, 4.2vw, 40px);
  font-weight: 700;
  line-height: 1.26;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

.post-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.68;
}

.post-meta {
  display: flex;
  margin-top: 16px;
  align-items: baseline;
  flex-wrap: wrap;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.post-meta > * + *::before {
  content: "/";
  margin: 0 12px;
  color: var(--faint);
}

.post-meta time {
  color: var(--accent);
}

.post-meta a:hover {
  color: var(--accent);
}

.post-layout {
  display: grid;
  padding-block: 26px 48px;
  grid-template-columns: 172px minmax(0, var(--article));
  gap: 38px;
  align-items: start;
  justify-content: center;
}

.post-toc {
  position: sticky;
  top: 78px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.6;
}

.post-toc > strong {
  display: block;
  margin-bottom: 12px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.post-toc ol,
.post-toc ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.post-toc ol ol,
.post-toc ul ul {
  padding-left: 14px;
  margin-top: 5px;
}

.post-toc li {
  position: relative;
  margin-block: 7px;
}

.post-toc a {
  display: block;
  padding-left: 1.2em;
  transition: color 150ms ease;
}

.post-toc a::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--accent);
  opacity: 0;
}

.post-toc a:hover {
  color: var(--accent);
}

.post-toc a.is-active {
  color: var(--accent);
}

.post-toc a.is-active::before {
  opacity: 1;
}

.post-layout > .article-content {
  grid-column: 2;
}

/* ---------- article content ---------- */

.article-content {
  min-width: 0;
  font-size: 16.5px;
  line-height: 1.75;
  overflow-wrap: break-word;
}

.article-content > :first-child {
  margin-top: 0;
}

.article-content h1,
.article-content h2,
.article-content h3,
.article-content h4 {
  font-weight: 700;
  line-height: 1.4;
  scroll-margin-top: 78px;
}

.article-content h1::before,
.article-content h2::before,
.article-content h3::before,
.article-content h4::before {
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 400;
}

.article-content h1::before { content: "# "; }
.article-content h2::before { content: "# "; }
.article-content h3::before { content: "## "; }
.article-content h4::before { content: "### "; }

.article-content h1 {
  margin: 1.6em 0 0.65em;
  font-size: 30px;
}

.article-content h2 {
  padding-top: 0.9em;
  margin: 1.8em 0 0.65em;
  border-top: 1px solid var(--line);
  font-size: 26px;
  letter-spacing: -0.02em;
}

.article-content h3 {
  margin: 1.5em 0 0.6em;
  font-size: 21px;
}

.article-content h4 {
  margin: 1.4em 0 0.5em;
  font-size: 17.5px;
}

.article-content p {
  margin-block: 0.85em;
}

.article-content a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.article-content a:hover {
  text-decoration-color: var(--accent);
}

.article-content blockquote {
  padding-left: 18px;
  margin: 1.8em 0;
  border-left: 2px solid var(--amber);
  color: var(--muted);
}

.article-content ul,
.article-content ol {
  padding-left: 1.5em;
}

.article-content li {
  margin-block: 0.35em;
}

.article-content li::marker {
  color: var(--accent);
  font-family: var(--mono);
}

.article-content img {
  display: block;
  height: auto;
  margin: 2em auto;
  border: 1px solid var(--line);
  opacity: 0.92;
}

:root[data-theme="light"] .article-content img {
  opacity: 1;
}

.article-content hr {
  height: 1px;
  margin-block: 3em;
  border: 0;
  background: var(--line);
}

.article-content code {
  padding: 0.12em 0.35em;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--bg-raise);
  font-family: var(--mono);
  font-size: 0.84em;
}

.article-content pre,
.article-content .highlight {
  position: relative;
  overflow: auto;
}

.code-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 3px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms ease, color 150ms ease, border-color 150ms ease;
}

.article-content pre:hover .code-copy,
.article-content .highlight:hover .code-copy,
.article-content .code-copy:focus-visible {
  opacity: 1;
}

.code-copy:hover,
.code-copy:focus-visible {
  color: var(--accent);
  border-color: var(--accent);
}

.article-content > pre,
.article-content .highlight {
  padding: 18px 20px;
  margin: 1.8em 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--code-text);
  background: var(--code-bg);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.65;
}

.article-content .highlight table {
  width: auto;
  margin: 0;
  border: 0;
}

.article-content .highlight td {
  padding: 0;
  border: 0;
}

.article-content .highlight .gutter {
  padding-right: 16px;
  color: var(--code-line);
  text-align: right;
  user-select: none;
}

.article-content .highlight pre {
  padding: 0;
  margin: 0;
  overflow: visible;
}

.article-content pre code,
.article-content .highlight code {
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
}

.article-content table {
  display: block;
  width: 100%;
  margin: 1.8em 0;
  border-collapse: collapse;
  overflow-x: auto;
  font-size: 14px;
}

.article-content th,
.article-content td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
}

.article-content th {
  background: var(--bg-raise);
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 500;
}

/* ---------- post nav ---------- */

.post-nav {
  display: grid;
  width: min(100%, var(--article));
  padding-block: 24px 52px;
  margin-inline: auto;
  border-top: 1px solid var(--line);
  grid-template-columns: 1fr 1fr;
  gap: 32px;
}

.post-nav a {
  display: flex;
  flex-direction: column;
}

.post-nav a:last-child {
  text-align: right;
}

.post-nav span {
  margin-bottom: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}

.post-nav strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.5;
}

.post-nav a:hover strong {
  color: var(--accent);
}

/* ---------- archive / collection ---------- */

.collection-page,
.standalone-page {
  padding-block: clamp(36px, 5vw, 52px);
}

.collection-header,
.standalone-page > header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line-strong);
}

.collection-header h1,
.standalone-page > header h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(26px, 3.4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.collection-header h1::before,
.standalone-page > header h1::before {
  content: "~/";
  color: var(--accent);
  font-weight: 400;
}

.archive-year {
  display: grid;
  padding-block: 26px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.archive-year h2 {
  margin: 0;
  color: var(--faint);
  font-family: var(--mono);
  font-size: clamp(28px, 3.6vw, 38px);
  font-weight: 700;
  letter-spacing: -0.03em;
}

.archive-year h2::before {
  content: "# ";
  color: var(--accent);
  font-weight: 400;
}

.archive-row {
  display: grid;
  padding-block: 9px;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 16px;
  align-items: baseline;
}

.archive-row time {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.archive-row h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
}

.archive-row a:hover {
  color: var(--accent);
}

/* ---------- pagination ---------- */

.pagination {
  display: flex;
  width: min(calc(100% - (2 * var(--gutter))), var(--container));
  padding-bottom: 48px;
  margin-inline: auto;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-family: var(--mono);
  font-size: 12px;
}

.pagination a,
.pagination span {
  display: grid;
  min-width: 32px;
  height: 32px;
  padding-inline: 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  place-items: center;
  transition: color 150ms ease, border-color 150ms ease;
}

.pagination a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.pagination .current {
  color: var(--accent-ink);
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- standalone page ---------- */

.standalone-page .article-content {
  width: min(100%, var(--article));
  margin: 44px auto 0;
}

/* ---------- search ---------- */

.search-dialog {
  width: min(600px, calc(100% - 32px));
  max-height: calc(100vh - 32px);
  padding: 22px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-raise);
}

.search-dialog::backdrop {
  background: var(--backdrop);
}

.search-dialog__header {
  display: flex;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
}

.search-dialog__header h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 500;
}

.search-dialog__header h2::before {
  content: "$ ";
  color: var(--accent);
}

.search-dialog__header button {
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 12px;
}

.search-dialog__header button:hover {
  color: var(--accent);
}

.search-dialog input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: var(--bg);
  caret-color: var(--accent);
  font-family: var(--mono);
  font-size: 13px;
  outline: 0;
}

.search-dialog input:focus {
  border-color: var(--accent);
}

#search-status {
  margin: 12px 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11.5px;
}

#search-results {
  max-height: 420px;
  padding: 0;
  margin: 0;
  overflow-y: auto;
  list-style: none;
}

.search-result a {
  display: grid;
  padding-block: 11px;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
}

.search-result time,
.search-result__tags {
  color: var(--faint);
  font-family: var(--mono);
  font-size: 11px;
}

.search-result strong {
  font-size: 14px;
  font-weight: 500;
}

.search-result__tags {
  display: none;
}

.search-result a:hover strong {
  color: var(--accent);
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .post-layout {
    grid-template-columns: minmax(0, var(--article));
    gap: 28px;
  }

  .post-layout > .article-content {
    grid-column: 1;
  }

  .post-toc {
    position: static;
    padding: 14px 16px;
    border: 1px solid var(--line);
  }
}

@media (max-width: 640px) {
  :root {
    --gutter: 18px;
  }

  .site-nav {
    gap: 15px;
  }

  .site-nav a:nth-child(2) {
    display: none;
  }

  .hero__inner {
    padding-block: 32px 24px;
  }

  .hero h1 {
    font-size: clamp(26px, 8vw, 32px);
  }

  .hero__status span {
    width: 70px;
  }

  .featured__read {
    width: 100%;
    margin-left: 0;
  }

  .post-row {
    padding: 13px 10px;
    margin-inline: -10px;
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .post-row__tag {
    display: none;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .site-footer__inner {
    min-height: 92px;
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
  }

  .post-header {
    padding-block: 34px 24px;
  }

  .post-layout {
    padding-block: 24px 44px;
  }

  .article-content {
    font-size: 16px;
    line-height: 1.72;
  }

  .article-content h2 {
    font-size: 23px;
  }

  .article-content h3 {
    font-size: 19px;
  }

  .article-content > pre,
  .article-content .highlight {
    padding: 16px;
    margin-inline: calc(-1 * var(--gutter));
    border-inline: 0;
    border-radius: 0;
    font-size: 12px;
  }

  .post-nav {
    grid-template-columns: 1fr;
  }

  .post-nav a:last-child {
    text-align: left;
  }

  .archive-year {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

/* ---------- motion & print ---------- */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}

@media print {
  .site-header,
  .site-footer,
  .post-toc,
  .post-nav,
  .read-progress {
    display: none;
  }

  .post-header,
  .post-page,
  .post-layout,
  .article-content {
    width: 100%;
    max-width: none;
  }
}
