:root {
  --bg: #0f1a12;
  --bg-elevated: #16241a;
  --bg-card: #1a2e20;
  --bg-card-hover: #1f3828;
  --border: #2a4a34;
  --border-light: #355c42;
  --text: #e8f0ea;
  --text-muted: #9bb8a4;
  --text-dim: #6b8f78;
  --accent: #4ade80;
  --accent-dark: #22c55e;
  --accent-glow: rgba(74, 222, 128, 0.15);
  --warning: #fbbf24;
  --danger: #f87171;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(15, 26, 18, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { color: var(--accent); display: flex; }
.brand-text h1 { font-size: 1.1rem; font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
.brand-sub { font-size: 0.7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.08em; }

.site-nav { display: flex; gap: 8px; }
.site-nav a {
  color: var(--text-muted); text-decoration: none;
  font-size: 0.875rem; font-weight: 500;
  padding: 6px 12px; border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}
.site-nav a:hover { color: var(--text); background: var(--bg-card); }

.nav-toggle {
  display: none; background: none; border: none;
  cursor: pointer; padding: 8px; flex-direction: column;
  gap: 5px; width: 36px;
}
.nav-toggle span {
  display: block; height: 2px; background: var(--text);
  border-radius: 2px; transition: var(--transition);
}

/* Hero */
.hero {
  padding: 80px 24px 60px;
  background: linear-gradient(180deg, var(--bg-elevated) 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-inner { max-width: 720px; margin: 0 auto; text-align: center; }
.hero-tag {
  display: inline-block; font-size: 0.75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--accent); background: var(--accent-glow);
  padding: 4px 14px; border-radius: 20px; margin-bottom: 20px;
}
.hero h2 { font-size: 2.5rem; font-weight: 800; line-height: 1.15; letter-spacing: -0.02em; margin-bottom: 16px; }
.hero-lead { font-size: 1.1rem; color: var(--text-muted); max-width: 560px; margin: 0 auto 32px; line-height: 1.7; }

.hero-stats { display: flex; justify-content: center; gap: 40px; }
.stat { text-align: center; }
.stat strong { display: block; font-size: 1.8rem; font-weight: 800; color: var(--accent); }
.stat span { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; }

/* Sections */
section { padding: 60px 24px; }
.section-header { max-width: 720px; margin: 0 auto 32px; text-align: center; }
.section-header h2 { font-size: 1.6rem; font-weight: 700; margin-bottom: 8px; }
.section-header p { color: var(--text-muted); font-size: 0.95rem; }

/* Controls */
.controls { max-width: 1200px; margin: 0 auto 20px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-wrap { flex: 1; min-width: 200px; }
.search-wrap input {
  width: 100%; padding: 10px 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.9rem; font-family: var(--font);
  transition: border-color var(--transition);
}
.search-wrap input:focus { outline: none; border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-dim); }

.view-toggle { display: flex; background: var(--bg-card); border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.view-btn {
  padding: 8px 16px; background: none; border: none;
  color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.view-btn.active { background: var(--accent); color: var(--bg); }
.view-btn:hover:not(.active) { color: var(--text); background: var(--bg-card-hover); }

/* Filter Tabs */
.filter-tabs {
  max-width: 1200px; margin: 0 auto 24px;
  display: flex; gap: 8px; flex-wrap: wrap;
}
.tab {
  padding: 8px 18px; border-radius: 20px;
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-muted); font-size: 0.85rem; font-weight: 500;
  cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.tab:hover { border-color: var(--border-light); color: var(--text); }
.tab.active { background: var(--accent); color: var(--bg); border-color: var(--accent); }

/* Story Grid */
.story-grid {
  max-width: 1200px; margin: 0 auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.story-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: all var(--transition);
  position: relative;
}
.story-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); transform: translateY(-2px); box-shadow: var(--shadow); }
.story-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card-year {
  position: absolute; top: 14px; right: 14px;
  background: var(--accent); color: var(--bg);
  font-size: 0.7rem; font-weight: 700;
  padding: 3px 10px; border-radius: 12px;
  z-index: 2;
}

.card-category {
  display: inline-block; font-size: 0.65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 10px;
  margin-bottom: 10px;
}
.cat-debutant { background: rgba(74, 222, 128, 0.15); color: #4ade80; }
.cat-heritage { background: rgba(96, 165, 250, 0.15); color: #60a5fa; }
.cat-conflict { background: rgba(251, 191, 36, 0.15); color: #fbbf24; }
.cat-upset { background: rgba(248, 113, 113, 0.15); color: #f87171; }

.card-body { padding: 20px; }
.card-body h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; line-height: 1.3; }
.card-body .card-nation { font-size: 0.8rem; color: var(--accent); font-weight: 600; margin-bottom: 8px; }
.card-body p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.card-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.card-footer span { font-size: 0.75rem; color: var(--text-dim); }
.card-actions { display: flex; gap: 8px; }
.icon-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 4px; border-radius: 4px;
  font-size: 1rem; transition: all var(--transition);
  display: flex; align-items: center; gap: 4px;
}
.icon-btn:hover { color: var(--accent); background: var(--accent-glow); }
.icon-btn.bookmarked { color: var(--warning); }

/* Timeline */
.story-timeline { max-width: 800px; margin: 0 auto; position: relative; }
.story-timeline::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.timeline-item {
  position: relative; padding-left: 56px; margin-bottom: 28px;
}
.timeline-item::before {
  content: ''; position: absolute; left: 14px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg);
}
.timeline-year { font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.timeline-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 16px;
  cursor: pointer; transition: all var(--transition);
}
.timeline-card:hover { border-color: var(--border-light); background: var(--bg-card-hover); }
.timeline-card h4 { font-size: 0.95rem; font-weight: 600; margin-bottom: 4px; }
.timeline-card p { font-size: 0.8rem; color: var(--text-muted); }

/* Empty State */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-dim); }
.empty-state p { margin-bottom: 12px; }
.btn-text {
  background: none; border: none; color: var(--accent);
  cursor: pointer; font-size: 0.9rem; font-weight: 500;
  font-family: var(--font); text-decoration: underline;
}

/* Bookmarks */
.bookmarks-section { background: var(--bg-elevated); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }

/* About */
.about-content { max-width: 720px; margin: 0 auto; }
.about-content p { color: var(--text-muted); margin-bottom: 16px; line-height: 1.7; }
.about-meta { display: flex; gap: 24px; flex-wrap: wrap; margin-top: 20px; font-size: 0.75rem; color: var(--text-dim); }

/* Content Section */
.content-section { background: var(--bg-elevated); border-top: 1px solid var(--border); }
.content-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.content-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
}
.content-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 10px; color: var(--accent); }
.content-card p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.7; }

/* FAQ */
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-list dt { font-weight: 600; margin-top: 20px; font-size: 0.95rem; }
.faq-list dd { color: var(--text-muted); font-size: 0.9rem; margin-top: 6px; line-height: 1.7; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.7); backdrop-filter: blur(4px); }
.modal-panel {
  position: relative; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius);
  max-width: 680px; width: 90%; max-height: 85vh; overflow-y: auto;
  padding: 32px; box-shadow: var(--shadow-lg);
}
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none; color: var(--text-dim);
  font-size: 1.5rem; cursor: pointer; padding: 4px 8px;
  border-radius: 4px; transition: all var(--transition);
}
.modal-close:hover { color: var(--text); background: var(--bg-card); }

.modal-year { font-size: 0.75rem; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.modal-title { font-size: 1.4rem; font-weight: 800; margin-bottom: 4px; }
.modal-nation { font-size: 0.85rem; color: var(--accent); font-weight: 600; margin-bottom: 16px; }
.modal-section { margin-top: 20px; }
.modal-section h4 { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); margin-bottom: 8px; }
.modal-section p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.7; }
.modal-actions { display: flex; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.btn-primary {
  padding: 10px 20px; background: var(--accent); color: var(--bg);
  border: none; border-radius: var(--radius-sm); font-size: 0.85rem;
  font-weight: 600; cursor: pointer; font-family: var(--font);
  transition: all var(--transition);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-secondary {
  padding: 10px 20px; background: var(--bg-card); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 500; cursor: pointer;
  font-family: var(--font); transition: all var(--transition);
}
.btn-secondary:hover { border-color: var(--border-light); background: var(--bg-card-hover); }

/* Footer */
.site-footer { border-top: 1px solid var(--border); padding: 24px; }
.footer-inner { max-width: 1200px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.footer-inner p { font-size: 0.8rem; color: var(--text-dim); }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 0.8rem; color: var(--text-dim); text-decoration: none; transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text); padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.85rem; box-shadow: var(--shadow);
  z-index: 300; transition: opacity 0.3s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .site-nav { display: none; }
  .nav-toggle { display: flex; }
  .site-nav.open {
    display: flex; flex-direction: column; position: absolute;
    top: 64px; left: 0; right: 0;
    background: var(--bg-elevated); border-bottom: 1px solid var(--border);
    padding: 12px 24px;
  }
  .hero h2 { font-size: 1.8rem; }
  .hero-stats { gap: 24px; }
  .stat strong { font-size: 1.4rem; }
  .story-grid { grid-template-columns: 1fr; }
  .content-grid { grid-template-columns: 1fr; }
  .modal-panel { padding: 24px 20px; width: 95%; }
  .footer-inner { flex-direction: column; text-align: center; }
}

@media (max-width: 480px) {
  .hero { padding: 48px 16px 40px; }
  section { padding: 40px 16px; }
  .hero h2 { font-size: 1.5rem; }
  .filter-tabs { gap: 6px; }
  .tab { padding: 6px 12px; font-size: 0.78rem; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
