/* Pi, one stylesheet (ADR 105), in the brand of 2026-10-28 (ADR 134), with
   one style per kind (ADR 158). The look itself, its colors, sizes, space,
   faces, base text, the mark and its animation, is wizard-aesthetics',
   written once as design tokens and copied into look/ from its Fuzz domain
   by make look (ADR 108); this file holds Pi's layout on top of it. One
   theme: nothing here follows a dark scheme. Ids in comments name the rule
   book's rule a choice follows (T type, G grid, C color, M marks and motion,
   P parsimony). Ground shows works, paper is read, the panel acts.

   Each kind has one rule and one markup, listed in ADR 158: four voices,
   three headings, a box, a small box and a filled box, a link, a line of
   acts, a field row, a fold, a work row, a cover, a table, name and value
   rows, an error and a warning, a status line. No italic, no shadow. */

@import url("look/wizard.css");
@import url("look/mark.css");

:root {
  /* The frame, every length a multiple of the 7 px unit (G2). */
  --spine: 252px; --gut: 28px; --band: 84px; --cover: 448px; --side: 336px;
  --measure: 476px;
  --content: calc(var(--band) + var(--cover) + var(--side) + 2 * var(--gut));
  --hang: calc(var(--band) + var(--gut));
  --bar: 56px; --tap: 42px;
}

/* Pi's own base, after the look's. */

.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; }
.skip:focus { left: var(--s-2); top: var(--s-2); z-index: 50; background: var(--paper); padding: var(--s-1) var(--s-2); }
[hidden] { display: none !important; }

/* Voices (T5). Body is the look's. Quiet names or explains a value; strong
   must be read. A voice is a weight and a color; its size is the size of the
   text it sits in, except quiet, which is small. Code is the look's. */

.note, .field > label, legend, thead th, .pairs dt {
  font-weight: var(--w-text); font-size: var(--t-small); line-height: var(--l-small);
  font-style: normal; color: var(--muted);
}
/* Red is the pi's and the animation's alone (ADR 134), so an error is strong
   ink, and a warning, a safety fact, wears the same rule (ADR 150). */
.error, .warning { color: var(--ink); font-weight: var(--w-strong); }

/* One reading measure for text in main; lists of works, the people grid,
   tables, the bill and the poster fill their column. */
main :is(p, ul, ol, dl) { max-width: var(--measure); }
main :is(.tracks, .people, .scroll, table, .credits, .pairs, .poster p) { max-width: none; }
/* Numbers show only where the number is a fact (ol.steps). */
main ol:not(.steps) { list-style: none; padding-left: 0; }

/* The frame: a spine on the left, the page beside it, the bar under both. */

.spine {
  position: fixed; inset: 0 auto 0 0; width: var(--spine); z-index: 5; overflow-y: auto;
  padding: var(--s-4) var(--s-4) calc(var(--bar) + var(--s-3)); background: var(--ground);
  display: flex; flex-direction: column; gap: var(--s-4); border-right: var(--rule-hair) solid var(--rule);
}
.spine .sections { list-style: none; margin: 0; padding: 0; }
.spine .sections li { margin: 0; padding: var(--s-1) 0 0; }
.find-field { margin: 0; }
.spine-foot { margin-top: auto; font-size: var(--t-small); line-height: var(--l-small); }
.spine-foot p { margin: 0 0 var(--s-1); }
.spine .drawer-close, .topbar { display: none; }

.page { margin-left: var(--spine); padding: var(--s-5) var(--s-6) calc(var(--bar) + var(--s-6)); min-height: 100vh; }
.page > main, .page > .foot { max-width: var(--content); }
/* A page outside the frame, the 500 page, has no spine to clear. */
.bare .page { margin-left: 0; }
body.embed main { padding: var(--s-3); }

/* Headings: the page title, a section, a subsection. The poster's and the
   receipt's titles are the two display forms (ADR 105). */

main h1 { font: var(--w-mark) var(--t-display)/var(--l-display) var(--f-mark); margin: 0 0 var(--s-3); }
main h2 { font: var(--w-mark) var(--t-title)/var(--l-title) var(--f-mark); margin: 0 0 var(--s-2); }
main h3 { font: var(--w-strong) var(--t-head)/var(--l-head) var(--f-main); margin: var(--s-4) 0 var(--s-1); }
main > section { margin-top: var(--s-6); }
/* A term over its indented answer, as on the about page. */
main > section > dl:not(.pairs) > dt { font-weight: var(--w-strong); margin-top: var(--s-1); }
main > section > dl:not(.pairs) > dd { margin: 0 0 0 var(--s-4); }

/* The current page, anywhere: ink, strong, no underline. */
:is(.spine, .topbar, main) [aria-current] { color: var(--ink); font-weight: var(--w-strong); text-decoration: none; }

/* The foot: one sentence, one line of links, the proof folded, all quiet. */
.foot { margin-top: var(--s-6); font-size: var(--t-small); line-height: var(--l-small); color: var(--muted); }
.foot p { margin: 0 0 var(--s-1); max-width: var(--measure); }
.foot details { margin: 0; }
.page.hang > .foot { margin-left: var(--hang); max-width: calc(var(--content) - var(--hang)); }

/* Actions. A button is always a box, a link always a link (T25). A box acts;
   a small box acts on one row or inside one field; the filled box is the one
   click after which money moves. Every box is the tap height (G22). */

button, input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: flex-start; gap: var(--s-2);
  min-height: var(--tap); padding: var(--s-1) var(--s-3); text-align: left; white-space: normal;
  font: var(--w-strong) var(--t-body)/1.2 var(--f-main); cursor: pointer;
  color: var(--ink); background: transparent; border: var(--rule-firm) solid var(--ink); border-radius: 0;
}
button.small, .player-controls button, .player-all button, .player-bar button {
  min-height: var(--tap); padding: var(--s-1) var(--s-2); font-size: var(--t-small);
}
input[type="file"] { font: var(--t-small)/var(--l-small) var(--f-main); color: var(--muted); }
input[type="file"]::file-selector-button {
  min-height: var(--tap); margin-right: var(--s-2); padding: var(--s-1) var(--s-2); cursor: pointer;
  font: var(--w-strong) var(--t-small)/1.2 var(--f-main);
  color: var(--ink); background: transparent; border: var(--rule-firm) solid var(--ink); border-radius: 0;
}
button.primary { background: var(--ink); color: var(--ground); }
:is(.panel, .player-bar) button { border-color: var(--panel-ink); color: var(--panel-ink); }
.panel button.primary { background: var(--panel-ink); color: var(--panel); }
/* Hover only where a pointer hovers: a phone keeps :hover on the last box
   tapped, which would read as chosen. */
@media (hover: hover) {
  button:not(.stomp):hover:not(:disabled):not(:focus-visible) { outline: var(--rule-hair) solid currentColor; outline-offset: -3px; }
  button.primary:hover:not(:disabled):not(:focus-visible) { outline-color: var(--ground); outline-offset: -5px; }
  .panel button.primary:hover:not(:disabled):not(:focus-visible) { outline-color: var(--panel); }
}
/* After the fills, so disabled wins on the ground and on ink. The edge keeps
   its width, so nothing moves when a control enables. */
button:disabled, button[aria-disabled="true"] { background: transparent; border-color: var(--rule); color: var(--muted); cursor: not-allowed; }
/* --panel-muted has --panel-ink's value, so the faint edge on ink is --muted. */
:is(.panel, .player-bar) button:is(:disabled, [aria-disabled="true"]) { background: transparent; border-color: var(--muted); color: var(--panel-muted); }
button[aria-busy="true"] { cursor: progress; }
/* A status line stays in the page, empty until it speaks, so its first words
   are read; empty, it takes no room. */
.status:empty { margin: 0; }
:is(.panel, .player-bar) :focus-visible { outline-color: var(--panel-link); }

/* A line of acts: two or more controls or links on one line. A link that
   stands alone is at least 28 px tall. */
.acts { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-3); align-items: center; }
/* As flex boxes these links drop the space between a name and its code, so
   the gap puts it back. */
:is(.acts, .spine-foot, .topbar, .foot, .player-bar) a { display: inline-flex; align-items: center; column-gap: 0.25em; min-height: 28px; }
/* A follow: user(), then its one-box form on the same line. */
.followed form { display: inline; }

/* The stomp: the work page's play control, one of the three round things
   (P5, ADR 105). player.js toggles .playing. */
button.stomp {
  width: 56px; height: 56px; min-height: 0; flex: none; padding: 0; border: 0; border-radius: 50%;
  background: var(--ink); color: var(--ground); font-size: 0; display: inline-grid; place-items: center;
}
.stomp::before { content: ""; border-style: solid; border-width: 9px 0 9px 15px; border-color: transparent transparent transparent currentColor; margin-left: 4px; }
.stomp.playing::before { width: 14px; height: 18px; border: 0; margin: 0; background: linear-gradient(90deg, currentColor 0 5px, transparent 5px 9px, currentColor 9px 14px); }

/* Forms. A field row is a label over its input; fields are 16 px or more on
   a phone (T38). No box around a group, no disabled field. */

label { display: inline-block; }
.field { display: grid; gap: var(--s-1); max-width: var(--measure); margin: 0 0 var(--s-2); }
.field > button { justify-self: start; }
input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="submit"]), textarea, select {
  font: var(--t-body) var(--f-main); color: var(--ink); background: var(--paper);
  border: var(--rule-hair) solid var(--ink); border-radius: 0;
  padding: var(--s-1) var(--s-2); min-height: var(--tap); width: 100%; max-width: 100%;
}
textarea { min-height: 112px; resize: vertical; line-height: var(--l-body); }
::placeholder { color: var(--muted); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--link); width: 18px; height: 18px; vertical-align: -3px; margin: 0 var(--s-1) 0 0; }
fieldset { border: 0; padding: 0; margin: 0 0 var(--s-2); min-width: 0; }
legend { padding: 0; margin: 0 0 var(--s-1); }

/* Folds. One fold: proof stays on the page, one click away (ADR 101). */

details > summary { cursor: pointer; min-height: 28px; }
details[open] > summary { margin-bottom: var(--s-2); }

/* Tables (T29, T30). A wide table scrolls inside itself. */

.scroll { overflow-x: auto; max-width: 100%; }
table { border-collapse: collapse; width: 100%; }
thead th { text-align: left; padding: var(--s-1) var(--s-2) var(--s-1) 0; border-bottom: var(--rule-firm) solid var(--ink); white-space: nowrap; }
tbody td, tbody th { padding: var(--s-1) var(--s-2) var(--s-1) 0; border-bottom: var(--rule-hair) solid var(--rule); vertical-align: middle; text-align: left; font-weight: 400; }
.n { text-align: right; white-space: nowrap; }

/* Name and value rows: a quiet name column, values in body. */
.pairs { margin: 0 0 var(--s-2); display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 0 var(--s-2); align-items: baseline; align-content: start; }
.pairs dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
/* A cut value, its whole in the title, is at most 17 characters: one line. */
code[title] { white-space: nowrap; }

/* Lists: a reply indents one step per level; the tally line, quiet, keeps its figures in ink. */
.depth-1 { margin-left: var(--s-4); }
.depth-2 { margin-left: var(--s-6); }
.depth-3 { margin-left: var(--s-7); }
.record-line .num { color: var(--ink); }

/* Covers and pictures: one square, never cropped otherwise (G24). No picture
   is the first letter on the ink square; a missing work is an empty frame. */

.cover { margin: 0; aspect-ratio: 1; width: 100%; background: var(--panel); position: relative; object-fit: cover; }
figure.cover img { width: 100%; height: 100%; object-fit: cover; }
.cover.blank { display: grid; place-items: center; color: var(--panel-ink); font: var(--w-mark) var(--t-title)/1 var(--f-mark); text-align: center; padding: var(--s-2); overflow: hidden; }
.cover.slot { background: var(--raised); display: grid; place-items: center; }
.cover.slot::before { content: ""; width: 42%; height: 42%; border: var(--rule-firm) solid var(--rule); }

/* The poster: band, cover, side, as on the flyer. */

.poster { display: grid; grid-template-columns: var(--band) var(--cover) var(--side); column-gap: var(--gut); align-items: start; }
.vtitle {
  grid-column: 1; grid-row: 1 / span 3; align-self: stretch; justify-self: start; margin: 0;
  writing-mode: vertical-rl; transform: rotate(180deg);
  font: var(--w-mark) var(--t-vertical)/var(--l-vertical) var(--f-mark);
  white-space: nowrap; height: 0; min-height: 100%; overflow: hidden; text-align: right;
}
.vtitle.long { font-size: var(--t-poster); line-height: var(--l-poster); }
.vtitle.longer { font-size: var(--t-display); line-height: var(--l-display); }
.vtitle.longest { font-size: var(--t-title); line-height: var(--l-title); }
.poster > .cover, .poster > .picture { grid-column: 2; grid-row: 1; }
.poster > .side { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.poster > .side > * { margin: 0; }
.poster > .under { grid-column: 2 / -1; grid-row: 2; margin-top: var(--s-4); }
.poster > .after { grid-column: 2 / -1; grid-row: 3; }
.hang main > .split, .hang main > section, .hang main > #record, .hang main > .credits { margin-left: var(--hang); max-width: calc(var(--content) - var(--hang)); }
/* Play all lands before the first list it plays, so it hangs with it. */
.hang main > .player-all { margin-left: var(--hang); }
.split { display: grid; grid-template-columns: var(--cover) var(--side); column-gap: var(--gut); align-items: start; margin-top: var(--s-5); }
.split > section { margin: 0; }
.split:has(#pay .pay-routes) { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); }
main > #record { margin-top: var(--s-6); }
/* The author's card hangs from the page edge: its band is the hang. */
.hang main > section.profile { margin-left: 0; max-width: none; }

/* The bill: name and value rows between two heavy rules, as on the flyer; one per screen. */
.credits { border-top: var(--heavy) solid var(--ink); border-bottom: var(--heavy) solid var(--ink); padding: var(--s-2) 0; margin: var(--s-5) 0; display: grid; grid-template-columns: var(--cover) var(--side); column-gap: var(--gut); }
.credits .pairs { margin: 0; }

/* Works in a list: one row each, a 56 px cover, the title, line two, and
   Play and Queue at the end (G24). */
.tracks { list-style: none; margin: 0; padding: 0; border-top: var(--rule-firm) solid var(--ink); }
.track {
  display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; grid-template-areas: "art title play" "art by play";
  column-gap: var(--s-2); align-items: center; min-height: 70px; padding: var(--s-1) 0; margin: 0;
  border-bottom: var(--rule-hair) solid var(--rule);
}
.track-art { grid-area: art; display: block; width: 56px; height: 56px; text-decoration: none; }
.track-art .cover { width: 56px; height: 56px; font-size: var(--t-small); padding: 0; }
.track-title { grid-area: title; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-by { grid-area: by; min-width: 0; }
.track :is(.player-controls, audio) { grid-area: play; }
.track audio { width: 100%; height: 42px; }
/* Without scripts the browser's own control, about 300 px wide, takes a line
   of its own under the title, so the title keeps its room on a phone. */
.track:has(> audio:not([hidden])) { grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "art title" "art by" "play play"; }

/* Authors as pictures and names, four across (G23). */
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s-4) var(--gut); list-style: none; padding: 0; margin: var(--s-3) 0; }
.people li { margin: 0; }
.people a { display: block; }
.people .cover { margin-bottom: var(--s-1); }

/* The panel: the pedal face, where things act. */

.panel { background: var(--panel); color: var(--panel-ink); padding: var(--s-4); border-radius: 0 0 var(--r-enclosure) var(--r-enclosure); }
.panel a, .panel a:visited { color: var(--panel-link); }
.panel :is(.note, .field > label, legend, thead th, .pairs dt) { color: var(--panel-muted); }
.panel :is(h2, h3, .error, .warning, [aria-current]) { color: var(--panel-ink); }
.panel :is(input:not([type="checkbox"]):not([type="radio"]), textarea, select) { background: var(--panel); color: var(--panel-ink); border-color: var(--panel-ink); }
.panel ::placeholder { color: var(--panel-muted); }
.panel :is(input[type="checkbox"], input[type="radio"]) { accent-color: var(--panel-ink); }
.panel thead th { border-bottom-color: var(--panel-ink); }
.panel tbody td, .panel tbody th { border-bottom-color: var(--panel-muted); }
.panel pre { background: transparent; color: var(--panel-ink); border-color: var(--panel-muted); }
/* A section inside the panel, such as the shares or the PSBT to sign, takes
   the space of a section on the ground. */
.panel :is(section, .pay-panel) { margin-top: var(--s-5); }

.pay .why { margin: 0 0 var(--s-3); }
.pay-step { max-width: 784px; margin-top: var(--s-4); }

/* The QR code stays black on white, as scanners need; the SVG holds its own quiet zone. */
.qr { width: 252px; height: 252px; background: #fff; margin: 0 0 var(--s-1); }
.qr svg { width: 100%; height: 100%; display: block; }

/* The receipt's title, the second display form (ADR 105). */
.receipt-title { font: var(--w-mark) var(--t-poster)/var(--l-poster) var(--f-mark); margin: 0 0 var(--s-2); }

/* The player bar, built by player.js in #player (ADR 83). */

#player:empty { display: none; }
.player-bar {
  position: fixed; inset: auto 0 0 0; z-index: 10; background: var(--panel); color: var(--panel-ink);
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; column-gap: var(--s-3); align-items: center;
  padding: var(--s-1) var(--s-4); font-size: var(--t-small); line-height: var(--l-small);
}
.player-bar a, .player-bar a:visited { color: var(--panel-link); }
.player-bar p { margin: 0; }
.player-bar audio { width: 100%; height: 42px; color-scheme: dark; }
.player-now { font-weight: var(--w-strong); overflow: hidden; text-overflow: ellipsis; }
.player-bar [data-player-check] { grid-column: 1 / -1; color: var(--panel-muted); }
.player-bar :is(.error, .warning) { color: var(--panel-ink); }
.player-bar [data-player-save] { grid-column: 1 / -1; }
.player-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s-1) var(--s-2); }
/* The bar sits over the page's foot and the spine's foot, so both make room
   for it once it shows. #player is a sibling of #page, not of .page. */
#page:has(~ #player .player-bar) .page { padding-bottom: calc(var(--s-8) + var(--s-6)); }
#page:has(~ #player .player-bar) .spine { padding-bottom: calc(var(--s-8) + var(--s-3)); }

/* Player controls added beside each work, and Play all under a list's heading. */
.player-controls, .player-all { display: flex; flex-wrap: wrap; gap: var(--s-1); align-items: center; margin: var(--s-1) 0; }
/* On the work page the stomp leads and Queue, a small box, sits beside it. */
.work-text .listen { display: contents; }
.work-text .listen .license { display: none; }
.work-text .player-controls { gap: var(--s-3); margin: 0; }

/* Mid widths: the poster folds before it squeezes (G18). */

@media (max-width: 1180px) {
  .poster { grid-template-columns: var(--band) minmax(0, var(--cover)); }
  .poster > .side { grid-column: 2; grid-row: auto; margin-top: var(--s-4); }
  .poster > .under, .poster > .after { grid-column: 2; grid-row: auto; }
  .vtitle { grid-row: 1 / span 5; }
  .hang main > .split, .hang main > section, .hang main > #record, .hang main > .credits { max-width: var(--cover); }
  .split { grid-template-columns: minmax(0, 1fr); row-gap: var(--s-4); }
  .credits { grid-template-columns: 1fr 1fr; }
  .people { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1023px) {
  :root { --spine: 196px; }
  .page { padding-left: var(--s-4); padding-right: var(--s-4); }
}

/* The phone: the flyer's skeleton. The mark over a heavy rule (ADR 105), one column. */

@media (max-width: 720px) {
  :root { --tap: 49px; }
  .spine { display: none; }
  .spine:target { display: flex; z-index: 30; width: min(294px, 86vw); }
  .spine:target .drawer-close { display: inline-flex; align-self: flex-end; }
  .topbar {
    display: flex; align-items: end; justify-content: space-between; position: sticky; top: 0; z-index: 8;
    padding: var(--s-2) var(--s-3) var(--s-1); background: var(--ground); border-bottom: var(--heavy) solid var(--ink);
  }
  .topbar .lockup { --mark-size: 40px; gap: var(--s-1); }
  .topbar nav { display: flex; gap: var(--s-3); }
  .topbar nav a { min-height: var(--tap); }
  .page { margin-left: 0; padding: var(--s-3) var(--s-3) calc(var(--bar) + var(--s-5)); min-height: 0; }
  .page.hang > .foot { margin-left: 0; max-width: none; }

  .poster { grid-template-columns: 56px minmax(0, 1fr); column-gap: var(--s-2); }
  .poster > .cover, .poster > .picture, .poster > .side, .poster > .under { grid-column: 2; grid-row: auto; }
  .poster > .after { grid-column: 1 / -1; grid-row: auto; }
  .poster > .side { margin-top: var(--s-3); }
  .vtitle { grid-row: 1 / span 3; font-size: var(--t-vertical); line-height: 56px; }
  .vtitle.long, .vtitle.longer { font-size: var(--t-display); line-height: 49px; }
  .vtitle.longest { font-size: var(--t-head); line-height: 42px; }
  .hang main > .split, .hang main > section, .hang main > #record, .hang main > .credits, .hang main > .player-all { margin-left: 0; max-width: none; }
  .credits { grid-template-columns: 1fr; margin: var(--s-4) 0; }
  .pairs { grid-template-columns: 98px minmax(0, 1fr); }
  .people { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3) var(--s-2); }

  .panel { padding: var(--s-3) var(--s-2); }
  .qr { width: 196px; height: 196px; }

  .player-bar { grid-template-columns: minmax(0, 1fr); padding: var(--s-1) var(--s-2); row-gap: var(--s-1); }
  /* Stacked, the bar is taller, its boxes at the phone's tap height. */
  #page:has(~ #player .player-bar) .page { padding-bottom: calc(var(--s-8) + var(--s-7)); }
  /* The check line shows on a phone until it says Checked, and when it fails. */
  .player-bar [data-player-check][data-state="done"], .player-bar [data-player-save] { display: none; }

  /* A table wider than a phone scrolls inside itself, wrapped or not (G18).
     A key or address in a cell keeps one line, since code may otherwise break
     anywhere and fold its column down to a letter a line; prose cells still
     wrap. A table in a .scroll wrapper stays a table, full width. */
  main table { display: block; overflow-x: auto; max-width: 100%; }
  main .scroll > table { display: table; }
  main td code, main th code { overflow-wrap: normal; white-space: nowrap; }
}

/* The narrowest phones, 320 px: Play and Queue go under line two, so the
   title keeps its room (WCAG 1.4.10). */
@media (max-width: 364px) {
  .track { grid-template-columns: 56px minmax(0, 1fr); grid-template-areas: "art title" "art by" "play play"; }
}
