/* ============================================================
   infradb.sh demo: mc setup, the install wizard (js/demos/setup.js).
   A terminal window in the wizard's own palette (wake/theme.go
   StandardTheme: background #0b1020, panel #0f1629, border #26345a),
   not the sage UI palette. The terminal is a fixed cell grid sized
   from the window's width: 80 x 24 with the 70 x 19 frame centred,
   70 x 19 (the frame's own size) in narrow windows, and on phones
   (.is-phone, set by setup.js under 462px of terminal) a 46 x 21 frame
   holding the screens reflowed to 42 columns, so text stays 11px or
   larger. Every glyph the site's Plex Mono subset lacks is drawn on
   that grid with CSS or SVG.
   ============================================================ */

.su-demo { max-width: 800px; }

/* Title bar: the window title centred, key presses at the right. */
.su-bar { justify-content: center; }
.su-bar .stage-lights { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.su-bar::after { display: none; }
.su-title {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 11.5px/1 var(--font-mono); color: #7a86a8;
}
.su-keys { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); display: flex; }
.su-key {
  display: inline-block; padding: 3px 7px; border-radius: 5px;
  border: 1px solid #26345a; border-bottom-width: 2px; background: #0b1020;
  font: 500 11px/1.2 var(--font-mono); color: #c9d3ea; white-space: nowrap;
}

/* The terminal: a container, so the cell size follows the window. */
.su-body { padding: 10px 12px 12px; background: #0b1020; container: suterm / inline-size; }
.su-term {
  --cols: 80; --rows: 24; --fx: 5; --fy: 2; --fw: 70; --fh: 19;
  --lw: max(1px, 0.062em);
  position: relative; overflow: hidden;
  height: calc(var(--rows) * 1.2em);
  font-family: var(--font-mono); font-weight: 400;
  font-size: min(1.06vw, 16px); /* without container queries */
  font-size: calc(100cqw / (var(--cols) * 0.6));
  line-height: 1.2em;
  font-kerning: none; font-variant-ligatures: none; font-synthesis: none;
  color: #c9d3ea;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
@container suterm (max-width: 560px) {
  .su-term { --cols: 70; --rows: 19; --fx: 0; --fy: 0; }
}
/* Phones: the reflowed screens in a 46 x 21 frame; about 11.7px at 390px wide. */
.su-demo.is-phone .su-term {
  --cols: 46; --rows: 21; --fw: 46; --fh: 21; --fx: 0; --fy: 0;
  width: calc(var(--cols) * 1ch); max-width: 100%; margin: 0 auto;
  font-size: min(13px, calc(100cqw / (46 * 0.6)));
}
.su-demo.is-phone .su-fcap { display: none; }

/* The shell, before the wizard takes the screen. */
.su-shell { position: absolute; left: 0; top: 0; height: 1.2em; white-space: pre; }
.su-ps1 { color: #6cc8ff; }
.su-ps2 { color: #7a86a8; }
.su-cmd { color: #f2f6ff; }
.su-cursor { display: inline-block; vertical-align: top; width: 1ch; height: 1.2em; background: #c9d3ea; }
.su-cursor.is-off { background: transparent; }

/* The frame: --fw x --fh cells (70 x 19) on the panel colour; the border
   runs through the middle of its outer cells (stage.go drawFrame). */
.su-frame {
  position: absolute;
  left: calc(var(--fx) * 1ch); top: calc(var(--fy) * 1.2em);
  width: calc(var(--fw) * 1ch); height: calc(var(--fh) * 1.2em);
  background: #0f1629;
}
.su-border {
  position: absolute; left: calc(0.5ch - var(--lw) / 2); top: calc(0.6em - var(--lw) / 2);
  width: calc((var(--fw) - 1) * 1ch + var(--lw)); height: calc((var(--fh) - 1) * 1.2em + var(--lw));
  border: var(--lw) solid #26345a; border-radius: 0.36em;
}
.su-ftitle, .su-fcap { position: absolute; top: 0; height: 1.2em; background: #0f1629; white-space: pre; }
.su-ftitle { left: 3ch; color: #6cc8ff; font-weight: 600; }
.su-fcap { left: calc((var(--fw) - 10) * 1ch); color: #7a86a8; }

/* Content: 66 x 17 (42 x 19 on phones), two layers (the screen and the one the wake replaces). */
.su-content { position: absolute; left: 2ch; top: 1.2em; width: calc((var(--fw) - 4) * 1ch); height: calc((var(--fh) - 2) * 1.2em); overflow: hidden; }
.su-layer { position: absolute; inset: 0; background: #0f1629; }
.su-l { height: 1.2em; overflow: hidden; white-space: pre; }
.su-l > span, .su-l > svg { display: inline-block; vertical-align: top; height: 1.2em; }

/* Colours ({a} {d} {g} {y} {p} {w}). Dim is lifted a touch from #6b7799
   so it reads at 4.5:1 on the panel (WCAG AA); brighter again on the
   highlight row. */
.su-a { color: #6cc8ff; }
.su-d { color: #7a86a8; }
.su-g { color: #7ee0a8; }
.su-y { color: #f2c96d; }
.su-p { color: #f283b5; }
.su-w { color: #f2f6ff; }
.su-b { font-weight: 600; }
.su-hl { background: #1a2747; }
.su-hl.su-d { color: #8e9abd; }

/* Glyphs on the grid: ─ and ━ through the cell's middle, the ▏ caret,
   icons (✓ ◆ ○ ● ▲ ✗) and the logo's half blocks as SVG. */
.su-h { background: linear-gradient(currentColor, currentColor) 0 50% / 100% var(--lw) no-repeat; }
.su-hh { background: linear-gradient(currentColor, currentColor) 0 50% / 100% max(2px, 0.15em) no-repeat; }
.su-caret { background: linear-gradient(currentColor, currentColor) 0 0 / max(1px, 0.075em) 100% no-repeat; }
/* the shorthands above reset the colour: keep the highlight behind a drawn glyph */
.su-hl:is(.su-h, .su-hh, .su-caret) { background-color: #1a2747; }
.su-i { display: inline-block; vertical-align: top; width: 1ch; height: 1.2em; overflow: visible; }
.su-i.su-b path { stroke-width: 1.9; }
.su-blocks { display: inline-block; vertical-align: top; height: 1.2em; }

/* The wake: one strip per row, its right edge at the row's crest. */
.su-wake { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.su-wake > i { display: block; position: relative; height: 1.2em; will-change: transform; }
.su-wake > i > b { position: absolute; top: 0; right: 100%; height: 100%; }

@media (max-width: 760px) {
  .su-body { padding: 6px; }
  .su-bar { height: 28px; }
  .su-bar .stage-lights i { width: 8px; height: 8px; }
  .su-title { font-size: 11px; }
  .su-key { font-size: 11px; padding: 2px 6px; }
}
/* The narrowest phones (360px): a little less padding round the terminal keeps its text at 11px. */
@media (max-width: 380px) {
  figure[data-demo="setup"] .stage-view { padding-left: 6px; padding-right: 6px; }
  .su-body { padding: 4px; }
}
