/* The iris play button: a round button made like the diaphragm of a cine lens, on a black page. The script draws the
   blades, the aperture ring and the icon in an SVG, and the film behind them on a canvas. */
:root {
  --page: #000000;          /* the page */
  --cream: #efe6d6;         /* the words, the play icon and the numbers on the ring */
  --muted: #8d8475;         /* the small words */
  --amber: #f0a43a;         /* the progress of the trailer and the mark on the ring */
  --blade: #2c3037;         /* the blades: their metal, their shade and the light on their edge */
  --blade-dark: #15171b;
  --blade-edge: #a7b0bb;
  --ring: #141517;          /* the aperture ring around the blades */
}

* {
  box-sizing: border-box;
}

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

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

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

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

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

/* ---------------------------------------------------------------- the label */
/* the button with its label under it: the playing state and the time left */
.trailer {
  display: grid;
  justify-items: center;
  text-align: center;
}

.trailer__label {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: clamp(16px, 2.6vh, 26px) 0 0;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: 0.02em;
}

.trailer__word {
  display: inline-block;
}

.trailer__time {
  color: var(--muted);
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the button */
.iris {
  width: min(340px, 76vw, 46svh);
  aspect-ratio: 1;
  -webkit-tap-highlight-color: transparent;
}

.iris__btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.iris__btn:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 6px;
}

html[data-using='pointer'] .iris__btn:focus-visible {
  outline: none;
}

/* the film: a canvas exactly under the window of the lens (radius 96 of the drawing's 136) */
.iris__scene {
  position: absolute;
  inset: 14.6%;
  width: 70.8%;
  height: 70.8%;
  border-radius: 50%;
  background: #000;
}

/* three layers of their own: the film changes every frame, the blades only when they move, the icon and the
   progress in between; kept apart, one changing does not make the browser repaint the others */
.iris__art,
.iris__face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  will-change: transform;
}

.iris__scene {
  will-change: transform;
}

/* ---------------------------------------------------------------- the drawing (colours from the variables) */
.iris__base {
  fill: var(--blade-dark);
}

/* each blade has its own gradient, set by the script: dark at the pivot, lighter towards its edge */
.iris__blade {
  fill-rule: evenodd;
}

.iris__metal-a { stop-color: var(--blade); }
.iris__metal-b { stop-color: var(--blade-dark); }

.iris__edge {
  fill: none;
  stroke: var(--blade-edge);
  stroke-width: 1.1;
  opacity: 0.6;
}

.iris__shade {
  fill: none;
  stroke: #000;
}

.iris__ring {
  fill: var(--ring);
}

.iris__lip {
  fill: none;
  stroke: #3b3e44;
  stroke-width: 1;
}

.iris__knurl {
  fill: none;
  stroke: #2e3035;
  stroke-width: 1.4;
}

.iris__stop {
  fill: var(--cream);
  font-family: 'Geist Mono Variable', ui-monospace, monospace;
  font-size: 8.4px;
  font-weight: 500;
  opacity: 0.62;
}

.iris__index {
  fill: var(--amber);
}

.iris__track {
  fill: none;
  stroke: var(--cream);
  stroke-width: 2;
  opacity: 0.1;
}

.iris__progress {
  fill: none;
  stroke: var(--amber);
  stroke-width: 2.4;
  stroke-linecap: round;
}

.iris__icon {
  fill: var(--cream);
  stroke: var(--cream);
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.iris__again {
  fill: none;
  stroke: var(--cream);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0;
}
