/* app/styles/syllabus.css — the Syllabus tab.
 *
 * Uses only the tokens already defined in app.css (--ink, --accent, --ok ...)
 * so the tab cannot drift away from the rest of the app when the palette moves.
 *
 * THE ONE RULE THIS FILE ENFORCES VISUALLY: a gap must be as legible as a
 * covered topic. The whole point of the tab is that a student can see what the
 * drill does NOT teach, so gaps are not greyed out into invisibility — they get
 * a warm border and a plain label. Only the genuinely-not-drillable rows recede,
 * because those are not work anyone is waiting on.
 *
 * FOUR RAILS, FOUR HUES, and they must be told apart at a glance in a 3px strip:
 *   covered  solid  green   (--ok)
 *   partly   DASHED indigo  (--accent)   <- the dash is the second signal, so the
 *                                           state does not rest on hue alone
 *   gap      solid  amber   (--warn)
 *   none     solid  grey    (--line)
 * Indigo rather than a second green on purpose: teal beside --ok reads as the
 * same colour at this width, and a partly-covered outcome mistaken for a covered
 * one is the precise lie the map exists to prevent.
 */

/* ------------------------------------------------------------ the tab bar */
.app-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 18px;
  border-bottom: 1px solid var(--line);
}
.app-tab {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  min-height: var(--tap);
  font: 600 15px/1.2 var(--font);
  color: var(--ink-soft);
  cursor: pointer;
}
.app-tab:hover { color: var(--ink); }
.app-tab.is-on { color: var(--accent-dk); border-bottom-color: var(--accent); }
.app-tab:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* --------------------------------------------------------------- the view */
.syl-intro { margin: 0 0 14px; color: var(--ink-soft); max-width: 62ch; }
.syl-loading { color: var(--ink-faint); }

.syl-lvls { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; }
.syl-lvl {
  appearance: none;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  min-height: var(--tap);
  font: 500 14px/1 var(--font);
  color: var(--ink-soft);
  cursor: pointer;
}
.syl-lvl:hover { border-color: var(--ink-faint); color: var(--ink); }
.syl-lvl.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.syl-lvl:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.syl-sum { margin: 0 0 14px; color: var(--ink); }
.syl-sum__rest { color: var(--ink-faint); font-size: .92em; }
.syl-foot { margin: 20px 0 0; color: var(--ink-faint); font-size: .9em; }

/* ---------------------------------------------------------------- chapter */
.syl-ch {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin: 0 0 8px;
  overflow: hidden;
}
.syl-ch__h {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  appearance: none;
  background: none;
  border: 0;
  padding: 12px 14px;
  min-height: var(--tap);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.syl-ch__h:hover { background: var(--line-soft); }
.syl-ch__h:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.syl-ch__no {
  flex: none;
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-faint);
  min-width: 62px;
}
.syl-ch__t { flex: 1 1 auto; font-weight: 600; color: var(--ink); }
.syl-ch__bar {
  flex: none;
  display: flex;
  width: 96px; height: 6px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
}
.syl-ch__bar > * { flex: none; height: 100%; }
.syl-ch__bar i { background: var(--ok); }
/* The partly-covered slice, drawn AFTER the green fill. Striped indigo, never
   green: it is work in progress, and a solid segment in the covered colour
   would add it to the finished length by eye even though pctCovered excludes
   it from the numerator. See app/syllabus-view.js's chapterBlock(). */
.syl-ch__bar b {
  background: repeating-linear-gradient(135deg,
    var(--accent) 0 3px, var(--accent-bg) 3px 6px);
}
/* A chapter with nothing drillable says so instead of drawing a bar — see
   app/syllabus-view.js. Muted and italic: it is a statement of fact about
   the syllabus, not a warning and not a score. */
.syl-ch__none{grid-column:span 2;justify-self:end;font-size:.82rem;font-style:italic;
  color:var(--ink-faint,#6b7280);white-space:nowrap}
.syl-ch__pct {
  flex: none;
  min-width: 40px;
  text-align: right;
  font: 600 13px/1 var(--font);
  color: var(--ink-soft);
}
.syl-unverified {
  font: 500 11px/1 var(--font);
  color: var(--warn);
  border: 1px solid currentColor;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 6px;
  white-space: nowrap;
}

.syl-ch__body { border-top: 1px solid var(--line); padding: 6px 14px 12px; }

/* ---------------------------------------------------------------- section */
.syl-sec { margin: 12px 0 0; }
.syl-sec__h {
  margin: 0 0 6px;
  font: 600 13px/1.3 var(--font);
  color: var(--ink-soft);
}
.syl-sec__ref {
  font: 600 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent-dk);
  margin-right: 4px;
}

/* ---------------------------------------------------------------- outcome */
.syl-list { list-style: none; margin: 0; padding: 0; }
.syl-outcome {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  padding: 8px 0 8px 10px;
  border-left: 3px solid var(--line);
  border-bottom: 1px solid var(--line-soft);
}
.syl-outcome:last-child { border-bottom: 0; }
.syl-outcome.is-covered { border-left-color: var(--ok); }
.syl-outcome.is-gap     { border-left-color: var(--warn); }
.syl-outcome.is-none    { border-left-color: var(--line); }
/* Dashed as well as a different hue — see the file header. The dash is the
   honest picture of the state: some of this rail is there and some of it is
   not. Text stays full-strength --ink, unlike an out-of-scope row: there ARE
   working drills on this line. */
.syl-outcome.is-partial { border-left-color: var(--accent); border-left-style: dashed; }

.syl-text { flex: 1 1 22rem; color: var(--ink); }
.syl-outcome.is-none .syl-text { color: var(--ink-soft); }
.syl-page {
  flex: none;
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--ink-faint);
}
.syl-actions { flex: 0 1 auto; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.syl-skill { display: inline-flex; align-items: center; gap: 6px; }
.syl-skill__name { font-size: .88em; color: var(--ink-faint); max-width: 22ch;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The tier buttons. Square, tappable, and one per tier the skill declares —
   4 and 5 exist on some skills now, so this must never assume three. */
.syl-tiers { display: inline-flex; gap: 4px; }
.syl-tier {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent-bg);
  color: var(--accent-dk);
  font: 600 14px/1 var(--font);
  text-decoration: none;
}
.syl-tier:hover { background: var(--accent); color: #fff; }
.syl-tier:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.syl-flag {
  font: 500 12px/1.3 var(--font);
  border-radius: 6px;
  padding: 4px 8px;
  white-space: nowrap;
}
.syl-flag--gap  { color: var(--warn); background: #fffbeb; border: 1px solid #fde68a; }
.syl-flag--none { color: var(--ink-faint); background: var(--line-soft);
  white-space: normal; max-width: 34ch; }
/* Badge + reason as ONE wrapping unit, so they never end up on separate lines
   with the buttons between them — see app/syllabus-view.js. `wrap` inside, so a
   phone stacks the reason under the badge instead of overflowing the row. */
.syl-partly {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* "partly covered" — a STATED badge, not a muted aside. It carries the whole
   difference between this row and the covered row above it, so it reads at the
   same weight as the tier buttons beside it. */
.syl-flag--partial { color: var(--accent-dk); background: var(--accent-bg);
  border: 1px solid var(--accent); font-weight: 600; }

/* The reason the other half is not drilled, printed in full and styled exactly
   like an out-of-scope `why` — same muted chip, same wrap, same width cap — so
   a student reads the two the same way. It follows the badge rather than
   replacing it: the badge says WHICH state, this says WHICH HALF. */
.syl-why {
  font: 500 12px/1.3 var(--font);
  border-radius: 6px;
  padding: 4px 8px;
  color: var(--ink-faint);
  background: var(--line-soft);
  white-space: normal;
  max-width: 34ch;
}

/* Touch targets stay 44px on a phone even though the chips are 34px drawn:
   the row's padding carries the rest. Below 560px the actions wrap under the
   text rather than squeezing it to one word per line. */
@media (max-width: 560px) {
  .syl-outcome { gap: 6px; }
  .syl-text { flex: 1 1 100%; }
  .syl-tier { width: 40px; height: 40px; }
  .syl-ch__bar { display: none; }
  .syl-skill__name { max-width: 14ch; }
}
