/* The pairing bulb: a dark panel on a black page, a clear glass bulb with a metal screw base.
   The colours of the hot coil are not here: script.js works them out from the temperature, like a real hot body. */
:root {
  --page: #000000;          /* the page */
  --panel: #111110;         /* the panel */
  --panel-edge: #262523;    /* the panel's fine edge */
  --ink: #f3efe8;           /* the words */
  --muted: #8d8981;         /* the quieter words */
  --error: #ff7b5e;         /* the words that say what went wrong */
  --cold: #6b665f;          /* the tungsten coil when it is cold */
  --wire: #7a766f;          /* the wires that hold the coil */
  --stem: #c9c4bb;          /* the glass rod in the middle */
  --metal-hi: #e4dfd6;      /* the screw base: the light on the metal */
  --metal-mid: #8f8a82;     /* the screw base: the metal */
  --metal-lo: #2b2a28;      /* the screw base: the dark sides */
  --insulator: #0b0b0b;     /* the black glass under the threads */
  --button: #f3efe8;        /* the button */
  --button-ink: #121110;    /* its words */
}

* {
  box-sizing: border-box;
}

/* a tap is a click at once: no wait for a double tap, no zoom */
html {
  touch-action: manipulation;
}

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

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

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

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the panel */
.pair {
  position: relative;
  isolation: isolate;
  width: min(380px, 100%);
  padding: 18px 20px 18px;
  overflow: hidden;
  border-radius: 26px;
  background: var(--panel);
  box-shadow: inset 0 0 0 1px var(--panel-edge);
}

/* the bulb's light on the panel: a warm pool round the bulb, wider and brighter once it is on */
.pair__light {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
}

.pair__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.pair__words {
  min-width: 0;
}

.pair__title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  font-stretch: 96%;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.pair__meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 430;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the words that change slide by themselves */
.pair__swap {
  display: inline-block;
}

.pair__swap .is-error {
  color: var(--error);
}

/* the coil's temperature, read off it like a meter */
.pair__kelvin {
  flex: none;
  margin: 1px 0 0;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  font-weight: 560;
  font-stretch: 92%;
  line-height: 16px;
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.pair__kelvin.is-hot {
  color: var(--ink);
}

/* ---------------------------------------------------------------- the bulb */
.pair__bulb {
  position: relative;
  height: 222px;
  margin: 2px 0 6px;
  display: grid;
  place-items: center;
}

.pair__art {
  width: 171px;
  height: 220px;
  overflow: visible;
}

.pair__wires path {
  stroke: var(--wire);
  stroke-width: 1.1;
}

.pair__coil--back {
  stroke-width: 1.15;
}

.pair__coil--front {
  stroke-width: 1.5;
}

.pair__coil--glow {
  stroke-width: 2.4;
}

.pair__coil--core {
  stroke-width: 0.7;
}

/* ---------------------------------------------------------------- the readout and the button */
.pair__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pair__readout {
  min-width: 0;
}

.pair__pct {
  position: relative;
  display: flex;
  align-items: center;
  margin: 0;
  font-size: 20px;
  font-weight: 620;
  font-stretch: 94%;
  line-height: 24px;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.pair__pct.is-quiet {
  color: var(--muted);
}

.pair__tick {
  flex: none;
  width: 0;
  height: 22px;
  margin-right: 0;
  fill: none;
  stroke: var(--lit, #ffcf96);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.pair__sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 450;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* the button: its words widen on the width axis under the pointer, and it squashes a little when pressed */
.pair__btn {
  position: relative;
  flex: none;
  height: 38px;
  padding: 0 18px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 38px;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

.pair__label {
  display: inline-block;
  font-stretch: 86%;
  transition: font-stretch 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* while the pairing runs the button only cancels it: it steps back */
.pair__btn.is-quiet {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.16);
}

@media (hover: hover) and (pointer: fine) {
  .pair__btn:hover .pair__label {
    font-stretch: 104%;
  }

  .pair__btn:hover {
    background: #ffffff;
  }

  .pair__btn.is-quiet:hover {
    background: rgba(255, 255, 255, 0.07);
  }
}

.pair__btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

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