/* Ergodex terminal (terminal.html): a full-screen shell in the site's type and orange. */
@font-face{font-family:"EDX Display";src:url("../fonts/edx-display.woff2") format("woff2");font-weight:300 800;font-stretch:100% 125%;font-display:swap}
@font-face{font-family:"EDX Text";src:url("../fonts/edx-text.woff2") format("woff2");font-weight:300 700;font-display:swap}

/* Palettes follow the site theme (html[data-theme], set by theme.js). Dark is the default. */
html.term-page{
  --bg:#0b0c0b;--ink:#e8ebe5;--dim:#8b948c;--line:#2a302b;--panel:#131513;
  --acc:#ff7a1a;--acc-ink:#ff7a1a;--cmd:#c49bd6;--link:#729fcf;--ok:#8ae234;--warn:#fce94f;--err:#ff6b5e;
  --mono:"EDX Text",ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  --fs:15px;--lh:1.45;
  --accent:var(--acc);--accent-ink:var(--acc-ink);
  color-scheme:dark;background:var(--bg)
}
html.term-page[data-theme=light]{
  --bg:#f4f4f0;--ink:#0e100e;--dim:#5d655e;--line:#c9cbc2;--panel:#ebebe5;
  --acc:#fd7001;--acc-ink:#ad4700;--cmd:#7a3e74;--link:#1d5f8a;--ok:#1f7a3a;--warn:#8a6a00;--err:#b3261e;
  color-scheme:light
}
html.term-page,html.term-page body{height:100%;margin:0;overflow:hidden}
html.term-page body{background:var(--bg);color:var(--ink);font:400 var(--fs)/var(--lh) var(--mono);letter-spacing:0;-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:100%;text-size-adjust:100%}
html.term-page ::selection{background:color-mix(in srgb,var(--acc) 38%,transparent)}

.sr-only{position:absolute!important;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0}
.skip{position:absolute;left:16px;top:-60px;z-index:50;padding:6px 10px;background:var(--acc);color:#0b0c0b;font-weight:700;text-decoration:none}
.skip:focus{top:12px}
/* Questions written to the log for screen readers only: out of the flow and out of copied text. */
.r.sr-only{min-height:0;-webkit-user-select:none;user-select:none}

.term{position:fixed;left:0;right:0;top:var(--vvt,0px);height:var(--vvh,100dvh);display:flex;flex-direction:column}
/* One-line status bar: the way back to the site and to Talk to us stays on screen whatever the shell shows. */
.term-bar{flex:none;display:flex;justify-content:space-between;align-items:center;gap:2ch;padding:8px 24px 0;font-size:12px;line-height:1.5;color:var(--dim);white-space:nowrap}
.term-bar .tb-id{overflow:hidden;text-overflow:ellipsis}
.term-bar .tb-id b{color:var(--acc-ink);font-weight:700}
.term-bar .tb-links{display:flex;align-items:center;gap:0 2.5ch;margin-left:auto}
.term-bar :is(a,button){padding:4px 0;border:0;background:none;color:var(--dim);font:inherit;letter-spacing:inherit;text-decoration:none;cursor:pointer}
.term-bar :is(a,button):hover{color:var(--ink)}
.term-bar .tb-cta{color:var(--acc-ink);font-weight:700}
.term-bar .tb-cta:hover{color:var(--acc-ink);text-decoration:underline;text-underline-offset:.22em}
.term-bar :is(a,button):focus-visible{outline:1px solid currentColor;outline-offset:2px}
html:not(.js) .term-bar .tb-js{display:none}
.term-scroll{position:relative;flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;padding:16px 24px 28px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--line) transparent}
/* Lines scrolling up fade out under the status bar; at the top of the log only the padding is in the fade. */
.term-scroll{-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 12px);mask-image:linear-gradient(to bottom,transparent 0,#000 12px)}
.term-out{container-type:inline-size}

/* Text index: visible without JS, hidden once the shell runs. */
.term-index{max-width:76ch;color:var(--dim)}
.term-index a{color:var(--link)}
html.js .term-index{display:none}

/* Rows */
.r{min-height:calc(var(--lh) * 1em);white-space:pre-wrap;overflow-wrap:break-word}
.r.p,.ul,.kv.steps,.kv.sta{max-width:76ch}
.r.pre{white-space:pre;overflow-x:auto;scrollbar-width:thin}
.r.gap{height:calc(var(--lh) * 1em)}
.blk{margin-top:calc(var(--lh) * 1em)}
.r.h{font-weight:700;color:var(--acc-ink)}
.r.h.man{color:var(--ink)}
.r.h.sec{font-weight:400}
.r.b,.t-b,.b{font-weight:700}
.t-dim{color:var(--dim)}
.t-acc{color:var(--acc-ink)}
.t-ok{color:var(--ok);font-weight:700}
.t-err{color:var(--err)}
.t-warn{color:var(--warn)}
.ind{padding-left:4ch}
.ul{margin:0;padding:0;list-style:none}
.ul li{padding-left:2ch;text-indent:-2ch}
.ul li::before{content:"•";display:inline-block;width:2ch;text-indent:0;color:var(--dim)}
.manhead{display:flex;justify-content:space-between;gap:2ch;max-width:76ch;font-weight:700}
.manhead .mid{font-weight:400;color:var(--dim)}
.tabs{color:var(--dim)}
.ls{line-height:1.7}

/* Two-column tables (help, links, history): command words in a column sized by --kw. */
.kv{display:grid;grid-template-columns:var(--kw,20ch) minmax(0,1fr);max-width:110ch}
.kv .k{white-space:pre}
.kv .v{white-space:pre-wrap;overflow-wrap:break-word;min-width:0}
.kv.help .v,.kv.hist .k{color:var(--ink)}
.kv.areas .k{color:var(--dim)}
.kv.steps .k{color:var(--acc-ink);font-weight:700}

/* Command words and links are clickable. */
.c{font:inherit;font-weight:700;color:var(--cmd);background:none;border:0;padding:0;margin:0;cursor:pointer;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--cmd) 35%,transparent);text-underline-offset:.22em;text-decoration-thickness:1px;letter-spacing:inherit}
.c:hover{text-decoration-color:currentColor}
.c:focus-visible,.l:focus-visible{outline:1px solid currentColor;outline-offset:2px}
.l{color:var(--link);font-weight:700;text-decoration:underline;text-decoration-color:color-mix(in srgb,var(--link) 40%,transparent);text-underline-offset:.22em;text-decoration-thickness:1px;overflow-wrap:anywhere}
.l:hover{text-decoration-color:currentColor}

/* Banner: scales to the screen so it never wraps. */
.banner{width:min(96%,calc(var(--fs) * 34.8));color:var(--acc)}
.banner svg{display:block;width:100%;height:auto}
.banner.is-text{width:auto;white-space:pre;overflow:hidden;font-size:min(var(--fs),calc(100cqi / 36.3));line-height:1.12}
.banner-sm{display:none;color:var(--acc);font-weight:700}
@container (max-width:200px){.banner{display:none}.banner-sm{display:block}}

/* Prompt: guest (orange) @ergodex : cwd (blue) $ (green), then the live input with a block cursor. */
.pu{color:var(--acc-ink);font-weight:700}
.pc{color:var(--link);font-weight:700}
.pd{color:var(--ok);font-weight:700}
.pq{font-weight:700;color:var(--ink)}
.echo.q .pq{color:var(--dim);font-weight:400}
.term-line{display:flex;align-items:flex-start;gap:1ch;margin-top:calc(var(--lh) * 1em)}
.term:not([data-ready]) .term-line{display:none}
/* While a command runs the prompt is hidden, but the input stays (dimmed) so you can see what you type ahead.
   Enter then queues the line; it runs as soon as the shell is free. */
.term.is-busy:not(.is-asking) .term-prompt{visibility:hidden}
.term.is-busy:not(.is-asking) .term-field{opacity:.65} /* .65 keeps typed-ahead text above 4.5:1 in light */
.term.is-busy.has-typeahead:not(.is-asking) .term-field{opacity:.75}
.term-prompt{flex:none;white-space:pre}
/* A long question wraps, and the answer field drops to its own line when the question leaves it too little room. */
.term.is-asking .term-line{flex-wrap:wrap}
.term.is-asking .term-prompt{flex:0 1 auto;min-width:0;white-space:pre-wrap;overflow-wrap:break-word}
.term.is-asking .term-field{flex:1 0 14ch}
.term-field{position:relative;flex:1;min-width:0;height:calc(var(--lh) * 1em);overflow:hidden}
.term-mirror{position:absolute;left:0;top:0;white-space:pre;pointer-events:none;will-change:transform}
.term-input{position:absolute;inset:0;width:100%;height:100%;margin:0;padding:0;border:0;border-radius:0;outline:0;background:transparent;color:transparent;caret-color:transparent;font:inherit;line-height:inherit;letter-spacing:inherit;-webkit-appearance:none;appearance:none}
.term-input::selection{background:color-mix(in srgb,var(--acc) 40%,transparent);color:transparent}
.term-input::-webkit-search-cancel-button{display:none}
.cur{background:var(--ink);color:var(--bg)}
.term-field:not(:focus-within) .cur{background:transparent;color:inherit;box-shadow:inset 0 0 0 1px var(--dim)}
.term-field:focus-within .cur.blink{animation:term-blink 1.2s steps(1) infinite}
@keyframes term-blink{50%{background:transparent;color:inherit}}
/* A command pressed while the shell is busy: the prompt line shakes once (term.js nudge). */
.term.nudge .term-line{animation:term-nudge .3s ease-out}
@keyframes term-nudge{25%{transform:translateX(-3px)}75%{transform:translateX(3px)}}

/* Phones and touch screens: tap chips above the keyboard. */
.term-chips{display:none}
@media (max-width:640px),(hover:none) and (pointer:coarse){
  .term-chips{display:flex;flex:none;gap:8px;overflow-x:auto;padding:8px 16px calc(8px + env(safe-area-inset-bottom));border-top:1px solid var(--line);background:var(--bg);scrollbar-width:none;scroll-padding-inline:16px;
    -webkit-mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent);mask-image:linear-gradient(90deg,#000 calc(100% - 28px),transparent)}
  .term-chips::-webkit-scrollbar{display:none}
  .term-chips::after{content:"";flex:none;width:20px}
  .chip{flex:none;min-height:44px;padding:0 14px;border:1px solid var(--line);background:var(--panel);color:var(--ink);font:400 14px/1 var(--mono);white-space:nowrap;cursor:pointer}
  .chip:active{border-color:var(--acc);color:var(--acc-ink)}
  .chip[data-chip=send]{border-color:var(--acc);color:var(--acc-ink);font-weight:700}
}
@media (max-width:640px){
  html.term-page{--fs:14px}
  .term-bar{padding:4px 16px 0;font-size:13px}
  .term-bar :is(a,button){padding:9px 0}
  .term-bar .tb-wide{display:none}
  .term-scroll{padding:10px 16px 20px}
  .term-line{font-size:16px}
  .ind{padding-left:2ch}
  .manhead .mid{display:none}
  .kv{max-width:none}
}
@container (max-width:58ch){
  .kv.help,.kv.links{grid-template-columns:minmax(0,1fr)}
  .kv.help .v{padding-left:2ch;color:var(--dim);margin-bottom:.35em}
  .kv.links .v{padding-left:2ch;margin-bottom:.35em}
}
/* Tables wider than a phone print a stacked twin; the container query shows one. */
.dual .narrow{display:none}
@container (max-width:66ch){
  .dual .wide{display:none}
  .dual .narrow{display:block}
}
@media (prefers-reduced-motion:reduce){
  .term-field:focus-within .cur.blink{animation:none}
  .term.nudge .term-line{animation:none;outline:1px solid var(--acc);outline-offset:2px}
}
