@property --wet {
  syntax: "<number>";
  inherits: false;
  initial-value: 0;
}

/* the wall of a drinks can, square on: the lower edge of its cobalt label, then bare aluminium */
.ij {
  --cobalt: #1238d0;
  --ink: #101114;
  position: relative;
  isolation: isolate;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: url("./can.jpg") 0 0 / 540px 540px;
  font-family: "Archivo Variable", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.ij * {
  box-sizing: border-box;
}

/* the field's label is knocked out of the label's ink: the letters are the can's own metal, taken
   from further down the same photograph so the highlight runs straight through them */
.ij-label {
  position: absolute;
  left: 0;
  top: 37px;
  width: 540px;
  padding-left: 11px;
  font-size: 107.5px;
  font-weight: 800;
  font-stretch: 62%;
  line-height: 108px;
  text-transform: uppercase;
  white-space: nowrap;
  color: transparent;
  background: url("./can.jpg") 0 -242px / 540px 540px;
  -webkit-background-clip: text;
  background-clip: text;
  cursor: default;
}

/* three printed boxes, one per segment */
.ij-date {
  position: absolute;
  left: 16px;
  top: 266px;
  display: flex;
}
.ij-gap {
  width: 8px;
  font-size: 0;
  color: transparent;
}

.ij-cell {
  position: relative;
  display: block;
  width: 124px;
  height: 84px;
}
.ij-cell[data-type="year"] {
  width: 244px;
}
/* printed in the label's ink, which lets the metal through */
.ij-cell::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 2px solid var(--cobalt);
  mix-blend-mode: multiply;
  pointer-events: none;
  transition: border-width 0.12s cubic-bezier(0.3, 0, 0.2, 1);
}
.ij-cell:focus-within::before {
  border-width: 5px;
}

.ij-name {
  position: absolute;
  left: 0;
  top: -18px;
  font-size: 13px;
  font-weight: 700;
  font-stretch: 100%;
  line-height: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--cobalt);
  mix-blend-mode: multiply;
}

/* the SDK's input covers its box and takes the typing; what it holds is shown in drops */
.ij-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
  background: none;
  opacity: 0;
  cursor: text;
}

.ij-drops {
  position: absolute;
  left: 7px;
  top: 7px;
  pointer-events: none;
}
.ij-lot .ij-drops {
  left: 23px;
  top: 421px;
}

/* a dot of black ink on the metal: flat, a touch lighter in the middle where it domes, and a
   pinpoint of the strip light in it */
.ij-drop {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--pitch);
  height: var(--pitch);
  border-radius: 50%;
  background:
    radial-gradient(
      ellipse 11% 11% at 37% 30%,
      rgb(255 255 255 / calc(var(--light) * (0.8 + var(--wet) * 0.2))) 0,
      rgb(255 255 255 / calc(var(--light) * (0.8 + var(--wet) * 0.2))) 62%,
      rgb(255 255 255 / 0) 100%
    ),
    radial-gradient(circle at 50% 50%, #1b1c21 0, var(--ink) 72%);
}

/* typed digits are printed a stroke at a time, left to right; the pinpoint dulls as a drop dries */
.ij-drops[data-fresh] .ij-drop {
  animation:
    ij-land 0.06s calc(var(--col) * 33.33ms) cubic-bezier(0.2, 0.7, 0.3, 1)
      backwards,
    ij-dry 0.7s calc(var(--col) * 33.33ms) ease-out backwards;
}
@keyframes ij-land {
  from {
    opacity: 0;
    scale: 0.5;
  }
}
@keyframes ij-dry {
  from {
    --wet: 1;
  }
  to {
    --wet: 0;
  }
}

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