:root {
  color-scheme: light;
  --bg: #faf9f5;
  --paper: #fffefa;
  --ink: #151515;
  --muted: #69645d;
  --soft: #e4ddd2;
  --accent: #8f2f23;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 1.2px 1.2px, rgba(26, 28, 30, 0.075) 1.35px, transparent 1.75px),
    var(--bg);
  background-size: 30px 30px;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  line-height: 1.65;
}

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

.site-header,
main,
.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 34px 0 20px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

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

.hero {
  position: relative;
  min-height: calc(100vh - 96px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.72fr);
  gap: 56px;
  align-items: center;
  padding: 34px 0 74px;
  border-bottom: 1px solid var(--soft);
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 760;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 760px;
  margin-bottom: 26px;
  font-family: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  font-size: clamp(56px, 7.2vw, 96px);
  font-weight: 500;
  letter-spacing: 0;
  line-height: 1.04;
}

.hero-text {
  max-width: 680px;
  margin-bottom: 28px;
  color: #37332e;
  font-size: clamp(18px, 2vw, 22px);
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-meta span {
  padding: 7px 11px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.scroll-cue {
  position: absolute;
  left: 50%;
  bottom: 28px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scroll-cue:hover {
  color: var(--accent);
}

.scroll-cue span:last-child {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--soft);
  border-radius: 50%;
  background: rgba(255, 254, 250, 0.72);
  font-family: inherit;
  line-height: 1;
}

.hero-card {
  min-height: 440px;
  padding: 22px;
  border: 1px solid var(--soft);
  background:
    linear-gradient(135deg, rgba(143, 47, 35, 0.05), transparent 36%),
    linear-gradient(315deg, rgba(31, 90, 75, 0.07), transparent 40%),
    rgba(255, 254, 250, 0.86);
  box-shadow: 0 22px 64px rgba(38, 32, 24, 0.08);
}

.card-topline {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--soft);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.card-mark {
  display: grid;
  place-items: center;
  min-height: 190px;
  margin: 36px 0 26px;
  border: 1px solid var(--soft);
  background: rgba(255, 255, 255, 0.66);
  color: var(--accent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(58px, 6vw, 92px);
  line-height: 1;
}

.card-list {
  display: grid;
  gap: 10px;
}

.card-list p {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 13px 0 13px 14px;
  border-left: 3px solid var(--ink);
  background: rgba(255, 255, 255, 0.58);
}

.card-list strong {
  font-size: 13px;
}

.card-list span {
  color: var(--muted);
  font-size: 13px;
}

.card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.card-actions a {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.76);
  color: var(--ink);
  font-size: 13px;
  font-weight: 750;
}

.card-actions a:hover {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.home-articles {
  padding: 72px 0 96px;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--soft);
}

.section-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  font-size: clamp(38px, 5vw, 64px);
  font-weight: 500;
  line-height: 1.04;
}

.section-heading > a {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

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

.home-article-list {
  display: grid;
  gap: 18px;
  padding-top: 22px;
}

.home-article-card a {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 112px;
  gap: 28px;
  align-items: start;
  padding: 26px 0;
  border-bottom: 1px solid var(--soft);
}

.home-article-card h3 {
  margin-bottom: 8px;
  font-size: clamp(22px, 2.5vw, 32px);
  line-height: 1.25;
}

.home-article-card p {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.home-article-card a:hover h3 {
  color: var(--accent);
}

.read-more {
  justify-self: end;
  padding-top: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.articles {
  padding: 86px 0 96px;
}

.articles-page {
  padding-top: 56px;
}

.articles-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(280px, 0.7fr);
  gap: 64px;
  align-items: end;
  padding-bottom: 44px;
  border-bottom: 2px solid rgba(21, 21, 21, 0.42);
}

.article-kicker {
  margin-bottom: 18px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.18em;
}

.articles-hero h1,
.articles-hero h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(54px, 7vw, 86px);
  font-weight: 500;
  line-height: 0.95;
}

.articles-hero h1 span,
.articles-hero h1 em,
.articles-hero h2 span,
.articles-hero h2 em {
  display: block;
}

.articles-hero h1 em,
.articles-hero h2 em {
  color: var(--accent);
  font-style: italic;
}

.articles-hero > p {
  max-width: 360px;
  margin-bottom: 8px;
  color: #37332e;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.55;
}

.article-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 46px 0 18px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 14px 0 16px;
  border: 1px solid #bfb4a6;
  background: rgba(255, 254, 250, 0.86);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.search-box:focus-within {
  border-color: var(--accent);
  background: var(--paper);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.7),
    0 10px 32px rgba(38, 32, 24, 0.07);
}

.search-icon {
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
}

.search-box input::placeholder {
  color: #8c857b;
}

.search-key {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--soft);
  background: rgba(250, 249, 245, 0.76);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.article-count {
  align-self: stretch;
  display: grid;
  place-items: center;
  min-width: 112px;
  padding: 0 16px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  letter-spacing: 0.12em;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 40px;
}

.tag-row button {
  cursor: pointer;
  padding: 3px 9px;
  border: 1px solid #c9beb0;
  border-radius: 999px;
  background: rgba(255, 254, 250, 0.66);
  color: #3c3832;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.08em;
}

.tag-row button:hover,
.tag-row button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.article-item[hidden],
.empty-state[hidden] {
  display: none;
}

.empty-state {
  margin: 36px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
}

.article-list {
  border-top: 1px solid var(--soft);
}

.article-item a {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 70px;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--soft);
}

.article-date {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  padding-top: 6px;
}

.article-item h2,
.article-item h3 {
  margin-bottom: 8px;
  font-size: clamp(21px, 2.4vw, 30px);
  line-height: 1.25;
}

.article-item p {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 15px;
}

.article-item a:hover h2,
.article-item a:hover h3 {
  color: var(--accent);
}

.article-item a:hover {
  background: rgba(255, 254, 250, 0.42);
}

.read-time {
  justify-self: end;
  padding-top: 7px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 34px 0 44px;
  border-top: 1px solid var(--soft);
  color: var(--muted);
  font-size: 14px;
}

.site-footer p {
  margin-bottom: 0;
}

.article-page {
  max-width: 780px;
  padding: 56px 0 96px;
}

.article-with-toc {
  max-width: 780px;
  position: relative;
}

.article-shell {
  display: block;
}

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

.post-sidebar {
  position: sticky;
  top: 28px;
  float: right;
  width: 220px;
  margin-right: -292px;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding-top: 6px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

.back-link:hover {
  color: var(--accent);
}

.post-header {
  padding-bottom: 34px;
  border-bottom: 1px solid var(--soft);
}

.about-page .back-link {
  margin-bottom: 34px;
}

.about-page .post-header {
  padding-bottom: 8px;
  border-bottom: 0;
}

.about-page .post-content {
  padding-top: 10px;
}

.about-page .post-content h2:first-child {
  margin-top: 18px;
}

.post-meta {
  margin-bottom: 18px;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-header h1 {
  max-width: none;
  margin-bottom: 22px;
  font-size: clamp(42px, 6vw, 72px);
}

.post-summary {
  max-width: 680px;
  margin-bottom: 0;
  color: #37332e;
  font-size: 19px;
}

.identity-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin: -4px 0 0;
}

.identity-tags span {
  padding: 5px 10px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.post-content {
  padding-top: 34px;
  color: #332f2a;
  font-size: 18px;
}

.post-content h2 {
  margin: 42px 0 14px;
  font-size: 26px;
  line-height: 1.35;
}

.post-content h3 {
  margin: 30px 0 12px;
  font-size: 20px;
  line-height: 1.42;
}

.post-content p {
  margin-bottom: 22px;
}

.post-content a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.post-content ul,
.post-content ol {
  margin: 0 0 28px;
  padding-left: 1.2em;
}

.post-content li {
  margin-bottom: 10px;
}

.post-content code {
  padding: 0.12em 0.32em;
  background: rgba(255, 254, 250, 0.86);
  border: 1px solid var(--soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.88em;
}

.post-content pre {
  position: relative;
  overflow-x: auto;
  margin: 18px 0 30px;
  padding: 48px 18px 18px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.9);
}

.post-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.7;
}

.copy-code-button {
  position: absolute;
  top: 12px;
  right: 12px;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--soft);
  background: rgba(255, 254, 250, 0.94);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

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

.copy-code-button.is-copied {
  border-color: var(--accent);
  color: var(--accent);
}

.post-content figure {
  margin: 30px 0 34px;
}

.post-content img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--soft);
  background: var(--paper);
}

.post-content figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.post-toc {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 4px 0 4px 16px;
  border-left: 1px solid var(--soft);
}

.post-toc strong {
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.post-toc a {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  text-decoration: none;
}

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

.toc-parent {
  font-weight: 700;
}

.toc-child {
  display: none;
  padding-left: 12px;
  font-size: 12px;
}

.toc-child.is-visible {
  display: block;
}

.toc-child.is-active {
  font-weight: 700;
}

.post-content h2,
.post-content h3 {
  scroll-margin-top: 24px;
}

.post-note {
  margin-top: 36px;
  padding: 18px 20px;
  border-left: 3px solid var(--accent);
  background: rgba(255, 254, 250, 0.72);
  color: var(--muted);
}

@media (max-width: 1100px) {
  .post-sidebar {
    position: static;
    float: none;
    width: auto;
    margin: 0 0 26px;
    max-height: none;
    overflow: visible;
    padding-top: 0;
  }

  .post-toc {
    padding: 16px 18px;
    border-left: 3px solid var(--ink);
    background: rgba(255, 254, 250, 0.72);
  }

  .toc-child {
    display: none;
  }
}

@media (max-width: 700px) {
  .site-header,
  main,
  .site-footer {
    width: min(100% - 28px, 560px);
  }

  .hero {
    min-height: calc(100vh - 96px);
    grid-template-columns: 1fr;
    gap: 34px;
    padding: 42px 0 64px;
  }

  .hero-card {
    min-height: auto;
  }

  .scroll-cue {
    position: static;
    transform: none;
    justify-self: center;
    grid-column: 1;
    margin-top: -14px;
  }

  h1 {
    font-size: 44px;
  }

  .section-heading {
    display: block;
  }

  .section-heading .eyebrow {
    margin-bottom: 10px;
  }

  .section-heading > a {
    display: inline-block;
    margin-top: 14px;
  }

  .home-article-card a {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .read-more {
    justify-self: start;
    padding-top: 0;
  }

  .article-item a {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .articles-hero,
  .article-tools {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .read-time {
    justify-self: start;
    padding-top: 0;
  }

  .site-footer {
    flex-direction: column;
  }

  .article-page {
    padding-top: 34px;
  }
}
