/* ===== RESET ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; line-height: 1.6; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; }
ul, ol { list-style: none; }
a { text-decoration: none; color: inherit; }
h1, h2, h3, h4, h5, h6 { overflow-wrap: break-word; }
p { overflow-wrap: break-word; }
:focus-visible { outline: 2px solid #E35F32; outline-offset: 2px; }
@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; } }

/* ===== CSS VARIABLES ===== */
:root {
  --cream-bg: #F5F0E8;
  --dark-brown: #2C1A0E;
  --red-orange: #E35F32;
  --dark-gray: #3A3A3A;
  --mid-gray: #9B9B9B;
  --paper-overlay: rgba(245, 240, 232, 0.9);
  --border-shadow: #D4C9B8;
  --highlight-amber: #F4A940;
  --font-heading: Georgia, serif;
  --font-body: 'Helvetica Neue', Arial, sans-serif;
  --header-height: 64px;
  --content-max-width: 1200px;
  --content-padding: 1.5rem;
  --card-shadow: 0 2px 8px rgba(44, 26, 14, 0.08);
  --card-shadow-hover: 0 6px 20px rgba(44, 26, 14, 0.12);
}
@media (min-width: 768px) { :root { --content-padding: 2rem; --header-height: 72px; } }
@media (min-width: 1024px) { :root { --content-padding: 2.5rem; } }

/* ===== BASE TYPOGRAPHY ===== */
body {
  background-color: var(--cream-bg);
  color: var(--dark-gray);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.7;
}
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--dark-brown);
  font-weight: 400;
  line-height: 1.2;
}
::selection { background: var(--red-orange); color: #fff; }

/* ===== SKIP LINK ===== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 10000;
  background: var(--dark-brown);
  color: var(--cream-bg);
  padding: 0.5rem 1.2rem;
  font-family: var(--font-body);
  font-size: 0.875rem;
  border-radius: 0 0 4px 4px;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ===== SCROLL PROGRESS ===== */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9999;
  width: 0%;
  height: 3px;
  background: var(--red-orange);
  transition: width 0.1s linear;
}
@media (prefers-reduced-motion: reduce) { .scroll-progress { display: none; } }

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--dark-brown);
  color: var(--cream-bg);
  border-bottom: 1px solid rgba(245, 240, 232, 0.15);
  height: var(--header-height);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
  height: 100%;
  gap: 1rem;
}
.brand {
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 400;
  color: var(--cream-bg);
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.brand--footer {
  font-size: 1.4rem;
  color: var(--cream-bg);
}
@media (min-width: 768px) { .brand { font-size: 1.8rem; } }

/* ===== NAV TOGGLE ===== */
.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(245, 240, 232, 0.3);
  border-radius: 4px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 6px;
}
.nav-toggle__bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--cream-bg);
  border-radius: 1px;
  transition: transform 0.25s, opacity 0.25s;
}
[data-open] .nav-toggle__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
[data-open] .nav-toggle__bar:nth-child(2) { opacity: 0; }
[data-open] .nav-toggle__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
@media (min-width: 768px) { .nav-toggle { display: none; } }

/* ===== NAVIGATION ===== */
.nav {
  display: none;
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  background: var(--dark-brown);
  border-bottom: 2px solid var(--red-orange);
  padding: 1rem var(--content-padding) 1.5rem;
  box-shadow: 0 8px 24px rgba(44, 26, 14, 0.3);
}
.nav[data-open] { display: block; }
.nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.nav-list__link {
  display: block;
  padding: 0.6rem 0.8rem;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--cream-bg);
  letter-spacing: 0.01em;
  border-left: 3px solid transparent;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
  border-radius: 0 4px 4px 0;
}
.nav-list__link:hover, .nav-list__link:focus-visible {
  color: var(--red-orange);
  border-left-color: var(--red-orange);
  background: rgba(227, 95, 50, 0.08);
}
.nav-list__link[aria-current="page"] {
  color: var(--red-orange);
  border-left-color: var(--red-orange);
  background: rgba(227, 95, 50, 0.12);
  font-weight: 600;
}
@media (min-width: 768px) {
  .nav {
    display: flex !important;
    position: static;
    background: transparent;
    border-bottom: none;
    box-shadow: none;
    padding: 0;
    flex: 1;
    justify-content: center;
  }
  .nav-list {
    flex-direction: row;
    gap: 0.125rem;
  }
  .nav-list__link {
    padding: 0.4rem 0.9rem;
    font-size: 0.875rem;
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    letter-spacing: 0.02em;
  }
  .nav-list__link:hover, .nav-list__link:focus-visible {
    border-left-color: transparent;
    border-bottom-color: var(--red-orange);
    background: transparent;
  }
  .nav-list__link[aria-current="page"] {
    border-left-color: transparent;
    border-bottom-color: var(--red-orange);
    background: transparent;
  }
}

/* ===== CTA BUTTON ===== */
.btn-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1.2rem;
  background: var(--red-orange);
  color: #fff;
  font-family: var(--font-body);
  font-size: 0.825rem;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
  transition: background 0.2s, transform 0.15s;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  letter-spacing: 0.03em;
}
.btn-cta:hover, .btn-cta:focus-visible {
  background: #c94f28;
  transform: translateY(-1px);
}
@media (min-width: 768px) { .btn-cta { padding: 0.5rem 1.5rem; font-size: 0.875rem; } }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--dark-brown);
  color: rgba(245, 240, 232, 0.85);
  border-top: 2px solid var(--red-orange);
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
}
.site-footer__inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 0 var(--content-padding);
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}
@media (min-width: 640px) { .site-footer__grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .site-footer__grid { grid-template-columns: 2fr 1fr 1.5fr; } }
.site-footer__col--brand { display: flex; flex-direction: column; gap: 0.5rem; }
.site-footer__tagline { font-size: 0.875rem; color: var(--mid-gray); font-family: var(--font-body); }
.site-footer__heading {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--mid-gray);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.8rem;
  color: var(--cream-bg);
}
.site-footer__link-list { display: flex; flex-direction: column; gap: 0.4rem; }
.site-footer__link {
  color: rgba(245, 240, 232, 0.75);
  font-size: 0.875rem;
  transition: color 0.2s;
}
.site-footer__link:hover, .site-footer__link:focus-visible { color: var(--red-orange); }
.site-footer__contact { font-size: 0.875rem; color: rgba(245, 240, 232, 0.75); margin-bottom: 0.25rem; }
.site-footer__address { font-size: 0.825rem; color: var(--mid-gray); margin-top: 0.4rem; }
.site-footer__bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  margin-top: 2rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(212, 201, 184, 0.2);
  text-align: center;
}
.site-footer__copyright { font-size: 0.75rem; color: var(--mid-gray); }
.site-footer__icp { font-size: 0.7rem; color: var(--mid-gray); letter-spacing: 0.02em; }
@media (min-width: 640px) { .site-footer__bottom { flex-direction: row; justify-content: space-between; text-align: left; } }

/* ===== BACK TO TOP ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 900;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--red-orange);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 2px 12px rgba(227, 95, 50, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.3s, visibility 0.3s, transform 0.3s, background 0.2s;
}
.back-to-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover, .back-to-top:focus-visible { background: #c94f28; transform: translateY(-2px); }
.back-to-top:focus-visible { outline: 2px solid var(--cream-bg); outline-offset: 3px; }
.back-to-top__arrow { display: block; line-height: 1; }
@media (min-width: 768px) { .back-to-top { bottom: 2.5rem; right: 2rem; width: 48px; height: 48px; font-size: 1.3rem; } }

/* ===== CONTENT GRID (通用) ===== */
.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 2rem var(--content-padding);
}
@media (min-width: 768px) {
  .content-grid {
    grid-template-columns: 1fr 280px;
    grid-template-rows: auto;
  }
  .content-grid__main { grid-column: 1; }
  .content-grid__side { grid-column: 2; }
}
@media (min-width: 1024px) {
  .content-grid { grid-template-columns: 1fr 320px; gap: 3rem; }
}

/* ===== CARD 通用 ===== */
.card {
  background: #fff;
  border: 1px solid var(--border-shadow);
  border-radius: 6px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  transition: box-shadow 0.25s, transform 0.25s;
  position: relative;
}
.card:hover { box-shadow: var(--card-shadow-hover); transform: translateY(-2px); }
.card__index {
  font-family: var(--font-body);
  font-weight: 700;
  font-style: italic;
  font-size: 0.75rem;
  color: var(--red-orange);
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 0.4rem;
}
.card__tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  border-radius: 3px;
  background: var(--red-orange);
  color: #fff;
  letter-spacing: 0.03em;
}
.card__tag--amber { background: var(--highlight-amber); color: var(--dark-brown); }

/* ===== CHAPTER PREVIEW 首屏预览 ===== */
.chapter-preview {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.2rem;
  padding: 2rem var(--content-padding);
  max-width: var(--content-max-width);
  margin: 0 auto;
}
@media (min-width: 480px) { .chapter-preview { grid-template-columns: 1fr 1fr; } }
@media (min-width: 960px) { .chapter-preview { grid-template-columns: 1fr 1fr 1fr; gap: 1.5rem; } }

/* ===== DIVIDER ===== */
.divider {
  height: 1px;
  background: var(--border-shadow);
  border: none;
  margin: 2rem 0;
}

/* ===== FOOTNOTE ===== */
.footnote {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--mid-gray);
  line-height: 1.5;
}

/* ===== STATUS INDICATOR ===== */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
}
.status-dot--live { background: var(--red-orange); animation: pulse-dot 1.5s infinite; }
.status-dot--upcoming { background: var(--highlight-amber); }
.status-dot--finished { background: var(--mid-gray); }
@keyframes pulse-dot { 0%,100% { opacity: 1; } 50% { opacity: 0.4; } }
@media (prefers-reduced-motion: reduce) { .status-dot--live { animation: none; } }

/* ===== IMAGE CONTAINER (通用占位规则) ===== */
.img-container {
  position: relative;
  overflow: hidden;
  background: var(--border-shadow);
  border-radius: 4px;
}
.img-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}
.img-container:hover img { transform: scale(1.03); }
@media (prefers-reduced-motion: reduce) { .img-container:hover img { transform: none; } }

/* ===== SECTION NAV ===== */
.section-nav {
  position: sticky;
  top: calc(var(--header-height) + 1rem);
  z-index: 100;
  background: var(--paper-overlay);
  backdrop-filter: blur(4px);
  border: 1px solid var(--border-shadow);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  max-width: var(--content-max-width);
  margin: 0 auto 1.5rem;
}
.section-nav__list { display: flex; flex-wrap: wrap; gap: 0.3rem 0.6rem; }
.section-nav__link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--dark-gray);
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  transition: color 0.2s, background 0.2s;
}
.section-nav__link:hover, .section-nav__link:focus-visible { color: var(--red-orange); background: rgba(227,95,50,0.06); }
.section-nav__link.is-active { color: var(--red-orange); background: rgba(227,95,50,0.1); font-weight: 600; }

/* ===== RESPONSIVE HELPERS ===== */
@media (max-width: 767px) { .hide-mobile { display: none !important; } }
@media (min-width: 768px) and (max-width: 959px) { .hide-tablet { display: none !important; } }
@media (min-width: 960px) { .hide-desktop { display: none !important; } }

/* ===== PRINT ===== */
@media print {
  .site-header, .site-footer, .back-to-top, .scroll-progress, .section-nav { display: none !important; }
  body { background: #fff; color: #000; }
}
