/* The mastering lathe: a dark panel on a black page. The disc, the head and the light are painted by script.js with
   some of these colours; the panel, the words and the button are plain CSS. */
:root {
  --page: #000000;          /* the page */
  --panel: #0d0d10;         /* the export panel */
  --edge: #24242a;          /* its fine edge */
  --ink: #f2f0ec;           /* the words */
  --muted: #8d8c93;         /* the quieter words */
  --lacquer: #0a0a0d;       /* the blank lacquer */
  --platter: #1b1b20;       /* the platter under it */
  --metal: #b9bcc4;         /* the head, the rails, the hub */
  --pencil: #f4efe4;        /* the grease pencil on the lacquer */
  --done: #f3c46b;          /* the tick when the master is ready */
  --error: #ff6a55;         /* the words that say what went wrong */
  --button: #f2f0ec;        /* the button */
  --button-ink: #0d0d10;    /* its words */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap, no zoom */
html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Instrument Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the panel */
.lathe {
  position: relative;
  width: min(380px, 100%);
  padding: 14px 16px 16px;
  border-radius: 26px;
  background: var(--panel);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

/* the deck: the canvas spills over it on every side for the shadows; the words sit right of the disc, above and below
   the rails (the script says where the disc ends, in --side) */
.lathe__deck {
  position: relative;
  height: 216px;
  --side: 222px;
}

.lathe__paint {
  position: absolute;
  pointer-events: none;
}

.lathe__top,
.lathe__bottom {
  position: absolute;
  left: var(--side);
  right: 0;
  min-width: 0;
}

.lathe__top {
  top: 6px;
}

.lathe__bottom {
  bottom: 4px;
}

.lathe__top p,
.lathe__bottom p {
  margin: 0;
}

.lathe__phase {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  font-size: 13.5px;
  font-weight: 600;
  font-stretch: 92%;
  line-height: 1.25;
  letter-spacing: -0.005em;
}

.lathe__note,
.lathe__time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 460;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lathe__note {
  margin-top: 3px !important;
}

/* the words that change slide by themselves */
.lathe__swap {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

.lathe__phase .lathe__swap {
  white-space: normal;
}

.lathe__swap .is-error {
  color: var(--error);
}

.lathe__big {
  font-size: 34px;
  font-weight: 560;
  font-stretch: 84%;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px !important;
  transition: color 0.3s ease;
}

.lathe__big.is-quiet {
  color: color-mix(in srgb, var(--ink) 52%, var(--panel));
}

.lathe__tick {
  flex: none;
  width: 18px;
  height: 18px;
  margin-top: -1px;
  fill: none;
  stroke: var(--done);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  visibility: hidden;
}

/* ---------------------------------------------------------------- the file and the button */
.lathe__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.lathe__file {
  min-width: 0;
}

.lathe__title {
  margin: 0;
  overflow: hidden;
  font-size: 15px;
  font-weight: 600;
  font-stretch: 94%;
  line-height: 1.25;
  letter-spacing: -0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.lathe__meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 460;
  line-height: 1.35;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* the button: its words widen on the variable width axis under the pointer, and it squashes a little when pressed */
.lathe__btn {
  position: relative;
  flex: none;
  height: 36px;
  padding: 0 17px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 36px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease, opacity 0.25s ease;
}

.lathe__label {
  display: inline-block;
  font-stretch: 86%;
  transition: font-stretch 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* while the master is cut the button only pauses it: it steps back */
.lathe__btn.is-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 22%, transparent);
}

.lathe__btn[aria-disabled='true'] {
  cursor: default;
  opacity: 0.55;
}

@media (hover: hover) and (pointer: fine) {
  .lathe__btn:hover .lathe__label {
    font-stretch: 100%;
  }

  .lathe__btn:hover {
    background: color-mix(in srgb, var(--button) 84%, var(--panel));
  }

  .lathe__btn.is-quiet:hover {
    background: color-mix(in srgb, var(--ink) 8%, transparent);
  }

  .lathe__btn[aria-disabled='true']:hover .lathe__label {
    font-stretch: 86%;
  }
}

.lathe__btn:focus-visible {
  outline: 2px solid var(--done);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .lathe__label {
    transition: none;
  }
}
