/* The cleaner's screen. Two hues, one meaning each: --broken marks breakup and nothing else,
   --repaired marks what a repair has put right and nothing else. They differ in lightness as
   well as hue, for eyes that do not tell red from green. */
.clean {
  --broken: #d36c53;
  --repaired: #62b58f;
  --side: 360px;
  padding-bottom: 72px;
}
.clean .name a { text-decoration: none; }
.clean .sep { margin: 0 6px; color: var(--ink-3); }
/* `hidden` has to win over the display each of these parts is given below, which a rule of the
   same weight further down would otherwise take back. */
.clean [hidden] { display: none !important; }

/* A file's name can be any length and have no spaces to break at. */
.glance { font-size: 24px; line-height: 32px; overflow-wrap: anywhere; }
.sub { color: var(--ink-2); overflow-wrap: anywhere; }
.small { font-size: 13px; line-height: 20px; }
.measure { max-width: 62ch; text-wrap: pretty; }
.broken { color: var(--broken); }

.btn {
  height: 36px;
  padding: 0 16px;
  background: var(--paper-0);
  border: 1px solid var(--control);
  border-radius: 2px;
  cursor: pointer;
}
.btn:hover { background: var(--paper-1); }
.btn.go { background: var(--ink-1); border-color: var(--ink-1); color: var(--paper-0); font-weight: 500; }
.btn.go:hover { background: #fff; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* before a recording is in, and when what was given is not one */
.start { margin-top: 20vh; max-width: 62ch; }
.start .glance { margin-bottom: 12px; }
.start .btn { margin-top: 24px; }
.refused { margin: 12px 0 0; padding: 0; list-style: none; }
.facts { margin: 40px 0 0; display: grid; grid-template-columns: 96px 1fr; row-gap: 6px; }
.facts dt { color: var(--ink-3); }
.facts dd { margin: 0; color: var(--ink-2); }

/* the working screen: picture and strip on the left, the finding on the right */
.work {
  /* The picture's width over its height, set from the recording's own frame. */
  --shape: 1.5;
  display: grid;
  /* the picture is as wide as its height allows; the side sits against it, not at the far edge */
  grid-template-columns: minmax(0, calc((100vh - 330px) * var(--shape))) var(--side);
  justify-content: start;
  column-gap: 48px;
  margin-top: 24px;
  align-items: start;
}
.stage { min-width: 0; }
.picture { position: relative; aspect-ratio: var(--shape); background: #000; overflow: hidden; }
.picture canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.picture .tag {
  position: absolute; bottom: 8px; padding: 0 6px; max-width: calc(100% - 16px);
  font-size: 13px; line-height: 20px; background: #000; color: var(--ink-1);
}
/* Before a scan has judged its first frame it measures the picture, and for those seconds
   nothing on screen moves. The picture is dimmed and says what is happening, so a still
   screen is not taken for a stuck one. */
.picture .veil {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px;
  background: color-mix(in srgb, var(--paper-0) 72%, transparent);
  font-size: 17px; line-height: 24px; text-align: center; text-wrap: balance;
}
.picture .tag.l { left: 8px; max-width: calc(50% - 16px); }
.picture .tag.r { right: 8px; max-width: calc(50% - 16px); text-align: right; }

/* The wipe: the repaired frame is cut at --cut, the recorded one shows to its left. Drag or the
   arrow keys move the cut. */
.picture.wipe { --cut: 50%; cursor: ew-resize; touch-action: none; }
.picture.wipe .after { clip-path: inset(0 0 0 var(--cut)); }
.picture .edge { position: absolute; top: 0; bottom: 0; left: var(--cut); width: 1px; background: var(--ink-1); pointer-events: none; }
.strip .done { position: absolute; top: 0; bottom: 0; left: 0; border-bottom: 2px solid var(--ink-1); pointer-events: none; }

.strip { position: relative; margin-top: 12px; height: 28px; background: var(--paper-2); }
/* The strip is the scrubber once the recording is scanned. A finger on it drags the head,
   not the page. */
.strip[role='slider'] { cursor: ew-resize; touch-action: none; }
.strip svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.strip .b { fill: var(--broken); }
.strip .n { fill: var(--ink-3); }
.strip .r { fill: var(--repaired); }
.strip .unread { position: absolute; top: 0; bottom: 0; right: 0; background: var(--paper-0); border-left: 1px solid var(--ink-2); }
.strip .head { position: absolute; top: -4px; bottom: -4px; width: 1px; background: var(--ink-1); pointer-events: none; }
.axis { display: flex; justify-content: space-between; margin-top: 4px; color: var(--ink-3); font-size: 13px; line-height: 20px; }
.key { display: flex; gap: 16px; }
.key i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; }
.key .kb { background: var(--broken); }
.key .kn { background: var(--ink-3); }
.key .kr { background: var(--repaired); }

.clips { margin-top: 32px; }
.clips h2 { color: var(--ink-3); font-size: 13px; line-height: 20px; padding-bottom: 4px; border-bottom: 1px solid var(--hair); }
.clip {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) 64px minmax(140px, 1.6fr) minmax(90px, 1fr);
  column-gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 6px 0;
  background: none;
  border: 0;
  color: var(--ink-2);
  text-align: left;
}
/* A row and its remove button, side by side under one line. */
.clip-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: center; border-bottom: 1px solid var(--hair); }
.clip-line .remove { padding: 6px 0; background: none; border: 0; color: var(--ink-3); font-size: 13px; line-height: 20px; cursor: pointer; }
.clip-line .remove:hover { color: var(--ink-1); }
button.clip { cursor: pointer; }
button.clip:hover { color: var(--ink-1); }
.clip[aria-current='true'] { color: var(--ink-1); }
.clip[aria-current='true'] .clip-name { font-weight: 500; }
.clip span { min-width: 0; overflow-wrap: anywhere; }
.clip .num { text-align: right; }

.side .glance + .sub { margin-top: 4px; }
.side .small { margin-top: 12px; color: var(--ink-3); }
.side .row { margin-top: 24px; }
.out { margin-top: 24px; color: var(--ink-2); overflow-wrap: anywhere; }
.out + .out { margin-top: 8px; }
.account { margin: 24px 0 0; padding: 0; list-style: none; display: grid; row-gap: 6px; color: var(--ink-2); }

/* While a repair runs, the side also shows the last two frames it changed, each recorded and
   repaired side by side, the newest on top. The side takes the room the picture leaves; each
   pair is held short enough that both fit the window's height. */
.work.watching { grid-template-columns: minmax(0, calc((100vh - 330px) * var(--shape))) minmax(var(--side), 1fr); }
.pairs { margin-top: 32px; max-width: calc((100vh - 300px) * var(--shape)); }
.pairs h2 { color: var(--ink-3); padding-bottom: 4px; border-bottom: 1px solid var(--hair); }
.pair { margin: 12px 0 0; }
.pair figcaption { margin: 0 0 4px; color: var(--ink-3); }
.pair .two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pair .half { position: relative; aspect-ratio: var(--shape); background: #000; overflow: hidden; }
.pair canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pair .tag { position: absolute; left: 6px; bottom: 6px; padding: 0 6px; font-size: 13px; line-height: 20px; background: #000; color: var(--ink-1); }

@media (max-width: 900px) {
  .work, .work.watching { grid-template-columns: 1fr; row-gap: 32px; }
  .pairs { max-width: none; }
  .start { margin-top: 10vh; }
}
/* Four columns do not fit a phone: the name and length take one line, what was found the next. */
@media (max-width: 640px) {
  .clip { grid-template-columns: 1fr auto; row-gap: 0; }
  /* Side by side, a phone's halves would be too small to see a repair in. */
  .pair .two { grid-template-columns: 1fr; }
}

/* Said to someone listening, not shown: only a change of what the side is about. */
.announce { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.clips .row { margin-top: 16px; }
.btn:disabled { cursor: default; opacity: 0.6; }

/* Said only when clean.js never ran, as when one of the page's own files did not load: clean.js
   hides it as it starts, and it only shows after a few seconds, so a page that loads never
   flashes it. With scripts turned off, noscript.css hides it: the page says that instead. */
.not-started { animation: not-started 0s 4s both; }
@keyframes not-started { from { visibility: hidden; } to { visibility: visible; } }
