/* Article styles for long-form technical posts (e.g. the Merrin engineering blog).
   Loaded only by article pages, after tailwind.css and styles.css. */

.article-shell {
  max-width: 680px;
  margin: 0 auto;
  /* styles.css resets `main > :last-child { margin-bottom: 0 }`, which eats the
     closing CTA's bottom margin, so keep the pre-footer breathing room here. */
  padding: 0 20px 64px;
}

/* ---- Hero ---- */
.article-hero {
  padding: 72px 0 40px;
}
.article-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #d8b4fe;
  margin-bottom: 18px;
}
.article-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #22d3ee;
}
.article-title {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: 36px;
  line-height: 1.16;
  letter-spacing: 0;
  color: #ffffff;
  margin: 0 0 18px;
  text-wrap: balance;
}
.article-dek {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  color: #94a3b8;
  margin: 0 0 26px;
  max-width: 640px;
}
.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  color: #64748b;
}
.article-meta .byline {
  color: #cbd5e1;
}
.article-meta .sep {
  color: #334155;
}
.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.article-tag {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
  border-radius: 999px;
  padding: 5px 12px;
}

/* ---- Table of contents (collapsed by default; click summary to expand) ---- */
.article-toc {
  margin: 8px 0 40px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(19, 19, 24, 0.6);
  border-radius: 18px;
}
.article-toc summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 22px;
  cursor: pointer;
  list-style: none;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #94a3b8;
  transition: color 0.2s ease;
}
.article-toc summary::-webkit-details-marker { display: none; }
.article-toc summary:hover { color: #e2e8f0; }
.article-toc summary:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.7);
  outline-offset: -2px;
  border-radius: 18px;
}
.article-toc summary::after {
  content: '';
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.2s ease;
}
.article-toc[open] summary::after { transform: rotate(-135deg); }
.article-toc ol {
  list-style: none;
  counter-reset: toc;
  margin: 0;
  padding: 14px 22px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: grid;
  gap: 8px;
}
.article-toc li {
  counter-increment: toc;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.4;
}
.article-toc li::before {
  content: counter(toc, decimal-leading-zero);
  color: #7c3aed;
  font-size: 11px;
  font-weight: 600;
  margin-right: 10px;
}
.article-toc a {
  color: #cbd5e1;
  text-decoration: none;
  transition: color 0.2s ease;
}
.article-toc a:hover,
.article-toc a.is-active {
  color: #ffffff;
}

/* ---- Prose ---- */
.article-body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  letter-spacing: 0;
  word-spacing: normal;
  color: #cbd5e1;
  padding-bottom: 24px;
}
.article-body > * + * {
  margin-top: 2.4em;
}
.article-body h2 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 23px;
  font-weight: 600;
  line-height: 1.3;
  color: #ffffff;
  margin-top: 52px;
  scroll-margin-top: 96px;
  text-wrap: balance;
}
.article-body h3 {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  color: #f1f5f9;
  margin-top: 36px;
  scroll-margin-top: 96px;
}
.article-body a {
  color: #d8b4fe;
  text-decoration: underline;
  text-decoration-color: rgba(216, 180, 254, 0.35);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.2s ease, color 0.2s ease;
}
.article-body a:hover {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}
.article-body strong {
  color: #f8fafc;
  font-weight: 600;
}
.article-body ul,
.article-body ol {
  padding-left: 24px;
}
.article-body li + li {
  margin-top: 10px;
}
.article-body li::marker {
  color: #a855f7;
}
.article-body blockquote {
  padding: 16px 22px;
  border-left: 2px solid #a855f7;
  background: rgba(168, 85, 247, 0.06);
  border-radius: 0 14px 14px 0;
  color: #e2e8f0;
}
.article-body hr {
  border: 0;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 40px 0;
}
.article-body code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 2px 6px;
  color: #e9d5ff;
}
.article-body pre {
  background: #0b0b0f;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px 20px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.65;
}
.article-body pre code {
  background: none;
  border: 0;
  padding: 0;
  color: #cbd5e1;
}

/* Callout */
.callout {
  border: 1px solid rgba(103, 232, 249, 0.22);
  background: rgba(34, 211, 238, 0.06);
  border-radius: 16px;
  padding: 18px 20px;
  font-size: 15.5px;
  line-height: 1.65;
  color: #dbeafe;
}
.callout .callout-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #67e8f9;
  margin-bottom: 8px;
}

/* ---- Charts ---- */
.chart-figure {
  margin: 40px 0;
}
.chart {
  width: 100%;
  height: 380px;
}
.chart--short {
  height: 340px;
}
.chart-figure figcaption {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: #7c8798;
  margin-top: 14px;
  padding-left: 14px;
  border-left: 2px solid rgba(216, 180, 254, 0.3);
}
.chart-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  color: #64748b;
  font-size: 13px;
  text-align: center;
  padding: 20px;
}

/* ---- Comparison tables ---- */
.article-table-wrap {
  overflow-x: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(19, 19, 24, 0.6);
}
.article-table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.article-table th,
.article-table td {
  text-align: left;
  vertical-align: top;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.article-table thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
}
/* Give the comparison table more room than the reading column on wide screens. */
@media (min-width: 880px) {
  .article-table-wrap {
    margin-left: -72px;
    margin-right: -72px;
  }
}
.article-table tbody tr:last-child td {
  border-bottom: 0;
}
.article-table td:first-child {
  color: #f1f5f9;
  font-weight: 600;
  white-space: nowrap;
}
.article-table a {
  color: #d8b4fe;
  text-decoration: underline;
  text-decoration-color: rgba(216, 180, 254, 0.35);
  text-underline-offset: 3px;
}
.article-table a:hover {
  color: #ffffff;
  text-decoration-color: rgba(255, 255, 255, 0.6);
}

/* ---- Mermaid ---- */
.mermaid-figure {
  margin: 40px 0;
}
.mermaid {
  display: flex;
  justify-content: center;
  background: rgba(19, 19, 24, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 26px 18px;
  overflow-x: auto;
  min-height: 180px;
}
.mermaid svg {
  max-width: 100%;
  height: auto;
}
.mermaid-figure figcaption {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.55;
  color: #7c8798;
  margin-top: 14px;
  padding-left: 14px;
  border-left: 2px solid rgba(103, 232, 249, 0.3);
}

/* ---- Author box / closing ---- */
.article-footer {
  margin: 48px 0 24px;
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(19, 19, 24, 0.6);
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.6;
  color: #94a3b8;
}
.article-footer strong {
  color: #ffffff;
}

/* ---- CTA banner ---- */
.article-cta {
  margin: 40px 0 64px;
  text-align: center;
  padding: 36px 24px;
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 22px;
  background: radial-gradient(ellipse 80% 120% at 50% 0%, rgba(168, 85, 247, 0.14) 0%, rgba(8, 8, 10, 0) 70%);
}
.article-cta h2 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  font-size: 26px;
  line-height: 1.25;
  color: #ffffff;
  margin: 0 0 10px;
}
.article-cta p {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: #94a3b8;
  max-width: 480px;
  margin: 0 auto 22px;
}

/* Centered CTA buttons when Tailwind utilities are not enough */
.article-cta-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
}
.article-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  padding: 12px 24px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.article-cta-btn--primary {
  background: #ffffff;
  color: #0b0b0f;
}
.article-cta-btn--primary:hover {
  background: #e2e8f0;
  transform: translateY(-1px);
}
.article-cta-btn--ghost {
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.02);
}
.article-cta-btn--ghost:hover {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.35);
}

/* Reading progress bar */
.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 60;
  background: linear-gradient(90deg, #7ea2ff, #7c78ff 48%, #c17aff);
  transition: width 0.1s linear;
}

/* ---- Responsive ---- */
@media (min-width: 640px) {
  .article-hero { padding: 88px 0 44px; }
  .article-title { font-size: 42px; }
  .article-dek { font-size: 18px; }
  .article-body h2 { font-size: 25px; }
}
@media (min-width: 1024px) {
  .article-title { font-size: 48px; }
  .chart { height: 420px; }
}
@media (max-width: 480px) {
  .chart { height: 320px; }
}
@media (prefers-reduced-motion: reduce) {
  .article-cta-btn { transition: none; }
  .article-toc summary,
  .article-toc summary::after { transition: none; }
}
