/* The photo brought into focus: a black page, one photo in the middle, out of focus. A thin crosshair follows the
   pointer and the photo comes into focus round it; under the photo the f-number, in a variable typeface (Roboto
   Flex, weight 100 to 1000 and width 25 to 151), gets lighter as the lens stops down. */
:root {
  --page: #0e0e0d;     /* the page */
  --ink: #f1ede4;      /* the f-number, the crosshair while it hunts */
  --muted: #77736b;    /* the small print, the stops that are not in use */
  --accent: #ff5b2e;   /* the crosshair once it is in focus, the mark on the scale */
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
}

body {
  overflow: hidden;
  background: var(--page);
  color: var(--ink);
  font-family: 'Roboto Flex Variable', 'Roboto Flex', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.top {
  position: absolute;
  top: 26px;
  left: 32px;
  right: 32px;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
}

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

.mark {
  font-size: 15px;
  font-weight: 640;
  font-stretch: 112%;
  letter-spacing: 0.01em;
}

.title {
  font-size: 13px;
  font-weight: 380;
  font-stretch: 96%;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the script writes left, top, width and height */
.plate {
  position: absolute;
  margin: 0;
  visibility: hidden;
  touch-action: none;
}

.plate.is-ready {
  visibility: visible;
}

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

@media (hover: hover) and (pointer: fine) {
  .plate {
    cursor: none;
  }
}

/* the crosshair: four hairlines round an empty middle; the script moves the box and the arms */
.cross {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  color: var(--ink);
  pointer-events: none;
  will-change: transform;
  /* a breath of shade, so the hairlines read on a light or a busy photo */
  filter: drop-shadow(0 0 1px rgba(0, 0, 0, 0.35));
}

.arm {
  position: absolute;
  left: 0;
  top: 0;
  background: currentColor;
  will-change: transform;
}

.arm--n,
.arm--s {
  width: 1px;
  margin-left: -0.5px;
}

.arm--e,
.arm--w {
  height: 1px;
  margin-top: -0.5px;
}

/* each arm grows out of the empty middle */
.arm--n {
  transform-origin: 50% 100%;
}

.arm--e {
  transform-origin: 0 50%;
}

.arm--s {
  transform-origin: 50% 0;
}

.arm--w {
  transform-origin: 100% 50%;
}

/* two short ticks outside the photo, on the top and on the left edge, that say where the focus is */
.tick {
  position: absolute;
  left: 0;
  top: 0;
  background: var(--muted);
  pointer-events: none;
  will-change: transform;
}

.tick--x {
  top: -11px;
  width: 1px;
  height: 7px;
}

.tick--y {
  left: -11px;
  width: 7px;
  height: 1px;
}

/* under the photo: the f-number on the left, the scale of the stops on the right */
.read {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}

.stop {
  display: inline-flex;
  align-items: baseline;
  line-height: 1;
  white-space: nowrap;
}

.stop__f {
  font-size: 18px;
  font-weight: 360;
  font-stretch: 100%;
  color: var(--muted);
  margin-right: 2px;
}

/* the number: the script writes its weight and width every frame */
.stop__n {
  display: inline-block;
  font-size: 46px;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wght' 760, 'wdth' 100;
  transform-origin: 0 100%;
}

.scale {
  position: relative;
  display: flex;
  gap: 18px;
  padding-top: 12px;
  margin-bottom: 4px;
  font-size: 11px;
  font-weight: 420;
  font-stretch: 96%;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  white-space: nowrap;
}

.scale__label {
  display: inline-block;
  min-width: 1.6em;
  text-align: center;
  transition: color 0.25s ease;
}

.scale__label.is-on {
  color: var(--ink);
}

.scale__mark {
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: 7px;
  background: var(--accent);
  will-change: transform;
}

@media (max-width: 640px) {
  .top {
    top: 20px;
    left: 20px;
    right: 20px;
  }

  .mark {
    font-size: 14px;
  }

  .title {
    font-size: 12px;
  }

  .read {
    margin-top: 14px;
    gap: 10px;
  }

  .stop__f {
    font-size: 15px;
  }

  .stop__n {
    font-size: 36px;
  }

  .scale {
    gap: 9px;
    font-size: 10px;
  }
}
