/* The remote start button with the rev needle that settles to idle. A graphite pill (.rs__body, moved only by GSAP)
   holds three still layers: the metal with its hairlines and 1px edges (.rs__metal), a light that follows the pointer
   (.rs__shine) and the reflection that crosses it when the engine catches (.rs__sweep). On top the rev counter in its
   glass well, the two lines of words and the chip with the power sign that becomes the minutes left. */
:root {
  --page: #000000;            /* the page */
  --metal-top: #2c2f35;       /* the metal, top */
  --metal-bottom: #111317;    /* the metal, bottom */
  --ink: #eef0f3;             /* the words */
  --muted: rgba(238, 240, 243, 0.54); /* the small line */
  --accent: #8fd8ff;          /* the backlight of the cluster: lit ticks, the arc, the minutes */
  --needle: #ff8a4c;          /* the needle */
  --red: #ff5a4a;             /* the red line at the top of the scale */
  --warm: #ffc38a;            /* the cabin temperature while it warms */
}

* {
  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 {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
}

.rs {
  position: relative;
  display: grid;
  place-items: center;
}

/* the backlight the button throws on the floor once the engine runs */
.rs__spill {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 96%;
  height: 40px;
  margin: -18px 0 0 -48%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 50%, transparent), transparent);
  filter: blur(16px);
  opacity: 0;
  pointer-events: none;
}

.rs__btn {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  border-radius: 999px;
  -webkit-tap-highlight-color: transparent;
}

.rs__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 5px;
}

.rs__body {
  --mx: 30%;
  --my: 0%;
  position: relative;
  display: block;
  width: min(88vw, 312px);
  height: 60px;
  border-radius: 999px;
  isolation: isolate;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.04),
    0 1px 1px rgba(0, 0, 0, 0.6),
    0 8px 16px -8px rgba(0, 0, 0, 0.9),
    0 24px 44px -20px rgba(0, 0, 0, 1);
}

.rs__metal,
.rs__shine,
.rs__sweep {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  pointer-events: none;
}

/* graphite: horizontal hairlines, a soft slanted band of light, edges that catch the light */
.rs__metal {
  background:
    repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.02) 0 1px, rgba(0, 0, 0, 0.03) 1px 2px, transparent 2px 3px),
    linear-gradient(100deg, transparent 10%, rgba(255, 255, 255, 0.045) 32%, transparent 48%, transparent 66%, rgba(255, 255, 255, 0.03) 82%, transparent 94%),
    linear-gradient(180deg, var(--metal-top) 0%, color-mix(in srgb, var(--metal-top) 50%, var(--metal-bottom)) 46%, var(--metal-bottom) 100%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.07),
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.5),
    inset 0 -12px 18px -14px rgba(0, 0, 0, 0.8);
}

.rs__metal::after {
  content: '';
  position: absolute;
  left: 7%;
  right: 7%;
  top: 1px;
  height: 42%;
  border-radius: 999px 999px 40% 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0));
}

/* a faint blue backlight inside the metal while the engine runs (GSAP moves its opacity) */
.rs__metal::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(70px 44px at 30px 50%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 80%);
  opacity: var(--on, 0);
}

.rs__shine {
  background: radial-gradient(120px 34px at var(--mx) var(--my), rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.03) 55%, transparent 75%);
  opacity: 0;
}

.rs__sweep-band {
  position: absolute;
  top: -30%;
  left: 0;
  width: 34%;
  height: 160%;
  transform: translateX(-120%);
  background: linear-gradient(100deg, transparent 0%, rgba(255, 255, 255, 0.04) 30%, rgba(200, 236, 255, 0.22) 50%, rgba(255, 255, 255, 0.04) 70%, transparent 100%);
}

.rs__row {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 9px 0 8px;
  gap: 11px;
}

/* the rev counter in a glass well sunk into the metal */
.rs__gauge {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.9),
    0 1px 0 rgba(255, 255, 255, 0.08);
}

.rs__gauge svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.rs__well {
  fill: url(#rs-glass);
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 0.6;
}

.rs__track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 1.6;
  stroke-linecap: round;
}

.rs__lit {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  opacity: 0.9;
}

.rs__tick {
  stroke: rgba(255, 255, 255, 0.22);
  stroke-linecap: round;
}

.rs__tick--major {
  stroke-width: 1.1;
}

.rs__tick--minor {
  stroke-width: 0.7;
}

.rs__tick--red {
  stroke: color-mix(in srgb, var(--red) 55%, transparent);
}

.rs__glass {
  fill: none;
  stroke: rgba(255, 255, 255, 0.07);
  stroke-width: 1.4;
  stroke-linecap: round;
}

.rs__hub {
  fill: #1a1d22;
  stroke: rgba(255, 255, 255, 0.22);
  stroke-width: 0.6;
}

.rs__hub-dot {
  fill: rgba(255, 255, 255, 0.5);
}

.rs__unit {
  fill: rgba(255, 255, 255, 0.32);
  font-size: 4.6px;
  font-weight: 560;
  letter-spacing: 0.06em;
  text-anchor: middle;
  font-variation-settings: 'wdth' 110;
}

.rs__text {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 2px;
  text-align: left;
}

.rs__labels,
.rs__subs {
  display: grid;
}

.rs__label {
  grid-area: 1 / 1;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 580;
  font-variation-settings: 'wdth' 100;
  letter-spacing: 0.002em;
  white-space: nowrap;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

/* Starting shimmers: a band of light slides through the letters (GSAP moves background-position) */
.rs__label--busy {
  background: linear-gradient(90deg, var(--ink) 0%, var(--ink) 38%, #ffffff 46%, var(--accent) 50%, #ffffff 54%, var(--ink) 62%, var(--ink) 100%);
  background-size: 260% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
}

.rs__sub {
  grid-area: 1 / 1;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 480;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' 92;
  color: var(--muted);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rs__temp {
  display: inline-block;
  color: var(--warm);
  font-weight: 560;
}

/* the chip on the right: a recess with the power sign at rest, the minutes left while the engine runs */
.rs__chip {
  flex: none;
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 34px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.34), rgba(255, 255, 255, 0.02));
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.7),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04),
    0 1px 0 rgba(255, 255, 255, 0.07);
}

.rs__chip::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 38%, transparent), 0 0 14px -4px color-mix(in srgb, var(--accent) 60%, transparent);
  opacity: var(--on, 0);
}

.rs__power {
  grid-area: 1 / 1;
  width: 18px;
  height: 18px;
  overflow: visible;
}

.rs__power path {
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.7;
  stroke-linecap: round;
}

.rs__time {
  grid-area: 1 / 1;
  display: inline-flex;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-variation-settings: 'wdth' 96;
  color: var(--accent);
  letter-spacing: 0.01em;
  opacity: 0;
}

.rs__sec {
  display: inline-block;
}

.rs__sec > span {
  display: inline-block;
}

/* before the script runs, only the rest state shows */
.rs__label + .rs__label,
.rs__sub + .rs__sub {
  opacity: 0;
}
