:root {
  color-scheme: light;
  --bg: #f7f4ed;
  --paper: #fffdf7;
  --ink: #23201b;
  --muted: #6e665c;
  --line: #ded6c9;
  --accent: #1f6b5b;
  --accent-2: #8a3f35;
  --soft: #ebe4d8;
  --code: #f1eadf;
  font-family: ui-serif, "Songti SC", "Noto Serif CJK SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(31, 107, 91, 0.06), transparent 28rem),
    var(--bg);
}

a {
  color: inherit;
  text-decoration-color: rgba(31, 107, 91, 0.45);
  text-underline-offset: 0.2em;
}

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

.site-header,
.site-footer,
.home-main,
.post-main {
  width: min(100% - 32px, 1040px);
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0 22px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: grid;
  gap: 4px;
  text-decoration: none;
}

.brand-name {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-link,
.meta,
.tag,
.post-deck,
.site-footer {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.nav {
  display: flex;
  align-items: center;
  gap: 18px;
  color: var(--muted);
}

.nav-link {
  font-size: 0.92rem;
  text-decoration: none;
}

.home-main {
  padding: 54px 0 88px;
}

.intro {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.55fr);
  gap: 48px;
  align-items: end;
  margin-bottom: 56px;
}

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

h1 {
  max-width: 760px;
  margin-bottom: 20px;
  font-size: clamp(2.45rem, 6vw, 5.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.lede {
  max-width: 660px;
  margin-bottom: 0;
  color: #3c3730;
  font-size: 1.18rem;
  line-height: 1.9;
}

.series-note {
  border-left: 3px solid var(--accent);
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.85;
}

.section-title {
  margin-bottom: 18px;
  font-size: 1rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 650;
}

.post-list {
  display: grid;
  gap: 18px;
}

.post-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: start;
  padding: 24px;
  background: rgba(255, 253, 247, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
}

.post-card:hover {
  border-color: rgba(31, 107, 91, 0.55);
  background: rgba(255, 253, 247, 0.92);
}

.post-card h2 {
  margin-bottom: 12px;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.25;
}

.post-card p {
  max-width: 680px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
}

.tag {
  min-width: 88px;
  color: var(--accent-2);
  font-size: 0.88rem;
  font-weight: 700;
  text-align: right;
}

.post-main {
  display: grid;
  grid-template-columns: minmax(0, 760px) minmax(200px, 1fr);
  gap: 56px;
  padding: 58px 0 86px;
}

.post-main-single {
  grid-template-columns: minmax(0, 820px);
  justify-content: center;
}

.post-header {
  margin-bottom: 42px;
}

.back-link {
  display: inline-block;
  margin-bottom: 24px;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  text-decoration: none;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.post-title {
  margin-bottom: 22px;
  font-size: clamp(2.2rem, 6vw, 4.35rem);
  line-height: 1.05;
}

.post-deck {
  max-width: 690px;
  margin-bottom: 0;
  color: #514b43;
  font-size: 1.12rem;
  line-height: 1.85;
}

.article {
  padding: 42px 44px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.article h2 {
  margin: 44px 0 16px;
  font-size: 1.45rem;
  line-height: 1.35;
}

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

.article p,
.article li {
  font-size: 1.08rem;
  line-height: 2;
}

.article p {
  margin-bottom: 18px;
}

.article ul {
  margin: 0 0 20px;
  padding-left: 1.2em;
}

.formula {
  overflow-x: auto;
  margin: 24px 0;
  padding: 18px 20px;
  background: var(--code);
  border: 1px solid #e3d9ca;
  border-radius: 6px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.96rem;
  line-height: 1.75;
  white-space: pre;
}

.aside {
  position: sticky;
  top: 24px;
  align-self: start;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.92rem;
  line-height: 1.8;
}

.aside-title {
  margin-bottom: 12px;
  color: var(--ink);
  font-weight: 700;
}

.site-footer {
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
}

@media (max-width: 820px) {
  .site-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .intro,
  .post-main,
  .post-card {
    grid-template-columns: 1fr;
  }

  .home-main {
    padding: 34px 0 64px;
  }

  .tag {
    text-align: left;
  }

  .article {
    padding: 28px 22px;
  }

  .aside {
    position: static;
  }
}
