/* The dividing photo: a graphite panel on a black page, with a photo frame in the middle.
   The photo and its tiles are painted by script.js; the panel, the words and the button are plain CSS. */
:root {
  --page: #000000;          /* the page */
  --panel: #131417;         /* the panel */
  --panel-edge: #24262b;    /* the panel's thin edge */
  --well: #08090a;          /* the frame behind the tiles: the lines of the grid */
  --ink: #f3f2ef;           /* the words */
  --muted: #8d9099;         /* the quieter words */
  --accent: #ffb547;        /* the tick and the focus frame once the photo is sharp */
  --error: #ff6b57;         /* the words that say what went wrong */
  --button: #f3f2ef;        /* the button */
  --button-ink: #111214;    /* 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 */
.raw {
  position: relative;
  width: min(384px, 100%);
  padding: 16px 16px 14px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 120px),
    var(--panel);
  box-shadow:
    inset 0 0 0 1px var(--panel-edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: var(--ink);
}

.raw__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 0 4px;
}

.raw__words {
  min-width: 0;
}

.raw__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 600;
  font-stretch: 94%;
  line-height: 1.25;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.raw__meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 450;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
}

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

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

/* the figure on the right: the percentage, then the tick */
.raw__figure {
  position: relative;
  flex: none;
  min-width: 56px;
  height: 22px;
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  font-stretch: 90%;
  line-height: 22px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.raw__pct {
  display: inline-block;
}

.raw__pct.is-quiet {
  color: var(--muted);
  font-weight: 480;
  font-size: 13px;
}

.raw__tick {
  position: absolute;
  right: -3px;
  top: -2px;
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  visibility: hidden;
}

/* ---------------------------------------------------------------- the photo */
/* three by two, like the sensor; the tiles sit on a near-black well, which shows between them as the grid */
.raw__frame {
  position: relative;
  margin: 14px 0 12px;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  overflow: hidden;
  background: var(--well);
  isolation: isolate;
}

.raw__frame::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  pointer-events: none;
}

.raw__paint {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

/* the focus frame: four rounded corners, a little in from the edges */
.raw__af {
  position: absolute;
  inset: 12px;
  pointer-events: none;
  opacity: 0;
}

.raw__corner {
  position: absolute;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.6;
  stroke-linecap: round;
  overflow: visible;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.45));
  transition: stroke 0.25s ease;
}

.raw__af.is-locked .raw__corner {
  stroke: var(--accent);
}

.raw__corner--tl {
  left: 0;
  top: 0;
}

.raw__corner--tr {
  right: 0;
  top: 0;
  transform: scaleX(-1);
}

.raw__corner--bl {
  left: 0;
  bottom: 0;
  transform: scaleY(-1);
}

.raw__corner--br {
  right: 0;
  bottom: 0;
  transform: scale(-1, -1);
}

/* ---------------------------------------------------------------- the line and the button */
.raw__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 0 4px;
}

.raw__info {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.raw__info b {
  color: var(--ink);
  font-weight: 560;
}

/* the button: its words widen on the variable width axis under the pointer, and it squashes a little when pressed */
.raw__btn {
  position: relative;
  flex: none;
  height: 34px;
  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: 34px;
  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;
}

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

/* while the file loads the button only cancels it: it steps back */
.raw__btn.is-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 18%, transparent);
}

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

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

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

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

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