/* Prevent flash of white - set html background immediately */
html {
  background-color: #faf9f7;
}
html[data-theme="dark"] {
  background-color: #0f0e0d;
}

/* CSS Variables - Light Theme (default) */
:root {
  --bg-primary: #faf9f7;
  --bg-secondary: #f2f0ed;
  --bg-card: #ffffff;
  --bg-elevated: #ffffff;
  --text-primary: #1a1815;
  --text-secondary: #5c5651;
  --text-muted: #9c958e;
  --accent: #d97706;
  --accent-hover: #b45309;
  --accent-light: #fef3c7;
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.08);
  --gradient-hero: linear-gradient(135deg, #fef3c7 0%, #fed7aa 50%, #fecaca 100%);
  --font-display: 'Fraunces', serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

/* Dark Theme */
[data-theme="dark"] {
  --bg-primary: #0f0e0d;
  --bg-secondary: #1a1815;
  --bg-card: #1f1d1a;
  --bg-elevated: #292623;
  --text-primary: #f5f4f2;
  --text-secondary: #b8b3ac;
  --text-muted: #78736c;
  --accent: #f59e0b;
  --accent-hover: #fbbf24;
  --accent-light: rgba(245, 158, 11, 0.15);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.15);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.4);
  --gradient-hero: linear-gradient(135deg, rgba(245, 158, 11, 0.2) 0%, rgba(234, 88, 12, 0.15) 50%, rgba(220, 38, 38, 0.1) 100%);
}

/* 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);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
  text-decoration: none;
}

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

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

/* Navigation */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

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

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--text-primary);
  transition: color 0.2s ease;
}

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

.logo-icon {
  width: 40px;
  height: 40px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 24px;
}

.nav-link {
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

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

.theme-toggle {
  width: 44px;
  height: 44px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.theme-toggle:hover {
  background: var(--bg-card);
  color: var(--accent);
  border-color: var(--border-strong);
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

/* Hero */
.hero {
  padding: 140px 24px 80px;
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 700px;
  margin: 0 auto;
}

.hero-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 8px 16px;
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  line-height: 1.1;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.2rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

.hero-gradient {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--gradient-hero);
  opacity: 0.5;
  z-index: 0;
}

/* Main Content */
.main-content {
  padding: 60px 0 100px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 32px;
}

.section-header h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border-strong);
}

/* Featured Card */
.featured-section {
  margin-bottom: 64px;
}

.featured-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.featured-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--border-strong);
}

.featured-image {
  background: var(--gradient-hero);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 320px;
}

.featured-placeholder {
  width: 120px;
  height: 120px;
  background: var(--bg-card);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  box-shadow: var(--shadow-lg);
}

.featured-content {
  padding: 48px 48px 48px 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.featured-content h3 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 16px;
}

.featured-content h3 a {
  transition: color 0.2s ease;
}

.featured-content h3 a:hover {
  color: var(--accent);
}

.featured-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  line-height: 1.7;
}

/* Article Meta */
.article-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.article-category {
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.article-meta time {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Read More Link */
.read-more {
  color: var(--accent);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.read-more:hover {
  color: var(--accent-hover);
}

/* Articles Grid */
.articles-section {
  margin-bottom: 64px;
}

.articles-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.article-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px;
  transition: all 0.3s ease;
}

.article-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-strong);
  transform: translateY(-4px);
}

.article-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 12px;
}

.article-card h3 a {
  transition: color 0.2s ease;
}

.article-card h3 a:hover {
  color: var(--accent);
}

.article-card p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 16px;
  line-height: 1.6;
}

/* Subscribe Section */
.subscribe-section {
  margin-top: 80px;
}

.subscribe-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 48px;
  text-align: center;
}

.subscribe-card h2 {
  font-family: var(--font-display);
  font-size: 1.75rem;
  font-weight: 600;
  margin-bottom: 12px;
}

.subscribe-card p {
  color: var(--text-secondary);
  margin-bottom: 32px;
}

.subscribe-form {
  display: flex;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.subscribe-form input {
  flex: 1;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text-primary);
  font-family: var(--font-body);
  transition: all 0.2s ease;
}

.subscribe-form input::placeholder {
  color: var(--text-muted);
}

.subscribe-form input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg-card);
}

.subscribe-form button {
  padding: 16px 32px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
}

.subscribe-form button:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
}

/* Footer */
.footer {
  background: var(--bg-secondary);
  padding: 64px 0 32px;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 64px;
  margin-bottom: 48px;
}

.footer-brand {
  max-width: 320px;
}

.footer-brand .logo {
  margin-bottom: 16px;
}

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

.footer-links {
  display: flex;
  gap: 64px;
}

.footer-col h4 {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 16px;
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
  transition: color 0.2s ease;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  padding-top: 32px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-bottom p {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

/* Responsive */
@media (max-width: 900px) {
  .featured-card {
    grid-template-columns: 1fr;
  }

  .featured-image {
    min-height: 200px;
  }

  .featured-content {
    padding: 32px;
  }

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

  .footer-content {
    grid-template-columns: 1fr;
    gap: 48px;
  }

  .footer-links {
    gap: 48px;
  }
}

@media (max-width: 600px) {
  .nav-content {
    height: 64px;
  }

  .nav-link {
    display: none;
  }

  .hero {
    padding: 120px 24px 60px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .subscribe-form {
    flex-direction: column;
  }

  .subscribe-form button {
    width: 100%;
  }

  .footer-links {
    flex-direction: column;
    gap: 32px;
  }
}

/* Article Page Styles */
.article-page {
  padding: 120px 0 80px;
}

.article-header {
  max-width: 720px;
  margin: 0 auto 48px;
  text-align: center;
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 20px;
}

.article-header .article-meta {
  justify-content: center;
}

.article-body {
  max-width: 720px;
  margin: 0 auto;
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 48px 0 20px;
}

.article-body h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
  margin: 32px 0 16px;
}

.article-body p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 24px;
}

.article-body ul,
.article-body ol {
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1.8;
  margin-bottom: 24px;
  padding-left: 24px;
}

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

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

.article-body a {
  color: var(--accent);
  text-decoration: underline;
}

.article-body a:hover {
  color: var(--accent-hover);
}

.article-footer {
  max-width: 720px;
  margin: 64px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.2s ease;
}

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

/* Info Card in Articles */
.info-card {
  background: var(--accent-light);
  border-radius: 16px;
  padding: 24px;
  margin: 32px 0;
}

.info-card h4 {
  color: var(--accent);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.info-card p {
  color: var(--text-primary);
  font-size: 1rem;
  margin-bottom: 0;
}

/* Source Link */
.source-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 8px;
}

.source-link:hover {
  color: var(--accent);
}
