/* ==========================================================================
   Physics Arcade — long-form article / guide styles
   ========================================================================== */

.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.9rem, 4.6vw, 2.75rem);
  margin-bottom: var(--sp-4);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-2) var(--sp-4);
  font-size: var(--fs-sm);
  color: var(--muted);
  padding-bottom: var(--sp-4);
  border-bottom: 1px solid var(--border);
}
.article-meta a { color: var(--text-strong); font-weight: 650; }
.article-meta .sep { color: var(--muted-2); }
.article-meta time { font-variant-numeric: tabular-nums; }

.article-hero {
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
  margin: var(--sp-5) 0;
  background: var(--surface-2);
  aspect-ratio: 16 / 9;
}
.article-hero img { width: 100%; height: 100%; object-fit: cover; }
figure { margin: var(--sp-5) 0; }
figcaption { font-size: var(--fs-xs); color: var(--muted-2); text-align: center; margin-top: var(--sp-2); }

/* --------------------------------------------------------------------------
   Table of contents
   -------------------------------------------------------------------------- */

.toc {
  position: sticky;
  top: calc(var(--header-h) + var(--sp-4));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
  max-height: calc(100vh - var(--header-h) - var(--sp-6));
  overflow-y: auto;
}
.toc h2 {
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted-2);
  margin-bottom: var(--sp-3);
}
.toc ol { list-style: none; margin: 0; padding: 0; counter-reset: toc; }
.toc li { counter-increment: toc; margin-bottom: .1rem; }
.toc a {
  display: block;
  padding: .38rem .55rem;
  border-radius: 6px;
  font-size: var(--fs-sm);
  color: var(--muted);
  line-height: 1.35;
  border-left: 2px solid transparent;
}
.toc a:hover { color: var(--text-strong); background: var(--surface-2); text-decoration: none; }
.toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--surface-2); }

/* Inline TOC used on narrow screens / in-body */
.toc-inline {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4) var(--sp-5);
  margin-bottom: var(--sp-6);
}
.toc-inline h2 { font-size: var(--fs-base); margin-bottom: var(--sp-3); }
.toc-inline ol { margin: 0; padding-left: 1.2em; }
.toc-inline li { margin-bottom: .3rem; font-size: var(--fs-sm); }

/* --------------------------------------------------------------------------
   Body copy
   -------------------------------------------------------------------------- */

.article-body {
  font-size: 1.06rem;
  line-height: 1.78;
  max-width: 72ch;
}

.article-body > h2 {
  font-size: clamp(1.4rem, 3.2vw, 1.85rem);
  margin-top: var(--sp-7);
  margin-bottom: var(--sp-4);
  padding-top: var(--sp-2);
  scroll-margin-top: calc(var(--header-h) + 16px);
}
.article-body > h2:first-child { margin-top: 0; }

.article-body > h3 {
  font-size: 1.22rem;
  margin-top: var(--sp-5);
  margin-bottom: var(--sp-3);
  color: var(--text-strong);
  scroll-margin-top: calc(var(--header-h) + 16px);
}

.article-body p { margin-bottom: var(--sp-4); }
.article-body ul, .article-body ol { margin-bottom: var(--sp-4); }
.article-body li { margin-bottom: .55em; }
.article-body strong { color: var(--text-strong); }

.article-body > p:first-of-type {
  font-size: 1.14rem;
  color: var(--text);
}

blockquote {
  margin: var(--sp-5) 0;
  padding: var(--sp-4) var(--sp-5);
  border-left: 3px solid var(--accent-3);
  background: var(--surface);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

/* Key takeaways */
.takeaways {
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: var(--sp-5);
  margin: var(--sp-6) 0;
}
.takeaways h2 { font-size: var(--fs-lg); margin-bottom: var(--sp-3); margin-top: 0; }
.takeaways ul { list-style: none; padding: 0; margin: 0; }
.takeaways li {
  display: flex;
  gap: var(--sp-3);
  align-items: flex-start;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.takeaways li:last-child { margin-bottom: 0; }
.takeaways li::before {
  content: "✦";
  color: var(--accent);
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1.6;
}

/* Comparison / data tables inside articles scroll rather than overflow */
.table-scroll { overflow-x: auto; margin-bottom: var(--sp-5); }
.table-scroll table { min-width: 460px; margin-bottom: 0; }

/* Mistakes list */
.mistakes { list-style: none; padding: 0; }
.mistakes li {
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-2);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  margin-bottom: var(--sp-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.mistakes li strong { display: block; color: var(--text-strong); margin-bottom: .25rem; font-size: var(--fs-base); }

/* References */
.references { font-size: var(--fs-sm); }
.references ol { padding-left: 1.3em; }
.references li { margin-bottom: .6em; color: var(--muted); }
.references a { word-break: break-word; }

/* Inline game CTA inside an article */
.article-game-cta {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--sp-4);
  align-items: center;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  margin: var(--sp-6) 0;
}
.article-game-cta img { border-radius: var(--radius-sm); width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--surface-2); }
.article-game-cta h3 { font-size: var(--fs-md); margin-bottom: var(--sp-2); }
.article-game-cta p { font-size: var(--fs-sm); color: var(--muted); margin-bottom: var(--sp-3); }

@media (max-width: 560px) {
  .article-game-cta { grid-template-columns: 1fr; }
}

/* Update / correction note */
.update-note {
  font-size: var(--fs-xs);
  color: var(--muted-2);
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  margin-bottom: var(--sp-5);
}

/* Prev / next */
.article-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--sp-3);
  margin: var(--sp-6) 0;
}
.article-nav a {
  display: block;
  padding: var(--sp-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-strong);
  font-weight: 650;
}
.article-nav a:hover { border-color: var(--accent); text-decoration: none; }
.article-nav span { display: block; font-size: var(--fs-xs); color: var(--muted-2); text-transform: uppercase; letter-spacing: .1em; margin-bottom: .2rem; font-weight: 800; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1000px) {
  .article-layout { grid-template-columns: 1fr; }
  .toc { display: none; }
}

@media (max-width: 560px) {
  .article-body { font-size: 1rem; line-height: 1.72; }
  .article-body > p:first-of-type { font-size: 1.05rem; }
}
