/* ============================================
   Autonomous Driving - Neural Horizon Design
   ============================================ */

:root {
  /* Color Palette */
  --bg-primary: #0a0e1a;
  --bg-secondary: #0f1629;
  --bg-card: #141b2d;
  --bg-card-hover: #1a2340;
  
  --accent-cyan: #00d4ff;
  --accent-purple: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --border-color: #1e293b;
  --border-glow: rgba(0, 212, 255, 0.3);
  
  /* Typography */
  --font-main: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Outfit', var(--font-main);
  
  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;
  --space-xl: 3rem;
  --space-2xl: 4rem;
  
  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;
  
  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.2);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

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

a:hover {
  color: var(--text-primary);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

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

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) 0;
  min-height: 70px;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  text-decoration: none;
  color: var(--text-primary);
}

.logo {
  width: 48px;
  height: 48px;
  background: var(--accent-gradient);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-glow);
}

.brand-text .title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-text .tagline {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-menu {
  display: flex;
  list-style: none;
  gap: var(--space-xs);
}

.nav-item a {
  display: block;
  padding: var(--space-xs) var(--space-sm);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.nav-item a:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

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

/* Hero Section */
.hero {
  position: relative;
  min-height: 500px;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(10, 14, 26, 0.85) 0%,
    rgba(10, 14, 26, 0.7) 50%,
    rgba(10, 14, 26, 0.5) 100%
  );
}

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

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: var(--space-md);
  color: #ffffff;
  text-shadow: 
    2px 2px 0 #000,
    -2px 2px 0 #000,
    2px -2px 0 #000,
    -2px -2px 0 #000,
    0 4px 12px rgba(0, 0, 0, 0.6);
}

.hero p {
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-lg);
  max-width: 600px;
}

.hero .cta-buttons {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

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

.btn-primary {
  background: var(--accent-gradient);
  color: var(--bg-primary);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 30px rgba(0, 212, 255, 0.4);
  color: var(--bg-primary);
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--accent-cyan);
  color: var(--text-primary);
}

/* Stats Section */
.stats-section {
  padding: var(--space-xl) 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-md);
}

.stat-card {
  text-align: center;
  padding: var(--space-md);
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Section Common */
.section {
  padding: var(--space-2xl) 0;
}

.section-header {
  margin-bottom: var(--space-xl);
}

.section-title {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.section-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--transition-base);
  text-decoration: none;
  color: var(--text-primary);
  display: block;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent-cyan);
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg), var(--shadow-glow);
  color: var(--text-primary);
}

.card h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
}

.card p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* News Section */
.news-section {
  background: var(--bg-secondary);
  padding: var(--space-2xl) 0;
}

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

.news-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
}

.news-item:hover {
  border-color: var(--accent-cyan);
  background: var(--bg-card-hover);
}

.news-item a {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  color: var(--text-primary);
  text-decoration: none;
  width: 100%;
}

.news-date {
  font-size: 0.85rem;
  color: var(--accent-cyan);
  font-weight: 500;
  white-space: nowrap;
}

.news-title {
  font-size: 0.95rem;
  color: var(--text-secondary);
}

.news-item:hover .news-title {
  color: var(--text-primary);
}

.news-more {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
  color: var(--accent-cyan);
  font-weight: 500;
}

.news-more:hover {
  color: var(--text-primary);
}

/* Page Layout (2-column) */
.page-layout {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: var(--space-xl);
  padding: var(--space-xl) 0;
}

.page-main {
  min-width: 0;
}

.page-sidebar {
  position: sticky;
  top: 90px;
  height: fit-content;
}

/* Article Content */
.article-content h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: var(--space-lg);
  line-height: 1.3;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: var(--space-xl) 0 var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--border-color);
}

.article-content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: var(--space-lg) 0 var(--space-sm);
}

.article-content p {
  margin-bottom: var(--space-md);
  color: var(--text-secondary);
}

.article-content ul, .article-content ol {
  margin: var(--space-md) 0;
  padding-left: var(--space-lg);
}

.article-content li {
  margin-bottom: var(--space-xs);
  color: var(--text-secondary);
}

/* Sidebar */
.sidebar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
}

.sidebar-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: var(--space-sm);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.sidebar-section ul {
  list-style: none;
}

.sidebar-section li {
  margin-bottom: var(--space-xs);
}

.sidebar-section a {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.sidebar-section a:hover {
  color: var(--accent-cyan);
}

/* TOC */
.toc ol {
  list-style: none;
  counter-reset: toc-counter;
}

.toc li {
  counter-increment: toc-counter;
  margin-bottom: var(--space-xs);
}

.toc li::before {
  content: counter(toc-counter) ". ";
  color: var(--accent-cyan);
  font-weight: 500;
}

.toc a {
  color: var(--text-secondary);
}

.toc a:hover {
  color: var(--text-primary);
}

/* Banner */
.amazon-banner {
  background: var(--accent-gradient);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  text-align: center;
  margin: var(--space-md) 0;
}

.amazon-banner a {
  color: var(--bg-primary);
  font-weight: 600;
  font-size: 0.9rem;
}

/* Glossary Link */
.glossary-link {
  color: var(--accent-cyan);
  border-bottom: 1px dotted var(--accent-cyan);
}

.glossary-link:hover {
  color: var(--text-primary);
  border-color: var(--text-primary);
}

/* Footer */
footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: var(--space-xl) 0;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: var(--space-lg);
  margin-bottom: var(--space-md);
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.footer-links a:hover {
  color: var(--text-primary);
}

footer p {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Responsive */
@media (max-width: 1024px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .page-layout {
    grid-template-columns: 1fr;
  }
  
  .page-sidebar {
    position: static;
    order: -1;
  }
}

@media (max-width: 768px) {
  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: var(--space-md);
  }
  
  .nav-menu.active {
    display: flex;
  }
  
  .nav-item a {
    padding: var(--space-sm);
    border-bottom: 1px solid var(--border-color);
  }
  
  .hamburger {
    display: block;
  }
  
  .hero {
    min-height: 400px;
  }
  
  .hero h1 {
    font-size: 1.75rem;
  }
  
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .footer-links {
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .cta-buttons {
    flex-direction: column;
  }
  
  .btn {
    width: 100%;
    justify-content: center;
  }
}
