/* STEP/REPEAT. A phototypesetting proof sheet: bromide paper, film-black ink, one blueline
   blue for whatever is live. No radius, no shadow; structure is rules, margins and marks. */

:root {
  --paper: #efece4;
  --ink: #121211;
  --grey: #67645c; /* 5.1:1 on paper */
  --rule: rgba(18, 18, 17, 0.16);
  --blue: #2340ff; /* blueline proof ink, 6.0:1 on paper */
  --console-w: 312px;
  --head-h: 52px;
  --gutter: 22px;
  --drawer: cubic-bezier(0.32, 0.72, 0, 1);

  font-family: Archivo, 'Helvetica Neue', Helvetica, Arial, sans-serif;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--paper);
  accent-color: var(--blue);
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--paper);
}

::selection {
  color: var(--paper);
  background: var(--blue);
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

a {
  color: inherit;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--blue);
}

svg {
  display: block;
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ------------------------------------------------------------------ sheet */

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 0px;
  grid-template-rows: var(--head-h) minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  transition: grid-template-columns 260ms var(--drawer);
}

.sheet.console-open {
  grid-template-columns: minmax(0, 1fr) var(--console-w);
}

/* The machine's voice: expanded caps for labels, set small and tracked. */
.slug-label,
.act,
.group h2,
.seg button,
.field-name,
.num span,
.history button,
.vary,
.preset span,
.proof-no,
.readout,
.zoom button,
.keys,
.play {
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ head */

.head {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--ink);
}

.mark {
  display: flex;
  align-items: baseline;
  gap: 16px;
  flex: none;
}

.wordmark {
  font-size: 17px;
  font-weight: 850;
  font-stretch: 125%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}

.wordmark span {
  color: var(--blue);
}

.wordmark:hover {
  color: inherit;
}

.proof-no {
  color: var(--grey);
  white-space: nowrap;
}

.actions {
  display: flex;
  flex: none;
  margin-left: auto;
  border-left: 1px solid var(--rule);
}

.act {
  position: relative;
  height: var(--head-h);
  padding: 0 14px;
  background: none;
  border: 0;
  border-right: 1px solid var(--rule);
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease;
}

.act:last-child {
  border-right: 0;
}

.act::after {
  content: attr(data-key);
  margin-left: 8px;
  color: var(--grey);
  font-weight: 500;
}

.act:hover {
  color: var(--blue);
}

.act:active {
  transform: translateY(1px);
}

.act[aria-pressed='true'],
.act[aria-expanded='true'] {
  color: var(--paper);
  background: var(--ink);
}

.act[aria-pressed='true']::after,
.act[aria-expanded='true']::after {
  color: rgba(239, 236, 228, 0.6);
}

.act:focus-visible {
  outline-offset: -4px;
}

/* The Export menu hangs from the head rule: a paper sheet framed in ink, one rule per item. */
.menu-wrap {
  position: relative;
  display: flex;
}

.act-menu {
  display: flex;
  align-items: center;
  gap: 6px;
}

.act-menu::after {
  content: none;
}

.act-menu svg {
  width: 12px;
  height: 12px;
  fill: none;
}

.menu {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 10;
  width: 300px;
  background: var(--paper);
  border: 1px solid var(--ink);
}

.menu[hidden] {
  display: none;
}

.menu button {
  display: grid;
  gap: 3px;
  width: 100%;
  padding: 11px 14px 12px;
  text-align: left;
  background: none;
  border: 0;
  transition: color 120ms ease;
}

.menu button + button {
  border-top: 1px solid var(--rule);
}

.menu-name {
  display: flex;
  justify-content: space-between;
}

.menu-name,
.dialog-head h2,
.steps h3,
.do,
.dialog-close,
.preview-tag {
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.menu-name kbd {
  font: inherit;
  font-weight: 500;
  color: var(--grey);
}

.menu-note {
  font-size: 12px;
  line-height: 1.35;
  color: var(--grey);
}

.menu button:hover,
.menu button:focus-visible {
  color: var(--blue);
}

.menu button:focus-visible {
  outline-offset: -4px;
}

/* Export dialogs: a sheet laid over the bench under a paper veil, framed in ink, no lift. */
.sheet-dialog {
  width: min(560px, calc(100vw - 2 * var(--gutter)));
  max-height: calc(100dvh - 2 * var(--gutter));
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--ink);
  border-radius: 0;
}

.sheet-dialog::backdrop {
  background: rgba(239, 236, 228, 0.86);
}

.sheet-dialog[open] {
  display: flex;
  flex-direction: column;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  height: var(--head-h);
  padding-left: 20px;
  border-bottom: 1px solid var(--ink);
}

.dialog-head h2 {
  margin: 0;
}

.dialog-close {
  align-self: stretch;
  padding: 0 16px;
  background: none;
  border: 0;
  border-left: 1px solid var(--rule);
}

.dialog-close:hover:not(:disabled) {
  color: var(--blue);
}

.dialog-close:disabled {
  color: var(--grey);
  opacity: 0.5;
  cursor: default;
}

.dialog-close:focus-visible {
  outline-offset: -4px;
}

.dialog-body {
  padding: 18px 20px 22px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.lead {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}

.warn {
  margin: 12px 0 0;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid var(--ink);
}

.steps {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}

.steps li {
  position: relative;
  padding: 14px 0 16px 30px;
  border-top: 1px solid var(--rule);
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  top: 12px;
  left: 0;
  font-size: 18px;
  font-weight: 700;
  font-stretch: 100%;
}

.steps h3 {
  margin: 0 0 6px;
}

.steps p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--grey);
}

.steps b {
  font-weight: 600;
  color: var(--ink);
}

.steps .seg {
  margin-top: 10px;
}

.do {
  display: block;
  width: 100%;
  height: 34px;
  margin-top: 10px;
  background: none;
  border: 1px solid var(--ink);
  transition: color 120ms ease, background-color 120ms ease;
}

.do:hover:not(:disabled) {
  color: var(--paper);
  background: var(--ink);
}

.do:active:not(:disabled) {
  transform: scale(0.97);
}

.do:disabled {
  color: var(--grey);
  border-color: var(--rule);
  cursor: default;
}

.do-main {
  height: 40px;
  margin-top: 14px;
  color: var(--paper);
  background: var(--ink);
}

.do-main:hover:not(:disabled) {
  background: var(--blue);
}

.do-main:disabled {
  color: var(--grey);
  background: none;
}

.sizes {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--grey);
}

.sizes.is-error {
  color: #b3261e;
}

.code {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 10px 12px;
  font-family: ui-monospace, 'Cascadia Mono', Consolas, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  white-space: pre;
  color: var(--ink);
  background: rgba(18, 18, 17, 0.05);
  border: 1px solid var(--rule);
  border-radius: 0;
  resize: vertical;
}

.code:focus-visible {
  outline: 0;
  border-color: var(--blue);
}

.text-link {
  padding: 0;
  color: var(--ink);
  font-size: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  background: none;
  border: 0;
}

.text-link:hover {
  color: var(--blue);
}

.preview {
  position: relative;
  margin-top: 16px;
  aspect-ratio: 16 / 9;
  outline: 1px solid var(--ink);
}

.preview canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-tag {
  position: absolute;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  color: var(--paper);
  background: var(--ink);
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.choice .slug-label {
  margin-bottom: 6px;
}

.meter {
  height: 2px;
  margin-top: 8px;
  background: var(--rule);
}

.meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--blue);
}

/* ------------------------------------------------------------------ the proof */

.art {
  position: relative;
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  padding: var(--gutter);
}

.trim {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--paper);
  transition: background-color 160ms ease;
}

.is-negative .trim {
  background: var(--ink);
}

.trim canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
}

.is-panning .trim canvas {
  cursor: grabbing;
}

.is-shifting .trim canvas {
  cursor: crosshair;
}

/* Crop marks: hairlines in the gutter that stop short of the trim, as on a printed proof. */
.crop {
  position: absolute;
  width: 14px;
  height: 14px;
  pointer-events: none;
}

.crop::before,
.crop::after {
  content: '';
  position: absolute;
  background: var(--ink);
}

.crop::before {
  width: 14px;
  height: 1px;
}

.crop::after {
  width: 1px;
  height: 14px;
}

.crop.tl {
  top: 4px;
  left: 4px;
}
.crop.tl::before {
  top: calc(var(--gutter) - 4px);
  left: 0;
}
.crop.tl::after {
  left: calc(var(--gutter) - 4px);
  top: 0;
}

.crop.tr {
  top: 4px;
  right: 4px;
}
.crop.tr::before {
  top: calc(var(--gutter) - 4px);
  right: 0;
}
.crop.tr::after {
  right: calc(var(--gutter) - 4px);
  top: 0;
}

.crop.bl {
  bottom: 4px;
  left: 4px;
}
.crop.bl::before {
  bottom: calc(var(--gutter) - 4px);
  left: 0;
}
.crop.bl::after {
  left: calc(var(--gutter) - 4px);
  bottom: 0;
}

.crop.br {
  bottom: 4px;
  right: 4px;
}
.crop.br::before {
  bottom: calc(var(--gutter) - 4px);
  right: 0;
}
.crop.br::after {
  right: calc(var(--gutter) - 4px);
  bottom: 0;
}

.is-shifting .crop::before,
.is-shifting .crop::after {
  background: var(--blue);
}

/* Registration targets in blueline ink at the gutter's mid-edges, and the readout printed
   along the foot of the trim. */
.reg {
  position: absolute;
  width: 14px;
  height: 14px;
  color: var(--blue);
  fill: none;
  pointer-events: none;
}

.reg-t {
  top: 4px;
  left: calc(50% - 7px);
}

.reg-l {
  left: 4px;
  top: calc(50% - 7px);
}

.reg-r {
  right: 4px;
  top: calc(50% - 7px);
}

.readout {
  position: absolute;
  left: calc(var(--gutter) + 8px);
  right: calc(var(--gutter) + 8px);
  bottom: 0;
  height: var(--gutter);
  margin: 0;
  overflow: hidden;
  color: var(--grey);
  line-height: var(--gutter);
  white-space: pre;
  text-overflow: ellipsis;
  pointer-events: none;
}

.is-shifting .readout {
  color: var(--blue);
}

.is-presenting .reg,
.is-presenting .readout {
  display: none;
}

/* The traced window. */
.trace {
  position: absolute;
  top: 0;
  left: 0;
  border: 1px solid var(--blue);
  pointer-events: none;
  opacity: 0;
}

.trace.is-on {
  opacity: 1;
}

.trace::after {
  content: attr(data-label);
  position: absolute;
  top: -1px;
  left: calc(100% + 0px);
  padding: 3px 5px;
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.06em;
  color: var(--paper);
  white-space: nowrap;
  background: var(--blue);
}

.drop {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 2px dashed var(--blue);
  background: rgba(239, 236, 228, 0.86);
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease;
}

.drop span {
  padding: 8px 12px;
  color: var(--paper);
  background: var(--blue);
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.is-dropping .drop {
  opacity: 1;
}

.present-hint {
  position: absolute;
  left: 50%;
  bottom: 24px;
  margin: 0;
  padding: 7px 10px;
  color: var(--paper);
  background: var(--ink);
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
}

/* ------------------------------------------------------------------ slug */

.slug {
  grid-column: 1;
  grid-row: 3;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  align-items: end;
  gap: 28px;
  min-width: 0;
  padding: 14px var(--gutter) 16px;
  border-top: 1px solid var(--ink);
}

.slug-label {
  display: block;
  margin-bottom: 8px;
  color: var(--grey);
}

.set {
  min-width: 0;
}

.set-line {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}

.to-text {
  flex: none;
  height: 30px;
  margin-bottom: 4px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: none;
  border: 1px solid var(--ink);
}

.to-text:hover {
  color: var(--paper);
  background: var(--ink);
}

#text {
  display: block;
  width: 100%;
  min-height: 40px;
  max-height: 96px;
  margin: 0;
  padding: 2px 0 4px;
  font-size: 30px;
  font-weight: 850;
  line-height: 1.12;
  letter-spacing: -0.01em;
  caret-color: var(--blue);
  background: none;
  border: 0;
  border-bottom: 1px solid var(--ink);
  border-radius: 0;
  resize: none;
  overflow-y: hidden;
}

#text:hover {
  border-bottom-color: var(--blue);
}

#text:focus-visible {
  outline: 0;
  border-bottom: 2px solid var(--blue);
  padding-bottom: 3px;
}

#text:disabled {
  color: var(--grey);
  font-size: 20px;
  border-bottom-style: dotted;
}

.presets {
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: end;
}

.presets .slug-label {
  grid-column: 1 / -1;
}

.preset-row {
  display: flex;
  gap: 6px;
}

.preset {
  position: relative;
  display: grid;
  gap: 5px;
  width: 92px;
  padding: 0;
  text-align: left;
  background: none;
  border: 0;
}

.preset canvas {
  display: block;
  width: 92px;
  height: 56px;
  outline: 1px solid var(--rule);
  outline-offset: 0;
  transition: outline-color 120ms ease;
}

.preset span {
  display: flex;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  color: var(--grey);
  transition: color 120ms ease;
}

.preset span b {
  font-weight: 600;
  color: var(--ink);
}

.preset:hover canvas {
  outline-color: var(--ink);
}

.preset:hover span {
  color: var(--ink);
}

.preset[aria-pressed='true'] canvas {
  outline: 2px solid var(--blue);
}

.preset[aria-pressed='true'] span,
.preset[aria-pressed='true'] span b {
  color: var(--blue);
}

.preset:focus-visible {
  outline-offset: 4px;
}

.vary {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 6px;
  width: 64px;
  height: 56px;
  margin-bottom: 18px;
  padding: 0;
  background: var(--ink);
  color: var(--paper);
  border: 0;
  transition: background-color 120ms ease;
}

.vary svg {
  width: 18px;
  height: 18px;
}

.vary:hover {
  background: var(--blue);
}

.vary:active {
  transform: scale(0.97);
}

.machine {
  display: grid;
  justify-items: end;
  gap: 10px;
  min-width: 0;
}

.status {
  max-width: 100%;
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--grey);
  text-align: right;
  overflow-wrap: anywhere;
}

.status.is-error {
  color: #b3261e;
}

.zoom {
  display: flex;
  border: 1px solid var(--ink);
}

.zoom button {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 30px;
  padding: 0 8px;
  background: none;
  border: 0;
}

.zoom button + button {
  border-left: 1px solid var(--ink);
}

#zoom-reset {
  min-width: 62px;
}

.zoom button:hover:not(:disabled) {
  color: var(--paper);
  background: var(--ink);
}

.zoom button:disabled {
  color: var(--grey);
  opacity: 0.55;
  cursor: default;
}

.zoom button:focus-visible {
  outline-offset: -4px;
}

/* Registration shift: when something is struck, a blue impression lands a few points off
   and snaps into register. It runs once, in two hard steps, like a press. */
.is-struck {
  animation: strike 180ms steps(2, jump-none) 1;
}

@keyframes strike {
  0% {
    transform: translate(3px, -2px);
    filter: drop-shadow(-3px 2px 0 var(--blue));
  }
  100% {
    transform: none;
    filter: none;
  }
}

/* ------------------------------------------------------------------ console */

.console {
  grid-column: 2;
  grid-row: 2 / 4;
  min-width: 0;
  overflow: hidden;
  border-left: 1px solid var(--ink);
}

.sheet:not(.console-open) .console {
  border-left-width: 0;
}

.console-scroll {
  width: var(--console-w);
  height: 100%;
  padding: 0 20px 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) transparent;
}

.group {
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--rule);
}

.group-last {
  border-bottom: 0;
}

.group h2 {
  margin: 0 0 12px;
  color: var(--ink);
}

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--grey);
}

.seg {
  display: flex;
  border: 1px solid var(--ink);
}

.seg + .seg {
  margin-top: 8px;
}

.seg button {
  flex: 1;
  height: 32px;
  padding: 0 6px;
  background: none;
  border: 0;
  transition: color 120ms ease, background-color 120ms ease;
}

.seg button + button {
  border-left: 1px solid var(--ink);
}

.seg button:hover:not(:disabled):not([aria-pressed='true']) {
  color: var(--blue);
}

.seg button[aria-pressed='true'] {
  color: var(--paper);
  background: var(--ink);
}

.seg button:disabled {
  color: var(--grey);
  cursor: default;
}

.seg button:focus-visible {
  outline-offset: -4px;
}

.seg.is-off {
  border-color: var(--rule);
}

.seg.is-off button + button {
  border-left-color: var(--rule);
}

.seg.is-off button[aria-pressed='true'] {
  color: var(--grey);
  background: rgba(18, 18, 17, 0.08);
}

/* Each face button speaks in its own face. */
.seg .face-grotesk {
  font-weight: 900;
  font-stretch: 100%;
  letter-spacing: 0.02em;
}

.seg .face-narrow {
  font-family: 'Archivo Narrow', Archivo, sans-serif;
  font-weight: 700;
  font-stretch: 100%;
  font-size: 12px;
}

.seg .face-didone {
  font-family: 'Bodoni Moda', Didot, Georgia, serif;
  font-weight: 900;
  font-stretch: 100%;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* Grid shift pad: X runs across, Y runs down, exactly as the windows move. */
.grid-shift {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.pad {
  --x: 50%;
  --y: 50%;
  position: relative;
  width: 128px;
  height: 128px;
  border: 1px solid var(--ink);
  background-image: linear-gradient(var(--rule) 1px, transparent 1px), linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 16px 16px;
  background-position: -1px -1px;
  cursor: crosshair;
  touch-action: none;
}

.pad-h,
.pad-v {
  position: absolute;
  background: var(--ink);
  pointer-events: none;
}

.pad-h {
  left: 0;
  right: 0;
  top: var(--y);
  height: 1px;
}

.pad-v {
  top: 0;
  bottom: 0;
  left: var(--x);
  width: 1px;
}

.pad-dot {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: 9px;
  height: 9px;
  background: var(--ink);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.pad.is-live .pad-h,
.pad.is-live .pad-v,
.pad.is-live .pad-dot,
.pad:hover .pad-dot {
  background: var(--blue);
}

.pad-values {
  display: grid;
  gap: 8px;
}

.pad-values .hint {
  margin: 4px 0 0;
}

.num {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--rule);
}

.num span {
  color: var(--grey);
}

/* Number fields read as printed figures until touched. */
input[type='number'] {
  width: 58px;
  padding: 2px 0;
  font-size: 18px;
  font-weight: 700;
  font-stretch: 100%;
  text-align: right;
  background: none;
  border: 0;
  border-radius: 0;
  -moz-appearance: textfield;
  appearance: textfield;
}

input[type='number']::-webkit-inner-spin-button,
input[type='number']::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

input[type='number']:hover {
  color: var(--blue);
}

input[type='number']:focus-visible {
  outline: 0;
  color: var(--blue);
  box-shadow: 0 1px 0 var(--blue);
}

/* Fields */
.field + .field {
  margin-top: 12px;
}

.field-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.field-name {
  color: var(--grey);
  cursor: default;
  user-select: none;
  transition: color 120ms ease;
}

.field.is-set .field-name {
  color: var(--ink);
}

.field .field-num {
  font-size: 15px;
}

.field.is-set .field-num {
  color: var(--blue);
}

/* Sliders: a hairline track with a ticked scale, a solid run up to the value, and a
   slim square thumb like a typesetter's set-width pointer. */
input[type='range'] {
  --at: 0%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 22px;
  margin: 2px 0 0;
  padding: 0;
  background:
    linear-gradient(var(--ink), var(--ink)) 0 50% / var(--at) 2px no-repeat,
    linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 10%) 0 70% / 100% 5px no-repeat;
  cursor: pointer;
}

.field-signed input[type='range'] {
  background:
    linear-gradient(var(--ink), var(--ink)) 50% 50% / 1px 9px no-repeat,
    linear-gradient(var(--rule), var(--rule)) 0 50% / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 1px, transparent 1px 10%) 0 70% / 100% 5px no-repeat;
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 7px;
  height: 18px;
  background: var(--ink);
  border: 0;
  border-radius: 0;
}

input[type='range']::-moz-range-thumb {
  width: 7px;
  height: 18px;
  background: var(--ink);
  border: 0;
  border-radius: 0;
}

input[type='range']:hover::-webkit-slider-thumb,
input[type='range']:active::-webkit-slider-thumb,
input[type='range']:focus-visible::-webkit-slider-thumb {
  background: var(--blue);
}

input[type='range']:hover::-moz-range-thumb,
input[type='range']:active::-moz-range-thumb,
input[type='range']:focus-visible::-moz-range-thumb {
  background: var(--blue);
}

input[type='range']:focus-visible {
  outline-offset: 3px;
}

.play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  margin-top: 14px;
  background: none;
  border: 1px solid var(--ink);
  transition: color 120ms ease, background-color 120ms ease;
}

.play svg {
  width: 12px;
  height: 12px;
}

.play .i-pause,
.play[aria-pressed='true'] .i-play {
  display: none;
}

.play[aria-pressed='true'] .i-pause {
  display: block;
}

.play:hover {
  color: var(--blue);
}

.play[aria-pressed='true'] {
  color: var(--paper);
  background: var(--blue);
  border-color: var(--blue);
}

.play:active,
.seg button:active,
.history button:active {
  transform: scale(0.97);
}

.history {
  display: flex;
  border: 1px solid var(--ink);
}

.history button {
  flex: 1;
  height: 32px;
  background: none;
  border: 0;
}

.history button + button {
  border-left: 1px solid var(--ink);
}

.history button:hover:not(:disabled) {
  color: var(--blue);
}

.history button:disabled {
  color: var(--grey);
  opacity: 0.5;
  cursor: default;
}

.history button:focus-visible {
  outline-offset: -4px;
}

.keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 16px;
  margin: 16px 0 0;
  color: var(--grey);
}

.keys div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.keys dt {
  color: var(--ink);
}

.keys dd {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.04em;
}

#present-alt {
  margin-top: 8px;
}

/* Film and Present already sit in the head on wide screens; the console repeats them only on phones. */
.phone-only {
  display: none;
}

#motion-fields {
  margin-top: 14px;
}

#motion-fields[hidden],
.seg[hidden] {
  display: none;
}

.more {
  margin-top: 16px;
}

.more summary {
  width: fit-content;
  font-size: 11px;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--grey);
  cursor: pointer;
  list-style: none;
  transition: color 120ms ease;
}

.more summary::-webkit-details-marker {
  display: none;
}

.more summary::after {
  content: ' +';
}

.more[open] summary::after {
  content: ' −';
}

.more summary:hover {
  color: var(--blue);
}

.more .keys {
  margin-top: 12px;
}

/* Only the phone sheet needs its own close; on wide screens the head button sits beside it. */
.console-close {
  display: none;
}

/* ------------------------------------------------------------------ presenting */

.head,
.slug,
.console {
  transition: opacity 180ms ease;
}

.sheet.is-presenting {
  grid-template-columns: minmax(0, 1fr) 0px;
  grid-template-rows: 0px minmax(0, 1fr) 0px;
  transition: none;
}

.is-presenting .head,
.is-presenting .slug,
.is-presenting .console {
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  border: 0;
  padding-top: 0;
  padding-bottom: 0;
}

.is-presenting .art {
  padding: 0;
}

.is-presenting .crop {
  display: none;
}

.is-presenting .trim canvas {
  cursor: default;
}

.is-presenting.is-idle .trim canvas {
  cursor: none;
}

.show-hint .present-hint {
  opacity: 1;
}

/* ------------------------------------------------------------------ medium widths */

@media (max-width: 1100px) {
  .act::after {
    display: none;
  }

  .slug {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .machine {
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .status {
    text-align: left;
  }
}

/* ------------------------------------------------------------------ phones */

@media (max-width: 760px) {
  :root {
    --head-h: 48px;
    --gutter: 14px;
  }

  .sheet,
  .sheet.console-open {
    grid-template-columns: minmax(0, 1fr);
  }

  .head {
    gap: 12px;
    padding-right: 0;
  }

  .proof-no,
  .act .long {
    display: none;
  }

  .wordmark {
    font-size: 14px;
  }

  .act {
    padding: 0 11px;
  }

  .console-close {
    display: block;
    width: 100%;
    height: 40px;
    margin: 12px 0 0;
    font-size: 11px;
    font-weight: 600;
    font-stretch: 112%;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    background: var(--ink);
    color: var(--paper);
    border: 0;
  }

  #negative,
  #present {
    display: none;
  }

  .slug {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding: 12px var(--gutter) 14px;
  }

  #text {
    font-size: 24px;
    min-height: 34px;
  }

  .presets {
    grid-template-columns: minmax(0, 1fr);
  }

  .preset-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .preset {
    width: auto;
  }

  .preset canvas {
    width: 100%;
    height: 44px;
  }

  /* No number keys on a phone: the names stand alone, set at normal width so they fit. */
  .preset span {
    font-stretch: 100%;
    letter-spacing: 0.02em;
  }

  .preset span b {
    display: none;
  }

  .vary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 40px;
    margin: 10px 0 0;
  }

  .machine {
    grid-column: auto;
  }



  /* The console becomes a sheet that rises over the slug. */
  .console {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    max-height: 62dvh;
    background: var(--paper);
    border-left: 0;
    border-top: 1px solid var(--ink);
    transform: translateY(100%);
    visibility: hidden;
    transition: transform 280ms var(--drawer), visibility 0s linear 280ms;
  }

  .console-open .console {
    transform: none;
    visibility: visible;
    transition: transform 280ms var(--drawer), visibility 0s;
  }

  .console-scroll {
    width: 100%;
    max-height: 62dvh;
  }

  .more {
    display: none;
  }

  .phone-only {
    display: flex;
  }

  .menu {
    position: fixed;
    top: var(--head-h);
    right: 0;
    left: 0;
    width: auto;
    border-width: 0 0 1px;
  }

  .choices {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sheet,
  .console,
  .console-open .console {
    transition: none;
  }

  .is-struck {
    animation: none;
  }
}
