/* =============================================
   article-template.css — Article/Guide Template
   Component styles for [data-component="article-template"]
   Requires: 00-tokens.css (design tokens)
   ============================================= */

/* ── Hero Split ── */
.hero-split {
  background: var(--surface-subtle);
  padding: clamp(5rem, 8vw, 7rem) 0 clamp(3rem, 5vw, 4rem);
}

.hero-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  text-align: center;
}

.hero-eyebrow {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--space-3);
}

.hero-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-primary);
  text-wrap: balance;
  margin-bottom: var(--space-4);
}

.hero-meta {
  display: flex;
  justify-content: center;
  gap: var(--space-5);
  flex-wrap: wrap;
}

.hero-meta-item {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--text-tertiary);
  font-weight: 500;
}

.hero-meta-item svg {
  width: 14px;
  height: 14px;
  stroke: var(--color-primary);
  stroke-width: 2;
  fill: none;
}

/* ── Article Layout ── */
.article-section {
  padding: clamp(2.5rem, 4vw, 4rem) 0;
}

.article-layout {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: var(--space-12);
  align-items: start;
}

/* ── TOC Sidebar ── */
.toc-sidebar {
  position: sticky;
  top: 80px;
}

.toc-title {
  font-family: var(--font-heading);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

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

.toc-link {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-tertiary);
  text-decoration: none;
  border-radius: var(--radius-md);
  border-left: 2px solid transparent;
  transition: all var(--duration-normal) ease;
}

.toc-link:hover {
  color: var(--text-primary);
  background: var(--surface-subtle);
}

.toc-link.active {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

.toc-resources {
  margin-top: var(--space-6);
  padding-top: var(--space-5);
  border-top: 1px solid var(--surface-glass-border);
}

.toc-resources .toc-title {
  margin-bottom: var(--space-3);
}

.toc-resource-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
  border-radius: var(--radius-md);
  transition: background var(--duration-normal) ease;
}

.toc-resource-link:hover {
  background: rgba(var(--color-primary-rgb), 0.06);
}

.toc-resource-link svg {
  width: 14px;
  height: 14px;
  stroke: var(--color-primary);
  stroke-width: 2;
  fill: none;
  flex-shrink: 0;
}

/* ── Mobile TOC ── */
.mobile-toc-toggle {
  display: none;
  width: 100%;
  padding: 14px var(--space-5);
  background: var(--surface-base);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  cursor: pointer;
  margin-bottom: var(--space-5);
  align-items: center;
  justify-content: space-between;
}

.mobile-toc-toggle svg {
  width: 16px;
  height: 16px;
  stroke: var(--text-tertiary);
  stroke-width: 2;
  fill: none;
  transition: transform 300ms var(--ease-out);
}

.mobile-toc-toggle.open svg {
  transform: rotate(180deg);
}

.mobile-toc-content {
  display: none;
  background: var(--surface-base);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  margin-bottom: var(--space-6);
}

.mobile-toc-content.open {
  display: block;
}

/* ── Article Content ── */
.article-content {
  max-width: 680px;
}

.article-content h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.3rem, 3vw, 1.6rem);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-primary);
  margin: 2.5rem 0 1rem;
  padding-left: var(--space-4);
  position: relative;
}

.article-content h2::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  width: 4px;
  height: 20px;
  background: var(--color-primary);
  border-radius: 2px;
}

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

.article-content h3 {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: var(--text-lg);
  color: var(--text-primary);
  margin: 1.5rem 0 0.75rem;
}

.article-content p {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

.article-content ul,
.article-content ol {
  padding-left: 0;
  margin-bottom: 1.25rem;
  list-style: none;
}

.article-content li {
  font-size: var(--text-base);
  line-height: 1.75;
  color: var(--text-secondary);
  padding-left: var(--space-5);
  position: relative;
  margin-bottom: var(--space-2);
}

.article-content ul li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 11px;
  width: 6px;
  height: 6px;
  background: var(--color-primary);
  border-radius: 50%;
}

.article-content ol {
  counter-reset: item;
}

.article-content ol li::before {
  counter-increment: item;
  content: counter(item) ".";
  position: absolute;
  left: 0;
  font-weight: 600;
  color: var(--color-primary);
  font-size: var(--text-sm);
}

/* ── Content Image ── */
.article-image {
  width: 100%;
  border-radius: var(--radius-xl);
  margin: 1.5rem 0;
  background: var(--surface-muted);
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-sm);
  transition: transform var(--duration-slow) var(--ease-out);
  overflow: hidden;
}

.article-image:hover {
  transform: scale(1.01);
}

/* ── Callout Boxes ── */
.callout {
  position: relative;
  padding: var(--space-5) var(--space-5) var(--space-5) 52px;
  border-radius: var(--radius-lg);
  margin: 1.5rem 0;
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface-glass-border);
}

.callout::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  border-radius: 3px 0 0 3px;
}

.callout-icon {
  position: absolute;
  left: 18px;
  top: var(--space-5);
  width: 22px;
  height: 22px;
}

.callout-icon svg {
  width: 100%;
  height: 100%;
  stroke-width: 2;
  fill: none;
}

.callout-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: var(--space-1);
}

.callout-text {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-secondary);
}

/* Callout — Tip */
.callout-tip {
  background: rgba(16, 185, 129, 0.04);
}
.callout-tip::before {
  background: var(--color-success);
}
.callout-tip .callout-icon svg {
  stroke: var(--color-success);
}
.callout-tip .callout-title {
  color: #065F46;
}

/* Callout — Warning */
.callout-warning {
  background: rgba(var(--color-warm-rgb), 0.04);
}
.callout-warning::before {
  background: var(--color-warm);
}
.callout-warning .callout-icon svg {
  stroke: var(--color-warm);
}
.callout-warning .callout-title {
  color: #92400E;
}

/* Callout — Info */
.callout-info {
  background: rgba(var(--color-primary-rgb), 0.04);
}
.callout-info::before {
  background: var(--color-primary);
}
.callout-info .callout-icon svg {
  stroke: var(--color-primary);
}
.callout-info .callout-title {
  color: #1E40AF;
}

/* ── Related Guides ── */
.related-section {
  background: var(--surface-cool);
  padding: clamp(3rem, 5vw, 4.5rem) 0;
}

.related-container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
}

.related-header {
  text-align: center;
  margin-bottom: clamp(1.5rem, 3vw, 2.5rem);
}

.related-eyebrow {
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-primary);
  margin-bottom: var(--space-2);
}

.related-header h2 {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: var(--tracking-tighter);
  color: var(--text-primary);
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.related-card {
  background: var(--surface-base);
  border: 1px solid var(--surface-glass-border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform 300ms var(--ease-out), box-shadow 300ms var(--ease-out);
  text-decoration: none;
  color: inherit;
  display: block;
}

.related-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.related-card-img {
  aspect-ratio: 16/9;
  background: var(--surface-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: var(--text-xs);
  overflow: hidden;
}

.related-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--duration-slow) var(--ease-out);
}

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

.related-card-body {
  padding: var(--space-4) var(--space-5);
}

.related-card-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 15px;
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.related-card-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-primary);
}

.related-card-link .arrow {
  transition: transform 250ms var(--ease-out);
}

.related-card:hover .related-card-link .arrow {
  transform: translateX(3px);
}

/* ── Responsive: Mobile ── */
@media (max-width: 767px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .toc-sidebar {
    display: none;
  }

  .mobile-toc-toggle {
    display: flex;
  }

  .article-content li {
    padding-left: 20px;
  }

  .article-content p {
    font-size: 15px;
  }

  .related-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
  }

  .related-card {
    display: block;
  }

  .related-card-img {
    aspect-ratio: 16/9;
    height: 80px;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  }

  .related-card-body {
    padding: 10px var(--space-3);
  }

  .related-card-link {
    display: none;
  }

  .related-card-title {
    font-size: 13px;
  }

  .callout {
    padding-left: 44px;
  }

  .callout-icon {
    left: 14px;
  }

  .article-content h2 {
    font-size: 1.25rem;
  }
}

/* ── Responsive: Tablet ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .article-layout {
    grid-template-columns: 180px 1fr;
    gap: var(--space-8);
  }

  .related-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-4);
  }
}

/* ── Entrance animations (JS-driven) ── */
.js-loaded .article-content h2 {
  opacity: 0;
}

.js-loaded .related-card {
  opacity: 0;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .article-content h2,
  .related-card {
    opacity: 1 !important;
  }
}
