/* The export reels: two reels and a strip of film on a black page, lit from the gate in the middle; the words of the
   export over the strip, and the file and the buttons under it. The reels, the film and the light are painted by
   script.js with these colours; the words and the buttons are plain HTML. */
:root {
  --page: #000000;          /* the page */
  --ink: #f2ece1;           /* the words */
  --muted: #8f887c;         /* the quieter words */
  --error: #ff8a66;         /* the words that say what went wrong */
  --button: #f2ece1;        /* the main button */
  --button-ink: #17130e;    /* its words */
  --line: #3a352f;          /* the ring round the quiet buttons */
  --metal-hi: #b9bcc3;      /* the reels' flanges where the light catches them */
  --metal-lo: #34373d;      /* the flanges in shadow */
  --core: #24221f;          /* the plastic cores in the middle of the reels */
  --negative: #c96d35;      /* the orange base of the raw negative */
  --print: #2c2925;         /* the dark edges of the printed film */
  --leader: #4b4741;        /* the blank leader at either end of the film */
  --lamp: #ffd7a0;          /* the light in the gate */
  --tape: #f6ebcb;          /* the splicing tape */
}

* {
  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: 'Encode 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: 40px 16px;
}

/* ---------------------------------------------------------------- the export */
.export {
  position: relative;
  width: min(380px, 100%);
}

/* the deck: the canvas is bigger than its place, the light and the flapping film need room round it */
.export__deck {
  position: relative;
  height: 120px;
}

.export__paint {
  position: absolute;
  display: block;
  pointer-events: none;
}

/* ---------------------------------------------------------------- the words over the film */
/* between the two reels, above the gate */
.export__readout {
  position: absolute;
  top: 1px;
  left: 96px;
  right: 96px;
  text-align: center;
  pointer-events: none;
}

.export__readout p {
  margin: 0;
  white-space: nowrap;
}

.export__big {
  height: 44px;
  font-size: 40px;
  font-weight: 640;
  font-stretch: 80%;
  line-height: 44px;
  letter-spacing: -0.012em;
  font-variant-numeric: tabular-nums;
}

.export__big small {
  margin-left: 1px;
  font-size: 0.5em;
  font-weight: 560;
  font-stretch: 100%;
  vertical-align: 0.62em;
  letter-spacing: 0;
}

.export__big.is-quiet {
  color: var(--muted);
}

.export__phase {
  height: 18px;
  font-size: 13px;
  font-weight: 600;
  line-height: 18px;
}

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

.export__note {
  height: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

/* the words that change slide by themselves */
.export__swap {
  display: inline-block;
}

/* a long clip name ends in an ellipsis */
.export__phase .export__swap,
.export__note .export__swap {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}

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

.export__file {
  min-width: 0;
}

.export__title {
  margin: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 620;
  line-height: 18px;
  letter-spacing: -0.005em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.export__meta {
  margin: 2px 0 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 450;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.export__buttons {
  display: flex;
  flex: none;
  gap: 8px;
}

/* the buttons: their words widen on the variable width axis under the pointer, and they squash a little when pressed */
.export__btn {
  position: relative;
  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: 620;
  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;
}

.export__btn[hidden] {
  display: none;
}

.export__label {
  display: inline-block;
  font-stretch: 90%;
  transition: font-stretch 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* while the export runs the main button only pauses it: it steps back like the other one */
.export__btn--ghost,
.export__btn.is-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--line);
}

/* while the film is being saved or wound back there is nothing to press */
.export__btn[aria-disabled='true'] {
  cursor: default;
  opacity: 0.45;
}

@media (hover: hover) and (pointer: fine) {
  .export__btn:not([aria-disabled='true']):hover .export__label {
    font-stretch: 104%;
  }

  .export__btn:not([aria-disabled='true']):hover {
    background: color-mix(in srgb, var(--button) 86%, var(--page));
  }

  .export__btn--ghost:not([aria-disabled='true']):hover,
  .export__btn.is-quiet:not([aria-disabled='true']):hover {
    background: color-mix(in srgb, var(--ink) 8%, transparent);
  }
}

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

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