:root {
  --paper: #f6f1e7;
  --paper-card: #fbf8f1;
  --paper-deep: #ece4d4;
  --ink: #1c1917;
  --ink-muted: #6b6257;
  --rule: #d6cbb9;
  --rule-dark: #292524;
  --terracotta: #c84b31;
  --terracotta-dark: #a63a24;
  --terracotta-soft: rgba(200, 75, 49, 0.1);
  --olive: #3f5e4d;
  --olive-soft: rgba(63, 94, 77, 0.1);
  --serif: Georgia, "Times New Roman", "Songti SC", "SimSun", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--sans);
  background-color: var(--paper);
  background-image:
    radial-gradient(960px 460px at 85% -5%, rgba(200, 75, 49, 0.06), transparent 65%),
    radial-gradient(760px 420px at 10% 105%, rgba(63, 94, 77, 0.06), transparent 65%);
  color: var(--ink);
  line-height: 1.68;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
}

.page-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 22px 68px;
}

.article-shell {
  max-width: 880px;
}

/* Editorial Masthead */
.masthead {
  border-top: 3px solid var(--rule-dark);
  border-bottom: 1px solid var(--rule-dark);
  padding: 14px 0;
  margin-bottom: 34px;
}

.masthead-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 11.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.masthead-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
  letter-spacing: normal;
  text-transform: none;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.lang-btn:hover {
  color: var(--ink);
}

.lang-btn.active {
  background: var(--terracotta);
  color: #ffffff;
}

.masthead-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.brand-sub {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terracotta);
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-link {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink-muted);
  position: relative;
  padding-bottom: 2px;
  transition: color 0.18s ease;
}

.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.5px;
  background: var(--terracotta);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--terracotta);
}

.nav-link.active::after,
.nav-link:hover::after {
  transform: scaleX(1);
}

/* Editorial Index Intro */
.archive-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 26px;
  flex-wrap: wrap;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--olive);
  background: var(--olive-soft);
  border: 1px solid rgba(63, 94, 77, 0.25);
  padding: 4px 12px;
  border-radius: 4px;
  margin-bottom: 14px;
}

.archive-hero h1 {
  font-family: var(--serif);
  font-size: clamp(30px, 4.5vw, 44px);
  font-weight: 700;
  line-height: 1.14;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 10px;
}

.archive-hero h1 em {
  font-style: italic;
  color: var(--terracotta);
}

.hero-subtitle {
  font-size: 15.5px;
  color: var(--ink-muted);
  max-width: 650px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 6px;
  border: 1px solid var(--rule-dark);
  color: var(--ink);
  background: transparent;
  transition: background-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.btn-back:hover {
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-1px);
}

/* Filter Toolbar */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  border: 1px solid var(--rule);
  background: var(--paper-card);
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.filter-btn:hover {
  border-color: var(--terracotta);
  color: var(--ink);
}

.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.count-note {
  font-size: 13px;
  color: var(--ink-muted);
}

/* Editorial Article Grid */
.blog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
  margin-bottom: 48px;
}

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(28, 25, 23, 0.04);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.post-card:hover {
  transform: translateY(-3px);
  border-color: var(--terracotta);
  box-shadow: 0 14px 28px -12px rgba(28, 25, 23, 0.15);
}

.post-cover-link {
  display: block;
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: var(--paper-deep);
  border-bottom: 1px solid var(--rule);
  overflow: hidden;
}

.post-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}

.post-card:hover .post-cover {
  transform: scale(1.03);
}

.cover-badge {
  position: absolute;
  right: 10px;
  bottom: 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--paper);
  background: rgba(28, 25, 23, 0.8);
  backdrop-filter: blur(4px);
  padding: 3px 9px;
  border-radius: 999px;
}

.post-body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.post-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--ink-muted);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.post-cats {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cat-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--olive);
  background: var(--olive-soft);
  border: 1px solid rgba(63, 94, 77, 0.22);
  padding: 2px 8px;
  border-radius: 4px;
}

.post-title {
  font-family: var(--serif);
  font-size: 21px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.28;
  margin-bottom: 10px;
}

.post-title a {
  transition: color 0.18s ease;
}

.post-title a:hover {
  color: var(--terracotta);
}

.post-excerpt {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.post-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.post-note {
  font-size: 12px;
  color: var(--ink-muted);
  font-style: italic;
}

.read-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--terracotta);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.read-link:hover {
  color: var(--terracotta-dark);
  text-decoration: underline;
}

/* Standalone Article Page */
.article-breadcrumb {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.article-card-wrap {
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: 32px 34px 36px;
  box-shadow: 0 4px 16px rgba(28, 25, 23, 0.04);
  margin-bottom: 30px;
}

.article-header {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 18px;
  margin-bottom: 22px;
}

.article-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terracotta);
  margin-bottom: 10px;
}

.article-title {
  font-family: var(--serif);
  font-size: clamp(26px, 4vw, 36px);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--ink);
}

.article-hero-stage {
  background: var(--paper-deep);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 14px;
  text-align: center;
}

.article-hero-stage img {
  max-width: 100%;
  max-height: 520px;
  object-fit: contain;
  display: inline-block;
  border-radius: 4px;
}

.article-thumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}

.article-thumb-btn {
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  width: 86px;
  height: 62px;
  padding: 0;
  background: var(--paper-deep);
  cursor: pointer;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

.article-thumb-btn:hover {
  transform: translateY(-1px);
}

.article-thumb-btn.active {
  border-color: var(--terracotta);
}

.article-thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lang-section[hidden] {
  display: none;
}

.article-prose {
  font-size: 16px;
  color: var(--ink);
  line-height: 1.8;
}

.article-prose h3 {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 26px 0 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid var(--rule);
}

.article-prose h4 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  color: var(--olive);
  margin: 18px 0 8px;
}

.article-prose p {
  margin-bottom: 14px;
}

.article-prose ul {
  padding-left: 22px;
  margin-bottom: 16px;
}

.article-prose li + li {
  margin-top: 6px;
}

.article-prose pre {
  background: #221f1c;
  color: #f6f1e7;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.55;
  padding: 16px 18px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 14px 0 18px;
}

.article-prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0 20px;
  font-size: 14.5px;
  background: var(--paper);
  border: 1px solid var(--rule);
}

.article-prose th,
.article-prose td {
  border: 1px solid var(--rule);
  padding: 10px 13px;
  text-align: left;
  vertical-align: top;
}

.article-prose th {
  background: var(--paper-deep);
  font-weight: 700;
  color: var(--ink);
}

.article-prose a.inline-ref {
  color: var(--terracotta);
  text-decoration: underline;
  word-break: break-word;
}

.article-prose a.inline-ref:hover {
  color: var(--terracotta-dark);
}

/* Prev / Next Pager */
.article-pager {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 44px;
}

.pager-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px 18px;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 10px;
  transition: border-color 0.18s ease, transform 0.18s ease;
}

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

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

.pager-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--terracotta);
}

.pager-title {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

/* Footer */
.site-footer {
  border-top: 2px solid var(--rule-dark);
  padding-top: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-muted);
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--terracotta);
}

.footer-lang-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

@media (max-width: 780px) {
  .blog-grid,
  .article-pager {
    grid-template-columns: 1fr;
  }

  .article-card-wrap {
    padding: 22px 20px 26px;
  }
}

@media (max-width: 540px) {
  .top-nav {
    display: none;
  }

  .page-shell {
    padding: 18px 15px 48px;
  }
}
