/* ===================================
   BLOG ARTICLE PAGE ENHANCED STYLES WITH DARK MODE
   =================================== */

/* ===================================
   COLOR VARIABLES
   =================================== */
:root {
  /* Light Mode Colors */
  --bg-primary: #ffffff;
  --bg-secondary: #f8f9fa;
  --bg-tertiary: #f1f3f5;
  --text-primary: #1a202c;
  --text-secondary: #64748b;
  --text-tertiary: #94a3b8;
  --border-color: #e2e8f0;
  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --code-bg: #f1f5f9;
  --code-text: #334155;
  --link-color: #6366f1;
  --link-hover: #4f46e5;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-accent: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(139, 92, 246, 0.1));
}

/* Dark Mode Colors */
[data-theme="dark"] {
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --text-primary: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-tertiary: #94a3b8;
  --border-color: #334155;
  --accent-primary: #818cf8;
  --accent-secondary: #a78bfa;
  --code-bg: #1e293b;
  --code-text: #e2e8f0;
  --link-color: #818cf8;
  --link-hover: #a78bfa;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  --gradient-primary: linear-gradient(135deg, #4c1d95 0%, #581c87 100%);
  --gradient-accent: linear-gradient(135deg, rgba(129, 140, 248, 0.2), rgba(167, 139, 250, 0.2));
}

/* Auto Dark Mode based on system preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --accent-primary: #818cf8;
    --accent-secondary: #a78bfa;
    --code-bg: #1e293b;
    --code-text: #e2e8f0;
    --link-color: #818cf8;
    --link-hover: #a78bfa;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.6);
  }
}

/* ===================================
   DARK MODE TOGGLE BUTTON
   =================================== */
.dark-mode-toggle {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-primary);
  border: none;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9999;
  color: white;
  font-size: 1.5rem;
}

.dark-mode-toggle:hover {
  transform: scale(1.1);
  background: var(--accent-secondary);
}

.dark-mode-toggle:active {
  transform: scale(0.95);
}

/* ===================================
   BASE STYLES
   =================================== */
body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===================================
   ARTICLE CONTAINER
   =================================== */
.article-container {
  background-color: var(--bg-primary);
  padding: 4rem 0 6rem;
  min-height: 100vh;
}

.article-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ===================================
   ARTICLE HEADER
   =================================== */
.article-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 2px solid var(--border-color);
  animation: fadeInUp 0.6s ease-out;
}

.article-eyebrow {
  display: inline-block;
  padding: 0.5rem 1.25rem;
  background: var(--gradient-accent);
  color: var(--accent-primary);
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  border-radius: 50px;
  margin-bottom: 1.5rem;
}

.article-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}

.article-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 700px;
  margin: 0 auto;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  flex-wrap: wrap;
}

.article-meta-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-tertiary);
  font-size: 0.9375rem;
}

.article-meta-icon {
  font-size: 1.125rem;
}

/* ===================================
   FEATURED IMAGE
   =================================== */
.article-featured-image {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 3rem;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  aspect-ratio: 16 / 9;
}

.article-featured-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.article-featured-image:hover img {
  transform: scale(1.03);
}

/* ===================================
   ARTICLE CONTENT
   =================================== */
.article-content {
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.8;
  font-size: 1.0625rem;
}

.article-content p {
  margin-bottom: 1.5rem;
  color: var(--text-primary);
}

.article-content h2 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  margin: 3rem 0 1.5rem;
  line-height: 1.3;
  position: relative;
  padding-left: 1.25rem;
}

.article-content h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.5rem;
  width: 4px;
  height: calc(100% - 1rem);
  background: var(--gradient-primary);
  border-radius: 2px;
}

.article-content h3 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  line-height: 1.4;
}

.article-content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.article-content a {
  color: var(--link-color);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: all 0.2s ease;
}

.article-content a:hover {
  color: var(--link-hover);
  border-bottom-color: var(--link-hover);
}

/* ===================================
   BLOCKQUOTE
   =================================== */
.article-content blockquote {
  margin: 2rem 0;
  padding: 1.5rem 2rem;
  background: var(--bg-secondary);
  border-left: 4px solid var(--accent-primary);
  border-radius: 0 8px 8px 0;
  font-style: italic;
  color: var(--text-secondary);
  box-shadow: var(--shadow-sm);
}

.article-content blockquote p {
  margin: 0;
}

/* ===================================
   CODE BLOCKS
   =================================== */
.article-content code {
  background: var(--code-bg);
  color: var(--code-text);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
}

.article-content pre {
  background: var(--code-bg);
  padding: 1.5rem;
  border-radius: 12px;
  overflow-x: auto;
  margin: 2rem 0;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.article-content pre code {
  background: transparent;
  padding: 0;
  color: var(--code-text);
}

/* ===================================
   LISTS
   =================================== */
.article-content ul,
.article-content ol {
  margin: 1.5rem 0;
  padding-left: 2rem;
}

.article-content li {
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.article-content ul li::marker {
  color: var(--accent-primary);
}

.article-content ol li::marker {
  color: var(--accent-primary);
  font-weight: 600;
}

/* ===================================
   INFO BOX / CALLOUT
   =================================== */
.info-box {
  background: var(--gradient-accent);
  border-left: 4px solid var(--accent-primary);
  padding: 1.5rem;
  border-radius: 8px;
  margin: 2rem 0;
}

.info-box-title {
  font-weight: 700;
  color: var(--accent-primary);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.info-box-title::before {
  content: "💡";
  font-size: 1.25rem;
}

.info-box p {
  margin: 0;
  color: var(--text-primary);
}

/* ===================================
   FAQ SECTION
   =================================== */
.faq-section {
  margin-top: 3rem;
  padding-top: 3rem;
  border-top: 2px solid var(--border-color);
}

.faq-item {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
  transition: all 0.3s ease;
}

.faq-item:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.faq-question {
  font-weight: 700;
  color: var(--text-primary);
  font-size: 1.125rem;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.faq-question::before {
  content: "Q";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--accent-primary);
  color: white;
  border-radius: 50%;
  font-size: 0.875rem;
  font-weight: 700;
  flex-shrink: 0;
}

.faq-answer {
  color: var(--text-secondary);
  line-height: 1.7;
  margin-left: 2.25rem;
}

/* ===================================
   CTA SECTION
   =================================== */
.article-cta {
  margin: 4rem 0 2rem;
  padding: 3rem;
  background: var(--gradient-primary);
  border-radius: 16px;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.article-cta h3 {
  color: white;
  font-size: 2rem;
  margin-bottom: 1rem;
}

.article-cta p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.125rem;
  margin-bottom: 2rem;
}

.article-cta .button {
  background: white;
  color: var(--accent-primary);
  padding: 1rem 2.5rem;
  font-weight: 600;
  font-size: 1.0625rem;
  border-radius: 50px;
  text-decoration: none;
  display: inline-block;
  transition: all 0.3s ease;
}

.article-cta .button:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

/* ===================================
   BACK BUTTON
   =================================== */
.back-button-container {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border-color);
}

.back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.back-button::before {
  content: "←";
  font-size: 1.25rem;
  transition: transform 0.2s ease;
}

.back-button:hover {
  color: var(--accent-primary);
}

.back-button:hover::before {
  transform: translateX(-4px);
}

/* ===================================
   REFERENCES
   =================================== */
.references {
  font-size: 0.9375rem;
  color: var(--text-tertiary);
  font-style: italic;
  padding: 1.5rem;
  background: var(--bg-secondary);
  border-radius: 8px;
  margin: 2rem 0;
  border-left: 3px solid var(--accent-primary);
}

/* ===================================
   ANIMATIONS
   =================================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.article-content > * {
  animation: fadeInUp 0.6s ease-out both;
}

.article-content > *:nth-child(1) { animation-delay: 0.1s; }
.article-content > *:nth-child(2) { animation-delay: 0.15s; }
.article-content > *:nth-child(3) { animation-delay: 0.2s; }
.article-content > *:nth-child(4) { animation-delay: 0.25s; }
.article-content > *:nth-child(5) { animation-delay: 0.3s; }

/* ===================================
   RESPONSIVE DESIGN
   =================================== */
@media (max-width: 768px) {
  .article-container {
    padding: 2rem 0 4rem;
  }

  .article-wrapper {
    padding: 0 1rem;
  }

  .article-title {
    font-size: 1.75rem;
  }

  .article-subtitle {
    font-size: 1.0625rem;
  }

  .article-content {
    font-size: 1rem;
  }

  .article-content h2 {
    font-size: 1.5rem;
    margin: 2rem 0 1rem;
  }

  .article-content h3 {
    font-size: 1.25rem;
  }

  .article-cta {
    padding: 2rem 1.5rem;
  }

  .article-cta h3 {
    font-size: 1.5rem;
  }

  .dark-mode-toggle {
    bottom: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
  }

  .faq-question {
    font-size: 1rem;
  }

  .faq-answer {
    margin-left: 1.75rem;
  }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
  .dark-mode-toggle,
  .back-button-container {
    display: none;
  }

  .article-content {
    color: black;
  }

  .article-content a {
    color: #0066cc;
    text-decoration: underline;
  }
}

/* ===================================
   ACCESSIBILITY
   =================================== */
.article-content :focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 4px;
  border-radius: 4px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
