/* Hallmark · shape: app screen · genre: playful · theme: custom · idea: "each person is a pixel character, and the draw lights them up one by one like an arcade until it stops on whose turn it is" · vibe: "kwant by daylight, arcade lights, plain words"
 * paper: oklch(97.2% 0.011 295) · accent: oklch(84% 0.155 82) · display: Jersey 10 · body: Figtree
 * nav: a top bar, the wordmark and one quiet link · signature: the draw lighting the pixel characters · states: empty, full, rolling, round complete, form error, 404
 * axes: light/pixel/chromatic-amber · posture: committed (the indigo stage carries the draw) · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S5 R4 V5 · weakest: P, the home could read as a plain form; put the stage with real characters beside it so the first screen shows the product */
/* Hallmark · dismissed F4 · the quiet button on the stage takes the stage's own colour, so it reads as an outline, not a second fill */
/* Hallmark · answered F-focus · the focus ring leaves the accent's lightness on purpose: amber at L84 fails 3:1 on the light paper, so the ring is a dark amber on paper and a light amber on the stage */
/* Hallmark · finish-review: subagent · 6 findings · 5 resolved 1 unresolved (phone chips wrap names on two lines, accepted: two columns beat a long stack) · gap: none */
@import url("./tokens.css");
@import url("./base.css");

/* Stepped corners: four zero-blur shadows cut the corners. Unlike clip-path, this leaves the focus ring free. */
.pixel {
  --frame-color: var(--color-ink);
  margin: var(--pixel);
  box-shadow:
    0 calc(-1 * var(--pixel)) 0 0 var(--frame-color),
    0 var(--pixel) 0 0 var(--frame-color),
    calc(-1 * var(--pixel)) 0 0 0 var(--frame-color),
    var(--pixel) 0 0 0 var(--frame-color);
}

.skip-nav { position: absolute; left: var(--space-md); top: calc(-1 * var(--space-3xl)); z-index: var(--z-toast); padding: var(--space-xs) var(--space-md); background: var(--color-ink); color: var(--color-paper); }
.skip-nav:focus-visible { top: var(--space-md); }

/* Top bar and footer */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: var(--space-md); min-height: 72px; }
.brand { font: 400 var(--text-xl)/1 var(--font-display); font-size-adjust: var(--adjust-display); color: var(--color-ink); text-decoration: none; }
.brand:hover { color: var(--color-ink-2); }
.topbar__link { font-weight: 700; color: var(--color-ink); }
.topbar__link:hover { color: var(--color-ink-2); }
main { padding-block: var(--space-xl) var(--space-3xl); }
.footer { padding-block: var(--space-lg) var(--space-xl); color: var(--color-muted); font-size: var(--text-sm); }
.footer p { border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-lg); max-width: none; }

/* Headings */
h1, h2 { font-weight: 400; letter-spacing: var(--tracking-display); color: var(--color-ink); }
h1 { font-size: var(--text-display-s); line-height: 1.02; max-width: 20ch; }
h2 { font-size: var(--text-xl); line-height: 1.1; }
/* A list name runs up to 80 characters: past 30 it would take five lines at display size. */
h1.is-long { font-size: var(--text-3xl); line-height: 1.1; max-width: 32ch; }

/* Buttons */
.btn {
  --pixel: 3px;
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs);
  min-height: 44px; padding: 0 var(--space-lg); border: 0; border-radius: 0;
  background: var(--color-paper); color: var(--color-ink);
  font: 700 var(--text-md)/1 var(--font-body); white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out);
}
.btn:hover { background: var(--color-paper-3); }
.btn:active { transform: translateY(2px); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: calc(var(--pixel) + 3px); }
.btn:disabled { background: var(--color-paper-3); color: var(--color-muted); cursor: not-allowed; transform: none; }
.btn.htmx-request { cursor: progress; }
.btn--primary { background: var(--color-accent); color: var(--color-accent-ink); }
.btn--primary:hover { background: var(--color-accent-2); }
.btn--large { --pixel: 4px; min-height: 52px; padding-inline: var(--space-xl); font-size: var(--text-lg); }

/* Fields */
.field { display: grid; gap: var(--space-xs); }
label, legend { font-weight: 700; }
input[type="text"], textarea {
  width: 100%; min-height: 44px; padding: var(--space-xs) var(--space-sm);
  border: 2px solid var(--color-ink-2); border-radius: 0; background: var(--color-paper); color: var(--color-ink);
  outline: 2px solid transparent; outline-offset: 2px;
}
input[type="text"]:focus-visible, textarea:focus-visible { outline-color: var(--color-focus); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--color-error); }
textarea { resize: vertical; line-height: 1.5; }
::placeholder { color: var(--color-muted); opacity: 1; }
.hint { min-height: 1lh; font-size: var(--text-sm); color: var(--color-muted); }
.error { font-size: var(--text-sm); font-weight: 700; color: var(--color-error); }

/* Three buttons in a row. Only the checked mode shows its description, below; the others stay for screen readers. */
.modes { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); margin: 0; padding: 0 0 calc(var(--space-xs) + 2 * 1.45 * var(--text-sm)); border: 0; }
.modes legend { margin-bottom: var(--space-xs); padding: 0; }
.mode { display: flex; align-items: center; justify-content: center; min-height: 52px; padding: var(--space-xs); border: 2px solid var(--color-ink-2); background: var(--color-paper); text-align: center; line-height: 1.2; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
.mode:hover { background: var(--color-paper-3); }
.mode:has(:checked) { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-paper); }
.mode:has(:focus-visible) { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.mode input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.mode small { position: absolute; left: 0; right: 0; bottom: 0; font-size: var(--text-sm); font-weight: 400; line-height: 1.45; color: var(--color-muted); text-align: left; }
.mode:not(:has(:checked)) small { right: auto; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Home */
/* On a wide screen the sample goes to the right column; in the DOM it comes last and has nothing focusable. */
.home { display: grid; align-items: start; }
.home h1 { max-width: 9ch; }
.lede { margin-top: var(--space-lg); max-width: 32ch; font-size: var(--text-lead); color: var(--color-ink-2); }
.cta { margin-top: var(--space-xl); }
.showcase { margin: var(--space-2xl) 0 0; }
.showcase .stage { margin: var(--pixel); padding: var(--space-lg); }
.showcase figcaption { margin-top: var(--space-md); max-width: 48ch; font-size: var(--text-sm); color: var(--color-muted); }
/* A returning visitor comes back to a list: the lists lead and the CTA steps back. */
.recent { margin-top: var(--space-xl); max-width: 32rem; }
.recent h2 { font: 700 var(--text-md)/1.4 var(--font-body); color: var(--color-muted); }
.recent ul { display: grid; gap: var(--space-sm); margin: var(--space-sm) 0 0; padding: 0; list-style: none; }
.recent a { --pixel: 3px; --frame-color: var(--color-paper-2); display: grid; gap: var(--space-3xs); padding: var(--space-sm) var(--space-md); background: var(--color-paper-2); color: var(--color-ink); text-decoration: none; }
.recent a:hover { --frame-color: var(--color-paper-3); background: var(--color-paper-3); }
.recent a:focus-visible { outline: 2px solid var(--color-focus); outline-offset: calc(var(--pixel) + 3px); }
.recent strong { overflow-wrap: break-word; hyphens: auto; }
.recent span { font-size: var(--text-sm); color: var(--color-muted); }
.home:has(#recent:not([hidden])) .cta { margin-top: var(--space-lg); }
.home:has(#recent:not([hidden])) .cta .btn { --pixel: 3px; min-height: 44px; padding-inline: var(--space-lg); background: var(--color-paper); font-size: var(--text-md); }
.home:has(#recent:not([hidden])) .cta .btn:hover { background: var(--color-paper-3); }
/* The API pitch shows what a bot posts, not the request: the code lives on /api.
   The stage widens into a full-bleed band; the shadow and clip-path widen it without widening the page. */
.bot {
  position: relative; display: grid; justify-items: center; gap: var(--space-lg);
  margin: var(--space-4xl) 0 calc(-1 * var(--space-3xl)); padding-block: var(--space-3xl);
  background: var(--color-field); color: var(--color-field-ink); text-align: center;
  box-shadow: 0 0 0 100vmax var(--color-field); clip-path: inset(0 -100vmax);
}
/* Crenellated edges: paper notches cut into the band, one pixel row deep. */
.bot::before, .bot::after { content: ""; position: absolute; left: -100vmax; right: -100vmax; top: 0; height: 8px; background: repeating-linear-gradient(90deg, var(--color-paper) 0 16px, transparent 16px 32px); }
.bot::after { top: auto; bottom: 0; background-position: 16px 0; }
.bot h2 { max-width: 18ch; font-size: var(--text-display-s); line-height: 1.02; color: var(--color-field-ink); }
.bot__lede { max-width: 40ch; font-size: var(--text-lead); color: var(--color-field-muted); }
.bot .btn { margin-top: var(--space-md); }
.bot .btn--quiet { --frame-color: var(--color-field-ink); background: var(--color-field); color: var(--color-field-ink); }
.bot .btn--quiet:hover { background: var(--color-field-2); }
.feed { --pixel: 8px; --frame-color: var(--color-field-2); display: grid; gap: var(--space-md); width: min(100%, 30rem); padding: var(--space-lg); background: var(--color-field-2); text-align: left; }
.feed__channel { padding-bottom: var(--space-sm); border-bottom: var(--rule-hair) solid var(--color-field-3); font-weight: 700; color: var(--color-field-muted); }
.msg { display: flex; align-items: start; gap: var(--space-sm); }
.msg p { line-height: 1.9; }
.msg__head span, .msg__more { font-size: var(--text-sm); color: var(--color-field-muted); }
.msg__head span { margin-left: var(--space-2xs); }
.msg .person { display: inline-flex; vertical-align: middle; margin-inline: var(--space-2xs); padding: var(--space-3xs) var(--space-xs) var(--space-3xs) var(--space-3xs); line-height: 1.4; }
.msg .person:not(.current) { --frame-color: var(--color-field-3); background: var(--color-field-3); }
.msg .av--sm { margin: 0; vertical-align: 0; }
/* The other names stack over Carla, so the sentence keeps her width; only the lit one, then Carla, shows. */
.roller { position: relative; display: inline-flex; vertical-align: middle; }
.roller > .person:not(.current) { position: absolute; top: 0; left: 0; z-index: var(--z-base); white-space: nowrap; }
.roller > .person:not(.current), .roller.is-rolling > .person.current:not(.is-lit) { visibility: hidden; }
.roller.is-rolling > .person.is-lit { visibility: visible; --frame-color: var(--color-accent); background: var(--color-accent); color: var(--color-accent-ink); }
@media (min-width: 60rem) {
  .home .bot { grid-column: 1 / -1; }
  .bot h2 { font-size: var(--text-display); }
  .home { grid-template-columns: minmax(0, 6fr) minmax(0, 6fr); grid-template-rows: repeat(3, auto) 1fr; column-gap: var(--space-3xl); }
  .home > * { grid-column: 1; }
  .home .showcase { grid-column: 2; grid-row: 1 / -1; align-self: center; margin-top: 0; }
  .home h1 { font-size: var(--text-display); }
}

/* API docs: the whole page is the stage, so the docs read like a terminal screen. Amber marks the person whose turn it is, here too. */
body.dark { --color-focus: var(--color-focus-field); background: var(--color-field); color: var(--color-field-ink); }
html:has(body.dark) { scrollbar-color: var(--color-field-muted) var(--color-field); }
.dark :is(.brand, .topbar__link, h1, h2) { color: var(--color-field-ink); }
.dark :is(.brand, .topbar__link):hover { color: var(--color-field-muted); }
.dark .footer { color: var(--color-field-muted); }
.dark .footer p { border-color: var(--color-field-2); }
.dark ::selection { color: var(--color-field-ink); }
.doc { display: grid; gap: var(--space-3xl); }
.doc__hero, .doc__intro { display: grid; justify-items: center; text-align: center; }
.doc__hero { gap: var(--space-lg); padding-bottom: var(--space-xl); }
.doc__intro { gap: var(--space-md); }
.doc__intro p { max-width: 52ch; font-size: var(--text-lead); color: var(--color-field-muted); }
.doc h1 { font-size: var(--text-display); }
.doc h2 { font-size: var(--text-3xl); }
.av.av--xl { width: 96px; height: 96px; }
.doc code { font: 0.9em var(--font-mono); }
.doc p code { white-space: nowrap; color: var(--color-field-ink); }
.endpoint { display: grid; gap: var(--space-lg); align-items: start; padding-top: var(--space-2xl); border-top: 2px dashed var(--color-field-2); }
.endpoint__text { display: grid; gap: var(--space-sm); }
.endpoint__text p:not(.route) { color: var(--color-field-muted); }
.route { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-sm); }
.route code { font-size: var(--text-md); overflow-wrap: anywhere; }
.method { --pixel: 2px; --frame-color: var(--color-field-ink); padding: 0 var(--space-xs); background: var(--color-field-ink); color: var(--color-field); font: 700 var(--text-sm)/1.6 var(--font-mono); }
.term { --pixel: 6px; --frame-color: var(--color-field-well); min-width: 0; background: var(--color-field-well); color: var(--color-field-ink); font-size: var(--text-sm); }
.term pre { margin: 0; padding: var(--space-md) var(--space-lg); white-space: pre-wrap; overflow-wrap: break-word; line-height: 1.7; }
.term pre code { font-size: inherit; }
/* Generated content stays out of a copied command. */
.term .cmd::before { content: "$ "; color: var(--color-field-muted); }
.term pre + .term__out { border-top: 2px solid var(--color-field); }
.term__out { color: var(--color-field-muted); }
.term mark { background: none; color: var(--color-accent); }
@media (max-width: 40rem) { .av.av--xl { width: 72px; height: 72px; } .doc h1 { font-size: var(--text-display-s); } }
@media (min-width: 60rem) {
  .endpoint { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); column-gap: var(--space-2xl); }
  .av.av--xl { width: 144px; height: 144px; }
}

/* New list */
.create, .side { --pixel: 8px; --frame-color: var(--color-paper-2); }
.submit { display: grid; justify-items: start; gap: var(--space-sm); }
.create { display: grid; gap: var(--space-lg); max-width: 40rem; margin-inline: auto; padding: var(--space-xl); background: var(--color-paper-2); }

/* List */
.list-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: var(--space-lg); margin-bottom: var(--space-xl); }
.list-head p { margin-top: var(--space-xs); color: var(--color-muted); }
.saved { color: var(--color-success); }
.link { display: flex; align-items: center; gap: var(--space-sm); width: min(100%, 30rem); }
.link input { flex: 1; min-width: 0; min-height: calc(44px + 6px); font-size: var(--text-sm); color: var(--color-ink-2); }
html:not(.js) :is([data-copy], [data-delete]) { display: none; }
.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-2xl); align-items: start; }
@media (min-width: 60rem) { .panel { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); } }
.side { padding: var(--space-xl); background: var(--color-paper-2); }

/* The stage */
.stage {
  --pixel: 8px; --frame-color: var(--color-field);
  --color-focus: var(--color-focus-field);
  display: grid; gap: var(--space-xl); padding: var(--space-xl);
  background: var(--color-field); color: var(--color-field-ink);
}
/* On a phone the stage's 40px padding takes room the two quiet buttons need side by side. */
@media (max-width: 40rem) { .stage, .side { padding: var(--space-lg); } }
.stage h2 { font: 400 var(--text-md)/1.4 var(--font-body); color: var(--color-field-muted); }
.stage p { color: var(--color-field-muted); }
.result { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--space-lg); min-height: 96px; }
.result strong { display: block; min-width: 0; letter-spacing: normal; overflow-wrap: break-word; hyphens: auto; font: 400 var(--text-4xl)/1.05 var(--font-display); font-size-adjust: var(--adjust-display); color: var(--color-field-ink); }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: var(--space-sm); margin: 0; padding: 0; list-style: none; }
.person {
  --pixel: 2px; --frame-color: var(--color-field-2);
  display: flex; align-items: center; gap: var(--space-xs); min-width: 0; padding: var(--space-xs) var(--space-sm) var(--space-xs) var(--space-xs);
  background: var(--color-field-2); color: var(--color-field-ink); font-weight: 700;
}
/* Names longer than the chip break between syllables (pt-BR from <html lang>), not at any letter. */
.person span { min-width: 0; overflow-wrap: break-word; hyphens: auto; line-height: 1.25; }
.person small { display: block; font-size: var(--text-sm); }
.person.done { --frame-color: var(--color-field); background: var(--color-field); color: var(--color-field-muted); font-weight: 400; }
.person.done .av { opacity: 0.45; }
.person.current, .person.is-lit { --frame-color: var(--color-accent); background: var(--color-accent); color: var(--color-accent-ink); }
.is-rolling .person.current:not(.is-lit) { --frame-color: var(--color-field-2); background: var(--color-field-2); color: var(--color-field-ink); }

.controls { display: grid; gap: var(--space-md); }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md) var(--space-lg); }
.actions__more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-md) var(--space-sm); }
.stage .btn--quiet { --frame-color: var(--color-field-ink); background: var(--color-field); color: var(--color-field-ink); }
.stage .btn--quiet:hover { background: var(--color-field-2); }
/* "Pular <name>" carries a name of up to 60 characters. */
.stage .btn--quiet { max-width: 100%; padding: var(--space-xs) var(--space-md); line-height: 1.2; white-space: normal; overflow-wrap: anywhere; }
.status { font-size: var(--text-sm); }
/* While the draw rolls, nothing may reveal the result early: the status, the skip and redraw buttons and the new history row wait. */
.js .is-rolling .status, .js .is-rolling .actions__more, .js body:has(.is-rolling) #history tbody tr:first-child { visibility: hidden; }
/* The first draw: a table with one hidden row is only a header and empty rules. */
.js body:has(.is-rolling) #history table:has(tbody tr:only-child) { visibility: hidden; }
@media (prefers-reduced-motion: no-preference) { .is-last .person.current { animation: last-blink 150ms steps(1) 5; } }
@keyframes last-blink { 50% { --frame-color: var(--color-field-2); background: var(--color-field-2); color: var(--color-field-ink); } }
/* On the stage a button is disabled only while the draw rolls: it means "busy", not "unavailable". */
.stage .btn:disabled { cursor: progress; }
.stage .btn--primary:disabled { background: var(--color-accent); color: var(--color-accent-ink); }

/* Characters */
/* Sizes are multiples of 12, the character grid, so each pixel lands whole on the screen. */
.av { flex-shrink: 0; width: 36px; height: 36px; }
.av--lg { width: 96px; height: 96px; }
/* On a phone the 96px character leaves the name a column too narrow for one word at 40px. */
@media (max-width: 40rem) {
  .result { gap: var(--space-md); }
  .result .av--lg { width: 64px; height: 64px; }
  .result strong { font-size: var(--text-3xl); }
}
.av--sm { display: inline-block; width: 24px; height: 24px; margin-right: var(--space-xs); vertical-align: -6px; }
.av .b { fill: var(--av); }
.av .k { fill: var(--color-ink); }
.av .c { fill: var(--color-blush); }
.av .w { fill: var(--color-paper); }
.h0 { --av: var(--color-avatar-0); } .h1 { --av: var(--color-avatar-1); } .h2 { --av: var(--color-avatar-2); }
.h3 { --av: var(--color-avatar-3); } .h4 { --av: var(--color-avatar-4); } .h5 { --av: var(--color-avatar-5); }

/* History and edit */
.history table { width: 100%; margin-top: var(--space-md); border-collapse: collapse; }
.history th, .history td { padding: var(--space-xs) var(--space-sm) var(--space-xs) 0; border-bottom: var(--rule-hair) solid var(--color-rule); text-align: left; }
.history th { font-size: var(--text-sm); font-weight: 400; color: var(--color-muted); }
.history .num { text-align: right; white-space: nowrap; }
.history td:first-child { overflow-wrap: break-word; hyphens: auto; }
.history :is(th, td):last-child { padding-right: 0; }
.text-btn { min-height: 32px; padding: 0; border: 0; background: none; color: var(--color-ink); font-weight: 700; text-decoration: underline; text-underline-offset: 0.16em; cursor: pointer; }
.text-btn:hover { color: var(--color-ink-2); }
.text-btn--danger, .text-btn--danger:hover { color: var(--color-error); }
.empty { margin-top: var(--space-md); color: var(--color-muted); }
.edit { margin-top: var(--space-xl); padding-top: var(--space-md); border-top: var(--rule-hair) solid var(--color-rule); }
.edit summary { padding-block: var(--space-sm); font-weight: 700; cursor: pointer; }
.edit summary:hover { color: var(--color-ink-2); }
.edit form { display: grid; gap: var(--space-lg); margin-top: var(--space-md); }
.edit [data-delete] { margin-top: var(--space-xl); }

.not-found p { margin-top: var(--space-lg); }
.not-found .recent { margin-top: var(--space-2xl); }

@media (max-width: 40rem) {
  .stage, .create, .side { padding: var(--space-lg); }
}

