/* /ascii-art/vt100-animations/: the standalone pages of the collection (layouts/ascii-art/vt100_*.html).
   Look: the terminal as an object. The page is the putty-coloured case, the title a dark name plate,
   the animation sits in a black bezel; selection is reverse video. The player itself is vtplay.css,
   whose --text / --muted / --orange-dark are given here. → doc/vt100_animations.md */

.vtx {
  --case: #e3dccb;
  --case-low: #d6cdb8;
  --rule: #b9ae96;
  --text: #26221b;
  --muted: #625a4b;
  --plate: #2b2722;
  --plate-text: #efe8d8;
  --link: #14477a;
  --orange-dark: #8a3d00;
  --mono: ui-monospace, "DejaVu Sans Mono", "Cascadia Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: "Helvetica Neue", Helvetica, Arial, "Liberation Sans", sans-serif;
  margin: 0; background: var(--case); color: var(--text); font: 15px/1.5 var(--sans); min-height: 100vh;
}
/* Monospace is what a terminal or a file system would show: the name plate, paths, the names of files and
   folders, the screens and the player. The rest is text. */
.plate, .crumbs, .path, .bezel, .tile-screen, .tile-name, .frow-name, .folder-id, .sidebar .t, .pager a,
.vtx :is(code, kbd, select.ids) { font-family: var(--mono); }
.vtx *, .vtx *::before, .vtx *::after { box-sizing: border-box; }
/* the player's own boxes keep the content-box their stylesheet was written for */
.vtx .vt-screen *, .vtx .vt-screen *::before, .vtx .vt-screen *::after { box-sizing: content-box; }
.vtx [hidden] { display: none !important; }
.vtx a { color: var(--link); }
.vtx code { font-size: .93em; background: var(--case-low); padding: 0 3px; overflow-wrap: anywhere; }
.vtx :focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }

/* A link that leaves the site, marked as everywhere on the blog (a.external-link of style.css, which
   these standalone pages do not load). By address and not by class: the links come from the JSON. The
   chrome (plate, menu line) stays out, its language links are absolute addresses of our own. */
.vtx main a[href^="http"]:not([href*="//maistrelis.com"], [href*=".maistrelis.com"])::after {
  content: ""; display: inline-block; width: .72em; height: .72em; margin-left: .2em; vertical-align: .08em;
  background-color: currentColor;
  -webkit-mask: url(/external_ref.svg) no-repeat center / contain; mask: url(/external_ref.svg) no-repeat center / contain;
}

.plate {
  background: var(--plate); color: var(--plate-text); padding: 8px 16px;
  display: flex; flex-wrap: wrap; gap: 2px 24px; align-items: baseline; justify-content: space-between;
}
.vtx .plate-name { color: inherit; text-decoration: none; font-weight: bold; letter-spacing: .12em; text-transform: uppercase; }
.plate-sub { color: #b3a990; font-size: 13px; }

.menubar {
  background: var(--case-low); border-bottom: 1px solid var(--rule); padding: 4px 16px; font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 2px 16px; justify-content: space-between;
}
.vtx .menubar a { color: var(--text); text-decoration: none; }
.vtx .menubar a:hover { background: var(--text); color: var(--case); }
.crumbs { overflow-wrap: anywhere; }
.crumbs [aria-current] { font-weight: bold; }
.menubar-right { display: inline-flex; gap: 16px; }
.lang-sw { display: inline-flex; gap: 2px; }
.lang-sw a, .lang-sw span { padding: 0 6px; }
.lang-sw .on { background: var(--text); color: var(--case); }
.lang-sw .off { color: var(--muted); }

.foot {
  background: var(--case-low); border-top: 1px solid var(--rule); padding: 10px 16px; font-size: 13px;
  position: sticky; top: 100vh;   /* a page shorter than the screen: at its bottom (the body is 100vh at least) */
  display: flex; flex-wrap: wrap; gap: 2px 24px; justify-content: space-between;
}

/* --- text pages (index, folder, people) --- */
.doc { max-width: 1100px; margin: 0 auto; padding: 16px 16px 48px; }
.vtx h1, .vtx .front-title { font-size: 20px; font-weight: bold; line-height: 1.3; margin: 8px 0 4px; }
.vtx .sr-only { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.prose { max-width: 78ch; }
/* the introduction: two justified columns over the whole width; one, ragged, where they would be under
   44 characters, since justified lines that short open wide gaps */
.intro { margin-top: 14px; font-size: 16px; }
@media (min-width: 900px) {
  .intro { columns: 2; column-gap: 48px; }
  .intro.hyphenate { text-align: justify; }
}
.vtx .intro p { margin: 0 0 14px; orphans: 2; widows: 2; }
.vtx .intro p:last-child { margin-bottom: 0; }
.vtx .path { margin: 0 0 12px; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.filter { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; margin: 20px 0 12px; }
.filter input {
  flex: 1 1 200px; max-width: 420px; font: inherit; padding: 5px 8px;
  background: #f6f2e8; color: var(--text); border: 1px solid var(--rule);
}
.filter span { color: var(--muted); }

/* --- the wall (index): every file a small screen --- */
.doc.wall-page { max-width: 1440px; padding-inline: 24px; }
.wall-page .filter {
  position: sticky; top: 0; z-index: 2; margin: 0 -24px; padding: 8px 24px;
  background: var(--case-low); border-bottom: 1px solid var(--rule);
}
.filter select { font-family: inherit; font-size: 13px; padding: 6px; margin-left: auto; background: #f6f2e8; color: var(--text); border: 1px solid var(--rule); }
.wall { margin-top: 24px; scroll-margin-top: var(--bar, 52px); }
.wall-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 16px; min-height: 32px; padding: 6px 0; }
/* open: the head stays under the filter's bar, so the folder has its name and its button all the way down */
.wall.open .wall-head { position: sticky; top: var(--bar, 52px); z-index: 1; background: var(--case); }
.vtx .wall h2 { font-size: 17px; line-height: 1.3; margin: 0; }
.vtx .wall h2 a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.folder-n { color: var(--muted); font-weight: normal; }
.folder-title { color: var(--muted); font-size: 14px; margin: -4px 0 14px; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 20px 14px; }
/* One row of each folder until its button opens it. The columns are fixed per width, so that the cut is
   CSS alone: the nth-child numbers are one more than the tiles shown. A folder that fits has no button. */
.wall-page { --cols: 6; }
.js .wall-page:not(.filtering) .wall:not(.open) .tile:nth-child(n+7) { display: none; }
.more { display: none; margin: 0; }
.js .wall-page:not(.filtering) .wall:has(.tile:nth-child(7)) .more { display: block; }
.more button::after { content: " ▾"; }
.more button[aria-expanded="true"]::after { content: " ▴"; }
.more button { font: inherit; font-size: 13px; min-width: 20ch; padding: 5px 12px; background: var(--case-low); color: var(--text); border: 1px solid var(--rule); cursor: pointer; }
.more button:hover { background: var(--text); color: var(--case); }
.vtx .tile a { display: block; color: inherit; text-decoration: none; }
.tile-screen {
  display: grid; place-items: center; aspect-ratio: 5 / 3; overflow: hidden;
  background: #0b0b0b; color: #cfc5ae; border: 6px solid #35302a; border-radius: 7px;
}
.tile-screen img { display: block; width: 100%; height: 100%; object-fit: contain; }
.tile a:hover .tile-screen { border-color: var(--link); }
.tile-content { font-size: 13px; }
.tile-head { display: flex; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 13px; }
.tile-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile a:hover .tile-name { text-decoration: underline; }
.tile-len { color: var(--muted); flex: none; font-variant-numeric: tabular-nums; }
.tile-title { color: var(--muted); font-size: 13px; line-height: 1.4; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }

/* --- a folder: the list, or the same small screens --- */
.folder-page { --cols: 5; }
/* the tabs stand on the line the files hang from; the one shown is in reverse video */
.views { display: flex; align-items: baseline; gap: 4px; margin-top: 20px; border-bottom: 2px solid var(--text); font-size: 14px; }
.views a { display: block; padding: 5px 14px; border: 1px solid var(--rule); border-bottom: 0; border-radius: 5px 5px 0 0; }
html:not(.js) .folder-page .views a { display: none; }        /* one page: without JS only the list */
.vtx .views a { color: var(--text); text-decoration: none; }
.vtx .views a:hover { text-decoration: underline; }
.vtx .views a[aria-current] { background: var(--text); border-color: var(--text); color: var(--case); text-decoration: none; }
/* the front pages: as wide as the filter's bar, which hangs from it */
.wall-page .views { margin-inline: -24px; padding-inline: 24px; }
.views-c { color: var(--muted); }
.views [aria-current] .views-c { color: #cfc5ae; }
.views-n { margin-left: auto; padding: 5px 0; color: var(--muted); }
.folder-page .frow:first-child { border-top: 0; }
.folder-page .tiles, .thumbs .folder-page .files { display: none; }
.thumbs .folder-page .tiles { display: grid; margin-top: 16px; }

.files { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.frow {
  display: grid; grid-template-columns: minmax(120px, 25ch) minmax(0, 1fr) minmax(0, 26ch) 11ch 6ch; gap: 0 14px;
  padding: 4px 0; border-top: 1px solid var(--rule);
}
.frow-name { overflow-wrap: anywhere; font-size: 13px; }
.frow-by { color: var(--muted); }
.frow-by::before { content: "· "; }
.frow-date { color: var(--muted); }
.frow-len { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.mark { margin-right: 6px; }
.mark-content { border: 1px solid var(--orange-dark); color: var(--orange-dark); padding: 0 4px; font-size: 12px; }
/* a movie camera */
.mark-video {
  display: inline-block; width: 1.25em; height: .8em; vertical-align: -.03em; background: currentColor; color: var(--text);
  -webkit-mask: var(--camera) no-repeat center / contain; mask: var(--camera) no-repeat center / contain;
  --camera: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 25 16'%3E%3Crect width='16' height='16' rx='2.5'/%3E%3Cpath d='M17.5 6.2 25 1.5v13l-7.5-4.7z'/%3E%3C/svg%3E");
}
.mark-missing { color: var(--orange-dark); cursor: help; }

/* --- the people: as many columns each as they have files. The names of a row share their height (subgrid),
   so the screens stand in line. An open one is alone in its row and is a block, for its head to stick. --- */
.people { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); column-gap: 14px; row-gap: 0; }
.people .wall { grid-row: span 2; display: grid; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
.people .wall[hidden] { display: none; }
.people .wall-head { align-content: end; align-items: end; }
.people .tiles { align-content: start; }
.vtx .people h3 { font-size: 15px; line-height: 1.3; margin: 0; min-width: 0; overflow-wrap: anywhere; }
.vtx .people-group .group-title { font-size: 19px; line-height: 1.3; margin: 0; }
.people-group { margin-top: 40px; }
.people-group > summary { display: flex; align-items: baseline; gap: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); cursor: pointer; list-style: none; }
.people-group > summary::-webkit-details-marker { display: none; }
.people-group > summary::before { content: "▾"; width: 1ch; }
.people-group:not([open]) > summary::before { content: "▸"; }
.people-group > summary:hover .group-title { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.wall-page .filter + .people-group { margin-top: 24px; }
/* the group's name is its heading already; open, the sticky head needs it */
.people #unknown:not(.open) h3 { visibility: hidden; }
.people-group:not(:has(.wall:not([hidden]))) { display: none; }        /* nothing left of it by the filter */
.people .role { color: var(--muted); font-weight: normal; font-size: 13px; }
.people .wall:target :is(h2, h3) { background: var(--text); color: var(--case); }
.people .wall:target :is(.folder-n, .role) { color: #cfc5ae; }
.people .g1 .folder-n { display: none; }
.people .g1 { --cols: 1; grid-column: span 1; }
.people .g2 { --cols: 2; grid-column: span 2; }
.people .g3 { --cols: 3; grid-column: span 3; }
.people .g4 { --cols: 4; grid-column: span 4; }
.people .g5 { --cols: 5; grid-column: span 5; }
.people .g6 { --cols: 6; grid-column: span 6; }
.people .wall.open { display: block; }
.tile-from { display: block; color: var(--muted); font-size: 12px; line-height: 1.4; }

/* --- file page --- */
.layout { display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: start; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; background: var(--case-low); border-right: 1px solid var(--rule); }
.sidebar select { font-family: inherit; font-size: 13px; margin: 10px; padding: 4px; background: #f6f2e8; color: var(--text); border: 1px solid var(--rule); max-width: calc(100% - 20px); }
.sidebar ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; position: relative; flex: 1 1 auto; }
.vtx .sidebar a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 8px; padding: 5px 12px; font-size: 13px; color: var(--text); text-decoration: none; }
.vtx .sidebar a:hover { background: var(--case); }
.sidebar .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar .y { color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar .f { grid-column: 1 / -1; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* reverse video, as a terminal marks what is selected */
.vtx .sidebar [aria-current] { background: var(--text); color: var(--case); }
.sidebar [aria-current] .y, .sidebar [aria-current] .f { color: #cfc5ae; }

.stage { padding: 16px; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
/* The screen never grows past the window's height, with the row of reactions under it: 80 columns × 0.6em to --rows × 1.2em = 40:rows, which is
   5:3 for 24. --rows is on .stage, only where a file has another number (vt100_file.html). */
.bezel {
  width: 100%; max-width: max(320px, calc((100vh - 234px) * 40 / var(--rows, 24))); margin: 0 auto;
  background: #35302a; border-radius: 10px; padding: 14px; box-shadow: inset 0 0 0 1px #17140f;
}
.bezel .vt { margin: 0; }
.bezel .vt-screen { border-radius: 4px; }
.bezel .vt-bar, .bezel .vt-notes { --text: #efe8d8; --muted: #bfb59d; }
.bezel .vt-bar { margin-top: 10px; }
.bezel .vt-notes .vt-missing { color: #ffb454; font-size: 13px; font-weight: bold; }
.bezel .vt-notes .vt-missing::before { content: "⚠ "; }
.gate { aspect-ratio: 5 / 3; background: #0b0b0b; color: #dcdcdc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 12px; border-radius: 4px; }
.gate p { margin: 0; }
.gate button { font: inherit; background: #dcdcdc; color: #0b0b0b; border: 0; padding: 6px 16px; cursor: pointer; }
.gate button:focus-visible { outline-color: #fff; }

/* Over the screen and as wide as it. The bezel after it gives up the height the notice takes. */
.missing {
  width: 100%; max-width: max(320px, calc((100vh - 324px) * 40 / var(--rows, 24))); margin: 0 auto;
  border: 2px solid var(--orange-dark); background: #fbe3bd; padding: 8px 14px; font-size: 13px;
  display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; justify-content: space-between;
}
/* The two texts share one place, so the notice keeps its height, and the button its spot, when they swap. */
.missing .say { flex: 1 1 320px; display: grid; align-items: center; }
.missing .say p { grid-area: 1 / 1; margin: 0; }
.missing:not(.on-video) .say-video, .missing.on-video .say-vt { visibility: hidden; }
.missing.on-video { border-color: var(--rule); background: var(--case-low); }
.missing button { font: inherit; font-weight: bold; background: var(--orange-dark); color: #fff; border: 0; padding: 7px 14px; min-width: 23ch; cursor: pointer; }
.missing button:hover { background: var(--text); }
.missing + .bezel { max-width: max(320px, calc((100vh - 324px) * 40 / var(--rows, 24))); }
/* a video, and nothing the player cannot draw: the button alone, no warning */
.missing.video-only { border: 0; padding: 0; background: none; }
/* the one line of a file that flashes, and the room it takes (21px + 6px) */
.flashing { margin: 0 0 6px; color: #ffb454; font-size: 14px; line-height: 21px; font-weight: bold; font-family: var(--sans); }
.missing + .bezel:has(> .flashing) { max-width: max(320px, calc((100vh - 351px) * 40 / var(--rows, 24))); }
.video { display: block; width: 100%; aspect-ratio: 5 / 3; border: 0; border-radius: 4px; background: #0b0b0b; }
.hosted .video { aspect-ratio: 81 / 49; }        /* 1620 x 980 */
.video-note { margin: 8px 0 0; color: #bfb59d; font: 12px/1.4 var(--sans); }
.video-off { aspect-ratio: 5 / 3; background: #0b0b0b; color: #dcdcdc; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; text-align: center; padding: 12px; border-radius: 4px; font-family: var(--sans); }
.video-off p { margin: 0; }
.vtx .video-off a { color: #9cc7f5; }

/* The reactions under the screen: the row of style.css (which these pages do not load) in the case's colours.
   .react keeps the row's height while the section is hidden, and it counts in the screen's max-height
   above. «Mine» is the link's blue. → doc/reactions.md */
.react { min-height: 34px; margin: -6px 0; }
.reactions { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.reaction {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  height: 34px; min-width: 38px; padding: 0 9px; font: 13px/1 var(--sans); color: var(--text);
  background: none; border: 1px solid transparent; border-radius: 17px; cursor: pointer;
}
.reaction-char { font-size: 19px; filter: grayscale(1); opacity: .75; }
.reaction-count { font-weight: bold; font-variant-numeric: tabular-nums; }
.reaction-count:empty { display: none; }
.reaction--has { border-color: var(--rule); background: #f1ebdc; }
.reaction:is(:hover, :focus-visible, [aria-pressed="true"]) .reaction-char,
.reaction--has .reaction-char { filter: none; opacity: 1; }
.reaction:is(:hover, :focus-visible) { background: var(--case-low); }
.reaction[aria-pressed="true"] { border-color: var(--link); background: #dfe8ee; color: var(--link); }

.info dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 5px 18px; margin: 0; font-size: 14px; max-width: 110ch; }
.info dt { color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }
.info dd ul { margin: 0; padding-left: 2ch; }

.pager { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; border-top: 1px solid var(--rule); padding-top: 10px; font-size: 13px; }
.pager span:last-child { text-align: right; }
.vtx kbd { font-size: 12px; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 3px; padding: 0 5px; }

@media (max-width: 1160px) {
  .wall-page, .folder-page { --cols: 4; }
  .people :is(.g5, .g6) { --cols: 4; grid-column: span 4; }
  .js .wall-page:not(.filtering) .wall:not(.open) .tile:nth-child(n+5) { display: none; }
  .js .wall-page:not(.filtering) .wall:has(.tile:nth-child(5)) .more { display: block; }
}
/* two to a row, and two rows: one row of two would say little about a folder */
@media (max-width: 560px) {
  .wall-page, .folder-page { --cols: 2; }
  .people :is(.g3, .g4, .g5, .g6) { --cols: 2; grid-column: span 2; }
  /* the folder's name and its button on one line */
  .wall-head { column-gap: 8px; }
  .vtx .wall :is(h2, h3) { font-size: 15px; }
  .more button { font-size: 12px; min-width: 18ch; padding-inline: 6px; }
}

/* --- phone: the screen first, the folder's list after everything about the file --- */
@media (max-width: 820px) {
  .layout { display: flex; flex-direction: column; align-items: stretch; }
  .sidebar { order: 2; position: static; height: auto; border-right: 0; border-top: 1px solid var(--rule); }
  .sidebar ul { overflow: visible; }
  .stage { padding: 10px 16px 16px; }
  .missing, .bezel, .missing + .bezel, .missing + .bezel:has(> .flashing) { max-width: none; }
  .bezel { padding: 8px; }
  .doc.wall-page { padding-inline: 16px; }
  .wall-page .filter, .wall-page .views { margin-inline: -16px; padding-inline: 16px; }
  .wall-page .filter label { display: none; }
  .wall-page .filter input { flex-basis: 110px; min-width: 0; }
  .wall-page .filter select { max-width: 40%; }
  .tiles { gap: 16px 10px; }
  .people { column-gap: 10px; }
  .tile-screen { border-width: 4px; }
  .info dl { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .info dt { margin-top: 8px; }
  .pager .keys { display: none; }
  .react { min-height: 32px; }
  .reactions { gap: 1px; }
  .reaction { min-width: 0; height: 32px; padding: 0 5px; gap: 2px; }
  .reaction-char { font-size: 18px; }
  .pager { grid-template-columns: 1fr 1fr; }
  .frow { grid-template-columns: minmax(0, 1fr) auto 6ch; gap: 0 10px; }
  .frow-title, .frow-date { grid-column: 1 / -1; grid-row: 2; }
  .frow-date { grid-row: 3; }
}
@media print { .sidebar, .pager, .filter, .react { display: none; } .layout { display: block; } }
