/* ============================================================
   classList demo — RocketHour 4.7 tutor reference
   Single screen, no framework, no build.
   ============================================================ */

:root {
  --paper: #fefcf8;
  --paper-warm: #f5f0e6;
  --ink: #1a1a1a;
  --ink-soft: #4a4a4a;
  --ink-faint: #b8b3a8;
  --rule: #e7e0d2;
  --accent: #d62828;            /* matches lesson c1 .red-text */
  --accent-glow: rgba(214, 40, 40, 0.18);
  --pulse: #fde68a;             /* the "just fired" gold */
  --pulse-deep: #f59e0b;
  --html-tint: #fff8ed;
  --css-tint:  #f3f8f5;
  --js-tint:   #f3f4fa;
  --code-grey: #6b7280;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Newsreader", Georgia, "Times New Roman", serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

code, pre, .code, .btn {
  font-family: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* ========================== PAGE HEAD ========================== */

.page-head {
  max-width: 980px;
  margin: 0 auto;
  padding: 64px 32px 28px 32px;
  text-align: center;
}

.kicker {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 14px 0;
}

.page-title {
  font-size: 52px;
  font-weight: 500;
  margin: 0 0 18px 0;
  letter-spacing: -0.015em;
  line-height: 1.05;
}

.page-title code {
  font-size: 0.78em;
  background: var(--paper-warm);
  padding: 2px 12px;
  border-radius: 6px;
  color: var(--accent);
  font-weight: 500;
}

.page-lede {
  max-width: 580px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 19px;
  line-height: 1.55;
}

/* =========================== STAGE ============================= */

.stage {
  max-width: 980px;
  margin: 32px auto 16px auto;
  padding: 0 32px;
  text-align: center;
}

.stage-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 16px 0;
}

.stage-frame {
  background: var(--paper-warm);
  border: 1px dashed var(--rule);
  border-radius: 14px;
  padding: 56px 32px;
  min-height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* The subject — the live element. Default state. */
.subject {
  margin: 0;
  font-family: "Newsreader", Georgia, serif;
  font-size: 36px;
  font-weight: 500;
  color: var(--ink);
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 18px 32px;
  transition: color 220ms ease, border-color 220ms ease, font-size 320ms ease;
}

/* The three classes the demo flips on and off. Defined AFTER .subject
   so they override its base styles. */
.subject.red {
  color: var(--accent);
  border-color: var(--accent);
}

.subject.big {
  font-size: 96px;
  padding: 30px 56px;
}

.subject.hidden {
  display: none;
}

.vanished-hint {
  margin: 18px 0 0 0;
  font-size: 14px;
  color: var(--ink-faint);
  font-style: italic;
  visibility: hidden;
}
.vanished-hint.shown {
  visibility: visible;
}
.vanished-hint code {
  background: var(--paper-warm);
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 13px;
}

/* =========================== PANELS ============================ */

.panels {
  max-width: 1240px;
  margin: 40px auto 0 auto;
  padding: 0 32px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.panel {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100%;
}

.panel-html { background: var(--html-tint); }
.panel-css  { background: var(--css-tint); }
.panel-js   { background: var(--js-tint); }

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}

.panel-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink);
}

.panel-sub {
  font-family: "Newsreader", serif;
  font-size: 14px;
  font-style: italic;
  color: var(--ink-soft);
}

.code {
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.tok-tag   { color: #8b3a3a; }
.tok-attr  { color: #6b7280; }
.tok-str   { color: #166534; }
.tok-punct { color: var(--code-grey); }
.tok-sel   { color: #1d4ed8; font-weight: 500; }
.tok-prop  { color: #b45309; }
.tok-val   { color: #166534; }
.tok-fn    { color: #7c3aed; font-weight: 500; }

.panel-foot {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.45;
}

/* ---- HTML panel chips (the live class-list) ---- */

.chips {
  display: inline;
}

.chip {
  display: inline-block;
  padding: 1px 9px;
  margin: 0 2px;
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 13.5px;
  color: var(--ink-faint);
  background: transparent;
  border: 1px dashed var(--ink-faint);
  transition: background 180ms, color 180ms, border-color 180ms, box-shadow 180ms;
}

.chip.on {
  color: var(--ink);
  background: white;
  border: 1px solid var(--ink);
  border-style: solid;
}

.chip.pulse {
  background: var(--pulse);
  border-color: var(--pulse-deep);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}

/* ---- CSS panel rule blocks ---- */

.rule {
  background: white;
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 12px 14px;
  opacity: 0.45;
  transition: opacity 240ms, border-color 240ms, box-shadow 240ms, background 240ms;
}

.rule.active {
  opacity: 1;
  border-color: var(--ink);
  background: white;
}

.rule.pulse {
  border-color: var(--pulse-deep);
  background: var(--pulse);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}

/* ---- JS panel buttons ---- */

.btn-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.btn {
  appearance: none;
  text-align: left;
  background: white;
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  color: var(--ink);
  transition: background 140ms, border-color 140ms, transform 60ms,
              box-shadow 160ms;
}

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

.btn:active {
  transform: scale(0.985);
}

.btn-add { border-left: 3px solid #16a34a; }
.btn-rem { border-left: 3px solid #b91c1c; }

.btn.pulse {
  background: var(--pulse);
  border-color: var(--pulse-deep);
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25);
}

/* ========================= KEY IDEA ============================ */

.key-idea {
  max-width: 980px;
  margin: 56px auto 24px auto;
  padding: 32px 36px;
  background: var(--paper-warm);
  border: 1px solid var(--rule);
  border-radius: 14px;
  text-align: center;
}

.key-idea-title {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 16px 0;
}

.key-idea-body {
  font-size: 19px;
  margin: 0 0 18px 0;
  line-height: 1.6;
  color: var(--ink);
}

.key-idea-body .arrow {
  color: var(--accent);
  font-weight: 700;
}

.key-idea-note {
  margin: 0;
  font-size: 14px;
  color: var(--ink-soft);
  font-style: italic;
  line-height: 1.55;
}

.key-idea-note code {
  font-size: 13px;
  background: white;
  padding: 1px 6px;
  border-radius: 3px;
}

/* ========================== PAGE FOOT ========================== */

.page-foot {
  max-width: 980px;
  margin: 32px auto;
  padding: 24px 32px;
  text-align: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ========================== RESPONSIVE ========================= */

@media (max-width: 900px) {
  .page-title { font-size: 38px; }
  .page-lede  { font-size: 17px; }
  .panels {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .subject     { font-size: 28px; padding: 14px 24px; }
  .subject.big { font-size: 56px; padding: 22px 36px; }
  .stage-frame { padding: 36px 20px; min-height: 140px; }
}
