/* ============================================================
   SAKARTVELO DEFENDERS — DESIGN SYSTEM v2
   "Historical Epic" — Cream, Red, Gold, Georgian Heritage
   Identity: Georgian flag colors + parchment warmth
   Typography: Serif headings (Cormorant Garamond) + clean body (Inter)
   ============================================================ */

/* --- Google Fonts --- */
@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@300;400;500;600;700&family=Inter:wght@300;400;500;600;700&display=swap');

/* --- 1. DESIGN TOKENS --- */
:root {
  /* Georgian Flag Identity */
  --geo-red: #c1272d;
  --geo-red-dark: #a01f24;
  --geo-red-light: #e84045;
  --geo-green: #007b3d;
  --geo-green-dark: #005e2d;
  --geo-gold: #d4a836;
  --geo-gold-light: #f0c040;
  --geo-gold-dim: rgba(212, 168, 54, 0.12);

  /* Cream Foundation */
  --parchment: #faf6f0;
  --cream: #f3ece1;
  --warm-white: #fffdf9;
  --ivory: #ffffff;
  --linen: #ede5d8;

  /* Text hierarchy on light backgrounds */
  --charcoal: #1a1a2e;
  --stone: #4a4a5a;
  --muted: #7a7a8a;
  --ghost: rgba(26, 26, 46, 0.06);
  --ghost-strong: rgba(26, 26, 46, 0.10);
  --ghost-border: rgba(26, 26, 46, 0.08);

  /* Shadows — warm, papery */
  --shadow-elevated: 0 8px 30px rgba(26, 26, 46, 0.08),
                     0 2px 8px rgba(26, 26, 46, 0.04);
  --shadow-card: 0 2px 12px rgba(26, 26, 46, 0.06),
                 0 1px 3px rgba(26, 26, 46, 0.04);
  --shadow-hover: 0 12px 40px rgba(26, 26, 46, 0.12),
                  0 4px 12px rgba(26, 26, 46, 0.06);
  --shadow-glow-red: 0 0 40px rgba(193, 39, 45, 0.12);
  --shadow-glow-gold: 0 0 40px rgba(212, 168, 54, 0.10);

  /* Typography */
  --font-heading: 'Cormorant Garamond', 'Georgia', 'Times New Roman', serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Spacing (unchanged) */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;
  --space-5xl: 128px;

  /* Layout */
  --max-width: 1120px;
  --nav-height: 64px;
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-pill: 980px;

  /* Transitions */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --duration: 0.3s;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.6;
  color: var(--stone);
  background: var(--parchment);
  overflow-x: hidden;
}

/* Animated Georgian Five-Cross Flag — prominent watermark */
body::before {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 75vmin;
  height: 45vmin; /* 3:5 ratio */
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  opacity: 0.07;
  will-change: transform;
  animation: flag-wave 20s ease-in-out infinite;
  /* Official Georgian flag SVG */
  background-image: url('../assets/images/Flag_of_Georgia.svg');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

@keyframes flag-wave {
  0%, 100% {
    transform: translate(-50%, -50%) perspective(1200px) rotateY(0deg) scaleX(1);
  }
  25% {
    transform: translate(-50%, -50%) perspective(1200px) rotateY(2deg) scaleX(1.008);
  }
  50% {
    transform: translate(-50%, -50%) perspective(1200px) rotateY(0deg) scaleX(1.015);
  }
  75% {
    transform: translate(-50%, -50%) perspective(1200px) rotateY(-2deg) scaleX(1.008);
  }
}

/* Respect reduced-motion preference */
@media (prefers-reduced-motion: reduce) {
  body::before {
    animation: none;
  }
}

/* --- 3. TYPOGRAPHY --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--charcoal);
  font-family: var(--font-heading);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h1 {
  font-size: clamp(2.5rem, 6vw, 3.75rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.08;
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
  margin-bottom: var(--space-lg);
}

h3 {
  font-size: clamp(1.25rem, 2.5vw, 1.5rem);
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: var(--space-sm);
}

h4 {
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: var(--space-xs);
}

p {
  margin-bottom: var(--space-md);
  color: var(--stone);
}

a {
  color: var(--geo-red);
  text-decoration: none;
  transition: color var(--duration) var(--ease);
}

a:hover {
  color: var(--geo-red-dark);
}

strong, b {
  font-weight: 600;
}

.small-caps {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.section-label {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--geo-red);
  margin-bottom: var(--space-md);
  display: block;
}

/* Decorative section divider — Georgian vine motif */
.section-divider {
  width: 100%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--ghost-strong), transparent);
}

/* --- 4. LAYOUT --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  position: relative;
  z-index: 1;
}

section {
  padding: var(--space-5xl) 0;
  position: relative;
}

.text-center { text-align: center; }
.text-left { text-align: left; }

.grid {
  display: grid;
  gap: var(--space-lg);
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1024px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  section { padding: var(--space-3xl) 0; }
}

/* --- 5. NAVIGATION --- */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  z-index: 1000;
  background: rgba(250, 246, 240, 0.9);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--ghost-border);
  transition: background var(--duration) var(--ease);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--charcoal);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.nav-brand .brand-icon {
  width: 28px;
  height: 28px;
  background: var(--geo-red);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
  list-style: none;
}

.nav-links a {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  transition: color var(--duration) var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--geo-red);
}

.nav-cta {
  background: var(--geo-red) !important;
  color: white !important;
  padding: 8px 20px;
  border-radius: var(--radius-sm);
  font-weight: 500 !important;
  letter-spacing: 0.05em !important;
  transition: background var(--duration) var(--ease), box-shadow var(--duration) var(--ease);
}

.nav-cta:hover {
  background: var(--geo-red-dark) !important;
  color: white !important;
  box-shadow: var(--shadow-glow-red);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-sm);
}

.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--charcoal);
  margin: 4px 0;
  transition: all var(--duration) var(--ease);
}

@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: fixed;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: rgba(250, 246, 240, 0.97);
    backdrop-filter: blur(20px);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-lg);
    border-bottom: 1px solid var(--ghost-border);
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
}

/* --- 6. HERO --- */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  position: relative;
  overflow: hidden;
  background: var(--parchment);
}

/* Georgian flag-inspired radial glow behind hero text */
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 70%, rgba(193, 39, 45, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 20%, rgba(212, 168, 54, 0.04) 0%, transparent 45%),
    radial-gradient(ellipse at 80% 30%, rgba(0, 123, 61, 0.04) 0%, transparent 45%);
  pointer-events: none;
}

/* Subtle cross pattern inspired by Bolnisi cross */
.hero::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  opacity: 0.015;
  pointer-events: none;
  background:
    /* Vertical bar */
    linear-gradient(0deg, var(--charcoal) 0%, var(--charcoal) 100%) no-repeat
      center / 2px 100%,
    /* Horizontal bar */
    linear-gradient(90deg, var(--charcoal) 0%, var(--charcoal) 100%) no-repeat
      center / 100% 2px;
}

.hero-content {
  position: relative;
  z-index: 1;
  max-width: 800px;
  padding: 0 var(--space-lg);
}

.hero h1 {
  margin-bottom: var(--space-lg);
}

.hero h1 .accent {
  color: var(--geo-red);
}

.hero .subtitle {
  font-size: clamp(1rem, 2vw, 1.25rem);
  color: var(--stone);
  line-height: 1.6;
  margin-bottom: var(--space-2xl);
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

/* Decorative line above hero text */
.hero-line {
  width: 48px;
  height: 2px;
  background: var(--geo-red);
  margin: 0 auto var(--space-xl);
}

/* --- 7. BUTTONS --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 12px 28px;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  transition: all var(--duration) var(--ease);
  text-decoration: none;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--geo-red);
  color: white;
}

.btn-primary:hover {
  background: var(--geo-red-dark);
  color: white;
  box-shadow: var(--shadow-glow-red);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--charcoal);
  border: 1px solid var(--ghost-strong);
}

.btn-ghost:hover {
  background: var(--ghost);
  color: var(--geo-red);
  border-color: var(--geo-red);
}

.btn-pill {
  border-radius: var(--radius-pill);
}

.btn-sm {
  font-size: 0.8125rem;
  padding: 8px 20px;
}

.btn-group {
  display: flex;
  gap: var(--space-md);
  justify-content: center;
  flex-wrap: wrap;
}

/* --- 8. CARDS --- */
.card {
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-lg);
  padding: var(--space-2xl);
  transition: all var(--duration) var(--ease);
  position: relative;
  box-shadow: var(--shadow-card);
}

.card:hover {
  border-color: rgba(193, 39, 45, 0.15);
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  font-size: 1.125rem;
}

.card-icon.red {
  background: rgba(193, 39, 45, 0.08);
  color: var(--geo-red);
}

.card-icon.gold {
  background: var(--geo-gold-dim);
  color: var(--geo-gold);
}

.card-icon.green {
  background: rgba(0, 123, 61, 0.08);
  color: var(--geo-green);
}

.card-icon.blue {
  background: rgba(74, 74, 90, 0.08);
  color: var(--muted);
}

.card h3 {
  color: var(--charcoal);
}

.card p {
  font-size: 0.9375rem;
  line-height: 1.6;
}

/* --- 9. ERA CARDS --- */
.era-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

@media (max-width: 1024px) {
  .era-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .era-grid { grid-template-columns: 1fr; }
}

.era-card {
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--duration) var(--ease);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.era-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.era-card:hover {
  border-color: rgba(193, 39, 45, 0.12);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

.era-card .era-number {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: var(--space-sm);
  color: var(--muted);
}

.era-card h4 {
  font-family: var(--font-heading);
  color: var(--charcoal);
  font-weight: 600;
  font-size: 1.05rem;
}

.era-card .era-period {
  font-size: 0.75rem;
  color: var(--geo-red);
  margin-bottom: var(--space-sm);
  font-weight: 500;
}

.era-card p {
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--stone);
}

/* Era color accents — warm historical palette */
.era-card[data-era="0"]::before { background: #8B7355; }
.era-card[data-era="1"]::before { background: #C65D3E; }
.era-card[data-era="2"]::before { background: #7B8FA1; }
.era-card[data-era="3"]::before { background: var(--geo-gold); }
.era-card[data-era="4"]::before { background: #722F37; }
.era-card[data-era="5"]::before { background: #DAA520; }
.era-card[data-era="6"]::before { background: #4A6A8A; }
.era-card[data-era="7"]::before { background: var(--geo-red); }
.era-card[data-era="8"]::before { background: #22A7F0; }
.era-card[data-era="9"]::before { background: var(--geo-green); }

/* --- 10. SECTION VARIANTS --- */
.section-dark {
  background: var(--cream);
}

.section-darker {
  background: var(--linen);
}

.section-gradient {
  background: linear-gradient(180deg, var(--parchment) 0%, var(--cream) 100%);
}

/* --- 11. FEATURE LIST --- */
.feature-list {
  list-style: none;
  counter-reset: feature;
}

.feature-list li {
  counter-increment: feature;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--ghost-border);
  display: flex;
  gap: var(--space-md);
  align-items: flex-start;
}

.feature-list li::before {
  content: counter(feature, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--geo-red);
  font-weight: 500;
  min-width: 24px;
  padding-top: 3px;
}

/* --- 12. STAT / METRIC BLOCKS --- */
.stat-row {
  display: flex;
  gap: var(--space-2xl);
  justify-content: center;
  flex-wrap: wrap;
}

.stat {
  text-align: center;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 400;
  color: var(--charcoal);
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: var(--space-xs);
}

.stat-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* --- 13. TOWER/ENEMY/HERO CARDS --- */
.game-card {
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-card);
}

.game-card:hover {
  border-color: rgba(193, 39, 45, 0.12);
  box-shadow: var(--shadow-hover);
}

.game-card .gc-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.game-card .gc-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.game-card h4 {
  font-weight: 500;
}

.game-card .gc-stats {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.game-card .gc-stat {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.game-card .gc-stat span {
  color: var(--charcoal);
  font-weight: 500;
}

/* --- 14. CTA SECTION --- */
.cta-section {
  text-align: center;
  padding: var(--space-5xl) 0;
  position: relative;
}

.cta-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(193, 39, 45, 0.04) 0%, transparent 70%);
  pointer-events: none;
}

/* --- 15. FOOTER --- */
.footer {
  background: var(--charcoal);
  color: rgba(255, 255, 255, 0.6);
  border-top: 3px solid var(--geo-red);
  padding: var(--space-3xl) 0 var(--space-2xl);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
}

.footer-left p {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--space-xs);
}

.footer-right {
  display: flex;
  gap: var(--space-md);
}

.footer-right a {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--duration) var(--ease);
}

.footer-right a:hover {
  color: var(--geo-gold);
}

.footer-georgian {
  font-size: 0.875rem;
  color: var(--geo-gold);
  opacity: 0.7;
  margin-top: var(--space-xs);
}

/* --- 16. UTILITY --- */
.mt-sm { margin-top: var(--space-sm); }
.mt-md { margin-top: var(--space-md); }
.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mt-2xl { margin-top: var(--space-2xl); }
.mb-sm { margin-bottom: var(--space-sm); }
.mb-md { margin-bottom: var(--space-md); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }
.mb-2xl { margin-bottom: var(--space-2xl); }

/* Two column layout for content pages */
.content-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-3xl);
  align-items: start;
}

@media (max-width: 768px) {
  .content-split { grid-template-columns: 1fr; }
}

/* Prose block for long-form content */
.prose {
  max-width: 680px;
}

.prose h2 {
  margin-top: var(--space-2xl);
}

.prose p {
  font-size: 1rem;
  line-height: 1.7;
}

.prose ul {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.prose li {
  margin-bottom: var(--space-sm);
  color: var(--stone);
  line-height: 1.6;
}

/* Badge / tag */
.badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

.badge-red {
  background: rgba(193, 39, 45, 0.08);
  color: var(--geo-red);
}

.badge-gold {
  background: var(--geo-gold-dim);
  color: var(--geo-gold);
}

.badge-green {
  background: rgba(0, 123, 61, 0.08);
  color: var(--geo-green);
}

/* Responsive hero adjustments */
@media (max-width: 640px) {
  .hero { min-height: 90vh; }
  .stat-row { gap: var(--space-xl); }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-right { justify-content: center; }
}

/* --- 17. ANIMATIONS --- */
/* Elements that should animate on scroll start hidden */
.animate-on-scroll {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

/* When visible, animate in */
.animate-on-scroll.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children - apply delays to visible state */
.stagger > *:nth-child(1).visible { transition-delay: 0s; }
.stagger > *:nth-child(2).visible { transition-delay: 0.1s; }
.stagger > *:nth-child(3).visible { transition-delay: 0.2s; }
.stagger > *:nth-child(4).visible { transition-delay: 0.3s; }
.stagger > *:nth-child(5).visible { transition-delay: 0.4s; }
.stagger > *:nth-child(6).visible { transition-delay: 0.5s; }
.stagger > *:nth-child(7).visible { transition-delay: 0.6s; }
.stagger > *:nth-child(8).visible { transition-delay: 0.7s; }
.stagger > *:nth-child(9).visible { transition-delay: 0.8s; }
.stagger > *:nth-child(10).visible { transition-delay: 0.9s; }
.stagger > *:nth-child(11).visible { transition-delay: 1.0s; }
.stagger > *:nth-child(12).visible { transition-delay: 1.1s; }

/* --- 18. PAPER GRAIN TEXTURE --- */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  mix-blend-mode: multiply;
}

/* --- 19. BACK TO TOP BUTTON --- */
.back-to-top {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  background: var(--geo-red);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: all var(--duration) var(--ease);
  z-index: 900;
  box-shadow: var(--shadow-glow-red);
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--geo-red-dark);
  transform: translateY(-2px);
}

.back-to-top svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- 20. DARK MODE --- */
/* Dark mode tokens */
:root[data-theme="dark"] {
  --parchment: #0a0a0f;
  --cream: #0f0f15;
  --warm-white: #14141a;
  --ivory: #1a1a24;
  --linen: #121218;

  --charcoal: #f0f0f5;
  --stone: #c0c0d0;
  --muted: #9090a0;

  --ghost: rgba(240, 240, 245, 0.06);
  --ghost-strong: rgba(240, 240, 245, 0.10);
  --ghost-border: rgba(240, 240, 245, 0.08);

  --shadow-elevated: 0 8px 30px rgba(0, 0, 0, 0.4),
                     0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.3),
                 0 1px 3px rgba(0, 0, 0, 0.2);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, 0.5),
                  0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Dark mode toggle button */
.theme-toggle {
  position: relative;
  width: 40px;
  height: 40px;
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--duration) var(--ease);
}

.theme-toggle:hover {
  background: var(--cream);
  border-color: var(--geo-red);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  fill: var(--stone);
  transition: fill var(--duration) var(--ease);
}

.theme-toggle:hover svg {
  fill: var(--geo-red);
}

/* Sun icon (visible in dark mode) */
.theme-toggle .sun-icon {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg);
  transition: all var(--duration) var(--ease);
}

/* Moon icon (visible in light mode) */
.theme-toggle .moon-icon {
  position: absolute;
  opacity: 1;
  transform: rotate(0);
  transition: all var(--duration) var(--ease);
}

/* Toggle states */
:root[data-theme="dark"] .theme-toggle .sun-icon {
  opacity: 1;
  transform: rotate(0);
}

:root[data-theme="dark"] .theme-toggle .moon-icon {
  opacity: 0;
  transform: rotate(90deg);
}

/* Dark mode nav */
:root[data-theme="dark"] .nav {
  background: rgba(10, 10, 15, 0.95);
}

/* Dark mode footer */
:root[data-theme="dark"] .footer {
  background: #050508;
}

/* Dark mode grain blend mode */
:root[data-theme="dark"] body::after {
  mix-blend-mode: overlay;
  opacity: 0.04;
}

/* --- 21. IMPROVED FOOTER --- */
.footer {
  background: var(--charcoal);
  color: rgba(255, 255, 255, 0.6);
  border-top: 3px solid var(--geo-red);
  padding: var(--space-3xl) 0 var(--space-2xl);
  position: relative;
  overflow: hidden;
}

/* Georgian decorative pattern in footer */
.footer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--geo-red) 20%,
    var(--geo-gold) 50%,
    var(--geo-green) 80%,
    transparent 100%
  );
  opacity: 0.3;
}

/* Subtle cross pattern in footer */
.footer::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 200px;
  height: 120px;
  opacity: 0.03;
  pointer-events: none;
  background:
    linear-gradient(0deg, currentColor 0%, currentColor 100%) no-repeat
      center / 1px 100%,
    linear-gradient(90deg, currentColor 0%, currentColor 100%) no-repeat
      center / 100% 1px;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-lg);
  position: relative;
  z-index: 1;
}

.footer-content {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.footer-left p {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: var(--space-xs);
}

.footer-right {
  display: flex;
  gap: var(--space-md);
  align-items: center;
}

.footer-right a {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: color var(--duration) var(--ease);
}

.footer-right a:hover {
  color: var(--geo-gold);
}

.footer-georgian {
  font-size: 0.875rem;
  color: var(--geo-gold);
  opacity: 0.7;
  margin-top: var(--space-xs);
  font-weight: 400;
}

/* Footer navigation links */
.footer-nav {
  display: flex;
  gap: var(--space-lg);
  list-style: none;
  margin-top: var(--space-md);
}

.footer-nav a {
  font-size: 0.8125rem;
  color: rgba(255, 255, 255, 0.4);
  transition: color var(--duration) var(--ease);
}

.footer-nav a:hover {
  color: var(--geo-red);
}

/* --- 22. HERO CARDS (for heroes.html) --- */
.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-lg);
}

.hero-card {
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--duration) var(--ease);
  box-shadow: var(--shadow-card);
}

.hero-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(193, 39, 45, 0.2);
}

.hero-portrait {
  width: 100%;
  height: 200px;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid var(--ghost-border);
}

.hero-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration) var(--ease);
}

.hero-card:hover .hero-portrait img {
  transform: scale(1.05);
}

.hero-content {
  padding: var(--space-xl);
}

.hero-era {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--geo-red);
  margin-bottom: var(--space-xs);
  font-weight: 600;
}

.hero-name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: var(--space-md);
  line-height: 1.2;
}

.hero-abilities {
  list-style: none;
  margin-top: var(--space-md);
}

.hero-abilities li {
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--ghost-border);
  display: flex;
  gap: var(--space-sm);
  align-items: flex-start;
}

.hero-abilities li:last-child {
  border-bottom: none;
}

.hero-ability-name {
  font-weight: 600;
  color: var(--charcoal);
  min-width: 120px;
}

.hero-ability-desc {
  font-size: 0.875rem;
  color: var(--stone);
  line-height: 1.5;
}



/* --- TIMELINE (Chronicle Page) --- */
.era-timeline {
  position: relative;
}

.era-timeline::before {
  content: '';
  position: absolute;
  left: 24px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, var(--geo-gold), var(--geo-red), var(--geo-gold));
}

@media (min-width: 640px) {
  .era-timeline::before {
    left: 50%;
    transform: translateX(-50%);
  }
}

.timeline-item {
  position: relative;
  padding-left: 60px;
  padding-bottom: var(--space-2xl);
}

@media (min-width: 640px) {
  .timeline-item {
    padding-left: 0;
    padding-right: 0;
    width: 50%;
  }
  
  .timeline-item:nth-child(even) {
    margin-left: 50%;
    padding-left: var(--space-2xl);
  }
  
  .timeline-item:nth-child(odd) {
    text-align: right;
    padding-right: var(--space-2xl);
  }
}

.timeline-marker {
  position: absolute;
  left: 12px;
  top: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 3px solid var(--parchment);
  box-shadow: var(--shadow-card);
  z-index: 1;
}

@media (min-width: 640px) {
  .timeline-marker {
    left: 50%;
    transform: translateX(-50%);
  }
  
  .timeline-item:nth-child(even) .timeline-marker {
    left: -12px;
    transform: none;
  }
  
  .timeline-item:nth-child(odd) .timeline-marker {
    left: auto;
    right: -12px;
    transform: none;
  }
}

.timeline-content {
  background: var(--parchment);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-md);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.timeline-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.timeline-header h3 {
  margin-bottom: 0;
}

.timeline-battles,
.timeline-heroes,
.timeline-mechanics {
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--ghost-border);
}

.timeline-battles h4,
.timeline-heroes h4,
.timeline-mechanics h4 {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin-bottom: var(--space-sm);
}

.timeline-battles ul {
  list-style: none;
  padding: 0;
}

.timeline-battles li {
  position: relative;
  padding-left: var(--space-lg);
  margin-bottom: var(--space-xs);
  font-size: 0.9375rem;
}

.timeline-battles li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--geo-red);
}

.timeline-heroes p {
  margin-bottom: 0;
  font-size: 0.9375rem;
}

.timeline-mechanics p {
  margin-bottom: 0;
  font-size: 0.9375rem;
}


/* --- 23. FAQ STYLES --- */
.faq-item {
  background: var(--ivory);
  border: 1px solid var(--ghost-border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-md);
  overflow: hidden;
}

.faq-question {
  padding: var(--space-lg);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-md);
  transition: background var(--duration) var(--ease);
}

.faq-question:hover {
  background: var(--cream);
}

.faq-question h4 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--charcoal);
}

.faq-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  transition: transform var(--duration) var(--ease);
}

.faq-item.active .faq-icon {
  transform: rotate(180deg);
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--duration) var(--ease), padding var(--duration) var(--ease);
}

.faq-item.active .faq-answer {
  max-height: 500px;
  padding: 0 var(--space-lg) var(--space-lg);
}

.faq-answer p {
  margin: 0;
  line-height: 1.6;
  color: var(--stone);
}
