/* ============================================
   GameGuideHQ — Gaming Walkthroughs & Builds
   Dark Theme · Mobile-First · Core Web Vitals Optimized
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Colors */
  --bg-primary: #0f1117;
  --bg-secondary: #1a1d28;
  --bg-card: #212433;
  --bg-card-hover: #282d3d;
  --bg-code: #161822;
  --text-primary: #e8eaed;
  --text-secondary: #9aa0b0;
  --text-muted: #6b7280;
  --accent: #f59e0b;      /* Amber/gold — gaming feel */
  --accent-hover: #fbbf24;
  --accent-dim: rgba(245, 158, 11, 0.15);
  --danger: #ef4444;
  --success: #10b981;
  --info: #3b82f6;
  --border: #2d3144;
  --border-light: #363b50;

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;
  --space-3xl: 4rem;

  /* Layout */
  --max-width: 1200px;
  --content-width: 800px;
  --header-height: 64px;
  --sidebar-width: 280px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 20px rgba(245,158,11,0.15);

  /* Borders */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
}

/* --- Reset & Base --- */
*, *::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-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: 0.5em;
}

h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 1.875rem); }
h3 { font-size: clamp(1.15rem, 2.5vw, 1.5rem); }
h4 { font-size: 1.125rem; }

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

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-hover); }

ul, ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-xl);
}
li { margin-bottom: var(--space-sm); }

blockquote {
  border-left: 3px solid var(--accent);
  background: var(--accent-dim);
  padding: var(--space-md) var(--space-lg);
  margin: var(--space-lg) 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--text-secondary);
}

code {
  font-family: var(--font-mono);
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--accent);
}

pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  overflow-x: auto;
  margin: var(--space-md) 0;
}
pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-lg) 0;
  font-size: 0.95rem;
}
th, td {
  padding: var(--space-sm) var(--space-md);
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  background: var(--bg-secondary);
  font-weight: 600;
  color: var(--accent);
}
tr:hover td { background: var(--bg-card-hover); }

/* --- Layout --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.content-wrapper {
  display: flex;
  gap: var(--space-2xl);
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-2xl) var(--space-lg);
}

.main-content {
  flex: 1;
  min-width: 0;
}

/* --- Header / Navigation --- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  /* Prevent CLS: explicit height */
  height: var(--header-height);
  display: flex;
  align-items: center;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  text-decoration: none;
}
.brand-icon {
  font-size: 1.5rem;
}
.brand-accent { color: var(--accent); }

.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.main-nav a {
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
}
.main-nav a:hover,
.main-nav a.active {
  color: var(--text-primary);
  border-bottom-color: var(--accent);
}

.nav-search {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-primary);
  font-size: 0.9rem;
  width: 200px;
  transition: border-color var(--transition-fast);
}
.nav-search:focus {
  outline: none;
  border-color: var(--accent);
}

/* Mobile nav toggle */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: var(--space-xs);
}

/* --- Hero Section --- */
.hero {
  background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-card) 100%);
  border-bottom: 1px solid var(--border);
  padding: var(--space-3xl) 0;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin-bottom: var(--space-md);
}
.hero p {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 650px;
  margin: 0 auto var(--space-xl);
}
.hero-cta {
  display: inline-flex;
  gap: var(--space-md);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #000;
}
.btn-primary:hover {
  background: var(--accent-hover);
  color: #000;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Cards --- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-lg);
  margin: var(--space-xl) 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
  border-color: var(--accent);
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--bg-secondary);
  /* Prevent CLS: explicit dimensions */
  aspect-ratio: 16/9;
}

.card-body { padding: var(--space-lg); }
.card-body h3 {
  font-size: 1.15rem;
  margin-bottom: var(--space-sm);
}
.card-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: var(--space-md);
}
.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.card-tag {
  background: var(--accent-dim);
  color: var(--accent);
  padding: 0.15em 0.6em;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* --- Article / Guide Content --- */
.article-header {
  margin-bottom: var(--space-2xl);
  padding-bottom: var(--space-xl);
  border-bottom: 1px solid var(--border);
}
.article-header h1 {
  margin-bottom: var(--space-sm);
}
.article-meta {
  display: flex;
  gap: var(--space-lg);
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-wrap: wrap;
}
.article-meta span {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

/* TL;DR box */
.tldr {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  padding: var(--space-lg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-bottom: var(--space-xl);
}
.tldr-title {
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  margin-bottom: var(--space-sm);
}

/* Stat box */
.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin: var(--space-lg) 0;
}
.stat-box h4 {
  color: var(--accent);
  margin-bottom: var(--space-sm);
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-md);
}
.stat-item {
  text-align: center;
  padding: var(--space-md);
}
.stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
}

/* Boss / Enemy stat table */
.boss-table {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.boss-table th {
  background: var(--bg-secondary);
}

/* Step-by-step guide */
.steps { list-style: none; padding: 0; }
.steps li {
  counter-increment: step-counter;
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  position: relative;
  padding-left: 4rem;
}
.steps li::before {
  content: counter(step-counter);
  position: absolute;
  left: var(--space-lg);
  top: var(--space-lg);
  width: 2rem;
  height: 2rem;
  background: var(--accent);
  color: #000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

/* Tips / Warning callout */
.callout {
  padding: var(--space-md) var(--space-lg);
  border-radius: var(--radius-sm);
  margin: var(--space-lg) 0;
  font-size: 0.95rem;
}
.callout-tip {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: var(--success);
}
.callout-warning {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--danger);
}
.callout-info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: var(--info);
}

/* --- FAQ Section --- */
.faq-section {
  margin: var(--space-2xl) 0;
}
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-sm);
  overflow: hidden;
}
.faq-question {
  width: 100%;
  background: var(--bg-card);
  border: none;
  padding: var(--space-md) var(--space-lg);
  text-align: left;
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.faq-question:hover { background: var(--bg-card-hover); }
.faq-answer {
  padding: 0 var(--space-lg) var(--space-md);
  color: var(--text-secondary);
  display: none;
}
.faq-item.open .faq-answer { display: block; }
.faq-item.open .faq-icon { transform: rotate(180deg); }
.faq-icon {
  transition: transform var(--transition-fast);
  font-size: 0.8rem;
}

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
}

.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}
.sidebar-section h4 {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: var(--space-md);
}
.sidebar-section ul { list-style: none; padding: 0; margin: 0; }
.sidebar-section li {
  margin-bottom: var(--space-sm);
  padding: var(--space-xs) 0;
}
.sidebar-section li a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  transition: color var(--transition-fast);
}
.sidebar-section li a:hover { color: var(--accent); }

/* --- Table of Contents --- */
.toc {
  position: sticky;
  top: calc(var(--header-height) + var(--space-lg));
}
.toc-list { list-style: none; padding: 0; margin: 0; }
.toc-list li { margin-bottom: 0.25rem; }
.toc-list a {
  color: var(--text-muted);
  font-size: 0.85rem;
  display: block;
  padding: 0.25rem 0;
  border-left: 2px solid transparent;
  padding-left: var(--space-md);
  transition: all var(--transition-fast);
}
.toc-list a:hover,
.toc-list a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

/* --- Footer --- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: var(--space-2xl) 0 var(--space-xl);
  margin-top: auto;
}
.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--space-2xl);
  margin-bottom: var(--space-2xl);
}
.footer-col h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: var(--space-md);
}
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: var(--space-sm); }
.footer-col a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}
.footer-col a:hover { color: var(--text-primary); }
.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: var(--space-lg);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --- Breadcrumbs --- */
.breadcrumbs {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-lg);
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { margin: 0 var(--space-xs); }

/* --- Tags / Categories --- */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: var(--space-md) 0;
}
.tag {
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.tag:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  gap: var(--space-sm);
  justify-content: center;
  margin: var(--space-2xl) 0;
}
.pagination a,
.pagination span {
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-secondary);
}
.pagination a:hover { border-color: var(--accent); color: var(--accent); }
.pagination .active {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

/* --- Responsive --- */
@media (max-width: 1024px) {
  .content-wrapper { flex-direction: column; }
  .sidebar { width: 100%; }
  .toc { position: static; }
}

@media (max-width: 768px) {
  :root {
    --header-height: 56px;
  }

  .nav-toggle { display: block; }

  .main-nav {
    display: none;
    position: absolute;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: var(--space-lg);
    gap: var(--space-md);
  }
  .main-nav.open { display: flex; }

  .nav-search { width: 100%; }

  .card-grid {
    grid-template-columns: 1fr;
  }

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

  .article-header h1 { font-size: 1.5rem; }

  .footer-bottom { flex-direction: column; text-align: center; }

  .content-wrapper { padding: var(--space-lg); }
}

@media (max-width: 480px) {
  .container { padding: 0 var(--space-md); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* --- Print --- */
@media print {
  .site-header, .site-footer, .sidebar { display: none; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
