/*
* #000000book stylesheet
* Jamie Wilkinson <http://jamiedubs.com>
* (cc) Free Art & Technology Lab
*
* The site is named after a hex colour, so the ground stays #000000. Chrome is
* set in monospace and reads like instrumentation: this is an archive of
* motion capture data, and the numbers are worth showing. Everything loud is
* spent on the tags themselves.
*/

:root {
  --ground: #000000;
  --surface: #0b0b0b;
  --surface-raised: #141414;
  --line: #232323;
  --line-bright: #3a3a3a;
  --ink: #ffffff;
  --dim: #8c8c8c;
  --dimmer: #767676; /* 4.6:1 on black, the floor for small text */
  --accent: #f5ff00;
  --warn: #ff5c47;

  --display: "Archivo", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  /* Headlines. Fraunces at full SOFT is the closest free face to the
     logo's italic. */
  --serif: "Fraunces", Georgia, "Times New Roman", serif;

  --gutter: clamp(16px, 3.5vw, 44px);
  --rule: 1px solid var(--line);

  /* Uppercase monospace metadata, used everywhere chrome needs to speak. */
  --meta-size: 12px;
  --meta-tracking: 0.09em;
}

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

html {
  background: var(--ground);
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.5;
  font-variation-settings: "wdth" 100;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.04; letter-spacing: -0.02em; }

/* Headlines take the logo's voice: italic, soft, mixed case, and smaller
   than the earlier uppercase Archivo. */
.page__title, .lede__title, .section-head h2, .player__id, .about__defs dt {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 900;
  font-variation-settings: "SOFT" 100, "WONK" 1, "opsz" 72;
  letter-spacing: -0.01em;
  line-height: 1.05;
  text-transform: none;
  text-wrap: balance;
}
p { margin: 0 0 1em; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }
img, canvas, svg { display: block; max-width: 100%; }
hr { border: 0; border-top: var(--rule); margin: 24px 0; }

a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-bright); }
a:hover { border-bottom-color: var(--accent); color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* --- shared chrome ------------------------------------------------------ */

/* Keyboard users get straight to the content. Off screen until focused. */
.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 50;
  padding: 8px 12px;
  background: var(--accent);
  color: #000;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  border: 0;
}
.skip:focus { left: 8px; }

.meta {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}

.shell {
  width: 100%;
  max-width: 1920px;
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* --- masthead ----------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-block: 20px 18px;
  border-bottom: var(--rule);
}

.masthead__logo { border: 0; flex: 0 0 auto; }
.masthead__logo:hover { background: none; }
/* The wordmark is script with a tagline under it. Below about 50px the
   tagline turns to mush, and the logo is the one soft thing on the page. */
.masthead__logo img { height: 56px; width: auto; }

.masthead__nav { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* Every state has the same padding and a border, so nothing moves when the
   current one lights up. */
.masthead__nav a {
  padding: 5px 9px;
  border: 1px solid transparent;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dim);
}
.masthead__nav a:hover { color: var(--ink); border-color: var(--line); }
.masthead__nav a[aria-current="page"] { color: var(--ink); border-color: var(--line-bright); }

.masthead__account { display: flex; align-items: center; gap: 16px; }
.masthead__account a { padding: 6px 0; }
.masthead__account img { width: 22px; height: 22px; border-radius: 50%; }

/* A row of label/value readings. The writer profile uses it for tags,
   favorites and joined. */
.instruments {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: var(--rule);
  overflow-x: auto;
  scrollbar-width: none;
}
.instruments::-webkit-scrollbar { display: none; }

.instrument {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 20px 9px 0;
  margin-right: 20px;
  border-right: var(--rule);
  white-space: nowrap;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
}
.instrument:last-child { border-right: 0; margin-right: 0; }
.instrument__label { color: var(--dimmer); }
.instrument__value { color: var(--ink); font-weight: 600; }
.instrument__value a { border: 0; color: inherit; }

/* --- page furniture ----------------------------------------------------- */

.page { padding-block: clamp(20px, 4svh, 40px) clamp(32px, 8svh, 96px); }

.page__head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.page__title { font-size: clamp(1.5rem, 3vw, 2.25rem); }

.page__lede { color: var(--dim); max-width: 46ch; margin: 0; text-wrap: pretty; }

/* A way back, above the title. A link, not a label. */
.crumb { font-family: var(--mono); font-size: var(--meta-size); color: var(--dim); margin: 0 0 8px; }
.crumb a { border-bottom-color: var(--line); color: var(--dim); padding: 4px 0; }
.crumb a:hover { color: var(--accent); }

/* The front page: the tags and the player's readout, no labels around them. */
.page--quiet .player__context,
.page--quiet .tag-card__body,
.page--quiet .browse__actions,
.page--quiet .section-head { display: none; }

/* --- buttons ------------------------------------------------------------ */

.button,
a.button,
button.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  font-weight: 500;
  padding: 9px 14px;
  border: 1px solid var(--line-bright);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 120ms, color 120ms, border-color 120ms;
}
.button:hover,
a.button:hover,
button.button:hover { background: var(--accent); border-color: var(--accent); color: #000; }

.button--solid { background: var(--ink); border-color: var(--ink); color: #000; }
.button--quiet { border-color: var(--line); color: var(--dim); }
.button--danger:hover { background: var(--warn); border-color: var(--warn); color: #000; }

/* --- forms -------------------------------------------------------------- */

label { display: block; margin-bottom: 6px; }

input[type="text"], input[type="email"], input[type="password"],
input[type="search"], input[type="url"], select, textarea {
  font-family: var(--mono);
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line-bright);
  padding: 9px 11px;
  width: 100%;
  max-width: 420px;
}
textarea { line-height: 1.5; resize: vertical; }
fieldset { border: var(--rule); padding: 20px; margin: 0 0 20px; }
legend { padding: 0 8px; font-family: var(--mono); font-size: var(--meta-size); letter-spacing: var(--meta-tracking); text-transform: uppercase; color: var(--dim); }

input[type="submit"], button[type="submit"] {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  background: var(--ink);
  color: #000;
  border: 1px solid var(--ink);
  padding: 9px 16px;
  cursor: pointer;
}
input[type="submit"]:hover, button[type="submit"]:hover { background: var(--accent); border-color: var(--accent); }

/* Standalone form pages, such as registering an app. */
.form-page { max-width: 680px; }
.form-page fieldset p { margin: 0 0 14px; }
.form-page fieldset p:last-child { margin-bottom: 0; }
.form-page .actions { display: flex; align-items: center; gap: 8px; }
.form-page .check { display: flex; align-items: center; gap: 8px; }
.form-page .check label { margin: 0; }
.embed_details.disabled { opacity: 0.45; }

.error_explanation {
  border: 1px solid var(--warn);
  color: var(--warn);
  padding: 12px 14px;
  margin-bottom: 20px;
  font-family: var(--mono);
  font-size: 13px;
}
.error_explanation h2 { font-size: 13px; font-weight: 500; margin-bottom: 6px; }

/* --- tables (secondary pages) ------------------------------------------- */

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
  padding: 10px 12px 10px 0;
  border-bottom: var(--rule);
}
td { padding: 12px 12px 12px 0; border-bottom: var(--rule); vertical-align: middle; }
td a { padding: 4px 0; }

/* --- pagination --------------------------------------------------------- */

.pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
}
.pagination a, .pagination span {
  padding: 7px 10px;
  border: 1px solid transparent;
  color: var(--dim);
}
.pagination a { border-color: var(--line); }
.pagination a:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.pagination em, .pagination .current { font-style: normal; color: #000; background: var(--ink); border-color: var(--ink); }

/* --- flash -------------------------------------------------------------- */

#flash-notice, #flash-warning, #flash-error {
  display: none;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.04em;
  padding: 10px 16px;
  border: 1px solid var(--line-bright);
  background: var(--surface-raised);
  color: var(--ink);
}
#flash-error { border-color: var(--warn); color: var(--warn); }
#flash-notice { border-color: var(--accent); color: var(--accent); }

/* --- canvas player ------------------------------------------------------ */
/* Engine controls inherit this site's colors; the frame stays stable per viewport. */

.player {
  border: var(--rule);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  font-family: var(--mono);
}

.player__head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 44px 18px 18px;
  align-items: center;
  gap: 4px 12px;
  padding: 10px 14px;
  border-bottom: var(--rule);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
}
/* The id is the label. Display face, not mono, and the one thing in the head
   set in mixed case. */
.player__id { grid-column: 1; grid-row: 1; justify-self: start; max-width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 1.35rem; color: var(--ink); margin: 0; }
.player__context a { padding: 4px 0; }
.player__context { grid-column: 1 / -1; grid-row: 2; color: var(--dim); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.player__context a { color: var(--ink); border-bottom-color: var(--line); }
.player__context a:hover { color: var(--accent); }
.player__meta { grid-column: 1 / -1; grid-row: 3; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.page--quiet .player__head { grid-template-rows: 44px 18px; }
.page--quiet .player__meta { grid-row: 2; }
.player__browse-nav { grid-column: 2; grid-row: 1; display: flex; gap: 4px; }

.player__stage {
  position: relative;
  background: var(--ground);
  height: clamp(240px, calc(100svh - 380px), 740px);
  width: 100%;
}
.browse .player__stage { height: clamp(240px, calc(100svh - 480px), 600px); }
.player__drawing, .player__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.player__drawing { transition: width 160ms ease, height 160ms ease; }
.player__open, .player__animation { position: absolute; inset: 0; z-index: 1; border: 0; background: transparent; }
.player__open span, .player__animation span {
  position: absolute; left: 6px; bottom: 6px; padding: 5px 7px;
  background: var(--ground); color: var(--ink); font: 11px var(--mono); text-transform: uppercase;
}
.player__open span { opacity: 0; }
.player__open:hover span, .player__open:focus-visible span { opacity: 1; }
.player[data-renderer="webgl"] .player__open, .player--image .player__open { display: none; }
.player__final {
  position: absolute; z-index: 2; right: 10px; top: 64px;
  width: clamp(88px, 24%, 180px); height: clamp(66px, 18%, 135px);
  border: var(--rule); background: var(--ground); opacity: 0.6;
}
.player__final img { display: block; width: 100%; height: 100%; object-fit: contain; }
.player__final:hover, .player__final:focus-visible { opacity: 1; border-color: var(--accent); }
.player__final[hidden], .player__animation[hidden] { display: none; }
.player--image .player__final { inset: 0; width: 100%; height: 100%; opacity: 1; border: 0; padding: 10px; }
.player--image .player__drawing {
  inset: 64px 10px auto auto; z-index: 3; border: var(--rule);
  width: clamp(88px, 24%, 180px); height: clamp(66px, 18%, 135px);
  background: var(--ground);
}
.player--image .player__looks { display: none; }
.player__settings {
  position: absolute; top: 10px; right: 10px; z-index: 6;
  display: grid; place-items: center; width: 44px; height: 44px;
  border: var(--rule); background: var(--ground); color: var(--dim); cursor: pointer;
}
.player__settings:hover, .player__settings:focus-visible, .player__settings[aria-expanded="true"] {
  color: #000; background: var(--accent); border-color: var(--accent);
}
.player__status { position: absolute; left: 10px; bottom: 62px; z-index: 4; max-width: calc(100% - 20px); margin: 0; padding: 4px; background: var(--ground); color: var(--dim); font-size: 11px; }
.player__status:empty { display: none; }

/* Shown by player.js when a tag has no usable stroke data. */
.player[data-error] .player__stage::after {
  content: attr(data-error);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warn);
}

/* The height it will have once transport() fills it, so nothing below jumps. */
.player__transport { min-height: 50px; padding: 10px 14px; border-top: 1px solid var(--line); }

.gml-transport,
.gml-switches {
  --paper: var(--surface);
  --mute: var(--dim);
  --rule: var(--line-bright);
}
.gml-transport button,
.gml-switches button,
.gml-switches .label { text-transform: uppercase; letter-spacing: var(--meta-tracking); }
.gml-transport .fill,
.gml-transport input[type="range"]::-webkit-slider-thumb { background: var(--accent); }
.gml-transport input[type="range"]::-moz-range-thumb { background: var(--accent); }
.gml-switches button[aria-pressed="true"]:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #000; }

/* The pane sits over the stage rather than under it, so opening it does not
   resize the canvas. */
.player__pane {
  position: absolute;
  top: 64px;
  right: 10px;
  z-index: 5;
  width: min(400px, calc(100% - 20px));
  max-height: calc(100% - 74px);
  overflow: auto;
  padding: 12px;
  background: var(--ground);
  border: 1px solid var(--line-bright);
}
/* gml-ui's switches make their host display: grid, which would beat the
   hidden attribute. */
.player__pane[hidden] { display: none; }
.player__pane-title { font-size: 12px; font-weight: 500; text-transform: uppercase; }

/* --- filmstrip ---------------------------------------------------------- */
/* The tag's neighbours, oldest to newest, inside the player frame. Each cell
   is a live canvas (gml_thumbnails.js); the current one is lit. */

.strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.strip__rail {
  display: flex;
  gap: 1px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.strip__rail::-webkit-scrollbar { display: none; }
.strip__cell {
  display: block;
  position: relative;
  flex: 0 0 auto;
  width: 104px;
  height: 68px;
  background: var(--ground);
  border: 1px solid transparent;
  scroll-snap-align: center;
  transition: border-color 120ms;
}
.strip__cell:hover { border-color: var(--line-bright); }
.strip__cell[aria-current] { border-color: var(--accent); }
.strip__cell canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.strip__step {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  font-size: 18px;
  line-height: 1;
  color: var(--dim);
  border: 1px solid var(--line-bright);
}
a.strip__step:hover { background: var(--accent); border-color: var(--accent); color: #000; }
.strip__step--off { opacity: 0.3; }
.strip__hint { flex: 0 0 auto; white-space: nowrap; padding-left: 6px; }
.strip__back { flex: 0 0 auto; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; padding: 14px 4px; }

/* --- tag grid ----------------------------------------------------------- */

.tag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--rule);
}

.tag-grid--archive {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
}

.tag-card {
  background: var(--ground);
  display: flex;
  flex-direction: column;
  border: 0;
  color: inherit;
  transition: background-color 120ms;
}
.tag-card:hover { background: var(--surface-raised); border: 0; color: inherit; }

.tag-card__frame {
  position: relative;
  /* Capture screens were 480x320, so most tags arrive landscape. Matching that
     keeps them filling the cell instead of floating in dead space. */
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--surface);
}
/* The drawing's box, which the engine sizes its canvas to; picture in picture
   shrinks the box, not the canvas. */
.tag-card__drawing { position: absolute; inset: 0; }
.tag-card__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tag-card__still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: var(--ground); }
.app-card__art { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--ground); }

/* Display modes, set on <html> by the dropdown on /data. No attribute is the
   no-JS state: the still, when there is one. */
[data-display="drawing"] .tag-card__still { display: none; }
[data-display="still"] .tag-card__frame:has(.tag-card__still) .tag-card__drawing { display: none; }
[data-display="over"] .tag-card__frame:has(.tag-card__still) .tag-card__drawing { z-index: 1; mix-blend-mode: screen; }
[data-display="pip"] .tag-card__frame:has(.tag-card__still) .tag-card__drawing {
  inset: auto 6px 6px auto;
  width: 44%;
  height: 44%;
  z-index: 1;
  border: 1px solid var(--line-bright);
  background: var(--ground);
}
[data-display="hover"] .tag-card__still { opacity: 0; transition: opacity 120ms; }
[data-display="hover"] .tag-card:hover .tag-card__still,
[data-display="hover"] .tag-card:focus .tag-card__still { opacity: 1; }
.tag-card__frame noscript img { width: 100%; height: 100%; object-fit: contain; }

.tag-card__id {
  position: absolute;
  z-index: 2; /* above the drawing when a mode lifts it over the still */
  top: 8px;
  left: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  padding: 3px 6px;
  background: rgba(0, 0, 0, 0.72);
  color: var(--ink);
}
.tag-card:hover .tag-card__id { background: var(--accent); color: #000; }

.tag-card__body {
  padding: 10px 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--dimmer);
}
.tag-card__title { color: var(--ink); font-weight: 600; letter-spacing: 0.06em; }
.tag-card__app { color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag-card__who { color: var(--dimmer); }

/* --- filter bar --------------------------------------------------------- */

.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: var(--rule);
  border-bottom: var(--rule);
  margin-bottom: 24px;
}
.filters form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filters select { width: auto; min-width: 190px; max-width: 100%; }
.display { display: flex; align-items: center; gap: 8px; margin: 0; }
.display select { min-width: 0; padding: 7px 9px; font-size: 12px; }
.filters__spacer { flex: 1 1 auto; }

/* --- tabs --------------------------------------------------------------- */
/* The front page's sets. The current one is underlined in the accent. */

.tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 20px; border-bottom: var(--rule); }
.tabs a {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  padding: 10px 14px;
  margin-bottom: -1px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--dim);
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }

.sets-nav { display: flex; justify-content: space-between; align-items: center; gap: 8px 24px; flex-wrap: wrap; border-bottom: var(--rule); padding-bottom: 8px; margin-bottom: 14px; }
.sets-nav .tabs { margin: 0; border: 0; }
.sets-nav a { display: inline-flex; align-items: center; min-height: 44px; }
.sets-nav__primary { display: flex; flex-wrap: wrap; gap: 8px; }
.sets-nav__primary .button[aria-current] { color: #000; background: var(--accent); border-color: var(--accent); }
.sets-nav .sets-nav__collections { margin-left: auto; }
.collection-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 16px; margin-bottom: 16px; }
.collection-head h1, .collection-head h2 { font-size: 1.2rem; margin: 0; }
.collection-info { color: var(--dim); }
.collection-info[open] { flex-basis: 100%; }
.collection-info summary { cursor: pointer; width: fit-content; min-height: 44px; display: list-item; align-content: center; font-family: var(--mono); font-size: var(--meta-size); }
.collection-info summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.collection-info p { max-width: 75ch; margin: 0 0 8px; }
.collection-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
.collection-pagination a { min-height: 44px; }

/* --- chips -------------------------------------------------------------- */
/* Filters that combine. The active ones are lit. */

.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -8px 0 24px; }
.chip {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  padding: 6px 10px;
  border: 1px solid var(--line);
  color: var(--dim);
}
.chip:hover { color: var(--ink); border-color: var(--line-bright); }
.chip[aria-current] { color: #000; background: var(--accent); border-color: var(--accent); }
.chips__gap { width: 10px; }

/* --- home --------------------------------------------------------------- */

/* Keep the introduction short so the drawings stay above the fold. */
.lede { padding: 28px 0 8px; max-width: 60ch; }
.lede--home {
  max-width: none;
  margin-top: -28px;
  padding: 0 0 8px;
  display: flex;
  align-items: baseline;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: nowrap;
}
.lede--home > div, .lede--home .page__lede { max-width: none; }
.lede--home .lede__title { font-size: 1.15rem; margin: 0; }
.lede.lede--home .page__lede {
  margin: 0;
  font-size: 0.9rem;
  white-space: nowrap;
}
.lede__title { font-size: 1.4rem; margin-bottom: 8px; }
.lede .page__lede { margin-bottom: 14px; }

/* A bordered box with a small mono heading, used by the writer profile. */
.panel { border: var(--rule); background: var(--surface); padding: 14px; }
.panel h2 {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dimmer);
  font-weight: 500;
  margin-bottom: 10px;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  margin-bottom: 20px;
  border-bottom: var(--rule);
}
.section-head h2 { font-size: 1.2rem; }

/* --- tag detail --------------------------------------------------------- */

.tag-detail > * { min-width: 0; }
@media (min-width: 1081px) {
  .tag-detail { display: grid; grid-template-columns: minmax(0, 1fr) 280px; align-items: start; gap: var(--gutter); }
  .tag-detail__metadata .specs { grid-template-columns: minmax(0, 1fr); margin-top: 0; }
  .tag-detail__metadata .actions { flex-direction: column; align-items: stretch; }
}
.motion-profile { margin-top: 20px; padding: 14px; border: var(--rule); }
.motion-profile__title { margin: 0 0 12px; font-size: 1.2rem; }
.motion-profile__chart { display: block; width: 100%; color: var(--ink); font-family: var(--mono); }
.motion-profile__note, .motion-profile__warning, .motion-profile__empty { margin: 8px 0 0; color: var(--dim); font-size: 12px; line-height: 1.5; }

/* Metadata tiles also serve app and profile pages. */
.specs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--rule);
  margin-top: 20px;
}
.specs__row {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  background: var(--ground);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.05em;
}
.specs__row--wide { grid-column: 1 / -1; }
.specs__key { color: var(--dimmer); text-transform: uppercase; font-size: 11px; letter-spacing: 0.1em; }
.specs__value { color: var(--ink); overflow-wrap: anywhere; }
.specs__value a { border-bottom-color: var(--line); }
.specs__value--null { color: var(--dimmer); }

.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }

.source { margin-top: 14px; border: var(--rule); }
.source summary {
  padding: 10px 12px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dim);
  list-style: none;
}
.source summary::-webkit-details-marker { display: none; }
.source summary::before { content: "▸ "; color: var(--accent); }
.source[open] summary::before { content: "▾ "; }
.source summary:hover { color: var(--ink); }
.source textarea {
  max-width: none;
  border: 0;
  border-top: var(--rule);
  background: var(--ground);
  color: var(--dim);
  font-size: 11px;
  min-height: 200px;
}

.modbox { border: 1px solid var(--warn); margin-top: 14px; }
.modbox h2 {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--warn);
  padding: 10px 12px;
  border-bottom: 1px solid var(--warn);
  font-weight: 500;
}
.modbox__body { padding: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

/* An app's screenshot on its detail page. */
.figure { border: var(--rule); background: var(--surface); margin: 0; padding: 12px; }
.figure img { margin: 0 auto; }

/* --- browse ------------------------------------------------------------- */
/* One tag playing beside the grid. */

.browse {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: var(--gutter);
  align-items: start;
}
.browse__player { position: sticky; top: 16px; }
.browse__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.browse .tag-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 204px), 1fr)); }
/* Two 1px gutters leave room for three readable tiles on the home wall. */
.page--quiet .browse .tag-grid {
  grid-template-columns: repeat(auto-fill, minmax(min(100%, max(204px, calc((100% - 2px) / 3))), 1fr));
}

/* The cell whose tag is playing. */
.tag-card[aria-current] { outline: 1px solid var(--accent); outline-offset: -1px; }
.tag-card[aria-current] .tag-card__id { background: var(--accent); color: #000; }


/* --- upload ------------------------------------------------------------- */

/* The one loud item in the nav. */
.masthead__nav a.masthead__upload { color: var(--accent); border-color: var(--accent); }
.masthead__nav a.masthead__upload:hover { background: var(--accent); color: #000; }
.masthead__nav a.masthead__upload[aria-current="page"]::before { content: none; }

.upload-apps { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); margin-top: 0; }
.upload-apps + .section-head, .recorder + .section-head { margin-top: clamp(40px, 6vw, 80px); }
.upload-apps .specs__value {
  font-family: var(--display);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.45;
  color: var(--dim);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.upload-apps strong { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.upload-apps__icon { flex: 0 0 48px; width: 48px; height: 48px; object-fit: cover; border: var(--rule); }

.recorder { border: var(--rule); background: var(--surface); }
/* The pad uses all available width; height stays usable on tall screens and
   bounded by the stable viewport when a phone rotates or its browser bars move. */
.recorder__stage {
  position: relative;
  width: 100%;
  height: min(65vh, 720px);
  height: min(65svh, 720px);
  background: var(--ground);
  touch-action: none;
  cursor: crosshair;
}
.recorder__pad, .recorder__play { position: absolute; inset: 0; width: 100%; height: 100%; }
.recorder__play[hidden] { display: none; }
.recorder__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 14px; border-top: var(--rule); }
.recorder__bar form { display: contents; }
.recorder[data-empty] [data-recorder-upload],
.recorder[data-empty] [data-recorder-play],
.recorder[data-empty] [data-recorder-download] { opacity: 0.4; pointer-events: none; }

.upload-curl {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--surface);
  border: var(--rule);
  padding: 12px 14px;
  margin: 0 0 12px;
  overflow-x: auto;
}

/* The looks in the stage's corner, dim until the pointer is near. */
.player__looks {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  display: flex;
  gap: 4px;
  opacity: 0.55;
  transition: opacity 120ms;
}
.player__stage:hover .player__looks,
.player__looks:focus-within { opacity: 1; }
.player__looks button {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  min-height: 44px;
  padding: 4px 8px;
  background: rgba(0, 0, 0, 0.7);
  color: var(--dim);
  border: 1px solid var(--line-bright);
  cursor: pointer;
}
.player__looks button:hover, .player__looks button:focus-visible { color: #000; background: var(--accent); border-color: var(--accent); }
.player__looks button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #000; }

/* Previous and next remain visible above the canvas. */
.player__step { display: grid; place-items: center; width: 44px; height: 44px; border: var(--rule); font-size: 20px; }
.player__step:hover, .player__step:focus-visible { color: #000; background: var(--accent); border-color: var(--accent); }

/* --- profile & people --------------------------------------------------- */

.profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--gutter);
  align-items: start;
}
.profile__aside { display: flex; flex-direction: column; gap: 14px; }
.profile__photo img { width: 96px; height: 96px; object-fit: cover; }

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--rule);
}
.person {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--ground);
  border: 0;
  color: inherit;
}
.person:hover { background: var(--surface-raised); color: inherit; border: 0; }
.person img { width: 36px; height: 36px; border-radius: 50%; flex: 0 0 auto; }
.person__name { display: block; font-weight: 600; }
.person__meta { display: block; }

/* --- auth & narrow forms ------------------------------------------------ */

/* Login, signup and password reset all carry this class from the old markup. */
.signup_or_login {
  max-width: 420px;
  margin: 0 auto;
  border: var(--rule);
  background: var(--surface);
  padding: 24px;
}
.signup_or_login h1 {
  font-size: 1.5rem;
  font-variation-settings: "wdth" 108;
  text-transform: uppercase;
  margin-bottom: 18px;
}
.signup_or_login fieldset { border: 0; padding: 0; margin: 0; }
.signup_or_login legend { display: none; }
.signup_or_login label {
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 14px;
}
.signup_or_login input[type="text"],
.signup_or_login input[type="email"],
.signup_or_login input[type="password"] { max-width: none; }
.signup_or_login .buttons { margin-top: 18px; }
.signup_or_login .help { margin-top: 16px; padding-top: 14px; border-top: var(--rule); }
.signup_or_login .help li { margin-bottom: 6px; }
.signup_or_login .help a { font-family: var(--mono); font-size: var(--meta-size); color: var(--dim); padding: 4px 0; }

/* --- about -------------------------------------------------------------- */

.about__intro { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 500px); gap: var(--gutter); align-items: center; margin-bottom: 28px; }
.about__intro-copy p { max-width: 64ch; color: var(--dim); }
.about__hero { margin: 0; border: var(--rule); width: 100%; max-width: 500px; }
.about__hero img { display: block; width: 100%; height: auto; }

.about__body > p { max-width: 72ch; }
.about__body .section-head { margin-top: 32px; }

.about__defs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1px;
  background: var(--line);
  border: var(--rule);
  margin-bottom: 24px;
}
.about__defs > div { background: var(--ground); padding: 14px 16px; }
.about__defs dt { font-size: 1.25rem; margin-bottom: 4px; }
.about__defs dd { color: var(--dim); }
.about__defs em {
  font-style: normal;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dimmer);
  margin-right: 6px;
}

.about__row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; margin: 24px 0; }
.about__row img { max-height: 160px; width: auto; }

/* Float helpers a few remaining views still hang on to. */
.clear { clear: both; }
.center { text-align: center; }
.centered { margin-left: auto; margin-right: auto; }

/* --- footer ------------------------------------------------------------- */

.footer {
  border-top: var(--rule);
  padding-block: 22px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  align-items: baseline;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  color: var(--dimmer);
}
.footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
.footer a { border: 0; color: var(--dim); padding: 6px 0; }
.footer a:hover { color: var(--accent); }

/* --- responsive --------------------------------------------------------- */

@media (max-width: 1080px) {
  .profile { grid-template-columns: minmax(0, 1fr); }
  .browse { grid-template-columns: minmax(0, 1fr); }
  .browse__player { position: static; }
  .masthead { flex-wrap: wrap; gap: 12px; padding-block: 14px 12px; }
  .masthead__nav { order: 3; width: 100%; }
  .about__intro { grid-template-columns: minmax(0, 1fr); }
}

/* A short window must scroll the whole player, not pin its controls offscreen. */
@media (max-height: 800px) {
  .browse__player { position: static; }
}

@media (max-width: 720px) {
  body { font-size: 14px; }
  .masthead__logo img { height: clamp(28px, 8vw, 40px); }
  .masthead__nav { gap: 8px; }
  .sets-nav__primary { width: 100%; }
  .sets-nav__primary .button { flex: 1; justify-content: center; padding-inline: 10px; }
  .strip__hint { display: none; }
  .player__looks { opacity: 0.8; }
  /* The transport wraps its timeline onto a second row here. */
  .player__transport { min-height: 94px; }
  .gml-transport .rate { min-width: 0; }
  .strip__back { max-width: 76px; }
  .strip { gap: 4px; padding-inline: 6px; }
  .strip__cell { width: 84px; height: 56px; }
  .tag-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tag-grid--archive { grid-template-columns: repeat(auto-fill, minmax(min(100%, 180px), 1fr)); }
  .lede--home { gap: 2px 6px; flex-wrap: wrap; margin-top: -8px; }
  .lede--home .lede__title { font-size: 1.05rem; }
  .lede.lede--home .page__lede { font-size: 0.82rem; }
  .specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .page { padding-bottom: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- Docs (/docs) ------------------------------------------------------- */
/* Rendered from the markdown in docs/. Prose is the one place the mono chrome
   gives way to the display face: these are pages to read, not instrumentation. */

.docs {
  display: grid;
  grid-template-columns: minmax(0, 200px) minmax(0, 1fr);
  gap: var(--gutter);
  align-items: start;
}

.docs__nav {
  position: sticky;
  top: var(--gutter);
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
  border-right: var(--rule);
  padding-right: var(--gutter);
}

.docs__nav .docs__home { font-size: 1.2rem; margin-bottom: 1.2em; }
.docs__nav .docs__section { margin: 1.4em 0 0.6em; font: 11px var(--mono); text-transform: uppercase; letter-spacing: 0.1em; color: var(--dim); }
.docs__nav .docs__home + .docs__section { margin-top: 0; }
.docs__nav ul { list-style: none; margin: 0; padding: 0; }
.docs__nav li { margin-bottom: 0.9em; line-height: 1.35; }
.docs__nav a { color: var(--dim); text-decoration: none; }
.docs__nav a:hover { color: var(--ink); }
.docs__nav .is-current a { color: var(--accent); }

.docs__body {
  max-width: 68ch;
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.65;
}

.docs__body h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.1; margin: 0 0 0.7em; }
.docs__body h2 { font-size: 22px; margin: 2em 0 0.6em; padding-bottom: 0.3em; border-bottom: var(--rule); }
.docs__body h3 { font-size: 17px; margin: 1.6em 0 0.4em; }
.docs__body p { margin: 0 0 1.1em; }
.docs__body ul, .docs__body ol { margin: 0 0 1.1em 1.4em; padding: 0; }
.docs__body li { margin-bottom: 0.45em; }
.docs__body a { color: var(--ink); text-underline-offset: 3px; }
.docs__body a:hover { color: var(--accent); }
.docs__body img { display: block; max-width: 100%; width: auto; height: auto; max-height: 260px; margin-block: 20px; }
.docs__demo { margin-block: 24px; }

.docs__body code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--surface-raised);
  padding: 1px 5px;
}

.docs__body pre {
  font-family: var(--mono);
  background: var(--surface);
  border: var(--rule);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 1.1em;
  font-size: 13px;
  line-height: 1.5;
}

.docs__body pre code { background: none; padding: 0; font-size: inherit; }
.docs__body table { width: 100%; border-collapse: collapse; margin: 0 0 1.1em; }
.docs__body td, .docs__body th { padding: 8px 12px; border-bottom: var(--rule); text-align: left; vertical-align: top; }
.docs__body blockquote { margin: 0 0 1.1em; padding-left: 16px; border-left: 2px solid var(--line-bright); color: var(--dim); }
.docs__body hr { border: 0; border-top: var(--rule); margin: 2.5em 0; }
.docs__body em { color: var(--dim); }

.docs__source {
  margin-top: 3.5em;
  padding-top: 1.2em;
  border-top: var(--rule);
  font-family: var(--mono);
  font-size: var(--meta-size);
  letter-spacing: var(--meta-tracking);
  text-transform: uppercase;
}

.docs__source a { color: var(--dim); text-decoration: none; }
.docs__source a:hover { color: var(--accent); }
.docs__nav { grid-column: 1; grid-row: 1; }
.docs__body { grid-column: 2; grid-row: 1; }

@media (max-width: 720px) {
  .docs { grid-template-columns: minmax(0, 1fr); }
  .docs__body { grid-column: 1; }
  .docs__nav { grid-column: 1; grid-row: 2; position: static; border-right: 0; border-top: var(--rule); padding: var(--gutter) 0 0; }
  .docs__nav ul { display: flex; flex-wrap: wrap; gap: 0 1.2em; }
}
