/* ═══════════════════════════════════════════════════════════════
   Head First-style components — shared across all tutorial pages.
   Conventions:
     .hf-talk         → chatty section intro paragraph(s)
     .hf-speech       → coach speech bubble with SP avatar
     .hf-callout      → boxed callout with pill-shaped title
       .hf-callout--brain    purple   "Brain Power"     (predict + reveal)
       .hf-callout--qa       blue     "No Dumb Questions" Q&A list
       .hf-callout--pencil   yellow   "Sharpen Your Pencil" exercise
       .hf-callout--master   green    "Mastery Move"    (next-level insight)
       .hf-callout--trap     red      "Watch Out"       (common bug)
       .hf-callout--bullets  yellow   "Bullet Points"   end-of-section summary
     .hf-pin          → numbered marker placed inline inside <code>
     .hf-anno         → ordered list paired with hf-pins (data-n attribute)
     .hf-trace        → coloured step-by-step array trace ladder
     .hf-legend       → mini legend chips for trace colours

   Also adds:
     .tutorial-card__badge--yellow — missing yellow badge variant
   ═══════════════════════════════════════════════════════════════ */

/* Chatty intro paragraphs used at the top of a section */
.hf-talk { font-size: 1.05rem; line-height: 1.75; color: var(--text); }
.hf-talk p { margin-bottom: 14px; }
.hf-talk em { color: #ffb060; font-style: normal; font-weight: 600; }

/* Generic callout box with a pill-shaped title chip */
.hf-callout {
  position: relative;
  margin: 18px 0;
  padding: 20px 22px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card2);
}
.hf-callout__title {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 0.7rem; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.14em;
  padding: 6px 12px; border-radius: 999px;
  margin-bottom: 12px;
}
.hf-callout__title svg { width: 14px; height: 14px; }
.hf-callout__body { font-size: 0.96rem; line-height: 1.7; color: var(--text); }
.hf-callout__body > p { margin-bottom: 10px; }
.hf-callout__body > p:last-child { margin-bottom: 0; }

/* "Brain Power" — purple, asks the reader to predict */
.hf-callout--brain {
  background: linear-gradient(135deg, rgba(124,92,191,0.10), rgba(79,142,247,0.07));
  border-color: rgba(124,92,191,0.35);
}
.hf-callout--brain .hf-callout__title { background: rgba(124,92,191,0.22); color: #c9b5ff; }

/* "There Are No Dumb Questions" — Q & A list */
.hf-callout--qa { background: rgba(0,164,239,0.06); border-color: rgba(0,164,239,0.25); }
.hf-callout--qa .hf-callout__title { background: rgba(0,164,239,0.18); color: #7fc8ff; }
.hf-callout--qa dl { margin: 0; }
.hf-callout--qa dt { font-weight: 700; color: var(--text); margin-bottom: 4px; }
.hf-callout--qa dt::before { content: "Q: "; color: #58b9ff; font-weight: 800; }
.hf-callout--qa dd {
  margin: 0 0 14px;
  color: var(--text-muted);
  padding-left: 14px;
  border-left: 2px solid rgba(0,164,239,0.25);
}
.hf-callout--qa dd::before { content: "A: "; color: #58b9ff; font-weight: 800; }
.hf-callout--qa dd:last-of-type { margin-bottom: 0; }

/* "Sharpen Your Pencil" — yellow exercise w/ hidden answer */
.hf-callout--pencil { background: rgba(255,200,80,0.08); border-color: rgba(255,200,80,0.30); }
.hf-callout--pencil .hf-callout__title { background: rgba(255,200,80,0.20); color: #ffd76e; }
.hf-callout--pencil details {
  margin-top: 12px; padding: 12px 14px;
  background: rgba(52,211,153,0.08);
  border: 1px dashed rgba(52,211,153,0.30);
  border-radius: 10px;
}
.hf-callout--pencil details summary {
  cursor: pointer; font-weight: 700; color: #6ee7b7; outline: none;
  list-style: none; user-select: none;
}
.hf-callout--pencil details summary::-webkit-details-marker { display: none; }
.hf-callout--pencil details summary::before { content: "👉  "; }
.hf-callout--pencil details[open] summary { margin-bottom: 10px; }
.hf-callout--pencil details[open] summary::before { content: "👇  "; }
.hf-callout--pencil details pre {
  margin: 0; padding: 10px 12px;
  background: var(--bg-dark); border-radius: 8px;
  font-size: 0.82rem; line-height: 1.55;
  overflow-x: auto;
}

/* "Mastery Move" — next-level insight (green-purple) */
.hf-callout--master {
  background: linear-gradient(135deg, rgba(52,211,153,0.10), rgba(124,92,191,0.08));
  border-color: rgba(52,211,153,0.40);
}
.hf-callout--master .hf-callout__title { background: rgba(52,211,153,0.18); color: #6ee7b7; }

/* "Trap" — common bug warning (red) */
.hf-callout--trap {
  background: rgba(239,68,68,0.07);
  border-color: rgba(239,68,68,0.35);
}
.hf-callout--trap .hf-callout__title { background: rgba(239,68,68,0.18); color: #fca5a5; }
.hf-callout--trap code { color: #ffb4b4; }

/* "Bullet Points" summary — yellow sticky note */
.hf-callout--bullets {
  background: rgba(255,200,80,0.06);
  border-color: rgba(255,200,80,0.25);
  border-style: dashed;
}
.hf-callout--bullets .hf-callout__title { background: rgba(255,200,80,0.18); color: #ffd76e; }
.hf-callout--bullets ul { list-style: none; padding: 0; margin: 0; }
.hf-callout--bullets li { position: relative; padding-left: 24px; margin-bottom: 10px; line-height: 1.6; }
.hf-callout--bullets li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: #6ee7b7; font-weight: 800;
}
.hf-callout--bullets li:last-child { margin-bottom: 0; }

/* Speech bubble — coach talking to the reader */
.hf-speech {
  position: relative;
  margin: 18px 0 18px 58px;
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  font-style: italic;
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.65;
}
.hf-speech::before {
  content: "SP";
  position: absolute;
  left: -50px; top: 2px;
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-style: normal;
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 14px rgba(79,142,247,0.30);
}
.hf-speech::after {
  content: "";
  position: absolute;
  left: -7px; top: 18px;
  width: 14px; height: 14px;
  background: var(--bg-card2);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: rotate(45deg);
}

/* Numbered pin used inside code to mark annotated spots */
.hf-pin {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #ffb060; color: #1a1108;
  font-weight: 800; font-size: 0.72rem;
  font-family: 'JetBrains Mono', monospace;
  vertical-align: 1px;
  margin: 0 4px;
  box-shadow: 0 0 0 2px rgba(255,176,96,0.25);
}

/* Annotation list under code — pairs with .hf-pin numbers */
.hf-anno {
  margin: 12px 0 0; padding: 0;
  list-style: none;
  display: grid; gap: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}
.hf-anno li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  align-items: start;
}
.hf-anno li::before {
  content: attr(data-n);
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  background: #ffb060; color: #1a1108;
  font-weight: 800; font-size: 0.74rem;
  font-family: 'JetBrains Mono', monospace;
  margin-top: 1px;
}
.hf-anno li strong { color: var(--text); }
.hf-anno li code {
  font-size: 0.82rem;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px; border-radius: 4px;
}

/* Coloured trace ladder — one row per algorithm step */
.hf-trace { display: grid; gap: 8px; margin: 14px 0 4px; }
.hf-trace__step {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 10px 14px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.hf-trace__label {
  color: var(--text-muted);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 700;
}
.hf-trace__cells {
  display: flex; gap: 5px; flex-wrap: wrap;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.9rem;
}
.hf-trace__cell {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; padding: 4px 8px;
  border-radius: 7px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  color: var(--text);
}
.hf-trace__cell--look {
  background: rgba(255,176,96,0.22);
  border-color: rgba(255,176,96,0.55);
  color: #ffd09b;
  font-weight: 700;
}
.hf-trace__cell--swap {
  background: rgba(239,68,68,0.22);
  border-color: rgba(239,68,68,0.55);
  color: #ffb4b4;
  font-weight: 700;
}
.hf-trace__cell--final {
  background: rgba(52,211,153,0.18);
  border-color: rgba(52,211,153,0.55);
  color: #b8f4d0;
  font-weight: 700;
}
.hf-trace__note {
  color: var(--text-muted);
  font-style: italic;
  font-size: 0.84rem;
  text-align: right;
  min-width: 90px;
}

/* Tiny legend chip used above the trace */
.hf-legend {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: var(--text-muted);
}
.hf-legend span {
  display: inline-flex; align-items: center; gap: 6px;
}
.hf-legend i {
  width: 12px; height: 12px; border-radius: 4px;
  display: inline-block;
}
.hf-legend i.look  { background: rgba(255,176,96,0.55); }
.hf-legend i.swap  { background: rgba(239,68,68,0.55); }
.hf-legend i.final { background: rgba(52,211,153,0.55); }

/* Missing yellow badge variant — used by some tutorial pages */
.tutorial-card__badge--yellow {
  background: rgba(255,200,80,0.14);
  color: #ffd76e;
  border-color: rgba(255,200,80,0.30);
}

/* Light theme tweaks for legibility */
[data-theme="light"] .hf-callout--brain  { background: linear-gradient(135deg, rgba(124,92,191,0.06), rgba(79,142,247,0.04)); }
[data-theme="light"] .hf-callout--qa     { background: rgba(0,164,239,0.05); }
[data-theme="light"] .hf-callout--pencil { background: rgba(255,200,80,0.12); }
[data-theme="light"] .hf-callout--bullets{ background: rgba(255,200,80,0.12); }
[data-theme="light"] .hf-callout--master { background: linear-gradient(135deg, rgba(52,211,153,0.06), rgba(124,92,191,0.04)); }
[data-theme="light"] .hf-callout--trap   { background: rgba(239,68,68,0.05); }
[data-theme="light"] .hf-speech          { background: var(--bg-card); }
[data-theme="light"] .hf-speech::after   { background: var(--bg-card); }
[data-theme="light"] .hf-trace__step     { background: var(--bg-card); }

@media (max-width: 640px) {
  .hf-trace__step { grid-template-columns: 1fr; }
  .hf-trace__note { text-align: left; }
  .hf-speech { margin-left: 50px; }
  .hf-speech::before { width: 34px; height: 34px; left: -44px; font-size: 0.75rem; }
}

/* ─────────────────────────────────────────────────
   Tutorial jump-bar — "Jump to another tutorial"
   Shared by the home page and every tutorial page.
   ───────────────────────────────────────────────── */
.tut-jumpbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  max-width: 900px;
  margin: 0 auto 8px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.tut-jumpbar__label {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-right: 4px;
}
.tut-jumpbar__chip {
  text-decoration: none;
  transition: transform .15s ease, filter .15s ease;
  cursor: pointer;
}
.tut-jumpbar__chip:hover {
  transform: translateY(-1px);
  filter: brightness(1.18);
}
.tut-jumpbar__chip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.tut-jumpbar__chip[aria-current="page"] {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  pointer-events: none;
}
