@property --drop {
  syntax: "<number>";
  inherits: true;
  initial-value: 1;
}

.tp {
  --wall: #0f9f4e;
  --body: #f1efe8;
  --pit: #20211f;
  --red: #e02d20;
  --print: #151515;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.1' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.6 1.05'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23g)'/%3E%3C/svg%3E");
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: var(--wall);
  font-family: "Barlow Condensed", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

/* the body: matt white polycarbonate, one soft light from the upper left falling off across the face */
.tp-body {
  position: absolute;
  left: 38px;
  top: 38px;
  width: 464px;
  height: 560px;
  border-radius: 64px;
  background: radial-gradient(
    150% 130% at 12% 4%,
    #fdfcf9 0%,
    var(--body) 42%,
    #d9d6cc 100%
  );
  box-shadow:
    0 16px 26px -8px #00401fa6,
    0 3px 5px #00401f66,
    inset 0 1.5px 0.5px #ffffff,
    inset 1.5px 0 0.5px #ffffffb3,
    inset 0 -4px 6px #0000000f;
}

/* the spark-eroded grain of the mould: fine, even, only just there */
.tp-body::before,
.tp-dial::before,
.tp-hub::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--grain);
  opacity: 0.08;
  pointer-events: none;
}

/* everything round is set out from the centre of the dial */
.tp-arrow,
.tp-channel,
.tp-ring,
.tp-dial {
  position: absolute;
  left: 232px;
  top: 240px;
}

/* the pointer that marks the time: a wedge moulded on the body, its nose over the edge of the ring, its face printed */
.tp-arrow {
  width: 38px;
  height: 36px;
  margin: -247px 0 0 -19px;
  transform-origin: 19px 247px;
  filter: drop-shadow(var(--sx) var(--sy) 1.4px #00000080);
}
.tp-arrow i {
  position: absolute;
  inset: 0;
  background: linear-gradient(var(--light), #ffffff, #e6e3da);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}
.tp-arrow i::after {
  content: "";
  position: absolute;
  inset: 3px 5.4px 7.6px;
  background: var(--print);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* the channel the tappets stand in: a crisp parting line where the turning ring meets the body */
.tp-channel {
  width: 430px;
  height: 430px;
  margin: -215px 0 0 -215px;
  border-radius: 50%;
  background: var(--pit);
  box-shadow:
    0 0 0 0.75px #00000073,
    -1.2px -1.8px 1.2px #00000026,
    1.2px 1.8px 0.6px #ffffff,
    inset 3px 4.5px 5px #000000;
}

.tp-ring {
  width: 0;
  height: 0;
}

/* one tappet: the button is its whole slot */
.tp-tappet {
  position: absolute;
  left: -7px;
  top: -213px;
  width: 14px;
  height: 47px;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  appearance: none;
  outline: none;
  cursor: pointer;
  transform-origin: 7px 213px;
  -webkit-tap-highlight-color: transparent;
}

/* the red of the ring under it, seen once the tappet is pushed in; dark where its neighbours stand over it */
.tp-flank {
  position: absolute;
  left: 1.5px;
  top: 4.5px;
  width: 11px;
  height: 38.5px;
  background:
    linear-gradient(
      90deg,
      #00000059,
      #0000 2.4px calc(100% - 2.4px),
      #00000059
    ),
    linear-gradient(#00000066, #0000 5px),
    linear-gradient(var(--light), #f2493a, var(--red) 55%, #c9261b);
  clip-path: polygon(
    0.8px 0,
    calc(100% - 0.8px) 0,
    calc(100% - 1.8px) 100%,
    1.8px 100%
  );
}

/* the tappet itself: body white, standing proud of the ring, its top face in the light */
.tp-cap {
  position: absolute;
  left: 1.5px;
  top: 3px;
  width: 11px;
  height: 40px;
  filter: drop-shadow(
    calc(var(--sx) * var(--drop)) calc(var(--sy) * var(--drop)) 1.3px #000000d9
  );
  transition:
    translate 0.12s cubic-bezier(0.25, 1.5, 0.45, 1),
    --drop 0.12s;
}
.tp-cap i {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(#0000 5px, #00000021 5px 6px, #ffffffcc 6px 7px, #0000 7px),
    linear-gradient(var(--light), #ffffff, #f3f1ea 50%, #dedbd1);
  /* moulded, tapering towards the centre, corners broken */
  clip-path: polygon(
    1.2px 0,
    calc(100% - 1.2px) 0,
    100% 1.2px,
    calc(100% - 1px) 100%,
    1px 100%,
    0 1.2px
  );
  transition: filter 0.12s;
}

/* a firm stroke: it gives under the finger, then goes home under the rim of the dial */
.tp-tappet:active .tp-cap {
  translate: 0 9px;
  transition-duration: 0.05s;
  transition-timing-function: ease-out;
}
.tp-tappet[data-pressed] .tp-cap {
  --drop: 0.45;
  translate: 0 28px;
}
.tp-tappet[data-pressed] .tp-cap i {
  filter: brightness(0.93);
}
.tp-tappet[data-pressed]:active .tp-cap {
  translate: 0 20px;
}

.tp-tappet:focus-visible .tp-cap i {
  background:
    radial-gradient(circle at 50% 15px, var(--print) 0 2.8px, #0000 3.2px),
    linear-gradient(var(--light), #ffffff, #f3f1ea 50%, #dedbd1);
}

/* the dial inside the ring, with its print; the tappets go in under its rim */
.tp-dial {
  width: 332px;
  height: 332px;
  margin: -166px 0 0 -166px;
  border-radius: 50%;
  background: radial-gradient(
    130% 130% at 22% 14%,
    #fcfbf7,
    #f0eee7 50%,
    #e2dfd6
  );
  box-shadow:
    0 0 0 0.75px #00000080,
    2.5px 4px 3.5px #00000099,
    inset 0 1.2px 0.5px #ffffff,
    inset 0 -1.5px 1px #00000014;
  pointer-events: none;
}

.tp-print {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 540px;
  height: 540px;
  margin: -270px 0 0 -270px;
}

.tp-tick {
  stroke: var(--print);
  stroke-width: 1.6;
}

.tp-hour {
  fill: var(--print);
  font:
    600 44px/1 "Barlow Condensed",
    sans-serif;
  text-anchor: middle;
  dominant-baseline: central;
}

.tp-night {
  fill: none;
  stroke: var(--print);
  stroke-width: 9;
}
.tp-day {
  fill: none;
  stroke: var(--print);
  stroke-width: 1.6;
}

/* the grip in the middle: a plain dome */
.tp-hub {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 124px;
  height: 124px;
  margin: -62px 0 0 -62px;
  border-radius: 50%;
  background: radial-gradient(
    circle at 36% 30%,
    #ffffff 0%,
    #f4f2ec 30%,
    #e3e0d7 68%,
    #cbc8be 100%
  );
  box-shadow:
    0 0 0 0.75px #00000073,
    3px 5px 7px #00000052,
    1px 1.5px 1.5px #00000040;
}
