:root {
  color-scheme: light;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #242426;
  --muted: #6f7075;
  --faint: #94959a;
  --line: #e4e4e7;
  --accent: #285c52;
  --accent-soft: #e7f0ed;
  --note-bg: #f1f5f3;
  --code-bg: #f0f0f2;
  --shadow: 0 1px 2px rgb(18 18 20 / 3%);
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: Georgia, "Noto Serif SC", "Songti SC", serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #202022;
  --surface: #303033;
  --text: #e2e2e5;
  --muted: #aaaab0;
  --faint: #828288;
  --line: #3b3b40;
  --accent: #9bcab7;
  --accent-soft: #273a35;
  --note-bg: #29332f;
  --code-bg: #29292c;
  --shadow: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

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

.nav-shell,
.footer-shell { width: min(1024px, calc(100% - 44px)); margin: auto; }

.content-shell { width: min(720px, calc(100% - 44px)); margin: auto; }

.site-header { min-height: 64px; }

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
}

.brand {
  font-size: 21px;
  font-weight: 720;
  letter-spacing: -0.035em;
}

.brand span { margin-left: 5px; color: var(--muted); font-weight: 450; }

.nav-actions,
.nav-actions nav {
  display: flex;
  align-items: center;
}

.nav-actions { gap: 14px; }

.nav-actions nav {
  gap: 25px;
  color: var(--text);
  font-size: 15px;
}

.nav-actions nav a { opacity: 0.92; }
.nav-actions nav a:hover { color: var(--accent); opacity: 1; }

.theme-toggle {
  display: inline-grid;
  width: 27px;
  height: 27px;
  padding: 2px;
  place-items: center;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.theme-toggle:hover { background: var(--surface); }

.theme-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.theme-toggle .icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .icon-sun { display: block; }

.profile-intro { padding: 88px 0 83px; }

.eyebrow {
  margin: 0 0 15px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.profile-intro h1,
.listing-head h1,
.article h1 {
  margin: 0;
  color: var(--text);
  font-family: var(--sans);
  font-weight: 730;
  letter-spacing: -0.04em;
}

.profile-intro h1 {
  font-size: clamp(34px, 5vw, 43px);
  line-height: 1.1;
}

.profile-intro h1 span { color: var(--muted); font-weight: 470; }

.profile-intro > p:not(.eyebrow),
.listing-head > p:not(.eyebrow) {
  max-width: 690px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 16px;
}

.profile-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 22px;
  color: var(--muted);
  font-size: 14px;
}

.profile-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; }

.post-feed { padding-bottom: 72px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 17px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.section-head a { color: var(--muted); font-size: 14px; }
.section-head a:hover { color: var(--accent); }

.post-card {
  margin: 0 0 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: border-color 160ms ease, transform 160ms ease;
}

.post-card:hover {
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
  transform: translateY(-1px);
}

.post-card-link { display: block; padding: 24px 25px 23px; }

.post-card h2 {
  margin: 0;
  font-size: clamp(20px, 3vw, 25px);
  font-weight: 710;
  line-height: 1.25;
  letter-spacing: -0.035em;
}

.post-card-excerpt {
  display: -webkit-box;
  margin: 10px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.post-card-meta,
.article-meta {
  margin: 12px 0 0;
  color: var(--faint);
  font-size: 13px;
}

.listing-page { padding: 76px 0 72px; }
.listing-head { margin-bottom: 42px; }

.listing-head h1 {
  font-size: clamp(34px, 5vw, 43px);
  line-height: 1.12;
}

.pagination {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 2px 0 4px;
  color: var(--muted);
  font-size: 13px;
}

.pagination a:last-child { text-align: right; }
.pagination a:hover { color: var(--accent); }
.pagination > span:nth-child(2) { text-align: center; }

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tag-cloud a,
.article-tags a {
  display: inline-flex;
  gap: 0.4em;
  align-items: center;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 14px;
}

.tag-cloud a:hover,
.article-tags a:hover { border-color: var(--accent); color: var(--accent); }
.tag-cloud span { color: var(--faint); font-size: 12px; }

.article { padding: 74px 0 84px; }
.article header { margin-bottom: 48px; }

.article h1 {
  max-width: 820px;
  font-size: clamp(34px, 5.2vw, 49px);
  line-height: 1.14;
}

.article-meta { margin: 0 0 14px; }

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 23px 0 0;
  padding: 0;
  list-style: none;
}

.article-tags a { padding: 5px 10px; font-size: 12px; }

.prose {
  overflow-wrap: anywhere;
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.82;
}

.prose > :first-child { margin-top: 0; }
.prose > :last-child { margin-bottom: 0; }
.prose p,
.prose ul,
.prose ol,
.prose dl,
.prose blockquote,
.prose pre,
.prose table,
.prose figure { margin: 0 0 1.55em; }

.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  margin: 2.25em 0 0.7em;
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.32;
}

.prose h2 { font-size: 1.52em; }
.prose h3 { font-size: 1.25em; }
.prose h4,
.prose h5,
.prose h6 { font-size: 1.08em; }

.prose ul,
.prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 0.35em; }

.prose a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}

.prose strong { font-weight: 730; }

.prose blockquote {
  padding: 0.15em 0 0.15em 1em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}

.prose blockquote > :last-child { margin-bottom: 0; }

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.45em auto;
  border-radius: 4px;
}

.prose figure { margin-right: 0; margin-left: 0; }
.prose figcaption { margin-top: 0.6em; color: var(--muted); font-size: 0.82em; }

.prose pre {
  overflow-x: auto;
  padding: 1em 1.1em;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--code-bg);
  font: 0.82em/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.prose code {
  padding: 0.08em 0.25em;
  border-radius: 3px;
  background: var(--code-bg);
  font: 0.84em ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.prose pre code { padding: 0; background: transparent; }

.prose table {
  display: block;
  max-width: 100%;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.9em;
}

.prose th,
.prose td {
  padding: 0.5em 0.65em;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.prose th { background: var(--code-bg); font-weight: 700; }

.restoration-note {
  margin: 2em 0 0;
  padding: 0.9em 1em;
  border-left: 3px solid var(--accent);
  border-radius: 0 5px 5px 0;
  background: var(--note-bg);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.84em;
  line-height: 1.65;
}

.search-box { display: block; margin-bottom: 14px; }

.search-box input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.search-box input::placeholder { color: var(--faint); }
.search-status { min-height: 1.65em; margin: 0 0 24px; color: var(--muted); font-size: 14px; }

.footer {
  padding: 42px 0 48px;
  color: var(--faint);
  font-size: 13px;
}

.footer a:hover { color: var(--accent); }
.footer span { margin: 0 0.35em; }
.muted { color: var(--muted); }

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

@media (max-width: 680px) {
  .nav-shell,
  .footer-shell,
  .content-shell { width: min(100% - 30px, 720px); }

  .nav { min-height: 58px; }
  .brand { font-size: 19px; }
  .brand span { display: none; }
  .nav-actions { gap: 6px; }
  .nav-actions nav { gap: 14px; font-size: 14px; }
  .theme-toggle { width: 25px; }

  .profile-intro { padding: 67px 0 59px; }
  .listing-page { padding: 58px 0 55px; }
  .listing-head { margin-bottom: 32px; }
  .post-card { margin-bottom: 17px; }
  .post-card-link { padding: 20px; }
  .post-card h2 { font-size: 20px; }
  .article { padding: 57px 0 66px; }
  .article header { margin-bottom: 36px; }
  .article h1 { font-size: 33px; }
  .prose { font-size: 16px; line-height: 1.78; }
  .pagination { font-size: 12px; }
}

@media (max-width: 430px) {
  .nav-actions nav { gap: 11px; font-size: 13px; }
  .nav-actions nav a:nth-child(2) { display: none; }
  .profile-intro h1,
  .listing-head h1 { font-size: 34px; }
}
