/* ==========================================================================
   labs.css - layout and styling that belongs to specific sections.
   ========================================================================== */

/* ------------------------------------------------------------------ start / hero */
.hero {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 48px);
  background: radial-gradient(900px 340px at 100% -10%, var(--glow-1), transparent 70%),
    radial-gradient(600px 260px at -10% 110%, var(--glow-2), transparent 70%), var(--surface);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.hero h1 {
  max-width: 18ch;
  margin-bottom: var(--sp-4);
}
.hero .lead {
  margin-bottom: var(--sp-5);
}
.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: var(--sp-5);
  font-family: var(--font-mono);
}
.hero__meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-2);
  margin-bottom: var(--sp-5);
}
.objectives {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: obj;
  display: grid;
  gap: var(--sp-3);
}
.objectives li {
  counter-increment: obj;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: var(--sp-3);
  margin: 0;
  font-size: var(--fs-sm);
  line-height: 1.5;
}
.objectives li::before {
  content: counter(obj);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: var(--fs-xs);
  background: var(--accent-soft);
  color: var(--accent);
}
.objectives b {
  color: var(--ink);
}
.timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
  font-size: var(--fs-sm);
}
.timeline li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
}
.timeline li:last-child {
  border-bottom: 0;
  font-weight: 650;
}
.timeline span:last-child {
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------------ why: problem cards + journey */
.problem {
  display: grid;
  gap: var(--sp-2);
}
.problem__ico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  margin-bottom: 4px;
}
.problem__ico svg {
  width: 20px;
  height: 20px;
}
.problem:nth-child(1) .problem__ico {
  background: var(--chip-1);
}
.problem:nth-child(2) .problem__ico {
  background: var(--chip-2);
}
.problem:nth-child(3) .problem__ico {
  background: var(--chip-3);
}
.problem h3 {
  font-size: var(--fs-lg);
  margin: 0;
}
.problem p {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  margin: 0;
}
.problem__cause {
  margin-top: 6px;
}

.journey__nodes {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--sp-4);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  position: relative;
}
.journey__nodes li {
  margin: 0;
  position: relative;
}
.journey__nodes li:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 24px;
  left: calc(50% + 26px);
  right: calc(-50% + 26px);
  border-top: 2px dashed var(--line-2);
}
.journey__node {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0 4px;
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
  color: var(--ink-2);
  font-size: var(--fs-xs);
  font-weight: 600;
  line-height: 1.3;
}
.journey__dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border: 2px solid var(--line-2);
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--ink-2);
  transition: all 0.2s var(--ease);
}
.journey__node:hover .journey__dot {
  border-color: var(--accent);
  color: var(--accent);
}
.journey__node[aria-current='step'] .journey__dot {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  transform: scale(1.08);
  box-shadow: var(--ring);
}
.journey__node[aria-current='step'] {
  color: var(--ink);
}
.journey__detail {
  min-height: 170px;
}
.journey__detail h3 {
  margin-bottom: 6px;
}
.journey__detail p {
  color: var(--ink-2);
}
.miniwindow {
  display: flex;
  height: 30px;
  gap: 2px;
}
.miniwindow > div {
  border-radius: 4px;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: var(--fs-xs);
  font-weight: 650;
  color: #000;
  white-space: nowrap;
  overflow: hidden;
}
@media (max-width: 640px) {
  .journey__nodes li:not(:last-child)::after {
    display: none;
  }
  .journey__dot {
    width: 40px;
    height: 40px;
  }
  .journey__node span.lbl {
    font-size: 0.6875rem;
  }
}

/* ------------------------------------------------------------------ lab 1 playground */
.pg-controls {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3) var(--sp-5);
  align-items: center;
}
.presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.presets__label {
  font-size: var(--fs-sm);
  font-weight: 600;
  margin-right: 4px;
}
.compare-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-2);
}
.compare-cell {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: var(--surface);
  text-align: left;
}
.compare-cell .stat__value {
  font-size: var(--fs-xl);
}
.compare-cell[data-kind='real'] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}
.compare-cell[data-kind='na'] {
  background: var(--surface-2);
  border-style: dashed;
}
.compare-cell[data-kind='na'] .stat__value {
  color: var(--ink-3);
}
@media (max-width: 900px) {
  .compare-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.rt-ok {
  color: var(--good);
  font-weight: 600;
}
.trythis {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--sp-3);
}
.trythis li {
  margin: 0;
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.trythis li > b {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--warn-bg);
  color: var(--warn);
  font-size: var(--fs-xs);
}

/* ------------------------------------------------------------------ lab 2 BPE */
.bpe-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: var(--sp-4);
  align-items: start;
}
@media (max-width: 860px) {
  .bpe-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.bpe-words {
  display: grid;
  gap: 8px;
}
.bpe-word {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px;
  gap: var(--sp-3);
  align-items: center;
}
.bpe-word .toks {
  min-height: 0;
  font-size: var(--fs-sm);
}
.bpe-word .count {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  font-size: var(--fs-sm);
}
.bpe-word .count::before {
  content: '×';
  margin-right: 2px;
}
.pairs {
  display: grid;
  gap: 6px;
}
.pair {
  display: grid;
  grid-template-columns: minmax(78px, auto) minmax(0, 1fr) 34px;
  gap: var(--sp-3);
  align-items: center;
  width: 100%;
  text-align: left;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  cursor: default;
  font-size: var(--fs-sm);
}
button.pair {
  cursor: pointer;
}
button.pair:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.pair[data-top='true'] {
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: var(--accent-soft);
}
.pair[data-wrong='true'] {
  animation: shake 0.3s linear;
  border-color: var(--bad);
}
@keyframes shake {
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}
.pair__name {
  font-family: var(--font-mono);
  white-space: nowrap;
  font-weight: 600;
}
.pair__name i {
  font-style: normal;
  color: var(--ink-3);
  margin: 0 3px;
}
.pair__bar {
  height: 10px;
  border-radius: 0 4px 4px 0;
  background: var(--s1);
  min-width: 2px;
  transition: width 0.3s var(--ease);
}
.pair__n {
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.mergelog {
  max-height: 168px;
  overflow: auto;
  margin: 0;
  padding: 0;
  list-style: none;
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  display: grid;
  gap: 2px;
}
.mergelog li {
  margin: 0;
  color: var(--ink-2);
}
.mergelog li b {
  color: var(--ink);
}
.mergelog li:last-child {
  background: var(--accent-soft);
  border-radius: 6px;
  padding: 0 6px;
}
.spark {
  display: block;
  width: 100%;
  height: 54px;
}
.feedback-line {
  min-height: 1.6em;
  font-size: var(--fs-sm);
  font-weight: 550;
}
.feedback-line[data-kind='good'] {
  color: var(--good);
}
.feedback-line[data-kind='bad'] {
  color: var(--bad);
}
.feedback-line[data-kind='info'] {
  color: var(--ink-2);
}

/* ------------------------------------------------------------------ lab 3 budget */
.budget-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--sp-4) var(--sp-5);
}
@media (max-width: 760px) {
  .budget-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
.status {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: var(--sp-3);
  align-items: start;
  padding: var(--sp-4);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  font-size: var(--fs-sm);
}
.status svg {
  width: 22px;
  height: 22px;
}
.status strong {
  display: block;
  font-size: var(--fs-md);
  margin-bottom: 2px;
}
.status[data-ok='true'] {
  background: var(--good-bg);
  border-color: var(--good-line);
}
.status[data-ok='true'] svg,
.status[data-ok='true'] strong {
  color: var(--good);
}
.status[data-ok='false'] {
  background: var(--bad-bg);
  border-color: var(--bad-line);
}
.status[data-ok='false'] svg,
.status[data-ok='false'] strong {
  color: var(--bad);
}

/* ------------------------------------------------------------------ lab 4 memory */
.msgs {
  display: grid;
  gap: 6px;
}
.msg {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: var(--sp-3);
  align-items: start;
  padding: 8px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--fs-sm);
  line-height: 1.45;
  transition: opacity 0.2s var(--ease), background 0.2s var(--ease);
}
.msg__role {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  padding-top: 1px;
}
.msg__tok {
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  color: var(--ink-3);
  white-space: nowrap;
  text-align: right;
}
/* Dropped messages are meaningful content, so they are de-emphasised with explicit colours that still
   meet 4.5:1 contrast (strikethrough + dashed border + "dropped" label), never with opacity. */
.msg[data-state='dropped'] {
  border-style: dashed;
  background: var(--surface-2);
  color: var(--ink-3);
}
.msg[data-state='dropped'] .msg__text {
  text-decoration: line-through;
  text-decoration-color: var(--ink-3);
}
.msg[data-state='dropped'] .msg__tok::after {
  content: ' · dropped';
  color: var(--bad);
  font-weight: 650;
}
.msg[data-state='summary'] {
  background: var(--warn-bg);
  border-color: var(--warn-line);
}
.msg[data-state='kept'][data-protected='true'] .msg__role::after {
  content: ' · pinned';
  color: var(--accent);
  text-transform: none;
  letter-spacing: 0;
}
.msg__fact {
  display: inline-block;
  margin-left: 6px;
  font-size: var(--fs-xs);
  font-weight: 650;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  white-space: nowrap;
}
.msg[data-state='dropped'] .msg__fact {
  background: var(--surface-3);
  color: var(--ink-3);
}
@media (max-width: 560px) {
  .msg {
    grid-template-columns: minmax(0, 1fr) auto;
  }
  .msg__role {
    grid-column: 1 / -1;
  }
}
.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}
.fact {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: var(--fs-sm);
  background: var(--surface);
}
.fact svg {
  width: 16px;
  height: 16px;
  flex: none;
}
.fact[data-have='true'] {
  background: var(--good-bg);
  border-color: var(--good-line);
  color: var(--good);
  font-weight: 600;
}
.fact[data-have='false'] {
  background: var(--bad-bg);
  border-color: var(--bad-line);
  color: var(--bad);
  font-weight: 600;
}
/* a sensitive fact that IS stored is a risk (amber); one that is not stored is the good outcome (green, via data-have) */
.fact[data-risk='true'] {
  background: var(--warn-bg);
  border-color: var(--warn-line);
  color: var(--warn);
}
.bubble {
  border-radius: 16px 16px 16px 4px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  max-width: 62ch;
}
.bubble__who {
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-3);
  display: block;
  margin-bottom: 2px;
}
.bubble[data-kind='known'] {
  background: var(--good-bg);
  border-color: var(--good-line);
}
.bubble[data-kind='forgotten'],
.bubble[data-kind='rejected'] {
  background: var(--bad-bg);
  border-color: var(--bad-line);
}

/* ------------------------------------------------------------------ challenge */
.checklist {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.checklist li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: var(--sp-3);
  align-items: start;
  margin: 0;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  font-size: var(--fs-sm);
  background: var(--surface);
}
.checklist li svg {
  width: 20px;
  height: 20px;
  margin-top: 1px;
}
.checklist li[data-pass='true'] {
  background: var(--good-bg);
  border-color: var(--good-line);
}
.checklist li[data-pass='true'] svg {
  color: var(--good);
}
.checklist li[data-pass='false'] svg {
  color: var(--bad);
}
.checklist .detail {
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.editor {
  width: 100%;
  min-height: 250px;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  line-height: 1.6;
  tab-size: 2;
  background: var(--surface-2);
  border: 1px solid var(--line-2);
  border-radius: 12px;
  padding: 14px 16px;
  resize: vertical;
  white-space: pre;
  overflow: auto;
}
.editor:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: var(--ring);
}
.codeblock {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  overflow: auto;
  white-space: pre;
  margin: 0;
}
.tests {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}
.test {
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--sp-3);
  font-size: var(--fs-sm);
}
.test svg {
  width: 20px;
  height: 20px;
}
.test[data-pass='true'] {
  background: var(--good-bg);
  border-color: var(--good-line);
}
.test[data-pass='true'] svg {
  color: var(--good);
}
.test[data-pass='false'] {
  background: var(--bad-bg);
  border-color: var(--bad-line);
}
.test[data-pass='false'] svg {
  color: var(--bad);
}
.test__name {
  font-weight: 600;
}
.test__detail {
  font-family: var(--font-mono);
  font-size: var(--fs-xs);
  color: var(--ink-2);
  word-break: break-word;
}
.test__hint {
  font-size: var(--fs-xs);
  color: var(--ink);
  margin-top: 3px;
}
.test__hint::before {
  content: 'Hint: ';
  font-weight: 700;
}
.complete {
  text-align: center;
  padding: var(--sp-5);
}
.complete h3 {
  font-size: var(--fs-2xl);
}
.sumgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--sp-3);
}
.refs {
  font-size: var(--fs-sm);
  color: var(--ink-2);
  padding-left: 1.2em;
}
.refs li {
  margin-bottom: 0.6em;
}
.takeaways {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: var(--sp-3);
}
.takeaways li {
  margin: 0;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: var(--sp-3);
}
.takeaways li svg {
  width: 22px;
  height: 22px;
  color: var(--good);
  margin-top: 2px;
}

/* ------------------------------------------------------------------ small patches */
/* The playground re-renders on every keystroke; animating every chip would flicker. */
.toks--static .tok {
  animation: none;
}
.pair__bar-wrap {
  display: block;
  min-width: 0;
}

/* Phones: give checklist labels the full row; the detail text drops underneath. */
@media (max-width: 560px) {
  .checklist li {
    grid-template-columns: 24px 1fr;
  }
  .checklist .detail {
    grid-column: 2;
    white-space: normal;
  }
}

/* Sparkline: stretched line + a true-circle end dot (>= 8px with a 2px surface ring). */
.spark-wrap {
  position: relative;
  height: 54px;
}
.spark-wrap .spark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.spark-dot {
  position: absolute;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  box-sizing: border-box;
  background: var(--s1);
  border: 2px solid var(--surface);
}
