/* MetaChimera. CHIMERA's vector-display look: pure black, hairline blue frames, glowing
   single-stroke lettering. Blue is structure, amber is sound (whatever is playing, and the
   controls that play it). No fills, no rounded corners.

   Written phone first: the list is the page, the player docks at the bottom, the stage is a
   full-screen layer. From 900px the same list becomes a sidebar with the stage beside it. */

@font-face {
  font-family: "Hershey";
  src: url("fonts/AVHersheySimplexLight.otf") format("opentype");
  font-weight: 100 400;
  font-display: swap;
}
@font-face {
  font-family: "Hershey";
  src: url("fonts/AVHersheySimplexMedium.otf") format("opentype");
  font-weight: 401 900;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --blue: #4fb6f2;
  --blue-mid: #3f97d6;      /* secondary text: 6:1 on black */
  --blue-dim: #1f5f8c;      /* lines only, never text */
  --frame: #133954;
  --white: #eef6f8;
  --amber: #ffb340;
  --amber-dim: #7d5518;
  --amber-frame: #3d2a0e;
  --glow-blue: 0 0 1.5px rgba(79, 182, 242, 0.9), 0 0 6px rgba(79, 182, 242, 0.4);
  --glow-amber: 0 0 1.5px rgba(255, 179, 64, 0.9), 0 0 6px rgba(255, 179, 64, 0.35);
  --font: "Hershey", "Archivo", system-ui, -apple-system, "Segoe UI", "Noto Sans", sans-serif;
  --pad: 16px;
  --side: 420px;
  --dock-h: 0px;
  /* three sizes of lettering, and no others */
  --big: 18px;
  --text: 15px;
  --small: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { background: #000; -webkit-text-size-adjust: 100%; }
/* a row brought into view (by the keyboard, or by a link) clears the tabs that stick to the top and the player */
html { scroll-padding: 56px 0 calc(var(--dock-h) + 8px); }
body {
  margin: 0;
  background: #000;
  color: var(--blue);
  font-family: var(--font);
  font-size: var(--text);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: 0.035em;
}
a { color: inherit; }
button, select, input { font: inherit; letter-spacing: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; }
:focus-visible { outline: 1px dashed var(--blue); outline-offset: 2px; }
.dock :focus-visible { outline-color: var(--amber); }
[hidden] { display: none !important; }

/* ---- the column ---- */
.side { padding-bottom: calc(var(--dock-h) + env(safe-area-inset-bottom, 0px)); }

.head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 16px;
  align-items: center;
  padding: 18px var(--pad) 6px;
}
.mark {
  margin: 0;
  font-size: var(--big);
  font-weight: 500;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--white);
  text-shadow: var(--glow-blue);
}
.mark a { display: inline-block; padding: 12px 0; margin: -12px 0; text-decoration: none; }
.scope { display: block; width: 100%; height: 28px; }
.tag { grid-column: 1 / -1; margin: 6px 0 0; color: var(--blue-mid); }
.tag a { color: var(--blue); text-underline-offset: 3px; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 28px;
  padding: 0 var(--pad);
  background: #000;
  border-bottom: 1px solid var(--frame);
}
.tabs a {
  padding: 14px 0 11px;
  margin-bottom: -1px;
  border-bottom: 1px solid transparent;
  font-size: var(--big);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--blue-mid);
}
.tabs a[aria-current="page"] { color: var(--white); text-shadow: var(--glow-blue); border-bottom-color: var(--blue); }
.count { margin-left: 2px; font-size: var(--small); letter-spacing: 0.08em; text-shadow: none; color: var(--blue-mid); }

/* the quiet switches: which kind to show, and the order */
.filters, .sort { display: flex; flex-wrap: wrap; }
.filters { padding: 4px calc(var(--pad) - 10px) 0; }
.seg {
  min-height: 44px;
  padding: 6px 10px;
  font-size: var(--small);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-mid);
}
.seg[aria-pressed="true"] { color: var(--white); text-decoration: underline; text-decoration-color: var(--blue); text-underline-offset: 6px; }
.seg:hover { color: var(--white); }

.group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  margin-top: 6px;
  padding: 0 calc(var(--pad) - 10px) 0 var(--pad);
}
.group-head h2 {
  margin: 0;
  font-size: var(--small);
  font-weight: 300;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue-mid);
}
.note { margin: 0; padding: 24px var(--pad); color: var(--blue-mid); }

/* ---- one entry ---- */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  position: relative;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  column-gap: 14px;
  padding: 12px var(--pad);
}
.row + .row { border-top: 1px solid var(--frame); }

.thumb {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 1px solid var(--frame);
  overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.row.distinct .thumb { border-color: var(--blue-dim); }
.emblem { width: 44px; height: 44px; overflow: visible; }
.emblem path { fill: none; stroke: var(--blue); stroke-width: 1; vector-effect: non-scaling-stroke; filter: drop-shadow(0 0 2px rgba(79, 182, 242, 0.7)); }
.songs .emblem path, .dock .emblem path { stroke: var(--amber); filter: drop-shadow(0 0 2px rgba(255, 179, 64, 0.6)); }
.row.out .emblem path { stroke: var(--blue-mid); filter: none; }

.words { min-width: 0; }
.name {
  display: block;
  font-size: var(--big);
  line-height: 1.25;
  color: var(--white);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.name::after { content: ""; position: absolute; inset: 0; }      /* the whole row is the target */
.by { display: block; margin-top: 1px; color: var(--blue-mid); }
.by a {
  position: relative;
  z-index: 1;
  padding: 6px 0;          /* inline, so a long maker line wraps like text; the padding only widens the target */
  color: var(--blue);
  text-decoration-color: var(--blue-dim);
  text-underline-offset: 3px;
}
.by a:hover { text-decoration-color: var(--blue); }
.blurb {
  margin: 3px 0 0;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  color: var(--blue);
}
.row.picked .blurb { -webkit-line-clamp: 3; }       /* a hand-written line is shown whole */
.row.open .blurb { display: block; }

.tail { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 4px; min-height: 56px; }
.kind { padding-top: 4px; font-size: var(--small); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue-mid); white-space: nowrap; }
.more {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin: 0 -12px -8px 0;
  color: var(--blue-mid);
}
.more:hover { color: var(--white); }
.more svg { transition: transform 0.15s; }
.row.open .more svg { transform: rotate(180deg); }
svg.i { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }

.row:hover .name { text-shadow: var(--glow-blue); }
.row:hover .thumb { border-color: var(--blue-dim); }
.row[aria-current="true"] { box-shadow: inset 2px 0 0 var(--amber); }
.row[aria-current="true"] .name { color: var(--amber); text-shadow: var(--glow-amber); }
.row[aria-current="true"] .thumb { border-color: var(--amber-dim); }

/* the opened entry: the picture, the full description, the links */
.detail { grid-column: 1 / -1; position: relative; z-index: 1; padding-top: 12px; }
.detail p { margin: 0 0 8px; }
.detail .shot { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: 50% 0; margin: 0 0 12px; border: 1px solid var(--frame); }
.detail .facts, .detail .caveat { color: var(--blue-mid); }
.detail .install {
  display: block;
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--frame);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: var(--small);
  letter-spacing: 0;
  color: var(--white);
  overflow-wrap: anywhere;
  user-select: all;
}
.links { display: flex; flex-wrap: wrap; gap: 0 20px; }
.links a, .links button { display: inline-block; padding: 10px 0; color: var(--white); text-decoration: underline; text-decoration-color: var(--blue-dim); text-underline-offset: 4px; }
.links a:hover, .links button:hover { text-decoration-color: var(--blue); }

.foot { padding: 28px var(--pad) 24px; font-size: var(--small); letter-spacing: 0.06em; color: var(--blue-mid); }
.foot p { margin: 0; }

/* ---- shared controls ---- */
.icon { display: grid; place-items: center; width: 44px; height: 44px; color: var(--blue); }
.icon:hover { color: var(--white); }
.icon svg.i { width: 22px; height: 22px; }
.icon.sound { color: var(--amber); }
.icon.sound svg.i { filter: drop-shadow(0 0 2px rgba(255, 179, 64, 0.6)); }
.text-btn {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid var(--blue-dim);
  font-size: var(--small);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  color: var(--white);
}
.text-btn:hover { border-color: var(--blue); }

/* ---- the player ---- */
.dock {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "screen screen screen" "now now keys" "seek seek seek" "extra extra extra";
  align-items: center;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: #000;
  border-top: 1px solid var(--amber-dim);
}
.screen {
  grid-area: screen;
  position: relative;
  display: grid;
  place-items: center;
  height: min(34dvh, 100vw);
  border-bottom: 1px solid var(--amber-frame);
  overflow: hidden;
  cursor: pointer;
}
.screen .emblem { width: 40px; height: 40px; }
.face, .screen video { position: absolute; inset: 0; width: 100%; height: 100%; }
.screen video { object-fit: contain; background: #000; }
.face .anatomy { position: relative; width: 100%; height: 100%; }
.face canvas { display: block; width: 100% !important; height: 100% !important; }
.screen-note {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  margin: 0;
  text-align: center;
  font-size: var(--small);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--amber);
}
.now { grid-area: now; min-width: 0; padding: 8px 0 8px var(--pad); }
.now-name {
  display: block;
  font-size: var(--big);
  line-height: 1.25;
  color: var(--amber);
  text-shadow: var(--glow-amber);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.now-by { display: block; color: var(--blue-mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.keys { grid-area: keys; display: flex; padding-right: 4px; }
.seek { grid-area: seek; display: flex; align-items: center; gap: 10px; padding: 0 var(--pad); }
.time { min-width: 4ch; font-size: var(--small); letter-spacing: 0.08em; font-variant-numeric: tabular-nums; color: var(--blue-mid); }
.time:last-child { text-align: right; }
.extra { grid-area: extra; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px var(--pad) 12px; }
.voice { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: var(--small); letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue-mid); }
.voice select {
  min-width: 0;
  max-width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--blue-dim);
  border-radius: 0;
  background: #000;
  color: var(--white);
}

input[type="range"] { flex: 1; min-width: 0; height: 28px; margin: 0; background: none; accent-color: var(--amber); -webkit-appearance: none; appearance: none; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(to right, var(--amber) var(--at, 0%), var(--amber-dim) var(--at, 0%)); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -5px; border: 1px solid var(--amber); border-radius: 50%; background: #000; box-shadow: 0 0 6px rgba(255, 179, 64, 0.5); }
input[type="range"]::-moz-range-track { height: 1px; background: var(--amber-dim); }
input[type="range"]::-moz-range-progress { height: 1px; background: var(--amber); }
input[type="range"]::-moz-range-thumb { width: 10px; height: 10px; border: 1px solid var(--amber); border-radius: 50%; background: #000; }

/* what each kind of player shows */
.dock #show { display: none; }
.dock[data-kind="face"] .screen video, .dock[data-kind="audio"] .screen video, .dock[data-kind="stage"] .screen video { display: none; }
.dock[data-kind="video"] .face, .dock[data-kind="video"] .screen .emblem { display: none; }
.dock[data-kind="audio"] .face, .dock[data-kind="stage"] .face { display: none; }
.dock:not([data-kind="face"]) .voice, .dock:not([data-kind="face"]) #full { display: none; }
.dock:not([data-kind="face"]):not([data-kind="stage"]) .extra { display: none; }
.dock[data-kind="audio"] #size, .dock[data-kind="stage"] #size { display: none; }

/* small: one row with a thumbnail-sized screen; the line along the top edge is the progress */
.dock[data-size="small"], .dock[data-kind="audio"], .dock[data-kind="stage"] { grid-template-areas: "screen now keys"; }
.dock[data-size="small"] .screen, .dock[data-kind="audio"] .screen, .dock[data-kind="stage"] .screen {
  width: 48px;
  height: 48px;
  margin: 8px 0 8px var(--pad);
  border: 1px solid var(--amber-frame);
}
.dock[data-size="small"] .now, .dock[data-kind="audio"] .now, .dock[data-kind="stage"] .now { padding-left: 12px; }
.dock[data-size="small"] .seek, .dock[data-size="small"] .extra, .dock[data-size="small"] .screen-note { display: none; }
.dock[data-kind="audio"] .screen-note, .dock[data-kind="stage"] .screen-note { display: none; }
.dock[data-kind="audio"] { grid-template-areas: "screen now keys" "seek seek seek"; }
.dock[data-kind="audio"] .seek { padding-bottom: 6px; }
.dock[data-size="small"]:not([data-kind="stage"])::before, .dock[data-kind="audio"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: -1px;
  width: var(--at, 0%);
  height: 1px;
  background: var(--amber);
  box-shadow: 0 0 6px rgba(255, 179, 64, 0.7);
}
.dock[data-kind="audio"]::before { display: none; }

/* an app left running on the stage: its name, a way back to it, a way to stop it */
.dock[data-kind="stage"] { grid-template-columns: auto minmax(0, 1fr) auto auto; grid-template-areas: "screen now extra keys"; }
.dock[data-kind="stage"] .extra { padding: 0; }
.dock[data-kind="stage"] #show { display: inline-flex; }
.dock[data-kind="stage"] #play, .dock[data-kind="stage"] #next, .dock[data-kind="stage"] .seek { display: none; }
.app[data-view="stage"] .dock[data-kind="stage"] { display: none; }

/* ---- the stage: a full-screen layer on a phone ---- */
.stage {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  background: #000;
  visibility: hidden;        /* hidden, not removed: an app left running keeps sounding */
  pointer-events: none;
}
.app[data-view="stage"] .stage { visibility: visible; pointer-events: auto; }
.stage-bar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 52px;
  padding: 4px 6px 4px 8px;
  padding-top: calc(4px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--frame);
}
.stage-title { flex: 1; min-width: 0; padding: 0 8px; }
.stage-name, .stage-by { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-name { color: var(--white); line-height: 1.25; }
.stage-by { font-size: var(--small); letter-spacing: 0.06em; color: var(--blue-mid); }
.stage-bar .close, .own .wide { display: none; }
.stage-bar .icon { width: 40px; }
.stage-hint { flex: none; margin: 0; padding: 7px var(--pad); border-bottom: 1px solid var(--amber-frame); color: var(--amber); }
.frame { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; }
.frame::before { content: attr(data-wait); color: var(--blue-mid); font-size: var(--small); letter-spacing: 0.2em; text-transform: uppercase; }
.frame[data-wait=""]::before { display: none; }
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.idle { display: none; }
/* a framed address that does not answer: said plainly, with the way to the maker's page */
.offline { position: relative; display: grid; justify-items: center; gap: 6px; max-width: 34em; padding: 24px var(--pad); text-align: center; }
.offline .emblem { width: 96px; height: 96px; margin-bottom: 14px; }
.offline .emblem path { stroke: var(--blue-dim); filter: none; }
.offline p { margin: 0; }
.offline-line { font-size: var(--big); color: var(--white); }
.offline-more { color: var(--blue-mid); }
.offline .links { justify-content: center; margin-top: 8px; }

/* the picture that appears beside the list while pointing at an app (wide screens only) */
.peek { display: none; }

html.locked { overflow: hidden; }

/* ---- wide: the column becomes a sidebar, the stage sits beside it ---- */
@media (min-width: 900px) {
  html.locked { overflow: visible; }
  .app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); height: 100dvh; }
  .side { display: flex; flex-direction: column; min-height: 0; padding-bottom: 0; border-right: 1px solid var(--frame); }
  .head, .tabs, .filters, .foot, .dock { flex: none; }
  .head { padding-top: 22px; }
  .tabs { position: static; }
  .seg { min-height: 32px; }
  .filters { padding-top: 8px; }
  .group-head { min-height: 32px; margin-top: 14px; }
  .more { width: 36px; height: 32px; margin: 0 -8px 0 0; }
  .links a, .links button { padding: 5px 0; }
  .list { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--frame) transparent; padding-bottom: 16px; }
  .foot { padding: 10px var(--pad); border-top: 1px solid var(--frame); }

  .dock { position: relative; grid-template-areas: "now now keys" "seek seek seek" "extra extra extra"; padding-top: 4px; }
  /* big: the face takes the stage */
  .dock[data-size="big"]:not([data-kind="audio"]):not([data-kind="stage"]) .screen {
    position: fixed;
    left: calc(var(--side) + 1px);
    top: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    margin: 0;
    border: 0;
    z-index: 10;
    background: #000;
  }
  .dock[data-size="big"] .screen-note { bottom: 28px; }
  .dock[data-size="small"] { grid-template-areas: "screen now keys" "seek seek seek" "extra extra extra"; }
  .dock[data-size="small"] .seek { display: flex; }
  .dock[data-size="small"][data-kind="face"] .extra { display: flex; }
  .dock[data-size="small"] .screen { width: 72px; height: 72px; }
  .dock[data-size="small"]::before, .dock[data-size="small"]:not([data-kind="stage"])::before { display: none; }
  .dock[data-kind="stage"] { display: none; }
  .seek { padding-bottom: 6px; }

  .stage { position: relative; inset: auto; z-index: auto; visibility: visible; pointer-events: auto; min-width: 0; }
  .stage-bar { min-height: 48px; padding: 4px 8px 4px var(--pad); gap: 4px; }
  .stage-title { padding: 0 12px 0 0; display: flex; align-items: baseline; gap: 12px; }
  .stage-name { font-size: var(--big); }
  .stage-by { font-size: var(--text); letter-spacing: inherit; }
  .stage-bar .back { display: none; }
  .stage-bar .close { display: grid; }
  .own .wide { display: inline; }
  .own { margin: 0 4px; }

  .idle { flex: 1; display: grid; place-content: center; justify-items: center; gap: 6px; text-align: center; }
  .stage.on .idle { display: none; }
  .side:has(.dock:not([hidden])) ~ .stage .idle-line { visibility: hidden; }   /* something is already playing */
  .stage:not(.on) .frame { display: none; }
  .idle-mark .emblem { width: 180px; height: 180px; margin-bottom: 18px; }
  .idle-mark .emblem path { stroke: var(--blue-dim); filter: none; }
  .idle-line { margin: 0; font-size: var(--big); color: var(--white); }
  .idle-keys { margin: 0; font-size: var(--small); letter-spacing: 0.12em; color: var(--blue-mid); }

  .peek {
    position: fixed;
    left: calc(var(--side) + 14px);
    z-index: 40;
    display: block;
    width: 380px;
    border: 1px solid var(--blue-dim);
    background: #000;
    box-shadow: 0 0 28px rgba(79, 182, 242, 0.18);
    pointer-events: none;
  }
  .peek img { display: block; width: 100%; aspect-ratio: 16 / 10; object-fit: cover; }
  .peek p { margin: 0; padding: 7px 10px 8px; font-size: var(--small); letter-spacing: 0.06em; color: var(--blue-mid); border-top: 1px solid var(--frame); }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
