/* ============================================================
   blog.css — Blog-first page layout for LLM 3D Academy
   ============================================================
   Used by module pages that follow the "blog + embedded 3D" pattern.
   Layers on top of common.css.
   ============================================================ */

/* ----------------------------------------------------------
   1. Blog Article Container
   ---------------------------------------------------------- */
.blog-article {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed, 1.75);
}

/* ----------------------------------------------------------
   2. Typography — Article Headings
   ---------------------------------------------------------- */
.blog-article h1 {
  font-size: var(--text-3xl);
  font-weight: 700;
  line-height: var(--leading-tight, 1.25);
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

.blog-article .blog-subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-bottom: 2rem;
  line-height: var(--leading-normal, 1.5);
}

.blog-article h2 {
  font-size: var(--text-2xl);
  font-weight: 600;
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.blog-article h3 {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-top: 2rem;
  margin-bottom: 0.75rem;
  color: var(--text-primary);
}

.blog-article h4 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--text-primary);
}

/* ----------------------------------------------------------
   3. Paragraphs & Inline Elements
   ---------------------------------------------------------- */
.blog-article p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.blog-article strong {
  color: #fff;
  font-weight: 600;
}

.blog-article em {
  color: var(--text-secondary);
  font-style: italic;
}

.blog-article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--color-ffn);
}

.blog-article a {
  color: var(--color-info);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.blog-article a:hover {
  color: var(--color-attention);
}

/* ----------------------------------------------------------
   4. Lists
   ---------------------------------------------------------- */
.blog-article ul,
.blog-article ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.blog-article li {
  margin-bottom: 0.5rem;
}

.blog-article ul li {
  list-style-type: disc;
}

.blog-article ol li {
  list-style-type: decimal;
}

/* ----------------------------------------------------------
   5. Blockquotes — Key Insights / Intuition Boxes
   ---------------------------------------------------------- */
.blog-article blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--color-attention);
  background: rgba(255, 209, 102, 0.06);
  border-radius: 0 8px 8px 0;
  color: var(--text-primary);
  font-size: var(--text-base);
}

.blog-article blockquote p {
  margin-bottom: 0.5rem;
}

.blog-article blockquote p:last-child {
  margin-bottom: 0;
}

/* Callout variant — for tips, warnings */
.blog-article .callout {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-radius: 8px;
  border-left: 3px solid;
}

.blog-article .callout-tip {
  border-left-color: var(--color-success);
  background: rgba(181, 228, 140, 0.06);
}

.blog-article .callout-warning {
  border-left-color: var(--color-warning);
  background: rgba(244, 162, 97, 0.06);
}

.blog-article .callout-info {
  border-left-color: var(--color-info);
  background: rgba(144, 202, 249, 0.06);
}

.blog-article .callout-title {
  font-weight: 600;
  margin-bottom: 0.5rem;
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ----------------------------------------------------------
   6. Formula / Math Blocks
   ---------------------------------------------------------- */
.blog-article .formula {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--text-primary);
  overflow-x: auto;
  text-align: center;
  border: 1px solid var(--border-color);
}

/* ----------------------------------------------------------
   7. Interactive 3D Container
   ---------------------------------------------------------- */
.interactive-3d {
  width: 100%;
  max-width: 960px;
  aspect-ratio: 16 / 9;
  margin: 2rem auto;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.interactive-3d.wide {
  max-width: 100%;
}

.interactive-3d.square {
  aspect-ratio: 1 / 1;
  max-width: 500px;
}

.interactive-3d.portrait {
  aspect-ratio: 3 / 4;
  max-width: 450px;
}

/* Loading state */
.embed-3d-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-secondary);
}

.embed-3d-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top-color: var(--color-info);
  border-radius: 50%;
  animation: embed-spin 0.8s linear infinite;
}

@keyframes embed-spin {
  to { transform: rotate(360deg); }
}

/* Error state */
.embed-3d-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* 3D scene caption */
.interactive-3d + .viz-caption {
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: -1.25rem;
  margin-bottom: 2rem;
}

/* 3D controls bar */
.viz-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.viz-controls button {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.35rem 0.75rem;
  font-size: var(--text-xs);
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}

.viz-controls button:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border-color-hover);
}

.viz-controls button.active {
  background: var(--color-info);
  color: var(--bg-primary);
  border-color: var(--color-info);
}

/* ----------------------------------------------------------
   8. Static Diagrams / SVG Figures
   ---------------------------------------------------------- */
.blog-article figure {
  margin: 2rem 0;
  text-align: center;
}

.blog-article figure img,
.blog-article figure svg {
  max-width: 100%;
  border-radius: 8px;
}

.blog-article figcaption {
  margin-top: 0.5rem;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   9. Step-by-Step Flow Indicators
   ---------------------------------------------------------- */
.step-flow {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin: 1.5rem 0;
}

.step-flow .step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-flow .step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-tertiary);
  color: var(--color-info);
  font-size: var(--text-sm);
  font-weight: 600;
  border: 1px solid var(--border-color);
}

.step-flow .step-content {
  flex: 1;
  padding-top: 3px;
}

.step-flow .step-content strong {
  display: block;
  margin-bottom: 0.25rem;
}

.step-flow .step-content p {
  margin-bottom: 0;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ----------------------------------------------------------
   10. Comparison Table
   ---------------------------------------------------------- */
.blog-article .compare-grid {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.blog-article .compare-grid.cols-2 {
  grid-template-columns: repeat(2, 1fr);
}

.blog-article .compare-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.blog-article .compare-card {
  padding: 1rem;
  background: var(--bg-tertiary);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.blog-article .compare-card h4 {
  margin-top: 0;
  font-size: var(--text-base);
}

.blog-article .compare-card p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ----------------------------------------------------------
   11. Table of Contents (Sidebar / Inline)
   ---------------------------------------------------------- */
.blog-toc {
  position: sticky;
  top: 5rem;
  padding: 1rem 0;
  font-size: var(--text-sm);
}

.blog-toc h3 {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-top: 0;
  margin-bottom: 0.75rem;
}

.blog-toc a {
  display: block;
  padding: 0.25rem 0;
  color: var(--text-secondary);
  text-decoration: none;
  border-left: 2px solid transparent;
  padding-left: 0.75rem;
}

.blog-toc a:hover,
.blog-toc a.active {
  color: var(--text-primary);
  border-left-color: var(--color-info);
}

/* ----------------------------------------------------------
   12. Blog Layout — Sidebar + Content
   ---------------------------------------------------------- */
.blog-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
}

.blog-layout .blog-sidebar {
  display: none;
}

@media (min-width: 1024px) {
  .blog-layout {
    grid-template-columns: 200px 1fr;
  }

  .blog-layout .blog-sidebar {
    display: block;
  }

  .blog-layout .blog-article {
    max-width: none;
  }
}

/* ----------------------------------------------------------
   13. Hero / Chapter Header
   ---------------------------------------------------------- */
.blog-hero {
  text-align: center;
  padding: 3rem 1rem 2rem;
  max-width: 820px;
  margin: 0 auto;
}

.blog-hero h1 {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 0.75rem;
}

.blog-hero .hero-tag {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: var(--bg-tertiary);
  border-radius: 20px;
  font-size: var(--text-xs);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
  margin-bottom: 1rem;
}

.blog-hero .hero-desc {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto;
  line-height: var(--leading-relaxed, 1.75);
}

/* ----------------------------------------------------------
   14. Responsive
   ---------------------------------------------------------- */
@media (max-width: 768px) {
  .blog-article {
    padding: 1.5rem 1rem 3rem;
  }

  .blog-article h1 {
    font-size: var(--text-2xl);
  }

  .blog-article h2 {
    font-size: var(--text-xl);
    margin-top: 2rem;
  }

  .blog-hero h1 {
    font-size: 1.75rem;
  }

  .blog-hero .hero-desc {
    font-size: var(--text-base);
  }

  .interactive-3d {
    aspect-ratio: 4 / 3;
    margin: 1.5rem auto;
    border-radius: 8px;
  }

  .blog-article .compare-grid.cols-2,
  .blog-article .compare-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .step-flow .step {
    gap: 0.75rem;
  }
}

@media (max-width: 480px) {
  .blog-article {
    padding: 1rem 0.75rem 2rem;
  }

  .blog-hero {
    padding: 2rem 0.75rem 1.5rem;
  }

  .interactive-3d {
    aspect-ratio: 1 / 1;
  }
}

/* ----------------------------------------------------------
   15. Print Styles
   ---------------------------------------------------------- */
@media print {
  .interactive-3d {
    display: none;
  }

  .blog-article {
    max-width: none;
    color: #000;
  }

  .blog-toc,
  .blog-sidebar {
    display: none;
  }
}
