/* ==========================================
   LOCATRIA GLOBAL DESIGN SYSTEM - ARTICLE TEMPLATE
   ========================================== */

/* Layout with Article Main (LEFT) & TOC Sticky Sidebar (RIGHT) */
.layout-article-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
  padding-top: var(--space-6);
  padding-bottom: var(--space-16);
}

@media (min-width: 1024px) {
  .layout-article-grid {
    grid-template-columns: minmax(0, 720px) 260px;
    gap: var(--space-12);
    align-items: stretch; /* Spans full height of main content so TOC stops naturally before footer */
  }
}

/* Article Header */
.article-header {
  border-bottom: 1px solid var(--color-border-subtle);
  padding-bottom: var(--space-8);
  margin-bottom: var(--space-8);
}

.article-category-badge-group {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  flex-wrap: wrap;
}

.article-title-main {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text-main);
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: var(--space-4);
}

@media (min-width: 768px) {
  .article-title-main {
    font-size: 2.75rem;
  }
}

.article-subtitle-lead {
  font-size: var(--text-lg);
  color: var(--color-text-body);
  line-height: 1.6;
  margin-bottom: var(--space-6);
  font-weight: 400;
}

/* Metadata Row */
.article-meta-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex-wrap: wrap;
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-4);
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-item svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.5px;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.meta-divider {
  width: 1px;
  height: 12px;
  background-color: var(--color-border-strong);
}

/* Table of Contents (TOC) Desktop Sidebar Component */
.toc-sidebar-wrapper {
  display: none;
}

@media (min-width: 1024px) {
  .toc-sidebar-wrapper {
    display: block;
    position: relative;
    align-self: stretch;
  }
}

.toc-sidebar {
  position: sticky;
  top: 96px; /* 72px sticky header + 24px spacing */
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  scrollbar-width: thin;
}

.toc-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.toc-title svg {
  width: 14px;
  height: 14px;
  stroke-width: 1.5px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-xs);
}

.toc-link {
  color: var(--color-text-muted);
  text-decoration: none;
  display: block;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  line-height: 1.4;
  font-weight: 400;
}

.toc-link:hover {
  color: var(--color-primary-600);
  background-color: var(--color-primary-50);
}

.toc-link.is-active {
  color: var(--color-primary-600);
  background-color: var(--color-primary-50);
  font-weight: var(--weight-semibold);
  border-left: 3px solid var(--color-primary-500);
}

.toc-link.toc-h3 {
  padding-left: 20px;
}

/* Mobile Collapsible TOC */
.toc-mobile-details {
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
}

@media (min-width: 1024px) {
  .toc-mobile-details {
    display: none;
  }
}

.toc-mobile-summary {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: var(--space-3) var(--space-4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Main Body Typography & Scroll Margins */
.article-prose {
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--color-text-main);
  max-width: 720px;
}

.article-prose h2,
.article-prose h3,
.box-takeaways,
.recommended-tools-block {
  scroll-margin-top: 96px; /* Prevents headings from hiding under 72px sticky header */
}

.article-prose h2 {
  font-size: var(--text-2xl);
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
  color: var(--color-text-main);
}

.article-prose h3 {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
  color: var(--color-text-main);
}

.article-prose p {
  margin-bottom: var(--space-6);
  color: var(--color-text-body);
}

.article-prose ul, .article-prose ol {
  margin-bottom: var(--space-6);
  padding-left: var(--space-6);
  color: var(--color-text-body);
}

.article-prose li {
  margin-bottom: var(--space-2);
}

/* Key Takeaways Box */
.box-takeaways {
  background-color: var(--color-primary-50);
  border: 1px solid var(--color-primary-100);
  border-left: 4px solid var(--color-primary-500);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-8);
}

.takeaways-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  color: var(--color-primary-900);
  margin-bottom: var(--space-3);
}

.takeaways-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--text-sm);
  color: var(--color-primary-950);
}

.takeaways-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.takeaways-item svg {
  width: 16px;
  height: 16px;
  stroke-width: 2px;
  color: var(--color-primary-600);
  flex-shrink: 0;
  margin-top: 3px;
}

/* Callout Box System (User Diagram Specification) */
.callout,
.component-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: var(--space-6);
  font-size: var(--text-sm);
  line-height: 1.6;
}

.callout-icon,
.component-callout .callout-icon {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  stroke-width: 1.5px;
  margin-top: 2px;
}

.callout-content,
.component-callout .callout-content {
  flex: 1;
  margin: 0;
  padding: 0;
}

.callout-title,
.component-callout .callout-title {
  display: block;
  font-size: var(--text-base);
  font-weight: 800;
  margin-top: 0;
  margin-bottom: 6px;
  color: inherit;
}

.callout-body,
.component-callout .callout-body {
  margin: 0;
  padding: 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

.callout-body p,
.component-callout .callout-body p {
  margin-bottom: 6px;
}
.callout-body p:last-child,
.component-callout .callout-body p:last-child {
  margin-bottom: 0;
}

.callout-body ul,
.callout-body ol,
.component-callout .callout-body ul,
.component-callout .callout-body ol {
  margin-top: 4px;
  margin-bottom: 0;
  padding-left: 20px;
}

.callout-info,
.component-callout.variant-info {
  background-color: var(--color-primary-50);
  border: 1px solid var(--color-primary-100);
  color: var(--color-primary-900);
}
.callout-info .callout-icon,
.component-callout.variant-info .callout-icon { color: var(--color-primary-600); }

.callout-tip,
.component-callout.variant-tip {
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #14532d;
}
.callout-tip .callout-icon,
.component-callout.variant-tip .callout-icon { color: #16a34a; }

.callout-warning,
.component-callout.variant-warning {
  background-color: #fffbeb;
  border: 1px solid #fef3c7;
  color: #78350f;
}
.callout-warning .callout-icon,
.component-callout.variant-warning .callout-icon { color: #d97706; }

.callout-important,
.component-callout.variant-important {
  background-color: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
}
.callout-important .callout-icon,
.component-callout.variant-important .callout-icon { color: #dc2626; }

/* Checklist Component */
.checklist-container {
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-8);
}

.checklist-title {
  font-size: var(--text-base);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-3);
  color: var(--color-text-main);
}

.checklist-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--color-text-body);
}

.checklist-checkbox {
  width: 16px;
  height: 16px;
  min-width: 16px;
  min-height: 16px;
  flex-shrink: 0;
  margin-top: 3px;
  accent-color: var(--color-primary-500);
  cursor: pointer;
}

/* Step-by-Step Component */
.step-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
}

.step-card {
  position: relative;
  background-color: var(--color-bg-body);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background-color: var(--color-primary-500);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-2);
}

.step-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  margin-bottom: var(--space-2);
  color: var(--color-text-main);
}

/* Prompt Block / Code Block */
.prompt-block,
.component-prompt-block {
  background-color: #0f172a;
  color: #f8fafc;
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  margin-bottom: var(--space-6);
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  font-size: 0.8125rem;
  line-height: 1.6;
  position: relative;
  overflow-x: auto;
  text-align: left;
}

.prompt-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid #334155;
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-family: var(--font-sans, Inter, sans-serif);
  font-size: 0.6875rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.copy-btn {
  background-color: #334155;
  color: #f8fafc;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.6875rem;
  cursor: pointer;
  transition: background-color var(--transition-fast);
  font-family: var(--font-sans, Inter, sans-serif);
}

.copy-btn:hover {
  background-color: var(--color-primary-600);
}

.prompt-block code,
.component-prompt-block code {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
  background: transparent;
  padding: 0;
  border: none;
  text-align: left;
}

/* Responsive Table Wrapper */
.table-responsive-wrapper {
  width: 100%;
  overflow-x: auto;
  margin-bottom: var(--space-8);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
  text-align: left;
}

.data-table th, .data-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

.data-table th {
  background-color: var(--color-bg-subtle);
  font-weight: var(--weight-bold);
  color: var(--color-text-main);
}

.data-table tr:last-child td {
  border-bottom: none;
}

/* Recommended Tools / Affiliate Section */
.recommended-tools-block {
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-top: var(--space-10);
  margin-bottom: var(--space-10);
}

.tool-card {
  background-color: var(--color-bg-body);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

@media (min-width: 640px) {
  .tool-card {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.affiliate-disclosure-text {
  font-size: 0.6875rem;
  color: var(--color-text-muted);
  font-style: italic;
  margin-top: var(--space-2);
}

/* Author Trust Box */
.author-bio-card {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-top: var(--space-10);
  margin-bottom: var(--space-10);
}

.author-bio-avatar {
  width: 54px;
  height: 54px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary-100);
  color: var(--color-primary-700);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: var(--text-lg);
  flex-shrink: 0;
}
