/* ART BY CLAUDE
   One surface, hard edges. The plate is dark and the machine marks it with
   light, so tone on the page is carried by brightness alone. There is exactly
   one hue, taken off the logo, and it is reserved for the machine itself: the
   wordmark, the pulse, the point and its coordinate, the row of the plan being
   worked, the head on the timeline. Nothing the machine has drawn is ever that
   colour, so the thing working never blurs into the thing being made. Nothing
   is rounded, nothing glows, nothing fades. */

@font-face {
  font-family: 'Geist';
  src: url('fonts/geist-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  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: 'Geist';
  src: url('fonts/geist-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('fonts/geistmono-latin.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  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: 'Geist Mono';
  src: url('fonts/geistmono-latin-ext.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113,
    U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --void:     #08090A;
  --sheet:    #0B0C0E;
  --panel:    #0A0B0D;
  --line:     #191A1E;
  --line-2:   #26282D;
  --ink:      #B9BFC7;
  --ink-hard: #FFFFFF;
  --scrub:    #EDEFF2;
  --edge:     #3B3F46;
  --text:     #E7E9EC;
  --dim:      #82868E;
  --faint:    #4E525A;

  /* Taken off the logo. It is the machine, never the work: the wordmark, the
     pulse, the point on the plate, the row the plan is on, the head on the
     timeline. Used anywhere else it stops meaning anything. */
  --brand:    #FC471D;
  --brand-ink:#1A0A06;
  --brand-15: rgba(252, 71, 29, 0.15);
  --brand-30: rgba(252, 71, 29, 0.30);

  --sans: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --t-data: 11px;
  --t-body: 15px;

  --gutter: clamp(14px, 2.4vw, 30px);
  --bar-h: 46px;
  --plan-w: clamp(258px, 25vw, 348px);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
html.is-locked { overflow: hidden; }

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--mono);
  font-size: var(--t-data);
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
:focus-visible { outline: 1px solid var(--brand); outline-offset: 2px; }
h1, h2, h3, p, dl, dd, dt, ol, ul, li, figure, figcaption { margin: 0; padding: 0; }
ol, ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
canvas { display: block; }

.skip {
  position: absolute; left: -9999px; top: 0; z-index: 90;
  background: var(--void); padding: 10px 14px; border: 1px solid var(--line-2);
}
.skip:focus { left: 8px; top: 8px; }

/* ---- the live screen ---------------------------------------------------- */

.shell {
  height: 100svh;
  min-height: 560px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--plan-w);
  grid-template-rows: var(--bar-h) minmax(0, 1fr) auto;
  grid-template-areas:
    "bar   bar"
    "sheet plan"
    "foot  foot";
  border-bottom: 1px solid var(--line);
}

/* ---- the bar ------------------------------------------------------------ */

.bar {
  grid-area: bar;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}

.bar-mark {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: -0.018em;
  color: var(--brand);
  white-space: nowrap;
}
.bar-logo {
  width: 24px;
  height: 24px;
  object-fit: contain;
  display: block;
}

.bar-subject {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bar-subject.is-titled { color: var(--text); }

.bar-end {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.bar-state {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text); letter-spacing: 0.06em;
}
.bar-state b { font-weight: 400; }
.bar-state .dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand);
  animation: beat 2.4s steps(1) infinite;
}
@keyframes beat { 0%, 55% { opacity: 1; } 56%, 100% { opacity: 0.18; } }

/* ---- the chips: X, contract, ticker ------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 27px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  color: var(--text);
  letter-spacing: 0.06em;
  transition: border-color 80ms linear, color 80ms linear, background-color 80ms linear;
}
.chip b { font-weight: 400; color: var(--faint); }
.chip:hover, .chip:focus-visible { border-color: var(--brand); color: var(--brand); }
.chip:hover b { color: var(--brand-30); }
.chip[disabled] { cursor: default; }
.chip[disabled]:hover { border-color: var(--line-2); color: var(--text); }
.chip[disabled]:hover b { color: var(--faint); }

.chip-icon { width: 27px; padding: 0; justify-content: center; }
.chip-icon svg { width: 13px; height: 13px; fill: currentColor; display: block; }

.chip-ca.is-copied { border-color: var(--brand); color: var(--brand); }
.chip-ca.is-copied span::after { content: ' copied'; color: var(--dim); }

.chip-ticker {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
  font-weight: 500;
}
.chip-ticker:hover { color: var(--brand-ink); border-color: var(--brand); }

/* ---- the plate ---------------------------------------------------------- */

.sheet-wrap {
  grid-area: sheet;
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  padding: var(--gutter);
  border-right: 1px solid var(--line);
}

.sheet {
  position: relative;
  height: 100%;
  width: auto;
  aspect-ratio: 1 / 1;
  max-width: 100%;
  background: var(--sheet);
  border: 1px solid var(--line);
}
.sheet canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.sheet-flag {
  position: absolute;
  left: 0; bottom: -1px;
  padding: 5px 9px;
  background: var(--void);
  border: 1px solid var(--brand);
  color: var(--brand);
  letter-spacing: 0.06em;
}

body.is-catching .sheet { border-color: var(--line-2); }
body.is-turning .sheet-wrap { opacity: 0.25; transition: opacity 700ms linear; }

/* ---- the plan ----------------------------------------------------------- */

.plan-col {
  grid-area: plan;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--panel);
  min-height: 0;
}

.plan-head, .plan-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 0 var(--gutter);
  height: 34px;
  letter-spacing: 0.06em;
  color: var(--faint);
}
.plan-head { border-bottom: 1px solid var(--line); }
.plan-foot { border-top: 1px solid var(--line); }
.plan-head span:first-child {
  font-family: var(--sans);
  font-size: 12px;
  letter-spacing: 0;
  color: var(--text);
}
.plan-count { color: var(--dim); }

.plan-scroll {
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0 40vh;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.plan-scroll::-webkit-scrollbar { width: 8px; }
.plan-scroll::-webkit-scrollbar-thumb { background: var(--line-2); }

.plan-act + .plan-act { margin-top: 18px; }

.plan-act-head {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 8px var(--gutter) 7px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}
.plan-phase {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--text);
  letter-spacing: -0.005em;
}
.plan-note { color: var(--faint); }

.plan-ops { padding-top: 3px; }

.plan-op {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: baseline;
  padding: 3px var(--gutter);
  color: var(--faint);
  border-left: 1px solid transparent;
}
.plan-op.is-seekable { cursor: pointer; }
.plan-op.is-seekable:hover { background: #0F1013; color: var(--dim); }
.plan-op .op-kind { color: inherit; }
.plan-op .op-arg {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  opacity: 0.72;
}
.plan-op .op-at { font-variant-numeric: tabular-nums; opacity: 0.6; }
.plan-op.is-ghost .op-kind::after { content: ' *'; opacity: 0.5; }

.plan-op.is-done { color: var(--dim); }
.plan-op.is-now {
  color: var(--ink-hard);
  background: var(--brand-15);
  border-left-color: var(--brand);
}
.plan-op.is-now .op-arg { opacity: 1; }
.plan-op.is-now .op-at { opacity: 1; color: var(--brand); }

/* ---- the foot ----------------------------------------------------------- */

.foot {
  grid-area: foot;
  border-top: 1px solid var(--line);
  padding: 10px var(--gutter) 12px;
  display: grid;
  gap: 9px;
}

.say {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.say-verb {
  font-family: var(--sans);
  font-size: var(--t-body);
  color: var(--text);
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.say-note {
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.say-note:not(:empty)::before { content: '/ '; }

.data {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 20px;
  letter-spacing: 0.04em;
}
.data .d { display: inline-flex; align-items: center; gap: 7px; }
.data .d-end { margin-left: auto; }
.data .d-end i { color: var(--text); }
.data b { font-weight: 400; color: var(--faint); }
.data i { font-style: normal; color: var(--dim); }
.data i.sig { color: var(--text); }

.meter { display: inline-flex; gap: 2px; }
.meter i { width: 3px; height: 9px; background: var(--line-2); }
.meter i.on { background: var(--brand); }

.keys {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 18px;
  border-top: 1px solid var(--line);
  padding-top: 9px;
}
.keyset { display: flex; flex-wrap: wrap; gap: 4px 16px; }

.key {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--faint);
  letter-spacing: 0.04em;
  transition: color 80ms linear;
}
.key:hover, .key:focus-visible { color: var(--brand); }
.key.is-static { cursor: default; }
.key.is-on { color: var(--brand); }
.key[disabled] { opacity: 0.4; cursor: default; }
.key kbd {
  font: inherit;
  min-width: 16px;
  padding: 1px 4px;
  text-align: center;
  border: 1px solid var(--line-2);
  color: var(--dim);
}
.key:hover kbd { border-color: var(--brand); color: var(--brand); }

/* ---- the timeline ------------------------------------------------------- */

.tl { user-select: none; }

.tl-track {
  position: relative;
  height: 26px;
  cursor: ew-resize;
  touch-action: none;
}
.tl-track::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 16px;
  height: 1px; background: var(--line-2);
}

.tl-past {
  position: absolute; left: 0; top: 16px; height: 1px;
  background: var(--dim);
}

.tl-acts { position: absolute; inset: 0; pointer-events: none; }
.tl-tick { position: absolute; top: 11px; width: 1px; height: 6px; background: var(--line-2); }
.tl-tick b {
  position: absolute; left: 5px; top: -10px;
  font-weight: 400; font-size: 10px; letter-spacing: 0.06em;
  color: var(--faint); white-space: nowrap;
}

.tl-marks { position: absolute; inset: 0; pointer-events: none; }
.tl-mark {
  position: absolute; top: 13px;
  width: 4px; height: 4px; margin-left: -2px;
  background: var(--dim);
}

.tl-head {
  position: absolute; top: 8px; height: 17px; width: 1px;
  background: var(--brand);
  pointer-events: none;
}
.tl-head::after {
  content: ''; position: absolute; left: -2px; top: -3px;
  width: 5px; height: 5px; background: var(--brand);
}
.tl-head-label {
  position: absolute; left: 7px; top: -3px;
  color: var(--brand); letter-spacing: 0.04em;
  opacity: 0; transition: opacity 100ms linear;
}
.tl.is-scrubbing .tl-head-label,
body.is-held .tl-head-label { opacity: 1; }

.tl-scale {
  display: flex;
  justify-content: space-between;
  color: var(--faint);
  letter-spacing: 0.06em;
  margin-top: 1px;
}

body.is-held .bar-state .dot { animation: none; opacity: 0.3; }
body.is-held .tl-past { background: var(--faint); }

/* ---- the bands below ---------------------------------------------------- */

.band { padding: clamp(48px, 8vw, 110px) var(--gutter); border-bottom: 1px solid var(--line); }

.band-head {
  display: grid;
  gap: 10px;
  margin-bottom: clamp(24px, 4vw, 46px);
}
.band-head h2 {
  font-family: var(--sans);
  font-size: clamp(30px, 5.2vw, 62px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 0.98;
  color: var(--text);
}
.band-count { color: var(--faint); letter-spacing: 0.06em; }
.band-sub { color: var(--dim); max-width: 46ch; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr));
  gap: clamp(14px, 2vw, 26px);
}

.work-frame {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--sheet);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 80ms linear;
}
.work-frame:hover, .work-frame:focus-visible { border-color: var(--brand); }
.work-canvas { width: 100%; height: 100%; }

.work-cue {
  position: absolute; left: 0; bottom: 0;
  padding: 4px 8px;
  background: var(--void);
  border-top: 1px solid var(--brand);
  border-right: 1px solid var(--brand);
  color: var(--brand);
  letter-spacing: 0.06em;
  opacity: 0;
  transition: opacity 80ms linear;
}
.work-frame:hover .work-cue,
.work-frame:focus-visible .work-cue,
.work.is-playing .work-cue { opacity: 1; }

.work-meta { display: grid; gap: 2px; padding-top: 10px; }
.work-no { color: var(--faint); letter-spacing: 0.06em; }
.work-title { font-family: var(--sans); font-size: 13px; color: var(--text); }
.work-subject { color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-empty { color: var(--dim); }
.is-missing { opacity: 0.3; }

.steps { display: grid; gap: clamp(22px, 3vw, 40px); max-width: 92ch; }
.steps li { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 18px; align-items: start; }
.step-no { color: var(--faint); letter-spacing: 0.06em; padding-top: 4px; }
.steps h3 {
  font-family: var(--sans);
  font-size: clamp(16px, 1.6vw, 20px);
  font-weight: 500;
  letter-spacing: -0.015em;
  margin-bottom: 7px;
}
.steps p { font-size: var(--t-body); line-height: 1.62; color: var(--dim); max-width: 62ch; }

footer { padding: clamp(36px, 5vw, 64px) var(--gutter) 28px; }
.colophon {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.col-cell {
  display: grid; gap: 4px;
  padding: 13px 15px;
  background: var(--void);
}
.col-cell .k { color: var(--faint); letter-spacing: 0.06em; }
.col-cell .v { color: var(--text); overflow-wrap: anywhere; }
.col-cell .v.is-brand { color: var(--brand); }
a.v:hover { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

.foot-line {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  margin-top: 22px; color: var(--faint); letter-spacing: 0.06em;
}
.foot-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--brand); }
.foot-logo { width: 16px; height: 16px; object-fit: contain; display: block; }

/* ---- the replay overlay ------------------------------------------------- */

.replay {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(8, 9, 10, 0.94);
  display: grid; place-items: center;
  padding: var(--gutter);
}
.replay[hidden] { display: none; }

.replay-inner { display: grid; gap: 12px; width: min(78vh, 100%); }

.replay-label { display: flex; justify-content: space-between; gap: 14px; letter-spacing: 0.06em; }
.replay-label b { font-weight: 400; color: var(--text); }
.replay-label span { color: var(--dim); }

.replay-frame {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--sheet);
  border: 1px solid var(--line-2);
}
.replay-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.replay-bar { height: 1px; background: var(--line-2); }
.replay-bar-fill { height: 1px; width: 0; background: var(--text); }

.replay-controls { display: flex; gap: 10px; justify-content: flex-end; }
.btn {
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  color: var(--dim);
  letter-spacing: 0.06em;
  transition: color 80ms linear, border-color 80ms linear;
}
.btn:hover, .btn:focus-visible { color: var(--text); border-color: var(--faint); }

/* ---- narrow ------------------------------------------------------------- */

@media (max-width: 900px) {
  .shell {
    height: auto;
    min-height: 0;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas: "bar" "sheet" "foot" "plan";
  }
  .bar { height: var(--bar-h); flex-wrap: nowrap; gap: 10px; }
  .bar-subject { display: none; }
  .bar-end { margin-left: auto; }
  .sheet-wrap { border-right: 0; padding: var(--gutter) var(--gutter) 4px; }
  .sheet { height: auto; width: 100%; }
  .plan-col {
    border-top: 1px solid var(--line);
    grid-template-rows: auto 46vh auto;
  }
  /* the tail exists so the live row can sit mid column, and a short column
     needs a lot less of it than a tall one */
  .plan-scroll { padding-bottom: 18vh; }
  .tl-tick b { display: none; }
  .steps li { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .step-no { padding-top: 0; }
  .replay-inner { width: 100%; }
}

@media (max-width: 560px) {
  .bar-mark span { display: none; }
  .bar-state { display: none; }
  .chip { padding: 0 8px; gap: 5px; }
  .data { gap: 4px 14px; }
  .data .d-end { margin-left: 0; }
  .keys { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bar-state .dot { animation: none; }
  * { transition-duration: 1ms !important; }
}
