/* ==========================================================================
   Ping Pong Arcade — Article / guide typography and furniture
   ========================================================================== */

.article-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: var(--sp-6);
  align-items: start;
}

/* --------------------------------------------------------------------------
   Article header
   -------------------------------------------------------------------------- */
.article-header { margin-bottom: var(--sp-5); }
.article-header h1 {
  font-size: clamp(1.8rem, 4.4vw, 2.7rem);
  margin-bottom: var(--sp-3);
  max-width: 24ch;
}
.article-header .lead { margin-bottom: var(--sp-4); }

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--text-dim);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.article-meta__author {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-weight: 600;
  color: var(--text-muted);
}
.article-meta__author img {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 1px solid var(--border);
  object-fit: cover;
}
.article-meta__sep { opacity: 0.4; }

.article-figure { margin: 0 0 var(--sp-5); }
.article-figure img {
  width: 100%;
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.article-figure figcaption {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  text-align: center;
}

/* --------------------------------------------------------------------------
   Table of contents
   -------------------------------------------------------------------------- */
.article-toc {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  max-height: calc(100vh - var(--header-h) - 3rem);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  font-size: var(--fs-sm);
}
.article-toc h2 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.13em;
  color: var(--text-dim);
  margin-bottom: var(--sp-3);
}
.article-toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.article-toc li { margin-bottom: var(--sp-1); counter-increment: toc; }
.article-toc a {
  display: block;
  padding: var(--sp-2) var(--sp-2) var(--sp-2) 1.9rem;
  border-radius: var(--r-sm);
  color: var(--text-muted);
  position: relative;
  line-height: 1.4;
}
.article-toc a::before {
  content: counter(toc);
  position: absolute;
  left: var(--sp-2);
  color: var(--text-dim);
  font-size: var(--fs-xs);
  font-weight: 700;
}
.article-toc a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.article-toc a.is-active { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.article-toc a.is-active::before { color: var(--accent); }

/* --------------------------------------------------------------------------
   Article body typography
   -------------------------------------------------------------------------- */
.article-body {
  max-width: 72ch;
  font-size: var(--fs-md);
  line-height: 1.78;
  /* Long technical terms must not be able to widen the page on a small screen. */
  overflow-wrap: break-word;
}

.article-toc a,
.article-toc h2 { overflow-wrap: break-word; }
.article-body > h2 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-3);
  scroll-margin-top: calc(var(--header-h) + 16px);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border-soft);
}
.article-body > h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.article-body h3 {
  font-size: clamp(1.12rem, 2.4vw, 1.3rem);
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-2);
  color: var(--text);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-body p { color: var(--text-muted); }
.article-body li { color: var(--text-muted); }
.article-body strong { color: var(--text); font-weight: 700; }
.article-body a { text-decoration: underline; text-underline-offset: 2px; }

.article-body blockquote {
  margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-5);
  border-left: 4px solid var(--accent);
  background: var(--surface);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-muted);
  font-size: var(--fs-base);
}
.article-body blockquote > :last-child { margin-bottom: 0; }
.article-body blockquote cite {
  display: block;
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  font-style: normal;
  font-weight: 700;
}

/* Expert insight callout */
.insight {
  margin: var(--sp-5) 0;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent-2) 12%, var(--surface)), var(--surface));
  border: 1px solid color-mix(in srgb, var(--accent-2) 40%, transparent);
}
.insight__label {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: var(--sp-2);
}
.insight p:last-child { margin-bottom: 0; }

/* Key takeaways */
.takeaways {
  margin: var(--sp-6) 0;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--accent);
}
.takeaways h2 { font-size: var(--fs-lg); margin-top: 0; border-top: 0; padding-top: 0; }
.takeaways ul { list-style: none; padding: 0; margin: 0; }
.takeaways li {
  position: relative;
  padding-left: 1.9rem;
  margin-bottom: var(--sp-3);
  color: var(--text-muted);
  font-size: var(--fs-base);
}
.takeaways li:last-child { margin-bottom: 0; }
.takeaways li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 9px; height: 9px;
  border-radius: 2px;
  background: var(--accent);
  transform: rotate(45deg);
}

/* Inline stat / data block */
.data-points {
  display: grid;
  gap: var(--sp-3);
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin: var(--sp-5) 0;
}
.data-point {
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
}
.data-point strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  color: var(--accent);
  line-height: 1.1;
}
.data-point span { font-size: var(--fs-xs); color: var(--text-dim); }

/* --------------------------------------------------------------------------
   Author box
   -------------------------------------------------------------------------- */
.author-box {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: var(--sp-4);
  margin: var(--sp-6) 0;
  padding: var(--sp-5);
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--border);
}
.author-box img {
  width: 86px; height: 86px;
  border-radius: var(--r-md);
  object-fit: cover;
  border: 1px solid var(--border);
}
.author-box h2, .author-box h3 { margin: 0 0 var(--sp-1); font-size: var(--fs-md); border: 0; padding: 0; }
.author-box .role {
  font-size: var(--fs-xs);
  color: var(--accent-2);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: var(--sp-2);
}
.author-box p { font-size: var(--fs-sm); color: var(--text-muted); margin-bottom: var(--sp-2); }
.author-box > div > :last-child { margin-bottom: 0; }

@media (max-width: 480px) {
  .author-box { grid-template-columns: 1fr; }
  .author-box img { width: 70px; height: 70px; }
}

/* --------------------------------------------------------------------------
   Related content
   -------------------------------------------------------------------------- */
.related-list { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--sp-3); }
.related-list li { margin: 0; }
.related-list a {
  display: block;
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
  font-size: var(--fs-sm);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.related-list a:hover { border-color: var(--accent); text-decoration: none; transform: translateX(3px); }
.related-list .kicker {
  display: block;
  font-size: var(--fs-xs);
  color: var(--text-dim);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 2px;
}

/* CTA block */
.cta-block {
  margin: var(--sp-6) 0;
  padding: var(--sp-6);
  border-radius: var(--r-lg);
  text-align: center;
  background:
    radial-gradient(600px 220px at 50% 0%, color-mix(in srgb, var(--accent) 20%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
}
.cta-block h2 { margin-top: 0; border-top: 0; padding-top: 0; font-size: var(--fs-xl); }
.cta-block p { color: var(--text-muted); max-width: 52ch; margin-inline: auto; }
.cta-block .cluster { justify-content: center; }

/* References */
.references { font-size: var(--fs-sm); }
.references ol { padding-left: 1.4em; }
.references li { color: var(--text-muted); margin-bottom: var(--sp-2); }

/* Article list card (index pages) */
.article-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--t-base), border-color var(--t-base);
}
.article-card:hover { transform: translateY(-3px); border-color: var(--accent); }
.article-card__media { aspect-ratio: 16 / 9; background: var(--surface-2); }
.article-card__media img { width: 100%; height: 100%; object-fit: cover; }
.article-card__body { padding: var(--sp-4); display: flex; flex-direction: column; gap: var(--sp-2); flex: 1; }
.article-card__body h3 { font-size: var(--fs-md); margin: 0; }
.article-card__body h3 a { color: var(--text); }
.article-card__body h3 a::after { content: ""; position: absolute; inset: 0; }
.article-card__body h3 a:hover { color: var(--accent); text-decoration: none; }
.article-card__body p { font-size: var(--fs-sm); color: var(--text-muted); margin: 0; }
.article-card__meta {
  margin-top: auto;
  padding-top: var(--sp-2);
  font-size: var(--fs-xs);
  color: var(--text-dim);
  display: flex; gap: var(--sp-2); flex-wrap: wrap; align-items: center;
}
