/* The oven temperature knob with the notches that click: the oven card of a smart home app on a black page. The
   knob is made of layers: .knob__lift (GSAP: pop out, press), .knob__turn (GSAP: rotation) with the knurled rim, the
   brushed face and the mark, .knob__sheen inside it turned the other way by GSAP, and over them the warm light of the
   panel. The panel's warmth is two layers whose opacity follows the heat. */
:root {
  --page: #000000;            /* the page */
  --card: #111113;            /* the body of the panel */
  --edge: rgba(255, 255, 255, 0.075); /* the panel's edge */
  --ink: #f1efec;             /* the words */
  --muted: #85837f;           /* the small words */
  --tick: rgba(255, 255, 255, 0.17); /* a notch that is off */
  --warm: #ffb054;            /* the first lit notches, and the warmth of the panel */
  --ember: #ff4f1f;           /* the hottest notches */
  --metal: #b9bdc3;           /* the aluminium of the knob */
  --ready: #ffd29a;           /* the ring when the oven is ready */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 12px;
  overflow: hidden;
}

/* ---------------------------------------------------------------- the panel */
.oven {
  --dial: min(66vw, 47vh, 262px);
  position: relative;
  width: min(92vw, 368px);
  padding: clamp(14px, 3.4vh, 22px) clamp(16px, 5vw, 22px) clamp(14px, 3.2vh, 20px);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0) 38%),
    var(--card);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 24px 48px -24px rgba(0, 0, 0, 0.9);
  isolation: isolate;
  opacity: 0;
}

/* the warm glow the hot panel throws on the page under it */
.oven::after {
  content: '';
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -40px;
  height: 52px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--ember) 40%, transparent), transparent);
  filter: blur(14px);
  opacity: var(--glow, 0);
  pointer-events: none;
  z-index: -2;
}

/* the warmth that rises from the bottom of the panel */
.oven__heat {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(120% 70% at 50% 108%, color-mix(in srgb, var(--warm) 46%, transparent), transparent 62%),
    radial-gradient(70% 46% at 50% 46%, color-mix(in srgb, var(--warm) 14%, transparent), transparent 70%);
  opacity: 0;
  pointer-events: none;
  z-index: -1;
}

.oven__heat--hot {
  background:
    radial-gradient(110% 60% at 50% 110%, color-mix(in srgb, var(--ember) 52%, transparent), transparent 58%),
    radial-gradient(60% 38% at 50% 48%, color-mix(in srgb, var(--ember) 12%, transparent), transparent 72%);
}

.oven__head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.oven__logo {
  width: 30px;
  height: 30px;
  flex: none;
  fill: rgba(255, 255, 255, 0.04);
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  border-radius: 9px;
}

.oven__titles {
  display: grid;
  line-height: 1.15;
  min-width: 0;
}

.oven__name {
  font-size: 15px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
}

.oven__room {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.oven__mode {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 11px 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #d9d6d1;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}

.oven__mode svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
}

/* ---------------------------------------------------------------- the dial */
.dial {
  position: relative;
  width: var(--dial);
  height: var(--dial);
  margin: clamp(6px, 2vh, 14px) auto 0;
}

.dial__scale {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.tick {
  stroke: var(--tick);
  stroke-width: 1.3;
  stroke-linecap: round;
  transition: stroke 0.3s ease, stroke-width 0.3s ease;
}

.tick.is-lit {
  stroke: var(--c);
  stroke-width: 1.7;
}

.tick.is-head {
  stroke: #fff6ea;
  stroke-width: 2.4;
}

.dial__label {
  font-size: 7.4px;
  font-weight: 500;
  fill: var(--muted);
  text-anchor: middle;
  dominant-baseline: central;
  transition: fill 0.3s ease;
}

.dial__label.is-lit {
  fill: var(--ink);
}

.ring__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 1.2;
}

.ring__fill {
  fill: none;
  stroke: var(--warm);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.ring__head {
  fill: none;
  stroke: #fff3e2;
  stroke-width: 2.2;
  stroke-linecap: round;
}

/* the recess the knob sits in */
.dial__well {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #050506 55%, #1b1b1e 100%);
  box-shadow:
    inset 0 3px 6px rgba(0, 0, 0, 0.9),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.03);
}

/* ---------------------------------------------------------------- the knob */
.knob {
  position: absolute;
  inset: 23.5%;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}

.knob.is-turning {
  cursor: grabbing;
}

.knob:focus-visible {
  outline: 2px solid var(--warm);
  outline-offset: 6px;
}

.knob__shadow {
  position: absolute;
  inset: 4% 2% -6%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.4) 70%, transparent);
  filter: blur(7px);
  opacity: 0.2;
  pointer-events: none;
}

.knob__lift,
.knob__turn,
.knob__knurl,
.knob__face,
.knob__sheen,
.knob__rings,
.knob__warm,
.knob__flush {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.knob__lift,
.knob__turn {
  inset: 0;
}

/* the knurled rim: fine grooves that turn with the hand */
.knob__knurl {
  inset: 0;
  background:
    radial-gradient(circle, transparent 79%, rgba(0, 0, 0, 0.55) 80.5%, transparent 83%, transparent 97%, rgba(0, 0, 0, 0.6) 100%),
    repeating-conic-gradient(from 0deg, #5c6067 0deg 1.4deg, #e4e7ea 1.4deg 2.2deg, #8f949b 2.2deg 3.6deg),
    var(--metal);
  box-shadow:
    0 0 0 0.5px rgba(255, 255, 255, 0.2),
    inset 0 1px 1px rgba(255, 255, 255, 0.5);
}

/* the brushed face */
.knob__face {
  inset: 9%;
  background: #a6aab0;
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, 0.7),
    inset 0 -1px 2px rgba(0, 0, 0, 0.35),
    0 0 0 1px rgba(0, 0, 0, 0.35);
}

/* the reflection of the brushed aluminium: GSAP turns it the other way from the knob */
.knob__sheen {
  inset: 9%;
  background: conic-gradient(from 0deg,
      #7d828a 0deg, #eef0f2 22deg, #a3a8ae 52deg, #6a6f76 92deg, #8c9198 124deg,
      #f6f7f8 168deg, #9da2a8 200deg, #61666d 246deg, #a9aeb4 292deg, #e3e6e9 330deg, #7d828a 360deg);
  mix-blend-mode: normal;
}

/* the concentric brush lines, which do not change as it turns */
.knob__rings {
  inset: 9%;
  background:
    repeating-radial-gradient(circle, rgba(255, 255, 255, 0.07) 0 0.6px, rgba(0, 0, 0, 0.06) 0.6px 1.4px, transparent 1.4px 2.2px),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.25) 0 6%, transparent 7%, transparent 14%, rgba(0, 0, 0, 0.12) 15%, transparent 17%);
}

/* the mark: an engraved groove with an ember line in it */
.knob__mark {
  position: absolute;
  left: 50%;
  top: 12%;
  width: 4px;
  height: 27%;
  margin-left: -2px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--ember), #ff8a3d);
  box-shadow:
    inset 0 1px 1px rgba(0, 0, 0, 0.45),
    0 1px 0 rgba(255, 255, 255, 0.55),
    0 0 6px color-mix(in srgb, var(--ember) 40%, transparent);
}

/* the panel's warmth caught on the bottom of the metal */
.knob__warm {
  inset: 0;
  background: radial-gradient(90% 60% at 50% 104%, color-mix(in srgb, var(--warm) 75%, transparent), transparent 62%);
  mix-blend-mode: soft-light;
  opacity: 0;
}

/* flush in the panel the knob is in shadow */
.knob__flush {
  inset: 0;
  background: radial-gradient(circle at 50% 30%, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.55));
  opacity: 1;
}

/* ---------------------------------------------------------------- the reading */
.read {
  margin-top: clamp(4px, 1.4vh, 10px);
  text-align: center;
}

.read__temp {
  position: relative;
  margin: 0;
  height: clamp(42px, min(13vw, 11vh), 54px);
  font-size: clamp(42px, min(13vw, 11vh), 54px);
  line-height: 1;
  font-weight: 620;
  font-variation-settings: 'wdth' 92;
  letter-spacing: -0.035em;
}

.read__off,
.read__num {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

.read__off {
  color: #6f6d6a;
  font-variation-settings: 'wdth' 100;
}

.read__num {
  opacity: 0;
}

.roll {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  overflow: hidden;
}

.roll__col {
  display: flex;
  flex-direction: column;
}

.roll__col span {
  display: block;
  height: 1em;
  text-align: center;
}

.read__unit {
  margin: 0.08em 0 0 0.06em;
  font-size: 0.36em;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--muted);
}

.read__status {
  margin: clamp(6px, 1.6vh, 10px) 0 0;
  display: flex;
  justify-content: center;
  gap: 8px;
  height: 18px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

.read__state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #cfccc6;
}

.read__check {
  width: 0;
  height: 14px;
  fill: none;
  stroke: var(--ready);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.read__check path {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.read__now:empty {
  display: none;
}

/* ---------------------------------------------------------------- the pilot's hand */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  fill: #17171c;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.5));
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}

@media (max-height: 460px) {
  .oven__room {
    display: none;
  }
}
