/* Lento. One warm dark, one warm light, transparency. All colour is in the music. */
@font-face {
  font-family: 'Archivo';
  src: url('assets/fonts/Archivo.ttf') format('truetype');
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: block;
}
:root {
  --ground: #191817;
  --ink: #EFE7E0;
  --ink-90: rgba(239, 231, 224, .9);
  --ink-60: rgba(239, 231, 224, .6);
  --ink-45: rgba(239, 231, 224, .46);
  --ink-30: rgba(239, 231, 224, .3);
  --ink-15: rgba(239, 231, 224, .15);
  --ink-12: rgba(239, 231, 224, .12);
  --ink-08: rgba(239, 231, 224, .08);
  --left: #3CCAB0;
  --right: #F2A93B;
  --gut: max(64px, 6.25vw);
  --libw: clamp(260px, 24vw, 340px);
  --ease: cubic-bezier(.3, .7, .2, 1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ground); color: var(--ink); overflow: hidden; }
body {
  font-family: 'Archivo', ui-sans-serif, system-ui, sans-serif;
  font-stretch: 100%; font-size: 15px;
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  user-select: none; cursor: default;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button:focus-visible, input:focus-visible, canvas:focus-visible, .seg:has(button:focus-visible) { outline: 1px solid var(--ink-60); outline-offset: 4px; }
.seg button:focus-visible { outline: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
[hidden] { display: none !important; }

canvas#swarm, canvas#stage { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
canvas#stage { pointer-events: none; z-index: 1; }

/* The Mac window has no title bar: the top strip drags the window, the traffic lights sit top-left. */
#titlebar { position: fixed; left: 0; right: 0; top: 0; height: 40px; z-index: 6; -webkit-app-region: drag; }
body[data-screen="player"] #titlebar { display: none; }

/* ---------- buttons ---------- */
.go {
  flex: none; height: 44px; padding: 0 24px; border-radius: 3px;
  background: var(--ink); color: var(--ground); font-size: 15px; font-weight: 550; letter-spacing: .005em;
  transition: background .25s, color .25s, box-shadow .25s;
}
.go:hover { background: #fff; }
.go:disabled { background: transparent; color: var(--ink-30); box-shadow: inset 0 0 0 1px var(--ink-15); cursor: default; }
.btn {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 18px 0 15px; border-radius: 3px;
  color: var(--ink-90); box-shadow: inset 0 0 0 1px var(--ink-30); transition: box-shadow .25s, color .25s, background .25s;
}
.btn:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-60); background: var(--ink-08); }
.btn svg { width: 16px; height: 16px; flex: none; }
.ico { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 3px; color: var(--ink-60); transition: color .2s, background .2s; }
.ico:hover { color: var(--ink); background: var(--ink-08); }
.ico svg { width: 16px; height: 16px; }

/* A choice between two: a thumb slides between them. */
.seg { position: relative; display: inline-flex; padding: 3px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--ink-15); touch-action: none; }
.seg .thumb { position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 2px;
  background: var(--ink-12); box-shadow: inset 0 0 0 1px var(--ink-15);
  transition: transform .5s var(--ease), width .5s var(--ease); }
.seg.instant .thumb { transition: none; }
.seg button { position: relative; height: 38px; padding: 0 18px; font-size: 17px; color: var(--ink-45); transition: color .3s; white-space: nowrap; }
.seg button:hover { color: var(--ink-90); }
.seg button[aria-checked="true"] { color: var(--ink); }
.seg button:disabled { color: var(--ink-15); cursor: default; }
.seg.small { padding: 2px; }
.seg.small .thumb { top: 2px; bottom: 2px; }
.seg.small button { height: 28px; padding: 0 11px; font-size: 14px; }

/* A toggle: a swatch that is filled when on, hollow when off. Never an underline. */
.tog { display: inline-flex; align-items: center; gap: 8px; height: 32px; font-size: 14px; color: var(--ink-45); transition: color .2s; white-space: nowrap; }
.tog:hover { color: var(--ink-90); }
.tog[aria-pressed="true"] { color: var(--ink); }
.tog .sw { width: 9px; height: 9px; border-radius: 2px; box-shadow: inset 0 0 0 1.25px currentColor; transition: background .2s, box-shadow .2s; }
.tog[aria-pressed="true"] .sw { background: var(--ink); box-shadow: none; }
.hand[data-h="0"] .sw { color: var(--left); box-shadow: inset 0 0 0 1.25px var(--left); }
.hand[data-h="1"] .sw { color: var(--right); box-shadow: inset 0 0 0 1.25px var(--right); }
.hand[data-h="0"][aria-pressed="true"] .sw { background: var(--left); }
.hand[data-h="1"][aria-pressed="true"] .sw { background: var(--right); }

/* ---------- the wordmark ---------- */
#mark {
  position: fixed; z-index: 7; left: 0; top: 0; transform-origin: 0 0; -webkit-app-region: no-drag;
  transition: transform .8s var(--ease), opacity .4s;
}
#mark canvas { display: block; cursor: default; }
body[data-screen="player"] #mark { pointer-events: none; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; z-index: 2; opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .3s ease, visibility 0s linear .3s; }
.screen.on { opacity: 1; visibility: visible; transition: opacity .6s ease .26s, visibility 0s; }
.screen.on .live { pointer-events: auto; }

/* ---------- home ---------- */
.ask { position: absolute; left: var(--gut); top: 21vh; width: min(860px, calc(100vw - 2 * var(--gut) - var(--libw) - 72px)); }
.field { display: flex; align-items: flex-end; border-bottom: 1px solid var(--ink-30); transition: border-color .3s; }
.field:focus-within { border-bottom-color: var(--ink-60); }
#link {
  flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; color: var(--ink); user-select: text;
  font: inherit; font-size: clamp(42px, 5.3vw, 86px); font-weight: 300; font-stretch: 104%;
  letter-spacing: -.028em; line-height: 1.08; padding: 0 0 16px; caret-color: var(--ink);
}
#link::placeholder { color: var(--ink-90); transition: color .3s; }
#link:focus::placeholder { color: var(--ink-30); }
.dropline {
  display: block; width: 100%; text-align: left; background: transparent; border: 0; border-bottom: 1px solid var(--ink-30);
  color: var(--ink-90); font: inherit; font-size: clamp(42px, 5.3vw, 86px); font-weight: 300; font-stretch: 104%;
  letter-spacing: -.028em; line-height: 1.08; padding: 0 0 16px; cursor: pointer; transition: color .3s, border-color .3s;
}
.dropline:hover { color: #fff; border-bottom-color: var(--ink-60); }
.dropline[hidden], .field[hidden], .go[hidden] { display: none; }
#link.long { font-size: clamp(24px, 2.6vw, 36px); padding-bottom: 22px; letter-spacing: -.01em; }
.linkmsg { margin: 10px 0 0; min-height: 0; color: var(--ink-60); font-size: 15px; }
.linkmsg:empty { display: none; }
.under { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-top: 18px; }
.filepick { display: flex; align-items: center; gap: 16px; min-width: 0; }
.hint { color: var(--ink-45); font-size: 15px; white-space: nowrap; }
.kind { margin-top: 44px; }
.kindnote { margin: 12px 0 0; color: var(--ink-45); font-size: 15px; min-height: 1.4em; }
.rights { margin-top: 26px; max-width: 640px; animation: rise .6s var(--ease) both; }
.rights p { margin: 0 0 22px; font-size: clamp(20px, 1.9vw, 26px); font-weight: 350; line-height: 1.35; color: var(--ink-90); letter-spacing: -.008em; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.library { position: absolute; right: var(--gut); top: calc(21vh + 6px); width: var(--libw); }
.library h2 { margin: 0 0 12px; font-size: 14px; font-weight: 450; color: var(--ink-45); }
.library ol { list-style: none; margin: 0; padding: 0; overflow-x: hidden; max-height: calc(100vh - 21vh - 6px - 40px - clamp(140px, 22vh, 210px) - 24px); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: none; }
.library ol::-webkit-scrollbar { display: none; }
.library ol.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 44px), transparent); }
.library li { position: relative; border-top: 1px solid var(--ink-08); }
.library li:last-child { border-bottom: 1px solid var(--ink-08); }
.library .open {
  width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; column-gap: 16px; row-gap: 3px;
  text-align: left; padding: 13px 0 14px;
}
.library .t { font-size: 21px; font-weight: 400; color: var(--ink-90); letter-spacing: -.005em; transition: color .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library .d { font-size: 14px; color: var(--ink-45); transition: opacity .2s; }
.library .s { grid-column: 1 / -1; font-size: 14px; color: var(--ink-45); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library .open:hover .t { color: var(--ink); }
.library .acts { position: absolute; right: 0; top: 9px; display: flex; gap: 2px; opacity: 0; pointer-events: none; transition: opacity .2s; }
.library li:hover .acts, .library li:focus-within .acts { opacity: 1; pointer-events: auto; }
.library li:hover .d, .library li:focus-within .d { opacity: 0; }
.library li.job .s { color: var(--ink-60); }
.library li.confirm .open, .library li.confirm .acts { visibility: hidden; }
.library .ask2 { position: absolute; inset: 0; display: none; align-items: center; justify-content: space-between; gap: 10px; }
.library li.confirm .ask2 { display: flex; }
.library .ask2 span { font-size: 15px; color: var(--ink-90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.library .ask2 .acts2 { display: flex; gap: 8px; flex: none; }
.library .ask2 button { height: 32px; padding: 0 12px; border-radius: 3px; font-size: 14px; }
.library .ask2 .yes { background: var(--ink); color: var(--ground); }
.library .ask2 .no { color: var(--ink-60); box-shadow: inset 0 0 0 1px var(--ink-30); }
.empty { margin: 0; padding: 14px 0; border-top: 1px solid var(--ink-08); color: var(--ink-45); font-size: 15px; }

.about { position: absolute; right: var(--gut); top: 48px; font-size: 14px; color: var(--ink-45); padding: 4px 0; -webkit-app-region: no-drag; z-index: 7; }
.about:hover, .about[aria-expanded="true"] { color: var(--ink-90); }
.aboutp { position: absolute; right: var(--gut); top: 82px; width: 360px; padding: 18px 20px; z-index: 8;
  background: #211F1D; box-shadow: inset 0 0 0 1px var(--ink-12), 0 18px 50px rgba(0, 0, 0, .35); border-radius: 4px; animation: rise .35s var(--ease) both; }
.aboutp p { margin: 0 0 12px; font-size: 15px; line-height: 1.45; color: var(--ink-90); }
.aboutp ul { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.75; color: var(--ink-45); }

.dropveil { position: fixed; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center;
  font-size: clamp(46px, 5vw, 74px); font-weight: 300; font-stretch: 112%; letter-spacing: -.02em;
  opacity: 0; pointer-events: none; transition: opacity .3s; }
body.dragging .dropveil { opacity: 1; }
body.dragging #home .ask, body.dragging #home .library, body.dragging #home .about { opacity: .08; transition: opacity .3s; }

/* ---------- working ---------- */
.wsteps { position: absolute; left: var(--gut); top: 17vh; margin: 0; padding: 0; list-style: none; transition: opacity .6s; }
.wsteps li {
  font-size: clamp(36px, 3.7vw, 56px); font-weight: 300; font-stretch: 104%; letter-spacing: -.024em; line-height: 1.16;
  color: var(--ink-15); transition: color .9s ease; white-space: nowrap;
}
.wsteps li.done { color: var(--ink-30); }
.wsteps li.now { color: var(--ink); }
.wsteps li.now .dots::after { content: "..."; display: inline-block; width: 0; overflow: hidden; vertical-align: bottom;
  animation: dots 2.4s steps(4, end) infinite; }
@keyframes dots { to { width: 1.05em; } }
.wcount { font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--ink-45); margin-left: 14px; font-stretch: 100%; vertical-align: .9em; }
.wdone, .werr { position: absolute; left: var(--gut); top: 17vh; opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: opacity .9s ease, transform .9s ease, visibility 0s linear .9s; }
.wdone h1, .werr h1 { margin: 0; font-size: clamp(36px, 3.7vw, 56px); font-weight: 300; font-stretch: 104%; letter-spacing: -.024em; line-height: 1.16; }
.wdone p, .werr p { margin: 10px 0 0; color: var(--ink-45); font-size: 15px; max-width: 560px; line-height: 1.45; }
.werrb { display: flex; gap: 12px; margin-top: 28px; }
#working.finished .wsteps, #working.failed .wsteps { opacity: 0; }
#working.finished .wdone, #working.failed .werr { opacity: 1; visibility: visible; transform: none; transition: opacity .9s ease, transform .9s ease, visibility 0s; }
#working.failed .axis, #working.failed .wfoot, #working.failed .wback { opacity: 0; pointer-events: none; }
.wsrc { position: absolute; right: var(--gut); top: 17vh; text-align: right; max-width: 34vw; }
.wsrc .t { display: block; font-size: 21px; color: var(--ink-90); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wsrc .s { display: block; margin-top: 4px; font-size: 14px; color: var(--ink-45); }
.axis { position: absolute; display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-30); transition: opacity .6s; }
.axis.off { opacity: 0; }
.wfoot { position: absolute; left: var(--gut); bottom: 34px; margin: 0; font-size: 14px; color: var(--ink-45); transition: opacity .4s; }
.wback { position: absolute; right: var(--gut); bottom: 26px; height: 36px; padding: 0 16px; font-size: 14px; color: var(--ink-60); }
#working.finished .wfoot, #working.finished .wback { opacity: 0; pointer-events: none; }

/* ---------- player ---------- */
.pbar { position: absolute; left: 0; right: 0; top: 0; height: 64px; display: flex; align-items: center; gap: 18px; padding: 0 16px 0 80px;
  -webkit-app-region: drag; }
.pbar button, .pbar input, .pbar label, .pbar .seg, .pbar output { -webkit-app-region: no-drag; }
.pback { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 6px; margin-left: 2px; color: var(--ink-60); border-radius: 3px; flex: none; }
.pback:hover { color: var(--ink); background: var(--ink-08); }
.pback svg { width: 8px; height: 14px; flex: none; }
.pback .markspace { display: block; height: 22px; }
.ptitle { display: flex; align-items: baseline; gap: 12px; padding-left: 18px; border-left: 1px solid var(--ink-15); height: 18px; line-height: 18px; white-space: nowrap; min-width: 0; flex: 1 1 auto; overflow: hidden; }
.ptitle .t { font-size: 17px; font-weight: 450; overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; min-width: 4.5em; }
.ptitle .s { font-size: 14px; color: var(--ink-45); overflow: hidden; text-overflow: ellipsis; flex: 0 1000 auto; min-width: 0; }
.pctl { margin-left: auto; display: flex; align-items: center; gap: 22px; flex: none; }
.pp { width: 38px; height: 38px; border-radius: 50%; background: var(--ink); color: var(--ground); display: grid; place-items: center; transition: background .2s; }
.pp:hover { background: #fff; }
.pp svg { width: 14px; height: 14px; }
.time { font-size: 14px; color: var(--ink-45); min-width: 84px; white-space: nowrap; }
.time b { font-weight: 450; color: var(--ink); }
.speed { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--ink-45); }
.speed output { color: var(--ink); min-width: 36px; text-align: right; }
input[type=range] { -webkit-appearance: none; appearance: none; width: 104px; height: 20px; background: transparent; cursor: pointer; --fill: 100%; }
input[type=range]::-webkit-slider-runnable-track { height: 1px; background: linear-gradient(90deg, var(--ink-60) var(--fill), var(--ink-30) var(--fill)); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 11px; height: 11px; margin-top: -5px; border-radius: 50%; background: var(--ink); }
.hands { display: flex; gap: 16px; }
.saved { position: absolute; right: 16px; top: 52px; font-size: 13px; color: var(--ink-60); white-space: nowrap; opacity: 0; transition: opacity .4s; }
.saved.on { opacity: 1; }
#print { position: absolute; left: 24px; top: 64px; height: 34px; cursor: pointer; transition: opacity .5s; }
.pmsg { position: absolute; left: 0; right: 0; top: 42vh; margin: 0; text-align: center; font-size: 21px; color: var(--ink-60); }
.pmsg:empty { display: none; }

@media (max-width: 1180px) {
  .ptitle .s { display: none; }
  .pctl { gap: 16px; }
  .speed .lab { display: none; }
  input[type=range] { width: 84px; }
}
@media (max-width: 1040px) {
  .pbar { gap: 12px; }
  .pctl { gap: 13px; }
  .time { min-width: 76px; }
  .hands { gap: 12px; }
  .seg.small button { padding: 0 8px; }
  .hint { display: none; }
  input[type=range] { width: 64px; }
  .time { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .seg .thumb, #mark { transition: none; }
}
