:root {
  --bg: #f5f1e8;
  --paper: #fffaf0;
  --surface: #fffdf6;
  --ink: #1c2a35;
  --muted: #65717c;
  --line: #d6c7a7;
  --navy: #183752;
  --teal: #1f777b;
  --green: #407f56;
  --gold: #c58b2d;
  --rose: #b65348;
  --soft: #ebe1ca;
  --code: #f2eadc;
  --shadow: 0 18px 42px rgba(38, 45, 52, 0.11);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(31, 119, 123, 0.08), transparent 30%),
    radial-gradient(circle at 84% 12%, rgba(197, 139, 45, 0.08), transparent 28%),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", Arial, sans-serif;
  line-height: 1.78;
  text-rendering: optimizeLegibility;
}

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

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

img {
  max-width: 100%;
}

code {
  padding: 0.12em 0.34em;
  border-radius: 5px;
  background: rgba(197, 139, 45, 0.13);
  color: #8d3c34;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", monospace;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

pre {
  overflow-x: auto;
  margin: 24px 0;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--code);
  line-height: 1.58;
}

pre code {
  display: block;
  padding: 0;
  background: transparent;
  color: #263746;
  font-size: 15px;
  overflow-wrap: normal;
  white-space: pre;
}

.site-header,
.site-footer {
  align-items: center;
  gap: 18px;
  width: min(100%, 1240px);
  margin: 0 auto;
  padding: 22px clamp(18px, 4vw, 52px);
}

.site-header {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(245, 241, 232, 0.86);
  border-bottom: 1px solid rgba(214, 199, 167, 0.68);
  backdrop-filter: blur(14px);
}

.site-footer {
  display: flex;
  justify-content: space-between;
}

.brand,
.site-actions,
.site-footer {
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 10px;
  color: var(--navy);
  text-decoration: none;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--rose);
  box-shadow: 0 6px 14px rgba(38, 45, 52, 0.08);
}

.site-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  gap: 10px;
}

.site-action,
.language-switch a,
.site-footer a {
  color: var(--muted);
  text-decoration: none;
}

.site-action {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid rgba(24, 55, 82, 0.14);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.72);
}

.language-switch {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  overflow: hidden;
  border: 1px solid rgba(24, 55, 82, 0.14);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.72);
}

.language-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
}

.language-switch a + a {
  border-left: 1px solid rgba(24, 55, 82, 0.1);
}

.language-switch a.active {
  background: var(--navy);
  color: var(--surface);
}

.site-action:hover,
.language-switch a:hover,
.site-footer a:hover {
  color: var(--teal);
}

.language-switch a.active:hover {
  color: var(--surface);
}

.local-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: min(100%, 760px);
  margin: 22px auto 0;
}

.site-header .local-nav {
  width: 100%;
  max-width: none;
  margin: 0;
  flex-wrap: nowrap;
  justify-content: flex-start;
  justify-content: safe center;
  justify-self: stretch;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-padding-inline: 6px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}

.site-header .local-nav::-webkit-scrollbar {
  display: none;
}

.local-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 11px;
  border: 1px solid rgba(31, 119, 123, 0.18);
  border-radius: 999px;
  background: rgba(31, 119, 123, 0.07);
  color: #45606b;
  font-size: 13px;
  font-weight: 850;
  line-height: 1.2;
  text-decoration: none;
}

.site-header .local-nav a {
  flex: 0 0 auto;
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
  white-space: nowrap;
  scroll-snap-align: start;
}

.local-nav a:hover {
  border-color: rgba(31, 119, 123, 0.35);
  background: rgba(31, 119, 123, 0.12);
  color: var(--teal);
}

h1,
h2,
h3,
h4 {
  color: var(--navy);
  line-height: 1.24;
  letter-spacing: 0;
  scroll-margin-top: 92px;
}

h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 74px);
}

.long-title {
  font-size: 54px;
}

h2 {
  margin: 82px 0 24px;
  padding-top: 24px;
  border-top: 2px solid rgba(24, 55, 82, 0.2);
  font-size: clamp(28px, 3vw, 38px);
}

h3 {
  margin: 48px 0 14px;
  padding-left: 14px;
  border-left: 4px solid var(--green);
  font-size: clamp(21px, 2vw, 26px);
}

h4 {
  margin: 30px 0 10px;
  padding-left: 12px;
  border-left: 2px solid rgba(31, 119, 123, 0.45);
  color: #2b4457;
  font-size: clamp(17px, 1.5vw, 20px);
}

p,
li {
  font-size: 18px;
  overflow-wrap: break-word;
}

p {
  margin: 18px 0;
}

ul,
ol {
  margin: 16px 0 22px;
  padding-left: 1.35em;
}

li + li {
  margin-top: 8px;
}

blockquote {
  margin: 26px 0;
  padding: 4px 0 4px 20px;
  border-left: 4px solid var(--green);
  color: var(--muted);
}

.article-shell {
  display: grid;
  grid-template-columns: minmax(230px, 300px) minmax(0, 980px);
  gap: 30px;
  width: min(100%, 1380px);
  margin: 0 auto;
  padding: 42px clamp(14px, 3vw, 34px) 92px;
  align-items: start;
}

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

.article-card {
  overflow: hidden;
  border: 1px solid rgba(24, 55, 82, 0.12);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.94);
  box-shadow: var(--shadow);
}

.article-hero {
  padding: clamp(28px, 5vw, 62px) clamp(20px, 5vw, 62px) 26px;
}

.article-hero .lead {
  max-width: 880px;
  margin-top: 22px;
  color: #3d4b58;
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.72;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.meta-line span {
  padding: 5px 10px;
  border: 1px solid rgba(31, 119, 123, 0.2);
  border-radius: 999px;
  background: rgba(255, 253, 246, 0.78);
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.series-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 24px;
  border-top: 1px solid rgba(24, 55, 82, 0.14);
  border-bottom: 1px solid rgba(24, 55, 82, 0.14);
}

.series-strip > * {
  min-width: 0;
  padding: 14px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.55;
  text-decoration: none;
}

.series-strip > * + * {
  border-left: 1px solid rgba(24, 55, 82, 0.14);
}

.series-strip strong {
  display: block;
  color: var(--gold);
  font-size: 12px;
}

.series-strip a {
  color: var(--navy);
}

.series-strip a:hover {
  background: rgba(31, 119, 123, 0.07);
  color: var(--green);
}

.hero-image {
  margin: 28px 0 0;
}

.hero-image img,
.figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(24, 55, 82, 0.1);
  border-radius: 8px;
  background: var(--surface);
}

.article-body {
  padding: 0 clamp(20px, 5vw, 62px) clamp(34px, 5vw, 70px);
}

.toc-panel {
  position: sticky;
  top: 92px;
  max-height: calc(100vh - 112px);
  overflow: auto;
  padding: 14px 10px;
  border: 1px solid rgba(24, 55, 82, 0.14);
  border-radius: 8px;
  background: rgba(255, 253, 246, 0.88);
  box-shadow: 0 12px 28px rgba(38, 45, 52, 0.08);
}

.toc-title {
  margin: 0 0 10px;
  padding: 0 8px 10px;
  border-bottom: 1px solid rgba(24, 55, 82, 0.12);
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}

.toc-list,
.toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-link {
  display: block;
  position: relative;
  padding: 6px 8px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.36;
  text-decoration: none;
}

.toc-level-2 {
  margin-top: 9px;
  padding: 8px 10px;
  border-left: 3px solid rgba(31, 119, 123, 0.55);
  background: rgba(31, 119, 123, 0.07);
  color: var(--navy);
  font-weight: 900;
}

.toc-level-3 {
  margin-left: 10px;
  padding-left: 18px;
}

.toc-level-4 {
  margin-left: 24px;
  padding-left: 16px;
  color: #6d7882;
  font-size: 12px;
}

.toc-link:hover,
.toc-link.active {
  background: rgba(64, 127, 86, 0.12);
  color: var(--green);
}

.toc-level-3::before,
.toc-level-4::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 1em;
  width: 7px;
  border-top: 1px solid rgba(101, 113, 124, 0.4);
}

.note {
  margin: 26px 0;
  padding: 18px 20px;
  border: 1px solid rgba(31, 119, 123, 0.2);
  border-radius: 8px;
  background: rgba(31, 119, 123, 0.08);
}

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

.note p:last-child {
  margin-bottom: 0;
}

.figure {
  margin: 34px 0;
}

.figure figcaption {
  margin-top: 9px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
  text-align: center;
}

.table-wrap {
  overflow-x: auto;
  margin: 28px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
  font-size: 15px;
}

.curator-state-table td:first-child code {
  white-space: nowrap;
  overflow-wrap: normal;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  vertical-align: top;
}

th:last-child,
td:last-child {
  border-right: 0;
}

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

th {
  background: rgba(31, 119, 123, 0.1);
  color: var(--navy);
  text-align: left;
}

.source-list {
  columns: 2 300px;
  column-gap: 34px;
}

.source-list li {
  break-inside: avoid;
  margin: 0 0 10px;
  font-size: 15px;
}

.site-footer {
  border-top: 1px solid rgba(214, 199, 167, 0.7);
  color: var(--muted);
}

@media (max-width: 1320px) {
  .site-header {
    grid-template-columns: max-content minmax(0, 1fr);
    grid-template-areas:
      "brand actions"
      "local local";
  }

  .brand {
    grid-area: brand;
  }

  .site-header .local-nav {
    grid-area: local;
    flex-wrap: wrap;
    justify-content: center;
    overflow-x: visible;
  }

  .site-actions {
    grid-area: actions;
  }
}

@media (max-width: 1080px) {
  .article-shell {
    display: block;
    padding-top: 24px;
  }

  .toc-panel {
    position: relative;
    top: auto;
    max-height: 300px;
    margin-bottom: 18px;
  }
}

@media (max-width: 760px) {
  .series-strip {
    grid-template-columns: 1fr;
  }

  .series-strip > * + * {
    border-top: 1px solid rgba(24, 55, 82, 0.14);
    border-left: 0;
  }

  .site-header {
    align-items: center;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: 10px;
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-actions {
    justify-content: flex-end;
  }

  .site-header .local-nav {
    max-width: 100%;
    gap: 5px;
  }

  .site-header .local-nav a {
    padding-inline: 6px;
    font-size: 11px;
  }

  .article-shell {
    padding: 14px 10px 60px;
  }

  .article-hero,
  .article-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 36px;
  }

  .long-title {
    font-size: 34px;
  }

  h2 {
    margin-top: 56px;
    font-size: 28px;
  }

  h3 {
    margin-top: 36px;
  }

  p,
  li {
    font-size: 16px;
  }

  table {
    min-width: 0;
    display: block;
  }

  thead {
    display: none;
  }

  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

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

  tr:last-child {
    border-bottom: 0;
  }

  td {
    position: relative;
    min-height: 44px;
    padding: 10px 12px 10px 112px;
    border-right: 0;
  }

  td::before {
    content: attr(data-label);
    position: absolute;
    left: 12px;
    top: 10px;
    width: 84px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    line-height: 1.35;
  }

  td:first-child {
    padding-left: 12px;
    background: rgba(24, 55, 82, 0.06);
    color: var(--navy);
    font-weight: 900;
  }

  td:first-child::before {
    display: none;
  }
}

@media (max-width: 620px) {
  .brand span:last-child {
    display: none;
  }
}

@media (max-width: 480px) {
  .site-header {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "brand actions"
      "local local";
  }

  .brand {
    grid-area: brand;
  }

  .site-header .local-nav {
    grid-area: local;
    justify-content: center;
  }

  .site-actions {
    grid-area: actions;
    justify-content: flex-start;
  }
}
