/* ===== Shared Styles - 炁若 PneumaSofia ===== */
:root {
  --bg: #faf9f6;
  --text: #2d2d2d;
  --muted: #6b6b6b;
  --accent: #8b5e3c;
  --accent-light: #d4a574;
  --border: #e0d8cf;
  --card: #fff;
  --card-hover: #faf8f5;
  --quote-bg: #f5f0e8;
  --quote-text: #5a5040;
  --table-stripe: #faf8f5;
  --code-bg: #f3efe8;
  --pre-bg: #2d2d2d;
  --pre-text: #e8dcc8;
  --hover-bg: #f5efe5;
  --info-bg: #faf5ed;
  --radius: 8px;
}

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

body {
  font-family: Georgia, "Noto Serif", "Source Han Serif SC", "PingFang SC", "Microsoft YaHei", serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.85;
  font-size: 16px;
}

/* ---- Navigation ---- */
nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250,249,246,0.92);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.nav-brand {
  font-size: 1.1rem; font-weight: 700; color: var(--accent);
  text-decoration: none;
}
.nav-links { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.nav-links a {
  text-decoration: none; color: var(--muted);
  padding: 6px 14px; border-radius: 20px; font-size: 0.85rem;
  transition: color 0.2s, background 0.2s; white-space: nowrap;
}
.nav-links a:hover, .nav-links a.active { color: var(--accent); background: var(--hover-bg); }
.lang-switch {
  background: none; border: 1px solid var(--border); color: var(--muted);
  padding: 8px 14px; border-radius: 20px; cursor: pointer;
  font-size: 0.8rem; font-family: inherit;
  transition: color 0.2s, border-color 0.2s;
  min-height: 44px;
}
.lang-switch:hover { border-color: var(--accent); color: var(--accent); }

/* ---- Layout ---- */
.container { max-width: 760px; margin: 0 auto; padding: 0 24px; }

/* ---- Article Header ---- */
.article-header { padding: 64px 0 32px; text-align: center; }
.article-header h1 { font-size: 2.2rem; line-height: 1.35; margin-bottom: 12px; color: var(--text); }
.article-header .meta { color: var(--muted); font-size: 0.9rem; }
.article-header .tags { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }
.article-header .tags span {
  background: var(--quote-bg); color: var(--accent);
  padding: 2px 12px; border-radius: 14px; font-size: 0.8rem;
}

/* ---- Content ---- */
.content { padding-bottom: 80px; }
.content h2 {
  font-size: 1.55rem; margin: 48px 0 16px; padding-top: 24px;
  border-top: 1px solid var(--border); color: var(--text);
}
.content h3 { font-size: 1.2rem; margin: 32px 0 10px; color: var(--text); }
.content h4 { font-size: 1.05rem; margin: 24px 0 8px; color: var(--accent); }
.content p { margin: 0 0 14px; }
.content strong { font-weight: 700; }
.content ol { margin: 10px 0 18px 20px; }
.content li { margin: 4px 0; }
.content li::marker { color: var(--accent-light); }

.content blockquote {
  border-left: 3px solid var(--accent-light);
  padding: 14px 20px; margin: 20px 0;
  background: var(--quote-bg); border-radius: 0 var(--radius) var(--radius) 0;
  font-style: italic; color: var(--quote-text);
}
.content blockquote p:last-child { margin-bottom: 0; }

.content hr { border: none; border-top: 1px solid var(--border); margin: 40px 0; }

/* ---- Tables ---- */
.content table {
  width: 100%; border-collapse: collapse; margin: 18px 0 24px;
  font-size: 0.9rem;
}
.content th {
  background: var(--accent); color: #fff; padding: 10px 14px;
  text-align: left; font-weight: 600;
}
.content td { padding: 10px 14px; border-bottom: 1px solid var(--border); }
.content tr:nth-child(even) td { background: var(--table-stripe); }
.content tr:hover td { background: var(--hover-bg); }

/* ---- Code / Pre ---- */
.content code {
  background: var(--code-bg); padding: 2px 6px;
  border-radius: 4px; font-size: 0.9em; font-family: "JetBrains Mono", "Fira Code", monospace;
}
.content pre {
  background: var(--pre-bg); color: var(--pre-text); padding: 20px; margin: 18px 0;
  border-radius: var(--radius); overflow-x: auto; font-size: 0.85rem;
  line-height: 1.7;
}
.content pre code { background: none; padding: 0; }

/* ---- Source Note (core insight + classical citation) ---- */
.source-note {
  background: var(--info-bg); border: 1px solid var(--border);
  padding: 16px 20px; margin: 24px 0; border-radius: var(--radius);
  font-size: 0.88rem; color: var(--muted);
}
.source-note p { margin: 0 0 6px; }
.source-note p:last-child { margin-bottom: 0; font-size: 0.82rem; opacity: 0.85; }

/* ---- Info Box ---- */
.info-box {
  background: var(--info-bg); border: 1px solid var(--border);
  padding: 20px 24px; margin: 24px 0; border-radius: var(--radius);
  font-size: 0.92rem;
}

/* ---- Cross Links ---- */
.cross-links {
  padding: 0 24px 64px; max-width: 1100px; margin: 0 auto;
}
.cross-links h2 { font-size: 1.3rem; margin-bottom: 16px; color: var(--muted); }
.cross-links .cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.cross-links .card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; text-decoration: none;
  transition: background 0.2s, border-color 0.2s, box-shadow 0.2s; display: block;
}
.cross-links .card:hover { background: var(--card-hover); border-color: var(--accent-light); box-shadow: 0 2px 12px rgba(0,0,0,0.04); }
.cross-links .card h3 { font-size: 1rem; color: var(--accent); margin-bottom: 6px; }
.cross-links .card p { color: var(--muted); font-size: 0.88rem; margin: 0; }

/* ---- Footer ---- */
footer {
  text-align: center; padding: 32px 24px 48px;
  color: var(--muted); font-size: 0.85rem;
}

/* ---- Visually Hidden (a11y) ---- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Bilingual ---- */
[lang]:not(html) { display: none; }
[lang].active:not(html) { display: block; }
span[lang].active { display: inline; }

/* ---- Focus (a11y) ---- */
*:focus {
  outline: none;
}

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

a:focus-visible, button:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Skip Link ---- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 16px;
  background: var(--accent);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 100;
  font-size: 0.9rem;
  text-decoration: none;
}
.skip-link:focus-visible {
  top: 0;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .article-header h1 { font-size: 1.6rem; }
  .article-header { padding: 40px 0 20px; }
  .content h2 { font-size: 1.3rem; }
  .nav-links a { padding: 4px 10px; font-size: 0.78rem; }
  .content table { font-size: 0.8rem; }
  .content th, .content td { padding: 8px 10px; }
}
