/* AIML lesson pages — shared components (forge_base.css loaded first) */

/* Page header glow (uses per-page --accent) */
.pg-head { position: relative; overflow: hidden; }
.pg-head-glow {
  position: absolute;
  top: 0;
  right: -80px;
  width: min(500px, 60%);
  height: 100%;
  background: radial-gradient(
    ellipse at top right,
    color-mix(in srgb, var(--accent) 12%, transparent) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: 0;
}
.pg-head > * { position: relative; z-index: 1; }

.pg-crumb a { color: var(--text3); text-decoration: none; }
.pg-crumb a:hover { color: var(--accent); }
.pg-crumb-sep { color: var(--border2); opacity: 0.7; }

/* Sub-headings & tips */
.sub-heading {
  font-family: var(--display);
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  margin: 32px 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sub-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.tip-box {
  padding: 14px 16px;
  border-radius: var(--radius);
  margin-top: 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text2);
}
.tip-green {
  background: color-mix(in srgb, var(--green) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--green) 15%, transparent);
  border-left: 3px solid var(--green);
}
.tip-cyan {
  background: color-mix(in srgb, var(--cyan) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--cyan) 15%, transparent);
  border-left: 3px solid var(--cyan);
}

/* Tables & pipelines */
.algo-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 16px 0;
  overflow-x: auto;
  display: block;
}
.algo-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.algo-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
}
.algo-table tr:hover td { background: var(--surface2); }
.algo-table td:first-child {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}

.pipe-step { display: flex; gap: 0; position: relative; }
.pipe-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: -1px;
  width: 2px;
  background: linear-gradient(
    to bottom,
    color-mix(in srgb, var(--accent) 40%, transparent),
    transparent
  );
  z-index: 0;
}
.pipe-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}
.pipe-body { flex: 1; padding: 8px 0 28px 20px; }
.pipe-title { font-size: 15px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.pipe-desc { font-size: 13px; color: var(--text2); line-height: 1.65; }
.pipe-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--accent);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  border-radius: 0 6px 6px 0;
  margin-top: 10px;
}

.metric-formula {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--purple);
  background: color-mix(in srgb, var(--purple) 8%, transparent);
  padding: 6px 10px;
  border-radius: 6px;
  margin: 6px 0;
}
.metric-use { font-size: 11px; color: var(--text3); margin-top: 5px; }

.quiz-score {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 12px;
}

/* Roadmap */
.roadmap-phase {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border-color 0.18s;
}
.roadmap-phase:hover { border-color: var(--border2); }
.phase-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.phase-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 100px;
  letter-spacing: 0.8px;
}
.pb-1 { background: color-mix(in srgb, var(--cyan) 10%, transparent); color: var(--cyan); }
.pb-2 { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); }
.pb-3 { background: color-mix(in srgb, var(--purple) 10%, transparent); color: var(--purple); }
.pb-4 { background: color-mix(in srgb, var(--amber) 10%, transparent); color: var(--amber); }
.phase-title { font-size: 16px; font-weight: 700; color: var(--text); }
.phase-timeline {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--text3);
  margin-left: auto;
}
.phase-items {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
}
.phase-item {
  font-size: 13px;
  color: var(--text2);
  padding: 8px 12px;
  background: var(--surface2);
  border-radius: 6px;
  border: 1px solid var(--border);
}
.phase-item strong {
  color: var(--text);
  display: block;
  margin-bottom: 2px;
  font-size: 12px;
}
.phase-project {
  margin-top: 12px;
  font-size: 12px;
  font-family: var(--mono);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 8px 12px;
  border-radius: 6px;
}

/* Tools & glossary */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color 0.18s, transform 0.18s;
}
.tool-card:hover { border-color: var(--border2); transform: translateY(-2px); }
.tool-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tool-abbr {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  min-width: 44px;
}
.tool-name { font-size: 14px; font-weight: 700; color: var(--text); }
.tool-desc { font-size: 12px; color: var(--text2); line-height: 1.55; margin-bottom: 10px; }
.tool-snippet {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text3);
  background: var(--bg2);
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: pre;
}

.gloss-search-wrap { position: relative; margin-bottom: 20px; }
.gloss-search {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.18s;
}
.gloss-search:focus { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.gloss-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 14px;
  pointer-events: none;
}
.gloss-hidden { display: none !important; }

/* Stat bar */
.ml-stat-bar {
  display: flex;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.ml-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  border-right: 1px solid var(--border);
}
.ml-stat:last-child { border-right: none; }
.ml-stat-num {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.ml-stat-lbl {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Decision flowchart */
.decision-flow {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
}
.df-q-text {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 16px;
  line-height: 1.5;
}
.df-buttons { display: flex; flex-wrap: wrap; gap: 10px; }
.df-btn {
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s;
  font-family: var(--sans);
}
.df-btn:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: var(--accent);
  color: var(--accent);
}
.df-result-icon { font-size: 28px; margin-bottom: 12px; }
.df-result-text {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 18%, transparent);
  border-left: 3px solid var(--accent);
  padding: 16px;
  border-radius: 0 8px 8px 0;
  white-space: pre-line;
  line-height: 1.7;
}

/* Cheat sheet rows */
.cheat-row {
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.cheat-row:last-child { border-bottom: none; border-radius: 0 0 8px 8px; }
.cheat-row:first-child { border-radius: 8px 8px 0 0; }
.cheat-row:nth-child(even) { background: var(--surface2); }
.cheat-cell {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text2);
  border-right: 1px solid var(--border);
}
.cheat-cell:last-child { border-right: none; }
.cheat-head {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  background: var(--bg2);
}

/* Formula grid */
.formula-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.formula-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.formula-name {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 8px;
}
.formula-eq {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--purple);
  margin-bottom: 6px;
  line-height: 1.5;
}
.formula-note { font-size: 11px; color: var(--text2); line-height: 1.5; }

/* Mini pipeline */
.mini-pipeline {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: wrap;
  margin: 16px 0;
}
.mp-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 90px;
  padding: 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.mp-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 2px solid color-mix(in srgb, var(--accent) 30%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 6px;
}
.mp-label { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.mp-note {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  line-height: 1.4;
}
.mp-arrow {
  color: var(--border2);
  font-size: 16px;
  padding: 0 4px;
  flex-shrink: 0;
}

/* Injected lesson hero (replaces pg-head on some pages) */
.aim-hero {
  position: relative;
  padding: 44px 0 36px;
  margin-bottom: 28px;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.aim-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse 55% 70% at -5% 55%,
    color-mix(in srgb, var(--accent) 7%, transparent) 0%,
    transparent 58%
  );
}
.aim-hero > * { position: relative; z-index: 1; }

.aim-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 20%, transparent);
  padding: 4px 12px;
  border-radius: var(--r-full);
  margin-bottom: 14px;
}
.aim-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 5px var(--accent);
  animation: aimdot 2s ease infinite;
}
@keyframes aimdot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.6); }
}
.aim-title {
  font-family: var(--display);
  font-size: clamp(24px, 4vw, 38px);
  font-weight: 700;
  letter-spacing: -0.5px;
  color: var(--text);
  margin-bottom: 10px;
}
.aim-title span {
  background: linear-gradient(135deg, var(--purple), var(--cyan));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.aim-sub {
  font-size: 13.5px;
  color: var(--text2);
  line-height: 1.75;
  max-width: 600px;
  margin-bottom: 16px;
}
.aim-badges { display: flex; gap: 7px; flex-wrap: wrap; }
.aim-badge {
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: var(--r-full);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
  color: var(--accent);
}

.aim-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  overflow: hidden;
  margin-bottom: 32px;
}
.bks-box {
  background: var(--surface);
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  text-align: center;
  position: relative;
  transition: background 0.2s;
}
.bks-box::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--bks-c, var(--accent));
  opacity: 0;
  transition: opacity 0.2s;
}
.bks-box:hover {
  background: color-mix(in srgb, var(--bks-c, var(--accent)) 3%, transparent);
}
.bks-box:hover::after { opacity: 1; }
.bks-val {
  font-family: var(--display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
}
.bks-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--text3);
}

.anim-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.anim-in.visible { opacity: 1; transform: none; }

@media (max-width: 700px) {
  .cheat-row { grid-template-columns: 1fr 1fr; }
  .mini-pipeline { gap: 4px; }
  .mp-arrow { display: none; }
}
@media (max-width: 640px) {
  .aim-stats { grid-template-columns: repeat(2, 1fr); }
}

/* ── Stat bars (aliases) ── */
.ml-stat-bar,
.dl-stat-bar,
.stat-bar {
  display: flex;
  gap: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 24px;
}
.ml-stat,
.dl-stat,
.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 8px;
  border-right: 1px solid var(--border);
}
.ml-stat:last-child,
.dl-stat:last-child,
.stat-item:last-child { border-right: none; }
.ml-stat-num,
.dl-stat-num,
.stat-num {
  font-family: var(--display);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.ml-stat-lbl,
.dl-stat-lbl,
.stat-lbl {
  font-size: 10px;
  color: var(--text3);
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
}

.b-cyan {
  background: color-mix(in srgb, var(--cyan) 10%, transparent);
  color: var(--cyan);
  border: 1px solid color-mix(in srgb, var(--cyan) 22%, transparent);
}

.cheat-row-3,
.cheat-3 { grid-template-columns: 1fr 1fr 1fr; }
.cheat-row-4,
.cheat-4 { grid-template-columns: 1.5fr 1.5fr 1fr 1fr; }
.cheat-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin: 16px 0; }

/* Architecture cards */
.arch-grid,
.algo-grid,
.model-grid,
.task-grid,
.activation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin: 16px 0 24px;
}
.arch-card,
.algo-card,
.model-card,
.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: border-color 0.18s, transform 0.18s;
}
.arch-card:hover,
.algo-card:hover,
.model-card:hover,
.task-card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}
.ac-cyan, .arch-card.ac-cyan { border-top: 2px solid var(--cyan); }
.ac-pink, .arch-card.ac-pink { border-top: 2px solid var(--pink); }
.ac-green, .arch-card.ac-green { border-top: 2px solid var(--green); }
.ac-purple, .arch-card.ac-purple { border-top: 2px solid var(--purple); }
.ac-amber, .arch-card.ac-amber { border-top: 2px solid var(--amber); }
.ac-blue, .arch-card.ac-blue { border-top: 2px solid var(--blue); }

.arch-icon,
.model-icon,
.task-icon { font-size: 24px; margin-bottom: 10px; }
.arch-name,
.algo-name,
.model-name,
.task-name {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.arch-tag,
.model-tag,
.algo-type {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  margin-bottom: 10px;
  letter-spacing: 0.5px;
}
.tag-cyan { background: color-mix(in srgb, var(--cyan) 10%, transparent); color: var(--cyan); }
.tag-pink { background: color-mix(in srgb, var(--pink) 10%, transparent); color: var(--pink); }
.tag-green { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); }
.tag-purple { background: color-mix(in srgb, var(--purple) 10%, transparent); color: var(--purple); }
.tag-amber { background: color-mix(in srgb, var(--amber) 10%, transparent); color: var(--amber); }
.tag-blue { background: color-mix(in srgb, var(--blue) 10%, transparent); color: var(--blue); }

.arch-desc,
.algo-desc,
.model-desc,
.task-desc,
.task-detail {
  font-size: 13px;
  color: var(--text2);
  line-height: 1.65;
  margin-bottom: 10px;
}
.arch-use,
.model-examples,
.algo-formula {
  font-size: 11px;
  font-family: var(--mono);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 5%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  padding: 8px 10px;
  border-radius: 6px;
  line-height: 1.5;
}
.arch-body { font-size: 13px; color: var(--text2); line-height: 1.65; }
.arch-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.arch-item { padding: 12px 0; border-bottom: 1px solid var(--border); }
.arch-timeline { font-size: 11px; font-family: var(--mono); color: var(--text3); }
.arch-year { font-weight: 700; color: var(--accent); }

.at-vb { color: var(--cyan); background: color-mix(in srgb, var(--cyan) 10%, transparent); }
.at-pg { color: var(--green); background: color-mix(in srgb, var(--green) 10%, transparent); }
.at-on { color: var(--purple); background: color-mix(in srgb, var(--purple) 10%, transparent); }
.at-off { color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); }

.task-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.task-metric { font-family: var(--mono); font-size: 11px; color: var(--accent); }

/* Activation cards */
.activation-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.act-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.act-name { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.act-formula {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text2);
  margin-bottom: 6px;
}
.act-range { font-size: 11px; color: var(--text3); margin-bottom: 10px; }
.act-bar { height: 4px; border-radius: 2px; margin-bottom: 10px; }
.act-use { font-size: 12px; color: var(--text2); line-height: 1.55; }

/* Prompt examples */
.prompt-ex {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}
.prompt-bad { background: color-mix(in srgb, var(--red) 6%, transparent); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.prompt-good { background: color-mix(in srgb, var(--green) 6%, transparent); border-color: color-mix(in srgb, var(--green) 20%, transparent); }
.prompt-label { font-size: 11px; font-weight: 700; font-family: var(--mono); margin-bottom: 8px; }
.prompt-text { font-size: 13px; color: var(--text); line-height: 1.6; margin-bottom: 8px; font-style: italic; }
.prompt-why { font-size: 12px; color: var(--text2); line-height: 1.55; }

/* RAG flow */
.rag-flow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin: 16px 0 24px;
}
.rag-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-width: 88px;
  padding: 12px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.rag-icon { font-size: 20px; margin-bottom: 6px; }
.rag-name { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.rag-note { font-size: 10px; color: var(--text3); font-family: var(--mono); line-height: 1.35; }
.rag-arrow { color: var(--border2); font-size: 16px; padding: 0 2px; }

/* RL loop diagram */
.rl-loop {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 24px 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.rl-node {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
  min-width: 100px;
}
.rl-node-title { font-weight: 700; color: var(--text); font-size: 13px; }
.rl-node-sub { font-size: 10px; color: var(--text3); font-family: var(--mono); margin-top: 4px; }
.rl-arrow { text-align: center; color: var(--accent); font-size: 18px; }
.rl-arrow-label { font-size: 9px; font-family: var(--mono); color: var(--text3); }

/* Extra callouts & tips */
.callout-cyan { background: color-mix(in srgb, var(--cyan) 6%, transparent); border-left-color: var(--cyan); color: var(--text2); }
.callout-pink { background: color-mix(in srgb, var(--pink) 6%, transparent); border-left-color: var(--pink); color: var(--text2); }
.callout-purple { background: color-mix(in srgb, var(--purple) 6%, transparent); border-left-color: var(--purple); color: var(--text2); }
.tip-amber { background: color-mix(in srgb, var(--amber) 5%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 15%, transparent); border-left: 3px solid var(--amber); }
.tip-pink { background: color-mix(in srgb, var(--pink) 5%, transparent); border: 1px solid color-mix(in srgb, var(--pink) 15%, transparent); border-left: 3px solid var(--pink); }

.badge-intro,
.badge-mid,
.badge-adv {
  font-size: 11px;
  font-family: var(--mono);
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 6px;
}
.badge-intro { background: color-mix(in srgb, var(--green) 10%, transparent); color: var(--green); border: 1px solid color-mix(in srgb, var(--green) 22%, transparent); }
.badge-mid { background: color-mix(in srgb, var(--amber) 10%, transparent); color: var(--amber); border: 1px solid color-mix(in srgb, var(--amber) 22%, transparent); }
.badge-adv { background: color-mix(in srgb, var(--pink) 10%, transparent); color: var(--pink); border: 1px solid color-mix(in srgb, var(--pink) 22%, transparent); }

.metric-card { /* layout hook */ }

.comp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  margin: 16px 0;
}
.comp-table th,
.comp-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.comp-table th {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text3);
}

/* DS cheat sheet */
.cs-search-wrap { position: relative; margin-bottom: 12px; }
.cs-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.cs-search {
  width: 100%;
  padding: 12px 14px 12px 40px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 14px;
  font-family: var(--sans);
  outline: none;
  box-sizing: border-box;
}
.cs-search:focus { border-color: color-mix(in srgb, var(--accent) 40%, transparent); }
.cs-count { font-size: 12px; color: var(--text3); font-family: var(--mono); margin-bottom: 16px; }

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 32px;
}
.qn-btn,
.qn-pandas,
.qn-numpy,
.qn-sql,
.qn-excel,
.qn-mpl,
.qn-sklearn,
.qn-torch,
.qn-lg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  transition: all 0.18s;
}
.qn-btn:hover { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }

.cs-section { margin-bottom: 48px; scroll-margin-top: calc(var(--topbar-h) + 20px); }
.cs-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.cs-icon { font-size: 28px; }
.cs-title { font-family: var(--display); font-size: 22px; font-weight: 700; color: var(--text); }
.cs-subtitle { font-size: 13px; color: var(--text2); margin-top: 4px; }
.cs-sub { margin-bottom: 24px; }
.cs-sub-title {
  font-family: var(--display);
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
}
.cs-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; }
.cs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 480px;
}
.cs-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 10px 12px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.cs-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text2);
  vertical-align: top;
}
.cs-table tr:hover td { background: var(--surface2); }
.cs-table td:first-child {
  font-family: var(--mono);
  color: var(--accent);
  font-weight: 600;
  white-space: nowrap;
}
.t-pandas td:first-child { color: var(--cyan); }
.t-numpy td:first-child { color: var(--blue); }
.t-sql td:first-child { color: var(--green); }
.t-excel td:first-child { color: var(--amber); }
.t-mpl td:first-child { color: var(--orange); }
.t-sklearn td:first-child { color: var(--purple); }
.t-torch td:first-child { color: var(--pink); }
.t-lg td:first-child { color: var(--green); }

.sh-pandas { border-left: 3px solid var(--cyan); padding-left: 12px; }
.sh-numpy { border-left: 3px solid var(--blue); padding-left: 12px; }
.sh-sql { border-left: 3px solid var(--green); padding-left: 12px; }
.sh-excel { border-left: 3px solid var(--amber); padding-left: 12px; }
.sh-mpl { border-left: 3px solid var(--orange); padding-left: 12px; }
.sh-sklearn { border-left: 3px solid var(--purple); padding-left: 12px; }
.sh-torch { border-left: 3px solid var(--pink); padding-left: 12px; }
.sh-lg { border-left: 3px solid var(--green); padding-left: 12px; }

@media (max-width: 600px) {
  .cheat-row,
  .cheat-row-3,
  .cheat-3,
  .cheat-4 { grid-template-columns: 1fr !important; }
  .comp-table,
  .algo-table {
    display: block;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .cs-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .cs-table { min-width: 480px; }
  .comp-table th { font-size: 12px; }
}
