/* ============================================================
   HPy SHARED THEME — Warm REPL Reveal.js theme
   Shared by every presentation under Decks/HPy/ (Welcome and
   all unit/lesson content decks).

   ARCHITECTURE:
   1. Reveal.js controls reset        → force nav arrows visible
   2. Explicit theme application      → colors/fonts via CSS rules
   3. Dot-matrix texture              → persistent background texture
   4. CSS custom properties           → palette + px sizing tokens
   5. Structural overrides            → section, slide-inner, progress
   6. Slide labels & typography       → slide-tag, headings
   7. Bullet lists                    → .bullets component
   8. Glow blobs                      → decorative radial gradients
   9. Fragment overrides              → custom fade-up easing
  10. Storyboard strip                → SyncDeck thumbnail strip
  11. Reduced motion                  → accessibility
  12. Split grid helpers              → two-column layouts
  13. Callout boxes                   → info / warn / result variants
  14. Key property card               → .key-prop
  15. Topic list                      → .topic-list
  16. Warning blocks                  → .warn-block
  17. Title slide elements            → .subtitle
  18. Code panel                      → .code-card / syntax spans
  19. MCQ / FRQ fallback              → .mcq-opts / .opt-key / .frq-box
  20. Variable-box activity           → .var-boxes / .chip-tray
  21. Type classification bins        → .type-bins / .type-chip
   ============================================================ */

/* ─── 1. Force nav controls visible ──────────────────────── */

.reveal .controls {
  color: #f2b134;
  z-index: 30;
}
.reveal .controls .enabled {
  opacity: 0.95;
}

/* ─── 2. Explicit Reveal.js theme application ─────────────
   NOTE: --r-* CSS custom properties (like --r-background-color)
   are ONLY consumed by Reveal's bundled theme CSS files.
   Since we load reveal.css alone (no theme), we MUST use
   explicit CSS rules on the relevant elements.
   ──────────────────────────────────────────────────────── */

body,
.reveal-viewport {
  background: #1a1410;
  background-color: #1a1410;
}

.reveal {
  background: transparent;
  color: #f5ecdf;
  font-family: 'Manrope', sans-serif;
}

/* Headings — reset Reveal defaults (margin, text-transform, etc.) */
.reveal h1,
.reveal h2,
.reveal h3,
.reveal h4,
.reveal h5,
.reveal h6 {
  color: #f5ecdf;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-transform: none;
  margin: 0;
}

/* Body text */
.reveal p,
.reveal li,
.reveal blockquote {
  color: rgba(245,236,223,0.64);
  font-family: 'Manrope', sans-serif;
}

/* Links */
.reveal a { color: #f2b134; }
.reveal a:hover { color: rgba(242,177,52,0.7); }

/* Selection */
.reveal ::selection {
  background: rgba(242,177,52,0.25);
  color: #fff;
}

/* ─── 3. Dot-matrix texture ────────────────────────────────
   Subtle dot grid gives a print()/console-output feel.
   Fixed so it doesn't scroll/transform with Reveal's canvas.
   ──────────────────────────────────────────────────────── */

body::before {
  content: '';
  position: fixed; inset: 0;
  background-image: radial-gradient(rgba(242,177,52,0.09) 1px, transparent 1px);
  background-size: 26px 26px;
  pointer-events: none;
  z-index: 0;
}

/* ─── 4. CSS Custom Properties ────────────────────────────
   IMPORTANT: Use px for all font sizes and spacing.
   Reveal scales the 1600×900 canvas via CSS transform —
   px values scale correctly through it. em/clamp/vw
   reference actual viewport dimensions and double-scale.
   ──────────────────────────────────────────────────────── */

:root {
  /* Palette */
  --bg:            #1a1410;
  --bg-card:       #221a14;
  --text:          #f5ecdf;
  --text-muted:    rgba(245,236,223,0.64);
  --text-dim:      rgba(245,236,223,0.30);
  --accent:        #f2b134;
  --accent-dim:    rgba(242,177,52,0.12);
  --accent-border: rgba(242,177,52,0.25);
  --result:        #7cd992;   /* green highlight — secondary accent */
  --warn:          #ff6b5b;   /* warm red-orange — attention / caution */
  --syntax-string: #7ec8e3;   /* soft cyan — python string literals */
  --syntax-number: #c9a4ff;   /* soft violet — python numeric literals */

  /* Fonts */
  --font-ui:   'Manrope', sans-serif;
  --font-mono: 'Fira Code', monospace;

  /* Typography — px sized for the 1600×900 slide canvas.
     Reveal.js JS sets font-size on .reveal as floor(vh*0.04)
     (~28px at 720px), then scales slides via transform. Using
     px bypasses the inherited font-size entirely. */
  --title:  88px;    /* title slide main heading */
  --h2:     46px;    /* section headings         */
  --h3:     32px;    /* sub-headings             */
  --body:   24px;    /* paragraph / bullet text  */
  --small:  18px;    /* captions / annotations   */
  --label:  13px;    /* eyebrow labels / tags    */
  --code:   20px;    /* monospace / formula text */

  /* Spacing */
  --pad:     64px;   /* slide inner padding      */
  --gap:     22px;   /* between items            */
  --gap-sm:  11px;   /* tight gaps               */
  --gap-lg:  44px;   /* section breaks           */

  /* Animation */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ─── 5. Structural overrides ─────────────────────────────── */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* CRITICAL: Do NOT set position on sections.
   Reveal needs position: absolute to layer/fade slides.
   Overriding it with relative makes slides 2-N appear blank. */
.reveal .slides > section {
  height: 100%;
  padding: 0 !important;   /* override Reveal's default 20px */
  box-sizing: border-box;
  text-align: left;
}

/* Slide inner wrapper: applies padding, centres content.
   position: relative is safe here (it's a <div>, not <section>). */
.slide-inner {
  width: 100%;
  height: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: var(--pad);
  display: flex;
  flex-direction: column;
  justify-content: center;
  box-sizing: border-box;
  overflow: hidden;
  position: relative;
  z-index: 2;
}

/* Centred layout variant for title/impact slides */
.slide-center {
  align-items: center;
  text-align: center;
}

/* Progress bar */
.reveal .progress { height: 3px; }
.reveal .progress span {
  background: var(--accent);
  box-shadow: 0 0 8px rgba(242,177,52,0.4);
}

/* Slide number */
.reveal .slide-number {
  font-family: var(--font-mono);
  font-size: 1em;
  background: transparent;
  color: var(--text-dim);
}
.reveal .slide-number a,
.reveal .slide-number a:hover,
.reveal .slide-number a:focus {
  color: inherit;
  text-decoration: none;
  cursor: default;
}

/* ─── 6. Slide labels & typography ─────────────────────── */

/* Eyebrow tag above headings */
.slide-tag {
  font-family: var(--font-mono);
  font-size: var(--label);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--gap);
  display: block;
}
.slide-tag::before { content: '>>> '; opacity: 0.7; }

/* Title slide heading */
.title-h1 {
  font-size: var(--title);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0;
}

/* Accent color helper */
.accent { color: var(--accent); }
.result-color { color: var(--result); }

/* Heading sizes */
.reveal h2 { font-size: var(--h2); margin-bottom: var(--gap); }
.reveal h3 { font-size: var(--h3); margin-bottom: var(--gap-sm); }

/* ─── 7. Bullet lists ──────────────────────────────────── */

.bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}

.bullets li {
  position: relative;
  padding-left: 28px;
  font-size: var(--body);
  line-height: 1.55;
  color: var(--text-muted);
}

.bullets li::before {
  content: '#';
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--accent);
  font-weight: 700;
  position: absolute;
  left: 0;
  top: 0.22em;
}

.bullets li strong { color: var(--text); font-weight: 700; }

/* ─── 8. Glow blobs ─────────────────────────────────────── */

.glow {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
}

/* ─── 9. Fragment overrides ────────────────────────────── */

.reveal .fragment {
  transition:
    opacity 0.45s var(--ease),
    transform 0.45s var(--ease);
}
.reveal .fragment.fade-up {
  transform: translateY(18px);
}
.reveal .fragment.fade-up.visible {
  transform: translateY(0);
}

/* ─── 10. Storyboard strip ──────────────────────────────── */

.storyboard {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 0;
  overflow: hidden;
  background: rgba(12,9,6,0.97);
  border-top: 1px solid var(--accent-border);
  box-shadow: 0 -10px 30px rgba(0,0,0,0.4);
  z-index: 35;
  transition: height 0.28s var(--ease);
}

.storyboard-track {
  height: 100%;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 14px;
  overflow-x: auto;
  overflow-y: hidden;
}

.story-thumb {
  min-width: 212px;
  max-width: 212px;
  height: 150px;
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  background: rgba(20,15,10,0.9);
  color: var(--text);
  padding: 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}
.story-thumb:hover { border-color: rgba(242,177,52,0.5); }
.story-thumb.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(242,177,52,0.3) inset;
}

.story-num {
  position: absolute;
  top: 6px; left: 8px;
  z-index: 2;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(10,7,5,0.8);
  border: 1px solid var(--accent-border);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--warn);
  letter-spacing: 0.08em;
}

.story-preview {
  width: 192px;
  height: 108px;
  flex: 0 0 108px;
  border-radius: 6px;
  border: 1px solid var(--accent-border);
  overflow: hidden;
  background: var(--bg);
}

.story-scene {
  width: 1600px;
  height: 900px;
  transform: scale(0.12);
  transform-origin: top left;
  pointer-events: none;
}

.story-scene .slides {
  position: static;
  width: 1600px;
  height: 900px;
  inset: auto;
  transform: none;
}

.story-scene .slides > section {
  position: relative;
  display: block;
  top: auto; left: auto;
  width: 1600px;
  height: 900px;
  opacity: 1;
  visibility: visible;
  transform: none;
}

.story-caption {
  flex: 0 0 auto;
  font-size: 12px;
  line-height: 1.25;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 2px;
}

body.storyboard-open .storyboard { height: 172px; }
body.storyboard-open .reveal     { padding-bottom: 172px; }

/* ─── 11. Reduced motion ─────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  .reveal .fragment {
    transition: opacity 0.25s ease !important;
    transform: none !important;
  }
  .storyboard { transition: none; }
}

/* ─── 12. Split grid helpers ─────────────────────────────────
   Two-column grid layouts for slide content.
   .split is the base; combine with a ratio modifier class:
     class="split split-50"  → equal columns
     class="split split-40"  → left 40% / right 60%
     class="split split-60"  → left 60% / right 40%
   Add .split-top to align content flush to the top edge.
   ──────────────────────────────────────────────────────── */

.split {
  display: grid;
  gap: var(--gap-lg);
  align-items: center;
  flex: 1;
  min-height: 0;
}
.split-50  { grid-template-columns: 1fr 1fr; }
.split-40  { grid-template-columns: 2fr 3fr; }
.split-60  { grid-template-columns: 3fr 2fr; }
.split-top { align-items: start; }

/* ─── 13. Callout boxes ──────────────────────────────────── */

.callout {
  background: var(--accent-dim);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: var(--body);
  color: var(--text-muted);
  line-height: 1.55;
}
.callout strong { color: var(--text); }

.callout-warn {
  background: rgba(255,107,91,0.08);
  border-left: 3px solid var(--warn);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: var(--body);
  color: var(--text-muted);
  line-height: 1.55;
}
.callout-warn strong { color: var(--warn); }

.callout-result {
  background: rgba(124,217,146,0.07);
  border-left: 3px solid var(--result);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
  font-size: var(--body);
  color: var(--text-muted);
  line-height: 1.55;
}
.callout-result strong { color: var(--result); }

/* ─── 14. Key property card ──────────────────────────────── */

.key-prop {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: var(--body);
  color: var(--text-muted);
  line-height: 1.5;
}
.key-prop strong { color: var(--text); display: inline; }

/* ─── 15. Topic list ─────────────────────────────────────── */

.topic-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.topic-list li {
  position: relative;
  padding-left: 24px;
  font-size: 21px;
  color: var(--text-muted);
  line-height: 1.5;
}
.topic-list li::before {
  content: '#';
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent);
  position: absolute;
  left: 0;
}

/* ─── 16. Warning blocks ─────────────────────────────────── */

.warn-block {
  margin-top: var(--gap-sm);
  padding: 10px 14px;
  border-left: 3px solid var(--warn);
  background: rgba(255,107,91,0.06);
  border-radius: 0 4px 4px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.warn-label {
  font-family: var(--font-mono);
  font-size: var(--label);
  color: var(--warn);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ─── 17. Title slide elements ───────────────────────────── */

.subtitle {
  font-family: var(--font-mono);
  font-size: 20px;
  color: var(--text-dim);
  margin-top: 22px;
  letter-spacing: 0.02em;
}

/* ─── 18. Code panel ─────────────────────────────────────────
   .code-card wraps a terminal-style code block. Combine with
   either a plain <pre><code> (for static snippets) or a stack
   of .code-line rows (for line-by-line trace/highlight decks).
   ──────────────────────────────────────────────────────── */

.code-card {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  overflow: hidden;
}

.code-hdr {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--accent-border);
  font-family: var(--font-mono);
  font-size: var(--small);
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.code-hdr .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-border);
}
.code-hdr .dot:nth-child(1) { background: var(--warn); }
.code-hdr .dot:nth-child(2) { background: var(--accent); }
.code-hdr .dot:nth-child(3) { background: var(--result); }

.code-body { padding: 18px 22px; }
.code-body pre {
  box-shadow: none;
  width: auto;
  background: transparent;
  margin: 0;
}
.code-body pre code {
  max-height: none;
  font-family: var(--font-mono);
  font-size: var(--code);
  line-height: 1.7;
  color: var(--text);
  background: transparent;
  padding: 0;
  display: block;
  white-space: pre;
}

/* Line-numbered rows for step-by-step trace/highlight */
.code-line {
  display: flex;
  gap: 16px;
  padding: 2px 0;
  font-family: var(--font-mono);
  font-size: var(--code);
  line-height: 1.7;
  white-space: pre;
  transition: color 0.3s var(--ease), opacity 0.3s var(--ease);
}
.code-line .car {
  flex: 0 0 auto;
  width: 0.9em;
  color: var(--accent);
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.25s var(--ease);
}
.code-line.current .car { opacity: 1; }
.code-line .ln {
  flex: 0 0 auto;
  width: 1.6em;
  text-align: right;
  color: var(--text-dim);
  user-select: none;
}
.code-line.current .ln { color: var(--accent); font-weight: 700; }
.code-line.current {
  background: rgba(242,177,52,0.08);
  border-radius: 4px;
  margin: 2px -8px;
  padding: 2px 8px;
}
.code-line.done { opacity: 0.5; }
.code-line.pending { opacity: 0.35; }

/* Python syntax token colors — keep usage consistent by concept:
   keywords/builtins, identifiers, strings, numbers, booleans, comments. */
.tok-kw   { color: var(--accent); font-weight: 600; }
.tok-nm   { color: var(--text); font-weight: 600; }
.tok-str  { color: var(--syntax-string); }
.tok-num  { color: var(--syntax-number); }
.tok-bool { color: var(--result); font-weight: 600; }
.tok-cm   { color: var(--text-dim); font-style: italic; }
.tok-op   { color: var(--text-muted); }

/* ─── 19. MCQ / FRQ fallback rendering ────────────────────────
   Static, non-interactive rendering of MCQ options or an FRQ
   prompt for standalone/preview contexts. The resonance activity
   owns answer submission and reveal; this is display-only.
   ──────────────────────────────────────────────────────── */

.mcq-opts {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--gap-sm);
}
.mcq-opts li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-radius: 8px;
  font-size: var(--body);
  color: var(--text-muted);
}
.mcq-opts code {
  font-family: var(--font-mono);
  font-size: var(--code);
  color: var(--text);
}
.opt-key {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--small);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
}

/* FRQ prompt box — standalone fallback on resonance free-response slides */
.frq-box {
  background: var(--bg-card);
  border: 1px solid var(--accent-border);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 16px 20px;
}
.frq-box p {
  font-size: var(--body);
  line-height: 1.6;
  color: var(--text-muted);
}
.frq-box p strong { color: var(--text); }

/* ─── 20. Variable-box activity ───────────────────────────────
   Boxes represent named variables; chips represent candidate
   values. Students place a chip into a box to match what a line
   of Python code just assigned. See EMBEDDED_ACTIVITIES.md for
   why this stays plain HTML/CSS/JS rather than a hosted activity:
   it is a one-off deck-local exercise, not a reusable SyncDeck
   activity contract.
   ──────────────────────────────────────────────────────── */

.var-boxes {
  display: flex;
  gap: var(--gap);
  flex-wrap: wrap;
}
.var-box {
  min-width: 168px;
  border: 2px solid var(--accent-border);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease), transform 0.2s var(--ease);
}
.var-box-name {
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: var(--small);
  font-weight: 700;
  color: var(--text);
  background: rgba(242,177,52,0.08);
  border-bottom: 1px solid var(--accent-border);
  white-space: nowrap;
}
.var-box-value {
  padding: 18px 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: var(--code);
  font-weight: 600;
  color: var(--text-dim);
  text-align: center;
}
.var-box.empty .var-box-value { font-style: italic; }
.var-box.target {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(242,177,52,0.18);
}
.var-box.target .var-box-value { color: var(--accent); }
.var-box.correct {
  border-color: var(--result);
  box-shadow: 0 0 0 3px rgba(124,217,146,0.2);
}
.var-box.correct .var-box-value { color: var(--result); }
.var-box.shake { animation: var-box-shake 0.4s var(--ease); }
@keyframes var-box-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.chip-tray {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
  margin-top: var(--gap);
}
.chip {
  padding: 10px 20px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-dim);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--code);
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: transform 0.15s var(--ease), border-color 0.15s var(--ease), opacity 0.2s var(--ease), box-shadow 0.15s var(--ease);
}
.chip:hover { border-color: var(--accent); transform: translateY(-2px); }
.chip.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(242,177,52,0.25);
}
.chip.used { opacity: 0.25; pointer-events: none; cursor: default; }
.chip:active { cursor: grabbing; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.trace-feedback {
  margin-top: var(--gap);
  min-height: 1.4em;
  font-family: var(--font-mono);
  font-size: var(--small);
  color: var(--text-dim);
}
.trace-feedback.good { color: var(--result); }
.trace-feedback.bad { color: var(--warn); }

/* ─── 21. Type classification bins ────────────────────────────
   Bins represent Python types; the shared .chip / .chip-tray
   components (see section 20) get sorted into the correct bin.
   Unlike .var-box, a bin can hold multiple sorted items at once.
   ──────────────────────────────────────────────────────── */

.type-bins {
  display: flex;
  gap: var(--gap-sm);
  flex-wrap: wrap;
}
.type-bin {
  flex: 1 1 150px;
  min-width: 150px;
  border: 2px solid var(--accent-border);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.type-bin-header {
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: var(--small);
  font-weight: 700;
  color: var(--text);
  background: rgba(242,177,52,0.08);
  border-bottom: 1px solid var(--accent-border);
}
.type-bin-items {
  padding: 10px;
  min-height: 64px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 6px;
}
.type-bin.shake { animation: var-box-shake 0.4s var(--ease); }

.type-chip {
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(124,217,146,0.12);
  border: 1px solid rgba(124,217,146,0.35);
  color: var(--result);
  font-family: var(--font-mono);
  font-size: var(--small);
  font-weight: 600;
}
