/* =====================
   DESIGN TOKENS
===================== */
:root {
  --bg:         #f5f0e8;
  --surface:    #ffffff;
  --ink:        #1c1a14;
  --ink-light:  #3a3528;
  --gold:       #a07830;
  --gold-light: #c9a75a;
  --text:       #2d2a22;
  --muted:      #6b6455;
  --border:     #ddd5c0;
  --radius:     8px;
}

/* =====================
   SKIP LINK
===================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--gold);
  color: #fff;
  padding: 0.5rem 1rem;
  border-radius: 0 0 4px 4px;
  font-weight: bold;
  text-decoration: none;
  z-index: 9999;
}
.skip-link:focus { top: 0; }

/* =====================
   RESET & BASE
===================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  scroll-behavior: smooth;
}

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

/* =====================
   PORTAL BAR
===================== */
.portal-bar {
  background: var(--ink);
  padding: 0.45rem 1.5rem;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}

.portal-bar-link {
  font-size: 0.78rem;
  color: var(--gold-light);
  letter-spacing: 0.06em;
  transition: color 0.2s;
}

.portal-bar-link:hover {
  color: #ffffff;
}

/* =====================
   HEADER — INDEX
===================== */
.site-header {
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 2.5rem 1.5rem 2rem;
}

.site-header h1 {
  font-family: "Noto Serif SC", serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-light);
  margin: 0;
  letter-spacing: 0.06em;
}

/* =====================
   HEADER — CHAPTER
===================== */
.chapter-header {
  background: var(--ink);
  color: #fff;
  text-align: center;
  padding: 2rem 1.5rem 1.5rem;
}

.chapter-header h1 {
  font-family: "Noto Serif SC", serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold-light);
  margin: 0 0 0.5rem 0;
}

.back-link {
  display: inline-block;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.55);
  transition: color 0.2s;
}

.back-link:hover {
  color: var(--gold-light);
}

/* =====================
   INTRO — INDEX
===================== */
.intro {
  max-width: 760px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  text-align: center;
  font-size: 0.97rem;
  color: var(--muted);
  line-height: 1.85;
}

/* =====================
   CARD GRID — INDEX
===================== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.85rem;
  max-width: 960px;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1.5rem;
}

.chapter-card {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 70px;
  padding: 0 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: "Noto Serif SC", serif;
  font-size: 1rem;
  color: var(--ink-light);
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s;
  box-shadow: 0 2px 6px rgba(0,0,0,0.04);
}

.chapter-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(0,0,0,0.09);
  border-color: var(--gold);
  color: var(--gold);
}

/* =====================
   FOOTER
===================== */
.site-footer,
footer {
  background: var(--ink);
  color: rgba(255,255,255,0.35);
  text-align: center;
  padding: 1.5rem 1.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  margin-top: 2rem;
}

/* =====================
   CHAPTER PAGE — CONTAINER
===================== */
.chapter-container {
  max-width: 800px;
  margin: 2rem auto;
  padding: 0 1.5rem 3rem;
}

/* =====================
   FULL CHINESE TEXT
===================== */
.full-text {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 2rem;
  margin-bottom: 1.75rem;
  text-align: center;
  font-family: "Noto Serif SC", serif;
  font-size: 1.15rem;
  line-height: 2;
  color: var(--text);
}

.read-btn {
  display: inline-block;
  margin-top: 1.1rem;
  padding: 0.5rem 1.1rem;
  background: var(--gold);
  color: #fff;
  border: none;
  border-radius: 4px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  font-family: "Noto Sans SC", sans-serif;
}

.read-btn:hover {
  background: #8a6828;
}

/* =====================
   LINE-BY-LINE EXPLANATION
===================== */
.line-explanation h2,
.summary h2 {
  font-family: "Noto Serif SC", serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin: 1.75rem 0 1rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.04em;
}

.explanation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 0.9rem;
}

.explanation-card .line {
  font-family: "Noto Serif SC", serif;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.explanation-card .explanation {
  font-size: 0.92rem;
  line-height: 1.8;
  color: var(--muted);
}

/* =====================
   SUMMARY
===================== */
.summary {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.5rem;
  margin-top: 1.75rem;
}

.summary p {
  font-size: 0.94rem;
  line-height: 1.85;
  color: var(--muted);
}

/* =====================
   HEADER CHINESE SUBTITLE
===================== */
.header-zh {
  font-family: "Noto Serif SC", serif;
  font-size: 0.9rem;
  color: rgba(255,255,255,0.45);
  letter-spacing: 0.2em;
  margin-top: 0.2rem;
}

/* =====================
   CHAPTER PREV/NEXT NAV
===================== */
.chapter-nav {
  display: flex;
  gap: 2rem;
  margin-top: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}

.chapter-nav span { display: none; }

/* =====================
   FOOTER PORTAL LINK
===================== */
.footer-portal-link {
  display: block;
  color: rgba(255,255,255,0.45);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  margin-bottom: 0.4rem;
  transition: color 0.2s;
}
.footer-portal-link:hover { color: var(--gold-light); }

/* =====================
   RESPONSIVE
===================== */
@media (max-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .chapter-header,
  .site-header { padding: 1.5rem 1rem; }
  .chapter-container { padding: 0 1rem 2rem; }
  .full-text { padding: 1.25rem 1rem; }
}
