/* Converge: interactive figures and widgets. Controls borrow matplotlib's widget look. */

/* ---------- matplotlib-style widgets ---------- */

.mpl-btn {
  padding: 4px 14px; min-height: 32px;
  border: 1px solid var(--ink-3); border-radius: 0;
  background: var(--fill); color: var(--ink);
  font-family: var(--serif); font-size: 0.86em;
}
.mpl-btn:hover { background: var(--page); border-color: var(--ink); }
.mpl-btn[aria-pressed="true"], .mpl-btn[aria-selected="true"] { background: var(--ink); color: var(--page); border-color: var(--ink); }

.slider {
  display: grid; grid-template-columns: 9.5em 1fr 3.2em; align-items: center; gap: 10px;
  font-size: 0.86em;
}
.slider__lbl { text-align: right; white-space: nowrap; }
.slider__val { font-family: var(--serif); font-variant-numeric: tabular-nums lining-nums; }
.slider input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; margin: 0;
  background: transparent;
  --p: 50%;
}
.slider input[type="range"]::-webkit-slider-runnable-track {
  height: 14px; border: 1px solid var(--ink-3);
  background: linear-gradient(to right, color-mix(in srgb, var(--c-mlf) 70%, transparent) var(--p), transparent var(--p));
}
.slider input[type="range"]::-moz-range-track {
  height: 12px; border: 1px solid var(--ink-3);
  background: linear-gradient(to right, color-mix(in srgb, var(--c-mlf) 70%, transparent) var(--p), transparent var(--p));
}
.slider input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 4px; height: 20px; margin-top: -4px; background: var(--ink); border: 0; border-radius: 0;
}
.slider input[type="range"]::-moz-range-thumb { width: 4px; height: 20px; background: var(--ink); border: 0; border-radius: 0; }

/* ---------- Figure 1: the descent ---------- */

.descent__plot { width: 100%; height: auto; aspect-ratio: 624 / 360; cursor: crosshair; touch-action: manipulation; }
.descent__ctl { display: grid; gap: 6px; margin-top: 10px; }
.descent__btns { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-left: calc(9.5em * 0.86 + 10px); }
.descent__log { font-size: 0.86em; font-style: italic; color: var(--ink-2); }

@media (max-width: 560px) {
  .slider { grid-template-columns: 1fr 3em; }
  .slider__lbl { grid-column: 1 / -1; text-align: left; }
  .descent__btns { padding-left: 0; }
}

/* ---------- tables that stack into labelled rows on phones ---------- */

@media (max-width: 640px) {
  table.bt--stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.bt--stack, table.bt--stack tbody, table.bt--stack tr, table.bt--stack td { display: block; width: 100%; }
  table.bt--stack tr { padding: 8px 0; }
  table.bt--stack.bt--rows tbody tr + tr td { border-top: 0; }
  table.bt--stack tbody tr + tr { border-top: 1px solid var(--hair); }
  table.bt--stack td { padding: 2px 2px; text-align: left !important; white-space: normal !important; }
  table.bt--stack td[data-l]::before { content: attr(data-l) ": "; font-style: italic; color: var(--ink-2); }
  table.bt--stack td:first-child::before { content: none; }
  table.bt--stack td:first-child { font-size: 1.06em; }
}

/* ---------- colophon under the last page ---------- */

.colophon {
  padding: 8px 16px 36px; text-align: center;
  font-family: var(--ui); font-size: 13px; color: var(--bar-ink-2);
}
.colophon p { margin: 0; }

/* the author footnote uses a star, not a number */
.footnotes li.fn-star { list-style: none; margin-left: -1.2em; }

/* ---------- checklists (a table of \Box items) ---------- */

.check { margin: 1em 0 1.2em; border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); }
.check__cap { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--rule); font-size: 0.92em; }
.check__cap b { font-weight: 400; }
.check__list { margin: 0; padding: 4px 0; list-style: none; counter-reset: ck; font-size: 0.92em; }
.check__list li { counter-increment: ck; border-top: 1px solid var(--hair); }
.check__list li:first-child { border-top: 0; }
.check__list label { display: grid; grid-template-columns: 2em 1.4em 1fr; align-items: baseline; gap: 4px; padding: 5px 2px; cursor: pointer; }
.check__list label::before { content: counter(ck) "."; text-align: right; padding-right: 4px; color: var(--ink-2); font-variant-numeric: lining-nums; }
.check__list input {
  -webkit-appearance: none; appearance: none; width: 0.9em; height: 0.9em; margin: 0; align-self: center;
  border: 1px solid var(--ink); background: var(--page); display: grid; place-items: center; cursor: pointer;
}
.check__list input::after { content: ""; width: 0.5em; height: 0.28em; border-left: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(-45deg) translate(0.04em, -0.06em); opacity: 0; }
.check__list input:checked::after { opacity: 1; }
.check__list input:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.check__out { margin: 0; padding: 6px 2px; border-top: 1px solid var(--rule); font-style: italic; font-size: 0.92em; min-height: 2.2em; }

/* ---------- eligibility check ---------- */

.elig { margin: 0.8em 0 1.2em; padding: 12px 14px 14px; border: 1px solid var(--rule); font-size: 0.92em; }
.elig__course { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 10px; }
.elig__course label, .elig__quiz { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.elig input[type="radio"], .elig input[type="checkbox"] { accent-color: var(--ink); width: 1em; height: 1em; margin: 0; }
.elig__grid { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.elig__grid label { display: grid; gap: 2px; text-align: center; font-size: 0.9em; }
.elig__grid input, .calc input[type="number"] {
  width: 100%; min-width: 0; padding: 4px 4px; text-align: center;
  border: 0; border-bottom: 1px solid var(--ink); background: var(--fill); color: var(--ink);
  font-family: var(--serif); font-size: 1em; font-variant-numeric: tabular-nums lining-nums;
  -moz-appearance: textfield; border-radius: 0;
}
.elig__grid input::-webkit-outer-spin-button, .elig__grid input::-webkit-inner-spin-button,
.calc input::-webkit-outer-spin-button, .calc input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.elig__quiz { margin-top: 10px; }
.elig[data-course="mlp"] .elig__quiz { opacity: 0.45; }
.elig__out { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; min-height: 2.4em; }
.elig__detail { font-style: italic; color: var(--ink-2); }

/* the verdict: a double-ruled box, like \fbox inside \fbox */
.stamp-verdict:empty { display: none; }
.stamp-verdict {
  display: inline-block; padding: 3px 12px; border: 3px double var(--ink);
  font-variant: small-caps; font-weight: 700; letter-spacing: 0.04em; font-size: 1.05em;
}
.stamp-verdict[data-ok="false"] { border-style: solid; border-width: 1px; text-decoration: line-through; text-decoration-thickness: 1px; }

@media (max-width: 560px) {
  .elig__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ---------- Figure 3: the calculator ---------- */

.calc { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); padding: 12px 0 10px; }
.calc__tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.calc__inputs { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 12px; font-size: 0.88em; }
.calc__f { display: grid; gap: 3px; }
.calc__f span { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.calc__result { margin: 14px 0 4px; min-height: 3.2em; }
.calc__total { margin: 0; font-size: 1.05em; }
.calc__grade { display: inline-block; margin-left: 12px; padding: 1px 10px; border: 3px double var(--ink); font-variant: small-caps; font-weight: 700; letter-spacing: 0.04em; }
.calc__note { margin: 4px 0 0; font-size: 0.88em; font-style: italic; color: var(--ink-2); }
.calc__plot { width: 100%; height: auto; margin: 6px 0 2px; font-family: var(--serif); }
.calc__need { margin: 8px 0 0; }
.calc__need table.bt { font-size: 0.84em; }

/* ---------- Figure 4: the calendar ---------- */

.cal { border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); padding: 12px 0 10px; }
.cal__next { margin: 0 0 6px; font-size: 0.95em; }
.cal__plot { width: 100%; height: auto; font-family: var(--serif); margin: 4px 0 8px; }
.cal__table { font-size: 0.84em; }
.calc__need table.bt th, .calc__need table.bt td.num { white-space: normal; }
@media (max-width: 400px) { .calc__need table.bt { font-size: 0.78em; } .calc__need table.bt th, .calc__need table.bt td { padding: 4px 4px; } }
