@property --progress-value {
  syntax: "<percentage>";
  inherits: true;
  initial-value: 0%;
}

.hw {
  --etch: #2b2d30d9;
  --ink: #1b2019;
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background: linear-gradient(166deg, #d6d7d8 0%, #c7c9ca 40%, #b8babc 100%);
  color: var(--etch);
  font-family: "Roboto Flex Variable", sans-serif;
  font-stretch: 112%;
  -webkit-font-smoothing: antialiased;
}

/* Bead-blasted grain. */
.hw::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='270' height='270'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.3' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: soft-light;
  opacity: 0.42;
  pointer-events: none;
}

.hw p {
  position: absolute;
  margin: 0;
}

/* The display sits in a milled pocket, a millimetre under the face. */
.hw-lcd {
  position: absolute;
  top: 48px;
  left: 48px;
  width: 444px;
  height: 264px;
  border-radius: 5px;
  background:
    linear-gradient(118deg, #fff0 52%, #ffffff12 56%, #ffffff12 68%, #fff0 72%),
    linear-gradient(180deg, #a2a994 0%, #afb6a1 100%);
  box-shadow:
    0 1px 0 #ffffff8c,
    0 -1px 0 #0000002e,
    inset 0 3px 0 #00000061,
    inset 2px 0 0 #00000030,
    inset -2px 0 0 #0000001c,
    inset 0 -2px 0 #ffffff4d,
    inset 0 12px 14px -8px #00000052;
  color: var(--ink);
}

.hw-legend,
.hw-unit,
.hw-of {
  position: absolute;
  font-weight: 640;
  filter: drop-shadow(1.5px 2px 0 #1b20191f);
}

.hw-legend {
  top: 22px;
  font-size: 18px;
  line-height: 20px;
  opacity: 0.07;
}

.hw-filling {
  left: 22.5px;
}

.hw-done {
  left: 108px;
}

.hw[data-filling] .hw-filling,
.hw[data-done] .hw-done {
  opacity: 0.92;
}

.hw-value {
  position: absolute;
  top: 64px;
  left: 28px;
  display: flex;
  gap: 15px;
  transform: skewX(-5deg);
  filter: drop-shadow(1.5px 2px 0 #1b201924);
}

.hw-digit {
  display: block;
  width: 67.5px;
  height: 120px;
  overflow: visible;
}

.hw-digit polygon {
  fill: var(--ink);
  fill-opacity: 0.045;
}

.hw-digit polygon[data-on] {
  fill-opacity: 0.92;
}

.hw-unit {
  top: 153px;
  left: 274px;
  font-size: 36px;
  line-height: 38px;
  opacity: 0.92;
}

.hw-of {
  top: 168px;
  right: 22px;
  font-size: 18px;
  line-height: 20px;
  opacity: 0.92;
}

.hw-bar {
  --on: #1b2019eb;
  --off: #1b20190b;
  position: absolute;
  top: 216px;
  left: 24px;
  width: 400px;
  height: 24px;
  background: repeating-linear-gradient(90deg, var(--off) 0 12.5px, #0000 12.5px 16px);
}

.hw-fill {
  width: round(down, var(--progress-value), 4%) !important;
  height: 100%;
  background: repeating-linear-gradient(90deg, var(--on) 0 12.5px, #0000 12.5px 16px);
  filter: drop-shadow(1.5px 2px 0 #1b201924);
}

.hw-label {
  top: 404px;
  left: 45.5px;
  width: 250px;
  font-size: 32px;
  line-height: 36px;
  font-weight: 560;
  font-stretch: 122%;
}

.hw-label span {
  display: block;
  margin-top: 2px;
  padding-left: 1.5px;
  font-size: 18px;
  line-height: 22px;
  font-weight: 460;
  font-stretch: 112%;
}

/* Etched leader from the label to its button. */
.hw-label::after {
  content: "";
  position: absolute;
  top: 18px;
  left: 79px;
  width: 203px;
  height: 1px;
  background: var(--etch);
  opacity: 0.7;
}

.hw-btn {
  position: absolute;
  top: 352px;
  right: 48px;
  width: 140px;
  height: 140px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  outline: none;
  cursor: pointer;
  background:
    repeating-radial-gradient(circle, #ffffff0d 0 0.5px, #0000000a 0.5px 1.5px),
    conic-gradient(from 28deg, #cdcfd0, #e6e7e7 12%, #c4c6c7 25%, #abadaf 37%, #c8cacb 50%, #e1e2e2 62%, #c2c4c5 75%, #a9abad 87%, #cdcfd0);
  box-shadow:
    inset 0 0 0 1px #ffffff8c,
    inset 0 0 0 2.5px #00000014,
    0 0 0 1px #1f212399,
    0 0 0 3px #00000012,
    0 3px 4px #00000042,
    0 8px 14px #0000001f;
  transition:
    translate 70ms ease-out,
    box-shadow 70ms ease-out,
    filter 70ms ease-out;
}

.hw-btn:active {
  translate: 0 1.5px;
  filter: brightness(0.965);
  box-shadow:
    inset 0 0 0 1px #ffffff8c,
    inset 0 0 0 2.5px #00000014,
    0 0 0 1px #1f212399,
    0 0 0 3px #00000012,
    0 1px 1px #00000052,
    0 2px 3px #0000001f;
}

.hw-btn:focus-visible {
  box-shadow:
    inset 0 0 0 1px #ffffff8c,
    0 0 0 1px #1f212399,
    0 0 0 5px #2b2d30;
}
