/* 540 frame: the face of the instrument. Display window 18..522 by 18..346, its glass 40..500 by 46..316.
   Below it, the legend at 40 and the switch 244..500 by 375..483: its left edge is the graph's, its right edge the glass's. */
.fr {
  --face: #f7bd00;
  --ink: #17150f;
  --glass: #aab39b;
  --seg: #1b2016;
  --signal: #ff4b12;
  position: relative;
  width: 540px;
  height: 540px;
  overflow: hidden;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='3' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0.25  0 0 0 0 0.16  0 0 0 0 0  0 0 0 -0.9 0.46'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(178deg, #ffcd1f 0%, #f8be00 46%, #eeb000 100%);
  color: var(--ink);
  font-family: "Michroma", sans-serif;
  -webkit-font-smoothing: antialiased;
  cursor: default;
  user-select: none;
}

.fr *,
.fr *::before,
.fr *::after {
  box-sizing: border-box;
}

/* the display window: smoked acrylic let into the face */
.fr-bezel {
  position: absolute;
  left: 18px;
  top: 18px;
  width: 504px;
  height: 328px;
  border-radius: 13px;
  background: linear-gradient(180deg, #1d1d1f 0%, #111112 30%, #0b0b0c 100%);
  box-shadow:
    0 -1.5px 0 #9c6f00,
    0 1.5px 0 #ffe07a,
    inset 0 0 0 1px #000,
    inset 0 2px 1px #ffffff14;
}

/* what the window's front face throws back: one soft band of the room, across acrylic and glass alike */
.fr-bezel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(118deg, #ffffff00 0 36%, #ffffff12 36.15% 47%, #ffffff00 47.15% 50%, #ffffff0b 50.15% 53%, #ffffff00 53.15%);
  pointer-events: none;
}

.fr-print {
  position: absolute;
  color: #e9e6da;
  font-size: 10.5px;
  line-height: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.fr-print-top {
  left: 23px;
  top: 9px;
}

/* the liquid crystal: reflective, lit from the room; the bezel shades its top edge */
.fr-lcd {
  position: absolute;
  left: 22px;
  top: 28px;
  width: 460px;
  height: 270px;
  border-radius: 3px;
  background: radial-gradient(120% 130% at 18% 0%, #bcc4ad 0%, #aab39b 48%, #9aa48b 100%);
  box-shadow:
    inset 0 5px 7px -2px #2b33205c,
    inset 3px 0 5px -3px #2b332040,
    inset 0 0 0 1px #20261a66;
  overflow: hidden;
}

.fr-lcd svg {
  display: block;
  width: 460px;
  height: 270px;
  /* every dark segment throws its shadow on the reflector a little way behind the glass */
  filter: drop-shadow(1.4px 2px 0.5px #1b201638);
}

.fr-lcd .on { fill: var(--seg); }
.fr-lcd .off { fill: var(--seg); opacity: 0.065; }
.fr-lcd .fr-ghost { fill: var(--seg); opacity: 0.075; }

.fr-lcd .fr-ring {
  fill: none;
  stroke: var(--seg);
  stroke-width: 5;
}

.fr-lcd .fr-c { stroke-width: 7; }

/* the hours, printed on the window under the graph */
.fr-hours {
  position: absolute;
  left: 226px;
  top: 304px;
  width: 240px;
  height: 20px;
}

.fr-hours i {
  position: absolute;
  top: 0;
  width: 40px;
  margin-left: -20px;
  padding-top: 7px;
  color: #e9e6da;
  font-size: 10.5px;
  font-style: normal;
  line-height: 12px;
  letter-spacing: 0.06em;
  text-align: center;
}

.fr-hours i::before {
  content: "";
  position: absolute;
  left: 19.5px;
  top: 0;
  width: 1px;
  height: 5px;
  background: #e9e6da;
}

/* the legend, printed on the face */
.fr-control {
  position: absolute;
  inset: 346px 0 0 0;
  display: block;
  cursor: pointer;
}

.fr-legend {
  position: absolute;
  left: 39px;
  top: 47px;
  font-size: 27px;
  line-height: 36px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* the switch: a slot moulded into the face, a ribbed slide in it.
   Sliding it across uncovers the signal colour on the floor of the slot. */
.fr-switch {
  position: absolute;
  left: 244px;
  top: 29px;
  width: 256px;
  height: 108px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 12px;
  outline: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 28 37' fill='%2317150f'%3E%3Cpath d='M14 1a2.8 2.8 0 0 1 2.8 2.8v1a9.6 9.6 0 0 1 6.8 9.2v8.4l3.7 4.9v2.6H.7v-2.6l3.7-4.9V14a9.6 9.6 0 0 1 6.8-9.2v-1A2.8 2.8 0 0 1 14 1Z'/%3E%3Cpath d='M9.5 31.6h9a4.5 4.5 0 0 1-9 0Z'/%3E%3C/svg%3E") no-repeat 53px 34px / 31px 41px,
    linear-gradient(90deg, var(--signal) 0 117px, #1a1a1b 117px) no-repeat 11px 11px / 234px 86px,
    #0a0a0a;
  box-shadow:
    0 -1.5px 0 #9c6f00,
    0 1.5px 0 #ffe07a,
    inset 0 5px 8px #000,
    inset 0 0 0 1px #000;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* the slot's walls shade its floor */
.fr-switch::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 5px;
  box-shadow:
    inset 0 14px 11px -7px #000000c4,
    inset 7px 0 8px -5px #00000094,
    inset -7px 0 8px -5px #00000066,
    inset 0 -4px 5px -4px #00000059;
  pointer-events: none;
}

.fr-switch:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 5px;
}

.fr-thumb {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 1;
  width: 120px;
  height: 92px;
  border-radius: 5px;
  /* seven moulded ribs across the middle, each lit on its left flank and shading the groove to its right */
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='58'%3E%3ClinearGradient id='r' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%236c6d71'/%3E%3Cstop offset='.55' stop-color='%23444548'/%3E%3Cstop offset='1' stop-color='%232a2b2d'/%3E%3C/linearGradient%3E%3Crect x='7' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='0' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='0.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='19' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='12' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='12.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='31' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='24' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='24.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='43' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='36' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='36.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='55' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='48' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='48.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='67' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='60' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='60.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='72' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='72.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3C/svg%3E") no-repeat 20px 17px / 80px 58px,
    linear-gradient(180deg, #424346 0%, #2e2f31 55%, #222325 100%);
  box-shadow:
    inset 0 1.5px 0 #6a6b6f,
    inset 0 -2px 0 #131314,
    inset 1px 0 0 #4c4d50,
    inset -1px 0 0 #1b1b1c,
    0 8px 8px -2px #000000d1,
    7px 0 9px -3px #000000a6,
    -7px 0 9px -3px #000000a6;
  translate: 0 0;
  transition: translate 130ms cubic-bezier(0.25, 0.8, 0.3, 1);
}

.fr-thumb[data-checked] { translate: 120px 0; }

.fr-switch:hover .fr-thumb {
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='58'%3E%3ClinearGradient id='r' x2='1' y2='0'%3E%3Cstop offset='0' stop-color='%236c6d71'/%3E%3Cstop offset='.55' stop-color='%23444548'/%3E%3Cstop offset='1' stop-color='%232a2b2d'/%3E%3C/linearGradient%3E%3Crect x='7' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='0' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='0.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='19' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='12' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='12.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='31' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='24' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='24.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='43' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='36' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='36.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='55' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='48' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='48.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='67' y='1' width='3.5' height='56' rx='1.75' fill='%23060607'/%3E%3Crect x='60' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='60.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3Crect x='72' width='7.5' height='58' rx='3.75' fill='url(%23r)'/%3E%3Crect x='72.6' y='2' width='1.3' height='54' rx='0.65' fill='%23a3a4a8' opacity='.7'/%3E%3C/svg%3E") no-repeat 20px 17px / 80px 58px,
    linear-gradient(180deg, #4b4c4f 0%, #353638 55%, #28292b 100%);
}

/* a thumb on it: pressed towards the floor of the slot */
.fr-switch:active .fr-thumb {
  box-shadow:
    inset 0 1.5px 0 #6a6b6f,
    inset 0 -2px 0 #131314,
    inset 1px 0 0 #4c4d50,
    inset -1px 0 0 #1b1b1c,
    0 3px 4px -1px #000000d9,
    2px 0 3px -2px #00000080,
    -2px 0 3px -2px #00000080;
}

.fr-ends {
  position: absolute;
  left: 252px;
  top: 498px;
  display: grid;
  grid-template-columns: 120px 120px;
  width: 240px;
  pointer-events: none;
}

.fr-ends i {
  font-size: 13px;
  font-style: normal;
  line-height: 14px;
  letter-spacing: 0.2em;
  text-align: center;
  text-indent: 0.2em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
  .fr-thumb { transition: none; }
}
