/* ────────────────────────────────────────────────────────────
   C++ Containers Tutorial · Extra styles
   Builds on tutorial.css. Self-contained: includes the timeline
   and storage-table primitives so this page doesn't depend on
   the other tutorials' CSS files.
   ──────────────────────────────────────────────────────────── */

/* ── History timeline (§2) ── */
.timeline-block {
  margin: 1.5rem 0 2rem;
  border-left: 2px solid var(--tut-border);
  padding-left: 1.3rem;
  display: grid;
  gap: 1.1rem;
}

.timeline-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 1rem;
  align-items: start;
}

.timeline-year {
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--tut-accent);
  font-weight: 700;
  letter-spacing: 0.05em;
  position: relative;
  padding-top: 0.05rem;
}

.timeline-year::before {
  content: '';
  position: absolute;
  left: -1.42rem;
  top: 0.45rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--tut-accent);
  box-shadow: 0 0 0 4px rgba(167, 139, 250, 0.18);
}

.timeline-body {
  font-size: 0.97rem;
  line-height: 1.6;
  color: var(--tut-soft);
}

.timeline-body strong { color: var(--tut-text); }

@media (max-width: 640px) {
  .timeline-block { padding-left: 1rem; }
  .timeline-row { grid-template-columns: 50px 1fr; gap: 0.5rem; }
  .timeline-year::before { left: -1.12rem; }
}

/* ── Comparison tables (memory hierarchy, invalidation matrix, cheat sheet) ── */
.storage-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0 1.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
}
.storage-table th, .storage-table td {
  padding: 0.55rem 0.8rem;
  text-align: left;
  border-bottom: 1px solid var(--tut-border-soft);
  color: var(--tut-soft);
  vertical-align: top;
}
.storage-table th {
  color: var(--tut-text);
  font-weight: 700;
  letter-spacing: 0.04em;
  background: var(--tut-surface);
}
.storage-table tr:last-child td { border-bottom: 0; }

.storage-table td.bar {
  position: relative;
  width: 40%;
  padding: 0.55rem 0.8rem;
}
.storage-table td.bar > span.bar-fill {
  display: inline-block;
  height: 14px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--tut-accent) 0%, var(--tut-info) 100%);
  border-radius: 3px;
}

/* The cheat-sheet table is wider; wrap rather than scroll on narrow screens. */
.storage-table.cheat td:first-child {
  color: var(--tut-text);
  font-weight: 600;
  width: 28%;
}
.storage-table.cheat td:nth-child(2) {
  font-family: var(--mono);
  color: var(--tut-accent);
  width: 30%;
  font-size: 0.82rem;
}
.storage-table.cheat td:nth-child(3) {
  font-family: var(--serif);
  font-size: 0.93rem;
}
.storage-table.cheat code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: rgba(167, 139, 250, 0.08);
  padding: 0.05em 0.35em;
  border-radius: 3px;
  color: var(--tut-text);
}

/* ── Tutorial card background for the index page ── */
.tut-card-visual.cnt-bg,
.game-card-visual.cnt-bg {
  background: linear-gradient(135deg, #1a0e2e 0%, #2d1a4e 35%, #1e2a4a 70%, #0d0f24 100%);
  position: relative;
  overflow: hidden;
}
.tut-card-visual.cnt-bg::after,
.game-card-visual.cnt-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 25% 30%, rgba(167, 139, 250, 0.28), transparent 45%),
    radial-gradient(circle at 75% 75%, rgba(96, 165, 250, 0.24), transparent 45%);
  pointer-events: none;
}
.tut-card-visual.cnt-bg canvas,
.game-card-visual.cnt-bg canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* ── Stat-grid override so race widget shows five+ wide ── */
#widget-race .stat-grid,
#widget-cache-walker .stat-grid {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

/* ── Canvas background consistency ── */
#widget-cache-walker canvas,
#widget-vector-layout canvas,
#widget-vector-growth canvas,
#widget-invalidation canvas,
#widget-deque canvas,
#widget-listvsvec canvas,
#widget-rbtree canvas,
#widget-hash canvas,
#widget-swisstable canvas,
#widget-heap canvas,
#widget-race canvas {
  background: #07070d;
}
