/*
 * AInovaq Child — TOFU-specific CSS
 * Scoped under .tofu-article so nothing leaks to other pages.
 * Covers: article layout grid, TOC sidebar, article content typography,
 * stat block, callout boxes, pull quotes, FAQ accordion, internal links,
 * comparison table, reading progress, dark mode.
 */

/* ══════════════════════════════════════════════════════════
   ARTICLE LAYOUT — TOC sidebar (220px) + content column
   ══════════════════════════════════════════════════════════ */
.tofu-article .article-layout {
  max-width: var(--full-width);
  margin: 0 auto;
  padding: 48px 32px 80px;
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 64px;
  align-items: start;
}

/* ══════════════════════════════════════════════════════════
   STICKY TOC SIDEBAR
   ══════════════════════════════════════════════════════════ */
.tofu-article .toc-sidebar {
  position: sticky;
  top: calc(var(--nav-height) + 32px);
  max-height: calc(100vh - var(--nav-height) - 64px);
  overflow-y: auto;
  scrollbar-width: none;
}

.tofu-article .toc-sidebar::-webkit-scrollbar { display: none; }

.tofu-article .toc-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-caption);
  margin-bottom: 16px;
}

.tofu-article .toc-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.tofu-article .toc-list a {
  display: block;
  font-size: 13px;
  font-weight: 450;
  color: var(--text-caption);
  padding: 6px 12px;
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
  text-decoration: none;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
  line-height: 1.4;
}

.tofu-article .toc-list a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.tofu-article .toc-list a.active {
  color: var(--royal-blue);
  border-left-color: var(--royal-blue);
  background: rgba(36,60,143,0.04);
  font-weight: 500;
}

[data-theme="dark"] .tofu-article .toc-list a.active {
  color: var(--teal);
  border-left-color: var(--teal);
  background: rgba(112,195,197,0.06);
}

.tofu-article .toc-list .toc-h3 {
  padding-left: 24px;
  font-size: 12.5px;
}

/* ══════════════════════════════════════════════════════════
   ARTICLE CONTENT — typography
   ══════════════════════════════════════════════════════════ */
.tofu-article .article-content {
  max-width: var(--content-width);
  min-width: 0;
}

.tofu-article .article-content h2 {
  font-family: var(--font-sans);
  font-size: 1.75rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-top: 56px;
  margin-bottom: 20px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.tofu-article .article-content h3 {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-top: 40px;
  margin-bottom: 14px;
  scroll-margin-top: calc(var(--nav-height) + 24px);
}

.tofu-article .article-content p {
  font-size: 1.05rem;
  line-height: 1.78;
  color: var(--text-secondary);
  margin-bottom: 22px;
}


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

/* Lists */
.tofu-article .article-content ul,
.tofu-article .article-content ol {
  margin-bottom: 22px;
  padding-left: 24px;
}

.tofu-article .article-content li {
  font-size: 1.02rem;
  line-height: 1.72;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.tofu-article .article-content ul li::marker { color: var(--teal); }
.tofu-article .article-content ol li::marker { color: var(--royal-blue); font-weight: 600; }
[data-theme="dark"] .tofu-article .article-content ol li::marker { color: var(--teal); }

/* Links inside content */
.tofu-article .article-content p a,
.tofu-article .article-content li a {
  font-weight: 500;
  text-underline-offset: 3px;
  text-decoration: underline;
  text-decoration-color: rgba(36,60,143,0.25);
}

.tofu-article .article-content p a:hover,
.tofu-article .article-content li a:hover {
  text-decoration-color: var(--royal-blue);
}

/* Inline code */
.tofu-article .article-content code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-tertiary);
  color: var(--royal-blue);
  padding: 2px 6px;
  border-radius: 4px;
}

[data-theme="dark"] .tofu-article .article-content code {
  background: rgba(36,60,143,0.2);
  color: var(--teal);
}

/* ══════════════════════════════════════════════════════════
   STAT BLOCK
   ══════════════════════════════════════════════════════════ */
.tofu-article .stat-block {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin: 36px 0;
}

.tofu-article .stat-card {
  padding: 24px;
  border-radius: 12px;
  background: var(--surface-stat);
  border: 1px solid var(--border-subtle);
  text-align: center;
}

.tofu-article .stat-number {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1.2;
  margin-bottom: 6px;
}

.tofu-article .stat-label {
  font-size: 0.82rem;
  color: var(--text-caption);
  line-height: 1.4;
}

/* ══════════════════════════════════════════════════════════
   CALLOUT / KEY INSIGHT BOX
   ══════════════════════════════════════════════════════════ */
.tofu-article .callout-box {
  margin: 32px 0;
  padding: 24px 28px;
  border-radius: 12px;
  background: var(--surface-callout);
  border: 1px solid var(--surface-callout-border);
}

.tofu-article .callout-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--royal-blue);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

[data-theme="dark"] .tofu-article .callout-label { color: var(--teal); }
.tofu-article .callout-label svg { width: 16px; height: 16px; flex-shrink: 0; }

.tofu-article .callout-box p {
  font-size: 0.98rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  line-height: 1.68;
}

/* ══════════════════════════════════════════════════════════
   PULL QUOTE
   ══════════════════════════════════════════════════════════ */
.tofu-article .pull-quote {
  margin: 40px 0;
  padding: 28px 0 28px 28px;
  border-left: 3px solid;
  border-image: var(--grad) 1;
}

.tofu-article .pull-quote p {
  font-family: var(--font-sans);
  font-size: 1.25rem;
  font-style: italic;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.tofu-article .pull-quote cite {
  font-family: var(--font-sans);
  font-style: normal;
  font-size: 0.85rem;
  color: var(--text-caption);
  font-weight: 500;
}

/* ══════════════════════════════════════════════════════════
   COMPARISON TABLE
   ══════════════════════════════════════════════════════════ */
.tofu-article .comparison-table-wrap {
  margin: 32px 0;
  border-radius: 12px;
  border: 1px solid var(--border-primary);
  overflow: hidden;
}

.tofu-article .comparison-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

.tofu-article .comparison-table thead {
  background: var(--bg-tertiary);
}

.tofu-article .comparison-table th {
  padding: 14px 20px;
  text-align: left;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-caption);
  border-bottom: 1px solid var(--border-primary);
}

.tofu-article .comparison-table td {
  padding: 14px 20px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border-subtle);
  line-height: 1.5;
}

.tofu-article .comparison-table tr:last-child td { border-bottom: none; }
.tofu-article .comparison-table tbody tr:hover { background: var(--bg-tertiary); }

/* ══════════════════════════════════════════════════════════
   INTERNAL LINKS / CONTINUE READING BOX
   ══════════════════════════════════════════════════════════ */
.tofu-article .internal-links {
  margin-top: 48px;
  padding: 24px 28px;
  border-radius: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-subtle);
}

.tofu-article .internal-links-title {
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-caption);
  margin-bottom: 12px;
}

.tofu-article .internal-links ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tofu-article .internal-links li a {
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--royal-blue);
}

[data-theme="dark"] .tofu-article .internal-links li a { color: var(--teal); }

.tofu-article .internal-links li a::before {
  content: '\2192';
  color: var(--text-caption);
  font-size: 0.85rem;
  flex-shrink: 0;
}

.tofu-article .internal-links li a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ══════════════════════════════════════════════════════════
   FAQ ACCORDION
   ══════════════════════════════════════════════════════════ */
.tofu-article .faq-section {
  margin-top: 24px;
}

.tofu-article .faq-section > h2 {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 24px;
  letter-spacing: -0.02em;
}

.tofu-article .faq-item {
  border-bottom: 1px solid var(--border-subtle);
  padding: 20px 0;
}

.tofu-article .faq-question {
  font-family: var(--font-sans);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0;
  line-height: 1.4;
}

.tofu-article .faq-question svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-caption);
  transition: transform 0.3s ease;
}

.tofu-article .faq-question[aria-expanded="true"] svg {
  transform: rotate(45deg);
}

.tofu-article .faq-answer {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease, padding 0.35s ease;
}

.tofu-article .faq-answer.open {
  max-height: 600px;
}

.tofu-article .faq-answer-inner {
  padding-top: 12px;
  font-size: 0.98rem;
  line-height: 1.72;
  color: var(--text-secondary);
}

.tofu-article .faq-answer-inner p { margin-bottom: 12px; }
.tofu-article .faq-answer-inner p:last-child { margin-bottom: 0; }

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — TOFU layout collapses TOC at ≤1024px
   ══════════════════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .tofu-article .article-layout {
    grid-template-columns: 1fr;
    gap: 0;
    padding-top: 32px;
  }

  .tofu-article .toc-sidebar {
    display: none;
  }

  .tofu-article .stat-block {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 4-column stat block variant */
.tofu-article .stat-block--4col {
  grid-template-columns: repeat(4, 1fr);
}

@media (max-width: 1024px) {
  .tofu-article .stat-block--4col {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .tofu-article .article-layout {
    padding: 24px 20px 64px;
  }

  .tofu-article .stat-block {
    grid-template-columns: 1fr;
  }

  .tofu-article .article-content h2 { font-size: 1.45rem; margin-top: 40px; }
  .tofu-article .article-content h3 { font-size: 1.1rem; }
  .tofu-article .article-content p  { font-size: 1rem; }

  .tofu-article .internal-links { padding: 20px; }
  .tofu-article .callout-box    { padding: 20px; }
}
