:root {
  --paper: #f4f1e8;
  --paper-deep: #eae5d8;
  --card: #fbf9f3;
  --ink: #15201c;
  --ink-soft: #1d2b25;
  --muted: #606a62;
  --line: rgba(21, 32, 28, 0.16);
  --line-strong: rgba(21, 32, 28, 0.4);
  --accent: #df5731;
  --accent-soft: #f0c8b8;
  --green: #275b4c;
  --serif: "Iowan Old Style", "Palatino Linotype", "Songti SC", "STSong", "Noto Serif CJK SC", "SimSun", serif;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  --mono: "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --max: 900px;
  --pad: clamp(20px, 4vw, 48px);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 96px;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 82% 4%, rgba(223, 87, 49, 0.055), transparent 30%),
    radial-gradient(circle at 8% 46%, rgba(39, 91, 76, 0.045), transparent 34%);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.9;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  color: var(--card);
  background: var(--green);
}

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

h1,
h2,
h3,
p,
ul,
ol,
dl,
dd,
blockquote,
figure,
pre {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 10px 16px;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-160%);
  transition: transform 180ms ease;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 232, 0.88);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 16px var(--pad);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: var(--paper);
  background: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.brand-mark::after {
  content: "";
  position: absolute;
  top: -4px;
  right: -4px;
  width: 8px;
  height: 8px;
  border: 2px solid var(--paper);
  border-radius: 50%;
  background: var(--accent);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.brand-copy strong {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.brand-copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.2em;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: clamp(14px, 2.2vw, 28px);
}

.header-nav a {
  color: var(--muted);
  font-size: 12.5px;
  letter-spacing: 0.04em;
  transition: color 180ms ease;
}

.header-nav a:hover {
  color: var(--ink);
}

.note-wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: clamp(48px, 7vw, 88px) var(--pad) clamp(56px, 7vw, 88px);
}

.note-head {
  position: relative;
  padding-bottom: clamp(28px, 4vw, 40px);
  border-bottom: 1px solid var(--ink);
}

.note-head::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 82px;
  height: 3px;
  background: var(--accent);
}

.note-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.note-kicker .dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.note-kicker .kicker-muted {
  color: var(--muted);
}

.note-head h1 {
  max-width: 760px;
  margin-top: 24px;
  font-family: var(--serif);
  font-size: clamp(32px, 4.6vw, 52px);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.035em;
}

.note-lead {
  max-width: 680px;
  margin-top: 22px;
  color: var(--muted);
  font-size: clamp(14.5px, 1.3vw, 16px);
  line-height: 1.95;
}

.note-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 26px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.note-body {
  max-width: 720px;
  margin-top: clamp(34px, 4.5vw, 48px);
}

.note-body h2 {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-top: clamp(38px, 5vw, 52px);
  font-family: var(--serif);
  font-size: clamp(21px, 2.3vw, 25px);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: -0.02em;
}

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

.note-body h2 .num {
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
}

.note-body p {
  margin-top: 15px;
  color: var(--ink-soft);
  font-size: 15.5px;
  line-height: 2;
}

.note-body p + p {
  margin-top: 12px;
}

.note-body strong {
  color: var(--ink);
  font-weight: 600;
  background: linear-gradient(transparent 62%, var(--accent-soft) 62%);
}

.note-body ul,
.note-body ol {
  display: grid;
  gap: 9px;
  margin-top: 15px;
}

.note-body li {
  position: relative;
  padding-left: 20px;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.9;
}

.note-body ul li::before {
  content: "";
  position: absolute;
  top: 0.78em;
  left: 1px;
  width: 5px;
  height: 5px;
  background: var(--accent);
}

.note-body ol {
  counter-reset: item;
}

.note-body ol li {
  counter-increment: item;
}

.note-body ol li::before {
  content: counter(item, decimal-leading-zero);
  position: absolute;
  top: 0;
  left: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.04em;
}

.note-body blockquote {
  margin: clamp(30px, 4vw, 40px) 0;
  padding: 22px 26px;
  border-left: 3px solid var(--accent);
  background: rgba(251, 249, 243, 0.8);
  color: var(--ink-soft);
  font-family: var(--serif);
  font-size: clamp(17px, 1.7vw, 19px);
  line-height: 1.85;
}

.note-body blockquote cite {
  display: block;
  margin-top: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  font-style: normal;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.note-body .example {
  margin-top: 20px;
  border: 1px solid var(--line);
  background: var(--card);
}

.note-body .example-title {
  margin-top: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.note-body pre {
  overflow-x: auto;
  padding: 18px;
  color: var(--ink-soft);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.85;
  white-space: pre-wrap;
}

.note-body code {
  padding: 1px 5px;
  background: var(--paper-deep);
  font-family: var(--mono);
  font-size: 0.88em;
}

.note-body pre code {
  padding: 0;
  background: none;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid var(--line);
  background: var(--card);
}

.table-wrap table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 13px;
  line-height: 1.8;
}

.table-wrap caption {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.12em;
  text-align: left;
  text-transform: uppercase;
}

.table-wrap th,
.table-wrap td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.table-wrap th {
  color: var(--ink);
  font-weight: 600;
  background: rgba(39, 91, 76, 0.05);
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.table-wrap td {
  color: var(--muted);
}

.takeaway {
  margin-top: clamp(42px, 5vw, 56px);
  padding: 24px 26px;
  border: 1px solid var(--ink);
  background: var(--card);
  box-shadow: 7px 7px 0 var(--accent-soft);
}

.takeaway-title {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.takeaway-title::before {
  content: "";
  width: 20px;
  height: 1px;
  background: var(--accent);
}

.takeaway ul {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.takeaway li {
  position: relative;
  padding-left: 18px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.9;
}

.takeaway li::before {
  content: "";
  position: absolute;
  top: 0.8em;
  left: 0;
  width: 5px;
  height: 5px;
  background: var(--green);
}

.note-foot {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad) clamp(56px, 7vw, 88px);
}

.note-note {
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.9;
}

.pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 26px;
}

.pager a {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  background: rgba(251, 249, 243, 0.5);
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.pager a:hover {
  border-color: var(--ink);
  background: var(--card);
  transform: translateY(-2px);
}

.pager .pager-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.pager .pager-title {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.55;
}

.pager .pager-next {
  text-align: right;
  align-items: flex-end;
}

.pager .pager-placeholder {
  border-style: dashed;
  background: none;
  opacity: 0.5;
  pointer-events: none;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: rgba(234, 229, 216, 0.5);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 24px var(--pad) 30px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.05em;
}

.footer-inner a {
  color: var(--muted);
  transition: color 180ms ease;
}

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

.footer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

@media (max-width: 720px) {
  body {
    font-size: 15px;
  }

  .brand-copy strong {
    font-size: 15px;
  }

  .header-nav a:first-child {
    display: none;
  }

  .note-head h1 {
    font-size: clamp(29px, 8.4vw, 40px);
  }

  .note-body p,
  .note-body li {
    font-size: 15px;
  }

  .note-body h2 {
    gap: 9px;
  }

  .pager {
    grid-template-columns: minmax(0, 1fr);
  }

  .pager .pager-next {
    text-align: left;
    align-items: flex-start;
  }

  .footer-inner {
    justify-content: flex-start;
  }
}

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

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
