/* ============================================
   Topic pages (/topics/…) — on top of site.css.
   ============================================ */

/* ---- Page head ---- */
.topic-hero {
  padding: 136px 0 72px;
  border-bottom: 2px solid var(--border-thick);
}

.breadcrumb {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-muted);
  margin-bottom: 20px;
}

.breadcrumb a { transition: color 0.2s; }
.breadcrumb a:hover { color: var(--ink); }
.breadcrumb [aria-current] { color: var(--ink); }

.topic-hero h1 {
  font-family: 'Libre Baskerville', serif;
  font-size: clamp(2.6rem, 5.5vw, 4rem);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.topic-hero h1 .highlight {
  color: var(--coral);
  font-style: italic;
}

.topic-hero p {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 640px;
  margin-bottom: 36px;
  line-height: 1.7;
}

/* ---- An animation inside the explainer: a figure card with its title ---- */
/* The player keeps it as its top row, level with its restart button (player.css). */
.guide .example-title {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.1rem;
  line-height: 1.3;
}

/* ---- "All steps as text" under an animation ---- */
.example-steps { margin-top: 18px; }

.example-steps summary {
  display: inline-block;
  cursor: pointer;
  list-style: none;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  transition: color 0.2s;
}

.example-steps summary::-webkit-details-marker { display: none; }
.example-steps summary::before { content: '+ '; }
.example-steps[open] summary::before { content: '\2212  '; }
.example-steps summary:hover { color: var(--ink); }

.example-steps ol {
  margin: 12px 0 0 1.3em;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

.example-steps li + li { margin-top: 6px; }

/* ---- The explainer ---- */
.guide { max-width: 720px; }

.guide h3 {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.35rem;
  line-height: 1.3;
  margin: 48px 0 14px;
}

.guide p,
.guide li {
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink-soft);
}

.guide p + p { margin-top: 16px; }
.guide ul, .guide ol { margin: 16px 0 0 1.3em; }
.guide li + li { margin-top: 8px; }
.guide * + ul, .guide * + ol { margin-top: 12px; }

.guide a {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--gold);
  transition: border-color 0.2s;
}

.guide a:hover { border-color: var(--ink); }

.guide code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.88em;
  background: var(--cream-dark);
  padding: 1px 6px;
  border-radius: 6px;
}

.guide table {
  border-collapse: collapse;
  margin: 20px 0 8px;
  min-width: min(100%, 420px);
}

.guide th,
.guide td {
  padding: 10px 16px 10px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 1.05rem;
  color: var(--ink-soft);
}

.guide th {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-muted);
  border-bottom: 2px solid var(--border-thick);
}

.guide figure {
  margin: 32px 0;
  padding: 24px;
  background: white;
  border: 2px solid var(--border-thick);
  border-radius: var(--radius);
}

.guide .figure-art { display: block; max-width: 100%; height: auto; margin: 0 auto; }

.guide figcaption {
  margin-top: 16px;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-muted);
}

/* ---- In the app ---- */
.app-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-top: 56px;
}

.app-card {
  border: 2px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 32px 28px;
  transition: all 0.35s cubic-bezier(0.16,1,0.3,1);
}

.app-card h3 {
  font-family: 'Libre Baskerville', serif;
  font-size: 1.15rem;
  margin-bottom: 10px;
}

.app-card p {
  font-size: 0.95rem;
  color: rgba(255,255,255,0.6);
  line-height: 1.6;
}

.cta-more {
  margin-top: 36px;
  font-size: 0.95rem;
  color: var(--ink-muted);
}

.cta-more a {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 2px solid var(--gold);
  transition: border-color 0.2s;
}

.cta-more a:hover { border-color: var(--ink); }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .topic-hero .hero-buttons { justify-content: flex-start; }   /* the text here stays left-aligned */
  .app-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .topic-hero { padding: 104px 0 56px; }
  /* A little wider than the text on a phone: every pixel is a bigger drawing. */
  .guide figure { margin: 28px -16px; padding: 16px 14px 14px; }
  .guide th, .guide td { padding-right: 10px; }
  /* A table wider than the column scrolls on its own, instead of the whole page. */
  .guide table { display: block; max-width: 100%; overflow-x: auto; }
}
