/*
 * Theme System
 * ------------
 * Dark theme with indigo/purple accent colors.
 *
 * Color scale: bg-primary (darkest) -> bg-secondary -> bg-card -> bg-card-hover
 * Text scale: text-primary (brightest) -> text-secondary -> text-muted
 * Accent: indigo base with purple/pink gradient highlights
 */
:root {
  /* Backgrounds - dark to light */
  --bg-primary: #0a0a0b;
  --bg-secondary: #141416;
  --bg-card: #1a1a1d;
  --bg-card-hover: #222225;

  /* Text - light to muted */
  --text-primary: #f5f5f7;
  --text-secondary: #a1a1a6;
  --text-muted: #6e6e73;

  /* Accent colors */
  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-glow: rgba(99, 102, 241, 0.15);

  /* Borders */
  --border: #2a2a2e;

  /* Gradients - reusable accent gradient */
  --gradient-accent: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #d946ef 100%);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}

/* Animated gradient background */
.bg-gradient {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 20% 20%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(14, 165, 233, 0.05) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

/* Container */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header - Base styles for all headers */
.page-header {
  text-align: center;
}

.page-header h1 {
  font-weight: 700;
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.02em;
}

/* Index page header */
.page-header--index {
  padding: 60px 0 40px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 60px;
}

.page-header--index h1 {
  font-size: 2.75rem;
  margin-bottom: 16px;
}

.page-header--index p {
  color: var(--text-secondary);
  font-size: 1.15rem;
  max-width: 500px;
  margin: 0 auto;
}

/* Article page header */
.page-header--article {
  padding: 0;
  margin-bottom: 48px;
}

.page-header--article h1 {
  font-size: 2.5rem;
  line-height: 1.2;
  margin-bottom: 24px;
}

/* Navigation */
nav {
  padding: 20px 0;
  position: sticky;
  top: 0;
  background: rgba(10, 10, 11, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 100;
  border-bottom: 1px solid var(--border);
}

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

.nav-brand {
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-primary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-brand span {
  background: var(--gradient-accent);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-back {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.2s;
}

.nav-back:hover {
  color: var(--accent);
}

/* Card Grid */
.card-grid {
  display: grid;
  gap: 24px;
  padding-bottom: 80px;
}

.empty-state {
  text-align: center;
  color: var(--text-primary);
  padding: 60px 20px;
}

/* Article Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  display: flex;
  align-items: stretch;
  gap: 24px;
  position: relative;
  overflow: hidden;
}

.card-thumbnail {
  flex-shrink: 0;
  align-self: center;
  width: 225px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-secondary);
}

.card-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

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

.card-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity 0.3s;
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  transform: translateY(-4px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3), 0 0 60px var(--accent-glow);
}

.card:hover::before {
  opacity: 1;
}

.card-number {
  font-size: 0.8rem;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.card h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

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

.card-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 1.5rem;
  transition: all 0.3s;
  padding-left: 16px;
}

.card:hover .card-arrow {
  color: var(--accent);
  transform: translateX(4px);
}

/* Article Page */
article {
  padding: 60px 0 100px;
}

/* Video Thumbnail */
.video-thumbnail {
  display: block;
  position: relative;
  max-width: 640px;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  aspect-ratio: 16 / 9;
}

.video-thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}

.video-thumbnail:hover img {
  transform: scale(1.02);
}

.video-thumbnail .play-button {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 68px;
  height: 48px;
  background: #ff0000;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.video-thumbnail:hover .play-button {
  background: #cc0000;
  transform: translate(-50%, -50%) scale(1.1);
}

.video-thumbnail .play-button::after {
  content: '';
  border-style: solid;
  border-width: 10px 0 10px 18px;
  border-color: transparent transparent transparent #fff;
  margin-left: 4px;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.article-meta a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent-glow);
  border-radius: 8px;
  transition: all 0.2s;
}

.article-meta a:hover {
  background: rgba(99, 102, 241, 0.25);
}

.article-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 48px;
}

.article-content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 40px 0 20px;
  color: var(--text-primary);
  position: relative;
  padding-left: 20px;
}

.article-content h2:first-child {
  margin-top: 0;
}

.article-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 4px;
  background: var(--gradient-accent);
  border-radius: 2px;
}

.article-content h3 {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 32px 0 16px;
  color: var(--text-primary);
}

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

.article-content ul, .article-content ol {
  color: var(--text-secondary);
  margin: 16px 0;
  padding-left: 24px;
}

.article-content li {
  margin-bottom: 12px;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 20px;
  margin: 24px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Footer */
footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Animations */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeInUp 0.6s ease forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }

/* Reading progress bar */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  background: var(--gradient-accent);
  width: 0%;
  z-index: 1000;
  transition: width 0.1s ease;
}

/* Responsive */
@media (max-width: 768px) {
  .page-header--index h1 {
    font-size: 2rem;
  }

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

  .article-content {
    padding: 28px;
  }

  .card {
    flex-direction: column;
    padding: 20px;
    gap: 16px;
  }

  .card-thumbnail {
    width: 100%;
  }

  .card-arrow {
    display: none;
  }
}
