/* T1 Terminal: one shell session, printed on paper. */

:root{
  --paper:#FAFAF7;
  --ink:#14140F;
  --dim:#6B6B60;
  --amber:#A05D00;      /* 4.95:1 on paper. was #A86400 at 4.47, under AA */
  --rule:#E4E4DA;
  --select:#F1E3C9;

  --fs-out:15px;
  --fs-cmd:16px;
  --lh:1.72;
  --pad-x:18px;
}

@media (min-width:720px){
  :root{
    --fs-out:15.5px;
    --fs-cmd:15.5px;
    --pad-x:clamp(48px, 9vw, 132px);
  }
}

*,*::before,*::after{box-sizing:border-box}

html{-webkit-text-size-adjust:100%;text-size-adjust:100%}

body{
  margin:0;
  min-height:100svh;
  padding:clamp(38px, 11vh, 112px) var(--pad-x) clamp(52px, 12vh, 132px);
  background:var(--paper);
  color:var(--ink);
  font-family:"Andale Mono","AndaleMono",ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono","Courier New",monospace;
  font-size:var(--fs-out);
  line-height:var(--lh);
  font-weight:400;
  letter-spacing:0;
}

.screen{max-width:84ch}

p{margin:0}

::selection{background:var(--select);color:var(--ink)}

:focus-visible{outline:2px solid var(--amber);outline-offset:3px}

a{
  color:var(--ink);
  text-decoration:underline;
  text-decoration-thickness:1px;
  text-decoration-color:var(--dim);
  text-underline-offset:.2em;
}
a:hover{text-decoration-color:var(--amber)}

.sr-only{
  position:absolute;
  width:1px;height:1px;
  margin:-1px;padding:0;
  overflow:hidden;
  clip:rect(0 0 0 0);
  clip-path:inset(50%);
  white-space:nowrap;
  border:0;
}

/* the masthead, printed as the first thing the session wrote */

.banner{margin:0 0 2.2em}
.banner-name{
  font-size:1.26em;
  line-height:1.2;
  font-weight:400;
  letter-spacing:.01em;
  margin:0;
}
.banner-role{margin:.4em 0 0;color:var(--dim)}
.banner-note{margin:1.7em 0 0;color:var(--dim);max-width:56ch}

html.js #record{display:none}

/* the command line, echoed */

.echo{
  margin:1.9em 0 0;
  font-size:var(--fs-cmd);
  line-height:1.55;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
}
.banner + .echo{margin-top:0}

.ps{white-space:nowrap}
.ps-user{color:var(--ink)}
.ps-colon{color:var(--dim)}
.ps-path,.ps-mark,.typed{color:var(--amber)}

/* printed output */

.out{margin:.8em 0 0;padding-left:2ch}

.out > .label{margin:0 0 .45em}

.label{
  display:block;
  font-size:11px;
  font-weight:400;
  line-height:1.5;
  letter-spacing:.16em;
  text-transform:uppercase;
  color:var(--dim);
}

.rows{margin-top:.1em}

.row{
  display:grid;
  grid-template-columns:4ch 24ch minmax(0,1fr);
  align-items:baseline;
}
.row + .row{margin-top:.18em}

.num{color:var(--dim)}
.name{color:var(--ink);font-size:1em;font-weight:400;margin:0;letter-spacing:0}
.stack{color:var(--dim);overflow-wrap:break-word}

.proj{
  display:grid;
  grid-template-columns:4ch minmax(0,1fr);
  align-items:baseline;
}
.proj .num{grid-column:1;grid-row:1}
.proj .name{grid-column:2;grid-row:1}
.proj .body{grid-column:2;grid-row:2;margin-top:.55em;max-width:62ch}

.desc{overflow-wrap:break-word}

.def{
  display:grid;
  grid-template-columns:7ch minmax(0,1fr);
  align-items:baseline;
  margin-top:.85em;
}
.def + .def{margin-top:.5em}
.out > .def:first-child{margin-top:0}
.def .val{overflow-wrap:break-word}

.prose{max-width:64ch}
.prose p + p{margin-top:1.15em}

.hint{
  margin:.9em 0 0;
  color:var(--dim);
  font-size:.92em;
  line-height:1.65;
  white-space:pre-wrap;
  overflow-wrap:break-word;
}

.msg{overflow-wrap:anywhere}

.row.help-row{grid-template-columns:12ch minmax(0,1fr)}
.help-row .cmd{color:var(--ink)}
.help-row .desc-text{color:var(--dim)}

/* the live prompt */

.tail{margin-top:2.4em}
html:not(.js) .tail{display:none}

.prompt{
  position:relative;
  display:grid;
  grid-template-columns:auto minmax(0,1fr);
  align-items:baseline;
  column-gap:1ch;
  padding-bottom:.5em;
  border-bottom:1px solid var(--rule);
}
/* the hidden attribute has to mean hidden: the grid above would otherwise
   beat the user agent's [hidden] rule and show the prompt before it is wired */
.prompt[hidden]{display:none}
.prompt::after{
  content:"";
  position:absolute;
  left:0;right:0;bottom:-1px;
  height:2px;
  background:var(--amber);
  transform:scaleX(0);
  transform-origin:left center;
  transition:transform .18s ease;
}
.prompt:focus-within::after{transform:scaleX(1)}
.prompt .ps{font-size:var(--fs-cmd);line-height:1.5}

#cmd{
  appearance:none;
  -webkit-appearance:none;
  width:100%;
  min-width:0;
  margin:0;
  padding:0;
  border:0;
  border-radius:0;
  background:transparent;
  color:var(--ink);
  font-family:inherit;
  font-size:var(--fs-cmd);
  line-height:1.5;
  letter-spacing:0;
  caret-color:var(--amber);
}
#cmd:focus,#cmd:focus-visible{outline:none}
#cmd::placeholder{color:var(--dim);opacity:1}

/* a secondary route, quieter than the prompt */

.hints{
  display:none;
  flex-wrap:wrap;
  align-items:baseline;
  gap:.1em 1.6em;
  margin-top:.85em;
}
html.js .hints{display:flex}

.hint-btn{
  font-family:inherit;
  font-size:.86em;
  line-height:1.6;
  margin:0;
  padding:.35em 0;
  color:var(--dim);
  background:none;
  border:0;
  cursor:pointer;
  text-decoration:underline;
  text-decoration-style:dotted;
  text-decoration-thickness:1px;
  text-decoration-color:var(--dim);
  text-underline-offset:.3em;
}
.hint-btn:hover{color:var(--ink);text-decoration-color:var(--amber)}
.hint-btn:focus-visible{outline:2px solid var(--amber);outline-offset:3px;color:var(--ink)}

@media (max-width:659px){
  .row{grid-template-columns:4ch minmax(0,1fr);row-gap:.1em}
  .row .name{grid-column:2;grid-row:1}
  .row .stack{grid-column:2;grid-row:2}
  .row + .row{margin-top:.62em}
}

@media (prefers-reduced-motion: reduce){
  .prompt::after{transition:none}
}

/* for anyone who has asked the system for more contrast: the same four
   colours, pushed apart, with no change to the layout or the copy */
@media (prefers-contrast: more){
  :root{
    --dim:#4A4A42;      /* 8.55:1 on paper, was 5.15 */
    --amber:#8A5000;    /* 6.22:1 on paper, was 4.95 */
    --rule:#B9B9AC;
  }
}

/* On a wide screen the session fills the window and the prompt sits on the
   bottom edge, the way a terminal window does, instead of leaving a band of
   empty paper under it. On phones the prompt stays in normal flow, so the
   on-screen keyboard can never cover the line being typed. */

@media (min-width:720px){
  body{
    display:flex;
    flex-direction:column;
    min-height:100svh;
    /* the prompt is pinned now, so it wants to sit near the edge rather than
       float above the document padding */
    padding-bottom:clamp(28px, 5vh, 56px);
  }
  .screen{
    flex:1 1 auto;
    display:flex;
    flex-direction:column;
    width:100%;
  }
  .tail{
    margin-top:auto;
    padding-top:2.4em;
  }
}
