/* susankassin.com, text-adventure version.
   Layout: one terminal column. A scrolling log and a command line.
   Colors are the bright sixteen-color terminal palette old MUD clients used. */

:root {
  --bg: #050607;
  --fg: #b9bdc4;
  --bright: #ffffff;
  --dim: #858a93;
  --line: #2a2d33;
  --cyan: #55ffff;
  --green: #55ff55;
  --magenta: #ff77ff;
  --red: #ff6666;
  --blue: #88aaff;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", "Courier New", monospace;
  color-scheme: dark;
}

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
}

a { color: var(--blue); text-underline-offset: 0.2em; }
a:hover { color: var(--bright); }

h1, h2, h3 { font: inherit; font-weight: 700; margin: 0; }
p { margin: 0 0 0.75em; }
ul, ol { margin: 0 0 0.75em; padding-left: 4ch; }
li { margin-bottom: 0.5em; }
img { max-width: 100%; height: auto; display: block; }

/* Plaques, signs and cards: a rule of text characters above and below */
blockquote { margin: 0 0 0.75em; padding: 0 2ch; color: var(--bright); }
blockquote::before, blockquote::after {
  content: "+--------------------------------------------------------------------------------------------------------+";
  display: block; white-space: nowrap; overflow: hidden;
  margin: 0 -2ch; color: var(--dim);
}
blockquote::before { margin-bottom: 0.5em; }
blockquote > :last-child { margin-bottom: 0.5em; }
/* A lit display rather than a plaque */
blockquote.display { color: var(--green); }
blockquote.display .label { color: var(--bright); letter-spacing: 0.12em; }

/* ---------- Terminal ---------- */

#terminal {
  height: 100%;
  max-width: 96ch;
  margin: 0 auto;
  display: flex; flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

#log {
  flex: 1; min-height: 0;
  overflow-y: auto; overflow-x: hidden;
  position: relative;
  padding-block: 16px 10px;
  overflow-wrap: anywhere;
  scrollbar-color: var(--line) transparent;
}
#log > * { margin-bottom: 1em; }

.echo { color: var(--bright); }
.echo::before { content: "> "; color: var(--bright); }
.sys { color: var(--dim); }
.err { color: var(--red); }

.room-name { color: var(--cyan); margin-bottom: 0.4em; }
.room-name::before { content: "== "; color: var(--dim); }
.room-name::after { content: " =="; color: var(--dim); }
.sub { color: var(--cyan); margin: 1em 0 0.4em; }
.person-name { color: var(--magenta); }
.term { color: var(--magenta); font-weight: 700; }
.note { color: var(--dim); }
.howto { list-style: none; padding-left: 0; }
.howto li { margin-bottom: 0.25em; padding-left: 2ch; text-indent: -2ch; }
.howto li::before { content: "* "; color: var(--green); }

/* A command the visitor can type, shown in bright white. It is not clickable. */
.cmd { color: var(--bright); }
/* The two real buttons: leave the adventure for the plain page, and come back */
.go {
  font: inherit; color: var(--blue);
  background: none; border: 0; padding: 0; margin: 0;
  cursor: pointer; text-align: left;
  text-decoration: underline; text-underline-offset: 0.2em;
}
.go:hover { color: var(--bright); }
.go:focus-visible, a:focus-visible { outline: 1px solid var(--green); outline-offset: 2px; }

.exits { color: var(--green); }
.exits .cmd { color: var(--green); }
.exits ul { list-style: none; padding-left: 2ch; margin: 0; }
.exits li { margin: 0; }

/* Drawings made of text. --cols is the width of the drawing in characters,
   so it shrinks to fit a phone screen instead of wrapping. */
pre.art, pre.map {
  margin: 0 0 0.75em; font: inherit; line-height: 1.15; white-space: pre;
  overflow: hidden; color: var(--dim);
  font-size: min(1em, calc((100vw - 34px) / (var(--cols, 60) * 0.61)));
}
pre.art.name { color: var(--cyan); }
pre.art.sky { color: #e9e4cf; line-height: 1; }
pre.art.scene { color: #9aa0a9; }
/* The main drawing: the Webb telescope, gold mirror above a silver sunshield */
pre.art.webb { line-height: 1; font-size: min(0.8em, calc((100vw - 34px) / (var(--cols, 60) * 0.61))); }
/* webb colors: written by build_mud.py */
pre.art.webb .p0 { color: #f1e76d; }
pre.art.webb .p1 { color: #ffff00; }
pre.art.webb .p2 { color: #ffed00; }
pre.art.webb .p3 { color: #b4ae99; }
pre.art.webb .p4 { color: #e2ba05; }
pre.art.webb .p5 { color: #a4abac; }
pre.art.webb .p6 { color: #b99e8e; }
pre.art.webb .p7 { color: #aa9fac; }
pre.art.webb .p8 { color: #ca9800; }
pre.art.webb .p9 { color: #bc9d2c; }
pre.art.webb .p10 { color: #98a2af; }
pre.art.webb .p11 { color: #9898b0; }
pre.art.webb .p12 { color: #899cb1; }
pre.art.webb .p13 { color: #b8877f; }
pre.art.webb .p14 { color: #b86b9b; }
pre.art.webb .p15 { color: #9989b2; }
pre.art.webb .p16 { color: #838ab4; }
pre.art.webb .p17 { color: #8e76b5; }
pre.art.webb .p18 { color: #c14f85; }
pre.art.webb .p19 { color: #be4382; }
pre.art.webb .p20 { color: #b55399; }
pre.art.webb .p21 { color: #bf3b7c; }
pre.art.webb .p22 { color: #c22c6f; }
/* end webb colors */
pre.art.webb .star { color: #7d8594; }
/* The top of the page: the telescope, with the name in block letters under it.
   (They were tried side by side; she asked for the telescope back above the name.)
   The telescope's starry sky runs to the right edge of the column and carries on behind the name:
   a second block of sky sits behind the name and is cut off where the name ends. */
.masthead > pre.art.webb { margin-bottom: 0; }
.name-sky { position: relative; overflow: hidden; margin-bottom: 0.75em; }
.name-sky pre.art.webb { position: absolute; top: 0; left: 0; margin: 0; }
.name-sky pre.art.name { position: relative; margin: 0; padding-bottom: 0.6em; overflow: visible; }
/* The telescope as a flower, in the Control Room */
pre.art.flowers { line-height: 1; }
pre.art.joined { margin-bottom: 0; }
pre.art.flowers.labels { line-height: 1.4; color: var(--fg); }
pre.art.flowers.labels b { color: var(--bright); }
pre.art.flowers .gold { color: #f2c230; }
pre.art.flowers .shield { color: #c7b6da; }
pre.art.flowers .plant { color: #5fcf5f; }
pre.art.flowers .grass { color: #2f8f3f; }
pre.art.flowers .label { color: var(--bright); }
pre.art.flowers .star { color: var(--dim); }
/* Drawings with a dark panel behind them: the domes at night, the control room in red light */
pre.art.night, pre.art.red { line-height: 1; padding: 0.7em 1ch; width: fit-content; max-width: 100%; border: 1px solid var(--line); }
pre.art.night { color: #dfe3ea; background: #070b16; }
pre.art.night .ground { color: #6f7480; }
pre.art.night .star { color: #9aa3b5; }
pre.art.red { color: #ff5a4d; background: #190505; border-color: #4a1310; }
pre.art.red .screen { color: #ffc2b8; }
pre.art.red .dim { color: #b3362e; }
pre.map { color: var(--green); line-height: 1.2; }
pre.map .cmd { color: var(--bright); }
pre.map .cmd.here { background: var(--bright); color: var(--bg); }
pre.map .away { color: var(--fg); }

/* Two-column listings: who, help, CV */
.rows { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0.25em 3ch; margin: 0 0 0.75em; }
.rows dt { margin: 0; color: var(--bright); }
.rows dd { margin: 0; }
.rows.cv dt { color: var(--bright); font-variant-numeric: tabular-nums; }
.rows.cv dd b { color: var(--bright); font-weight: 400; }
@media (min-width: 621px) {
  .rows.who { grid-template-columns: 28ch minmax(0, 1fr); }
  .rows.cv { grid-template-columns: 18ch minmax(0, 1fr); }
}
@media (max-width: 620px) {
  .rows { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .rows dd { padding-left: 2ch; margin-bottom: 0.6em; }
}

.pubs { padding-left: 5ch; }
.pubs li::marker { color: var(--dim); }
.pubs .meta { display: block; color: var(--dim); }
.pubs .meta a { color: var(--dim); }

/* A group member: text portrait (or photograph) beside the words */
.person { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2ch; align-items: start; }
.person .picture { width: 242px; max-width: 100%; }
.person pre.portrait {
  margin: 0; font: inherit; font-size: 4.2px; line-height: 1; white-space: pre; overflow: hidden;
  color: #d5d8dd; border: 1px solid var(--line);
}
.person img { width: 242px; aspect-ratio: 1 / 1; object-fit: cover; object-position: 50% 22%; border: 1px solid var(--line); }
.person .photo-hint { font-size: 0.93em; margin-top: 0.3em; color: var(--dim); }
.js .person img { display: none; }
.js .person.show-photo img { display: block; }
.js .person.show-photo pre.portrait { display: none; }
@media (max-width: 560px) { .person { grid-template-columns: minmax(0, 1fr); } }
.person.no-picture { display: block; }
.photo { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.photo img { border: 1px solid var(--line); width: 100%; }
/* A figure from a paper: a plot on white, as published */
.plot { margin: 0 0 1em; max-width: 560px; }
.plot img { width: 100%; background: #fff; border: 1px solid var(--line); }
.plot figcaption { margin-top: 0.5em; color: var(--dim); font-size: 0.93em; }

.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; width: 72ch; background: #000; border: 1px solid var(--line); margin-bottom: 0.5em; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ---------- Command line ---------- */

#prompt {
  display: flex; align-items: center; gap: 1ch;
  border-top: 1px solid var(--line);
  padding-block: 10px 6px;
}
#prompt:focus-within { border-top-color: var(--green); }
#prompt label { color: var(--bright); }
#cmd {
  flex: 1; min-width: 0;
  background: transparent; border: 0; outline: none;
  color: var(--bright); caret-color: var(--green);
  font: inherit; font-size: 16px;
}
#cmd::placeholder { color: var(--dim); opacity: 1; }
/* Under the command line: where map, each direction and back lead from the current room */
#hints { margin: 0; padding-block: 0 12px; font-size: 0.86em; line-height: 1.45; color: var(--dim); display: flex; flex-wrap: wrap; gap: 0 3ch; }
#hints .off, #hints .off .cmd { color: #5d626b; }

/* ---------- The plain page (the default), and the adventure ----------
   The page opens as an ordinary page. When the visitor chooses to play, the script puts the class
   "js" on <html>: the terminal shows and the plain page hides. */

.js #world { display: none; }
html:not(.js) #terminal { display: none; }
html:not(.js) body { height: auto; }
#world {
  max-width: 96ch; margin: 0 auto; padding-block: 18px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#world > *, #world .page > * { margin-bottom: 2.5em; }
/* The plain site is several pages in one file. Only the page whose address is in the address bar
   shows (#group, #publications ...); with no address, or an unknown one, the home page shows. */
#world .page { display: none; margin-bottom: 0; }
#world .page:target, #world #home { display: block; }
#world:has(.page:target:not(#home)) #home { display: none; }
#world .sections { margin-bottom: 1.5em; padding-bottom: 0.75em; border-bottom: 1px solid var(--line); }
.sections b { color: var(--bright); font-weight: 400; }
#world .person { margin-bottom: 1.5em; }
#world .adventure-only, #world [data-item="help"], #world [data-item="map"], #world > [data-item="astroscholars"],
#world pre.portrait, #world .photo-hint { display: none; }
#log .plain-only { display: none; }
/* the offer to play needs the script, so it only shows once the script has loaded */
html:not(.can-play):not(.js) .play-offer { display: none; }
.play-offer { color: var(--dim); }             /* quieter than the main welcome line */
.sections { display: flex; flex-wrap: wrap; gap: 0.2em 3ch; margin: 0 0 0.75em; }
