/* ==========================================================================
   降临战纪 Descent War Chronicle - Epic War Chronicle Theme
   Steel Grays · Battle Crimson · Heraldic Shields · Medieval Manuscript
   Light parchment background · Zero framework · Mobile-first
   ========================================================================== */

/* --- CSS Variables --- */
:root {
  /* Primary palette */
  --steel-dark: #2c3038;
  --steel-mid: #4a505a;
  --steel-light: #7a8290;
  --crimson: #8b1a1a;
  --crimson-bright: #b2222d;
  --crimson-dark: #5c1010;
  --gold: #c8a84e;
  --gold-dark: #9e8230;
  --gold-light: #e0c76e;

  /* Backgrounds */
  --parchment: #f5f0e3;
  --parchment-light: #faf7ef;
  --parchment-dark: #e8e0cc;
  --parchment-border: #d4c9a8;

  /* Text */
  --text-primary: #2a2a2a;
  --text-secondary: #555555;
  --text-muted: #888888;
  --text-inverse: #f5f0e3;
  --text-link: #8b1a1a;

  /* Surfaces */
  --surface: #ffffff;
  --surface-alt: #f8f4e8;
  --surface-dark: #e8e0cc;

  /* Borders */
  --border-light: #d4c9a8;
  --border-mid: #c0b48e;
  --border-dark: #8b7d5e;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(44, 48, 56, 0.08);
  --shadow-md: 0 4px 12px rgba(44, 48, 56, 0.12);
  --shadow-lg: 0 8px 24px rgba(44, 48, 56, 0.16);

  /* Layout */
  --max-width: 1200px;
  --content-width: 860px;
  --nav-height: 64px;
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 12px;

  /* Typography */
  --font-heading: 'Georgia', 'Times New Roman', 'Noto Serif SC', serif;
  --font-body: 'Georgia', 'Times New Roman', 'Noto Serif SC', serif;
  --font-nav: 'Georgia', 'Times New Roman', 'Noto Serif SC', serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--parchment);
  color: var(--text-primary);
  line-height: 1.75;
  min-height: 100vh;
  background-image:
    linear-gradient(90deg, rgba(139, 26, 26, 0.03) 1px, transparent 1px),
    linear-gradient(rgba(139, 26, 26, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
}

/* --- Typography --- */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--steel-dark);
  line-height: 1.35;
}
h1 {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--crimson);
}
h2 {
  font-size: 1.85rem;
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--border-light);
  position: relative;
}
h2::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 60px;
  height: 2px;
  background: var(--crimson);
}
h3 {
  font-size: 1.35rem;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--steel-mid);
}
h4 {
  font-size: 1.1rem;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--steel-light);
}
p {
  margin-bottom: 1.15rem;
}
a {
  color: var(--text-link);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover {
  color: var(--crimson-bright);
  text-decoration: underline;
}
ul, ol {
  margin-bottom: 1.15rem;
  padding-left: 1.5rem;
}
li { margin-bottom: 0.4rem; }

/* --- Navigation --- */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--steel-dark) 0%, #3a3e48 100%);
  border-bottom: 3px solid var(--crimson);
  box-shadow: var(--shadow-md);
  height: var(--nav-height);
}
.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 1.25rem;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text-inverse);
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.nav-brand:hover { text-decoration: none; color: var(--gold-light); }
.nav-brand img {
  height: 38px;
  width: 38px;
  border-radius: 4px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.nav-links li { margin: 0; }
.nav-links a {
  display: block;
  padding: 0.5rem 0.9rem;
  color: #c8ccd4;
  font-family: var(--font-nav);
  font-size: 0.92rem;
  border-radius: var(--radius-sm);
  transition: all 0.2s;
  text-decoration: none;
}
.nav-links a:hover,
.nav-links a.active {
  color: var(--gold-light);
  background: rgba(200, 168, 78, 0.12);
  text-decoration: none;
}
.nav-cta {
  background: linear-gradient(135deg, var(--crimson-bright), var(--crimson)) !important;
  color: #fff !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em;
  padding: 0.5rem 1.25rem !important;
  border: 1px solid var(--crimson-dark);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
.nav-cta:hover {
  background: linear-gradient(135deg, #cc3333, var(--crimson-bright)) !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(178, 34, 45, 0.4);
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
}
.hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--text-inverse);
  border-radius: 1px;
  transition: all 0.3s;
}

/* --- Layout --- */
.container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 2rem 1.25rem;
}

/* --- Hero Section --- */
.hero {
  position: relative;
  background: linear-gradient(180deg, var(--steel-dark), #3a3e48);
  overflow: hidden;
  min-height: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 4px solid var(--crimson);
}
.hero-bg {
  position: absolute;
  inset: 0;
  opacity: 0.25;
  background-size: cover;
  background-position: center;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(139, 26, 26, 0.06) 2px, rgba(139, 26, 26, 0.06) 4px);
  pointer-events: none;
}
.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 3rem 1.5rem;
  max-width: 700px;
}
.hero-content h1 {
  font-size: 3.2rem;
  color: var(--gold);
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  margin-bottom: 0.5rem;
  letter-spacing: 0.08em;
}
.hero-content .subtitle {
  font-size: 1.15rem;
  color: #c8ccd4;
  margin-bottom: 1.5rem;
  font-style: italic;
  line-height: 1.6;
}
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}
.tag {
  display: inline-block;
  padding: 0.3rem 0.9rem;
  background: rgba(200, 168, 78, 0.15);
  border: 1px solid rgba(200, 168, 78, 0.35);
  color: var(--gold-light);
  font-size: 0.85rem;
  border-radius: 3px;
  font-family: var(--font-heading);
  letter-spacing: 0.04em;
}

/* --- Section Styling --- */
.section {
  padding: 3.5rem 0;
}
.section:nth-child(even) {
  background: var(--parchment-light);
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s, transform 0.2s;
  position: relative;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--crimson), var(--gold));
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}
.card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
  display: block;
}
.card h3 {
  margin-top: 0;
  font-size: 1.15rem;
  color: var(--steel-dark);
}
.card p {
  color: var(--text-secondary);
  font-size: 0.93rem;
  margin-bottom: 0;
}

/* --- Feature Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.feature-item {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  font-size: 2rem;
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--parchment-dark);
  border-radius: var(--radius-sm);
  border: 1px solid var(--crimson);
  color: var(--crimson);
}
.feature-text h3 {
  margin: 0 0 0.3rem 0;
  font-size: 1.05rem;
}
.feature-text p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0;
}

/* --- Screenshot Gallery --- */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.gallery img {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform 0.3s, box-shadow 0.3s;
}
.gallery img:hover {
  transform: scale(1.03);
  box-shadow: var(--shadow-md);
}

/* --- Reviews --- */
.review-list {
  margin: 2rem 0;
}
.review-item {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
}
.review-item::before {
  content: '\275D';
  position: absolute;
  top: 0.5rem;
  left: 1rem;
  font-size: 2.5rem;
  color: var(--border-mid);
  opacity: 0.5;
  line-height: 1;
}
.review-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding-left: 2.5rem;
}
.review-author {
  font-weight: 700;
  color: var(--steel-dark);
}
.review-stars { color: var(--gold); }
.review-text {
  color: var(--text-secondary);
  font-style: italic;
  padding-left: 2.5rem;
  margin: 0;
}

/* --- FAQ Accordion --- */
.faq-list { margin: 2rem 0; }
.faq-item {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  margin-bottom: 0.75rem;
  overflow: hidden;
  background: var(--surface);
}
.faq-question {
  width: 100%;
  background: none;
  border: none;
  padding: 1.15rem 1.5rem;
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--steel-dark);
  text-align: left;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.faq-question:hover { color: var(--crimson); }
.faq-icon {
  font-size: 1.3rem;
  color: var(--gold);
  transition: transform 0.3s;
  flex-shrink: 0;
}
.faq-item.open .faq-icon { transform: rotate(45deg); }
.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.35s ease;
}
.faq-item.open .faq-answer { max-height: 500px; }
.faq-answer-inner {
  padding: 0 1.5rem 1.15rem 1.5rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
  border-top: 1px solid var(--border-light);
}

/* --- Table --- */
.table-wrap {
  overflow-x: auto;
  margin: 1.5rem 0;
}
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}
th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-light);
}
th {
  background: linear-gradient(180deg, var(--steel-dark), var(--steel-mid));
  color: var(--text-inverse);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.9rem;
}
tr:nth-child(even) { background: var(--surface-alt); }
tr:last-child td { border-bottom: none; }

/* --- Highlight boxes --- */
.highlight-box {
  background: linear-gradient(135deg, rgba(139,26,26,0.06), rgba(200,168,78,0.06));
  border: 1px solid var(--border-light);
  border-left: 4px solid var(--crimson);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.5rem;
  margin: 1.5rem 0;
}
.highlight-box.gold {
  border-left-color: var(--gold);
  background: linear-gradient(135deg, rgba(200,168,78,0.08), rgba(200,168,78,0.02));
}
.highlight-box h4 { margin-top: 0; }

/* --- Character Cards --- */
.char-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
}
.char-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.char-card-header {
  background: linear-gradient(135deg, var(--steel-dark), var(--steel-mid));
  padding: 1.25rem;
  text-align: center;
  border-bottom: 2px solid var(--crimson);
}
.char-card-header h3 {
  margin: 0;
  color: var(--gold-light);
  font-size: 1.2rem;
}
.char-card-header .char-role {
  font-size: 0.82rem;
  color: #aab0b8;
  margin-top: 0.3rem;
}
.char-card-body {
  padding: 1.25rem;
  font-size: 0.93rem;
  color: var(--text-secondary);
}
.char-card-body p { margin-bottom: 0.5rem; }
.char-card-body p:last-child { margin-bottom: 0; }

/* --- Endings section --- */
.ending-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
  margin: 2rem 0;
}
.ending-card {
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  text-align: center;
}
.ending-card h3 {
  margin-top: 0;
  color: var(--crimson);
}

/* --- Tips List --- */
.tips-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0;
}
.tips-list li {
  padding: 0.75rem 1rem 0.75rem 2.25rem;
  margin-bottom: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  position: relative;
}
.tips-list li::before {
  content: '\2694';
  position: absolute;
  left: 0.75rem;
  top: 0.75rem;
  color: var(--crimson);
  font-size: 0.85rem;
}

/* --- Breadcrumb --- */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px dotted var(--border-light);
}
.breadcrumb a { color: var(--steel-light); }
.breadcrumb a:hover { color: var(--crimson); }
.breadcrumb span { color: var(--text-muted); }

/* --- Footer --- */
footer {
  background: linear-gradient(0deg, var(--steel-dark), #3a3e48);
  border-top: 3px solid var(--crimson);
  padding: 2rem 1.25rem;
  text-align: center;
  color: #8a8f98;
  font-size: 0.85rem;
}
footer p { margin-bottom: 0.25rem; }

/* --- Lightbox --- */
.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0,0,0,0.9);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
.lightbox-overlay.show { display: flex; }
.lightbox-img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: var(--radius-md);
  box-shadow: 0 0 40px rgba(0,0,0,0.5);
}
.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2.5rem;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
}

/* --- Timeline --- */
.timeline {
  position: relative;
  padding-left: 2rem;
  margin: 2rem 0;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 0.5rem;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border-mid);
}
.timeline-item {
  position: relative;
  margin-bottom: 2rem;
  padding-left: 1.5rem;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -1.65rem;
  top: 0.6rem;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--crimson);
  border: 2px solid var(--gold);
}
.timeline-item h3 { margin-top: 0; }

/* --- Utilities --- */
.text-center { text-align: center; }

/* --- Hero page-specific backgrounds --- */
.hero-home .hero-bg { background-image: url('../img/header.webp'); }
.hero-story .hero-bg { background-image: url('../img/screenshot-01.webp'); }
.hero-guide .hero-bg { background-image: url('../img/screenshot-03.webp'); }
.hero-characters .hero-bg { background-image: url('../img/screenshot-02.webp'); }
.hero-faq .hero-bg { background-image: url('../img/header.webp'); }

/* --- Responsive --- */
@media (max-width: 768px) {
  .hamburger { display: flex; }
  .nav-links {
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--steel-dark);
    flex-direction: column;
    padding: 1rem;
    border-bottom: 3px solid var(--crimson);
    display: none;
    box-shadow: var(--shadow-lg);
    z-index: 99;
  }
  .nav-links.show { display: flex; }
  .nav-links a { width: 100%; text-align: center; padding: 0.75rem; }

  h1 { font-size: 2rem; }
  h2 { font-size: 1.5rem; }
  .hero-content h1 { font-size: 2.2rem; }
  .card-grid, .char-grid { grid-template-columns: 1fr; }
  .gallery { grid-template-columns: 1fr; }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.7rem; }
  .hero-content h1 { font-size: 1.8rem; }
  .hero-content .subtitle { font-size: 0.95rem; }
  .nav-brand { font-size: 1rem; }
}
