/* The Programming+ Quarto extension: the frames around every view, the rendered views' own parts (the run, the
   stepper, the translations), and lingo highlighting. Attached to every page that uses a shortcode, after
   pplus-views.css (the app's rules for what its views draw, generated). Colors come from the page (Bootstrap's
   variables) and from the app's tokens, which pplus-views.css defines on .pplus-static. */

/* ---------- the live frame ---------- */
figure.pplus-embed,
.pplus-figure {
  margin: 1.25rem 0 1.75rem;
  border: 1px solid color-mix(in srgb, var(--bs-body-color) 16%, transparent);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bs-body-bg);
}
figure.pplus-embed .pplus-frame {
  display: block;
  width: 100%;
  border: 0;
  background: var(--bs-body-bg);
}
figure.pplus-embed figcaption,
.pplus-figure figcaption,
.pplus-under figcaption {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  padding: .4rem .8rem;
  font-size: .85rem;
  color: var(--bs-secondary-color, #6c757d);
  border-top: 1px solid color-mix(in srgb, var(--bs-body-color) 12%, transparent);
  background: color-mix(in srgb, var(--bs-body-bg) 97%, var(--bs-body-color));
}
.pplus-under figcaption { border: 0; background: none; padding: .1rem 0 0; }
.pplus-under { margin: -.75rem 0 1.5rem; }
figure .pplus-brand, .pplus-figure .pplus-brand, .pplus-under .pplus-brand { font-weight: 700; color: var(--bs-body-color); }
figure .pplus-caption, .pplus-figure .pplus-caption, .pplus-under .pplus-caption { color: var(--bs-body-color); }
figcaption a { text-decoration: none; }
figcaption a:hover { text-decoration: underline; }
.pplus-figcode { padding: .75rem .9rem 0; }
.pplus-figcode div.sourceCode, .pplus-figcode pre { margin: 0 0 .25rem; }
.pplus-figcode .math.display { display: block; margin: .25rem 0; }
.pplus-figtitle {
  padding: .5rem .9rem;
  font-weight: 600;
  border-bottom: 1px solid color-mix(in srgb, var(--bs-body-color) 12%, transparent);
}
button.pplus-golive {
  font: inherit;
  font-weight: 600;
  color: var(--bs-link-color, #2f5bea);
  background: none;
  border: 1px solid currentColor;
  border-radius: 999px;
  padding: 0 .6rem;
  cursor: pointer;
}
button.pplus-golive:hover { background: color-mix(in srgb, var(--bs-link-color, #2f5bea) 10%, transparent); }
div.pplus-figure.is-live .pplus-frame { display: block; width: 100%; border: 0; }

details.pplus-details { margin: 1rem 0 1.5rem; border: 1px solid color-mix(in srgb, var(--bs-body-color) 18%, transparent); border-radius: 10px; padding: .4rem .9rem; }
details.pplus-details > summary { cursor: pointer; font-weight: 600; padding: .25rem 0; }
details.pplus-details[open] > summary { margin-bottom: .5rem; }
details.pplus-details figure, details.pplus-details .pplus-figure { margin-top: .5rem; }
a.pplus-link::before { content: "▸ "; }

/* ---------- a rendered view ---------- */
.pplus-static {
  padding: .75rem .9rem;
  font-size: .9rem;
  line-height: 1.5;
  color: var(--ink);
  overflow-x: auto;
}
.pplus-static p { margin: .4rem 0; }
.pplus-static pre { margin: 0; }
.pplus-static code { color: inherit; background: none; padding: 0; }
.pplus-static table { margin: 0; }
.pplus-static details > summary { cursor: pointer; }
.pplus-head { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.pplus-spacer { flex: 1; }
.pplus-muted { color: var(--ink-3); }
.pplus-small { font-size: .82em; }
.pplus-who { font-size: .82em; }
.pplus-call { font-family: var(--mono); font-size: .88em; }
.pplus-chip {
  display: inline-block;
  font: 600 .72rem/1.6 var(--mono);
  padding: 0 .45rem;
  border-radius: 4px;
  color: var(--paper);
  /* the language's color moved a quarter of the way toward the ink, so the label reads at 4.5:1 or more in both
     themes (the green, orange and red of lingo, matho and Mojo are 3.3 to 3.7:1 under white text as they are) */
  background: color-mix(in srgb, var(--chip, var(--lang-pseudo, #2f5bea)) 75%, var(--ink, #16191f));
  text-transform: none;
}
.pplus-chip-lingo { --chip: var(--lang-lingo); }
.pplus-chip-matho { --chip: var(--lang-matho); }
.pplus-chip-pseudo { --chip: var(--lang-pseudo); }
.pplus-chip-speco { --chip: var(--lang-speco); }
.pplus-chip-mojo { --chip: var(--lang-mojo); }
.pplus-chip-asm { --chip: var(--lang-asm); }
.pplus-tag-generated {
  display: inline-block;
  font: 600 .7rem/1.6 var(--mono, monospace);
  padding: 0 .4rem;
  border-radius: 4px;
  color: var(--warn, #b5700d);
  background: var(--warn-bg, #fdf0d6);
}
.pplus-out {
  font-family: var(--mono);
  font-size: .85rem;
  white-space: pre-wrap;
  padding: .55rem .7rem;
  border-radius: 6px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  min-height: 2.2em;
}
.pplus-err { color: var(--err); font-size: .85rem; }
.pplus-note { color: var(--ink-2); font-size: .85rem; font-style: italic; }
.pplus-expect { margin-top: .5rem; font-size: .85rem; }
.pplus-expect.is-ok { color: var(--ok); }
.pplus-expect.is-bad { color: var(--err); }
.pplus-expect .pplus-out { margin-top: .3rem; color: var(--ink); }
.pplus-ref { font-family: var(--mono); color: var(--accent); margin-right: .35rem; }
.pplus-option { display: inline-block; font-size: .8rem; margin: .15rem .3rem 0 0; padding: 0 .4rem; border: 1px solid var(--line-2); border-radius: 4px; }
.pplus-picked { font-weight: 600; }

/* a listing, as the editor highlights it */
.pplus-code {
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.55;
  padding: .5rem 0;
  margin: 0;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow-x: auto;
  white-space: pre;
}
.pplus-ln { display: inline-block; min-width: 100%; padding: 0 .7rem 0 0; }
.pplus-lno { display: inline-block; width: 2.6em; padding-right: .8em; text-align: right; color: var(--ink-3); user-select: none; }
.pplus-code:not(:has(.pplus-lno)) .pplus-ln { padding-left: .7rem; }
.pplus-ln.is-last { background: var(--last-bg); }
.pplus-ln.is-next { background: var(--marker-bg); box-shadow: inset 3px 0 0 var(--marker); }

/* ---------- the stepper ---------- */
.pplus-steps-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem; margin-bottom: .6rem; }
.pplus-btn {
  font: 600 .8rem/1 var(--sans, inherit);
  min-width: 2rem;
  padding: .35rem .5rem;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  cursor: pointer;
}
.pplus-btn:hover { border-color: var(--accent); }
.pplus-btn:disabled { opacity: .45; cursor: default; }
.pplus-steps-slider { flex: 1 1 10rem; min-width: 8rem; accent-color: var(--accent); }
.pplus-steps-count { font: .8rem var(--mono); color: var(--ink-2); min-width: 5.5em; text-align: right; }
.pplus-steps-body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(14rem, 2fr); gap: .8rem; align-items: start; }
@media (max-width: 760px) { .pplus-steps-body { grid-template-columns: minmax(0, 1fr); } }
.pplus-steps-code .pplus-code { max-height: 30rem; overflow: auto; position: relative; }
.pplus-steps-now {
  font-size: .85rem;
  padding: .45rem .6rem;
  border-radius: 6px;
  background: var(--marker-bg);
  margin-bottom: .6rem;
  min-height: 2.6em;
}
.pplus-vars { width: 100%; border-collapse: collapse; font-size: .84rem; }
.pplus-vars th, .pplus-vars td { padding: .25rem .5rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.pplus-vars th { font: 600 .82rem var(--mono); color: var(--ink-2); width: 1%; white-space: nowrap; }
.pplus-vars td { font-family: var(--mono); word-break: break-word; }
.pplus-vars tr.is-wrote td { color: var(--k-write, var(--accent)); font-weight: 600; background: color-mix(in srgb, var(--k-write, #2f5bea) 10%, transparent); }
.pplus-steps-out-h { margin: .7rem 0 .25rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); }
.pplus-steps-out { max-height: 9rem; overflow: auto; }

/* ---------- the machine (pplus-hw): the board's cards over an x86-64 run ---------- */
.pplus-hw-now { font-size: .85rem; padding: .4rem .6rem; border-radius: 6px; background: var(--marker-bg); margin-bottom: .7rem; }
.pplus-hw-now .pplus-hw-machine { font-size: .8rem; }
.pplus-hw-body { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem; align-items: start; }
.pplus-hw-body.has-listing { grid-template-columns: minmax(12rem, 17rem) minmax(0, 1fr); }
.pplus-hw-body > .pplus-hw-listing { position: sticky; top: 4.5rem; }
@media (max-width: 760px) { .pplus-hw-body.has-listing { grid-template-columns: minmax(0, 1fr); } .pplus-hw-body > .pplus-hw-listing { position: static; } }
/* the cards: side by side when there is room (a page-wide figure), one under another otherwise */
.pplus-hw-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 24rem), 1fr)); gap: .75rem; align-items: start; }
.pplus-hw-card { min-width: 0; }
.pplus-hw-card.is-wide { grid-column: 1 / -1; }
.pplus-hw-title { font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); margin: 0 0 .3rem; }
.pplus-hw-listing .pplus-code { max-height: 26rem; overflow: auto; position: relative; }
.pplus-static .board-a86.a86 { margin: 0; overflow-x: auto; }
.pplus-static .a86-panel { margin: 0; }

/* ---------- translations, as the app's panes ---------- */
.pplus-translate-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: .75rem; }
.pplus-pane-head { display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.pplus-tabs .pplus-tab-note { font-size: .82rem; color: var(--bs-secondary-color, #6c757d); margin-top: -.4rem; }
.pplus-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; margin: 1rem 0; }
.pplus-columns .pplus-col > p:first-child { margin-bottom: .3rem; }

/* the app's views, on a page: their panels are not boxed in by a workspace */
.pplus-static .viz-scroll { max-height: none; }
.pplus-static .viz-scroll { overflow: auto; }
.pplus-static .flow-svg { max-width: none; }
.pplus-static .viz-head { margin-bottom: .5rem; }

/* A small translation table: pseudo on the left, the language on the right. */
.translation-table table { width: 100%; }
.translation-table td:first-child, .translation-table th:first-child { white-space: nowrap; }
.translation-table code { white-space: pre; }

/* lingo: the controlled English of Programming+. The colors fall back to the same roles the
   course's pseudo.css uses, so a site that has that stylesheet gets one family; any other site gets
   the fallbacks. */
.sourceCode.lingo .cf { color: var(--pseudo-flow, #9a2f4e); font-weight: 700; }
.sourceCode.lingo .kw { color: var(--pseudo-decl, #2f5d8c); font-weight: 600; }
.sourceCode.lingo .dt { color: var(--pseudo-type, #1f6f63); }
.sourceCode.lingo .fu { color: var(--pseudo-decl, #2f5d8c); font-weight: 700; }
.sourceCode.lingo .va { color: var(--pseudo-builtin, #5a4a8c); }
.sourceCode.lingo .op { color: var(--pseudo-keyword, #4a5568); }
.sourceCode.lingo .st, .sourceCode.lingo .ch, .sourceCode.lingo .dv { color: var(--pseudo-lit, #2f6f3f); }
.sourceCode.lingo .co { color: var(--pseudo-comment, #6f7680); font-style: italic; }

@media print {
  .pplus-steps-bar, button.pplus-golive { display: none; }
  .pplus-steps-code .pplus-code { max-height: none; }
}
