/* The Sync now button with the light running between the devices. The pill is a real <button>: its width and its
   place are set in pixels by the script (rest, syncing, synced) and its words are clipped by its rounded edge. The
   glass plate with the three devices sits above it in the same box and rises out of it while it syncs; the wires
   between the devices are drawn by the script from the real place of each icon, again on every resize. */
:root {
  --page: #000000;        /* the page */
  --pill-top: #1d2024;    /* the light on top of the pill */
  --pill: #0f1113;        /* the body of the pill */
  --ink: #eef2f1;         /* the words on the pill */
  --muted: #7c838a;       /* the small words */
  --dim: #4a5057;         /* the devices before the light reaches them */
  --wire: rgba(255, 255, 255, 0.13); /* the wire between the devices */
  --accent: #46e3c6;      /* the light, the lit devices, the tick */
}

* {
  box-sizing: border-box;
  margin: 0;
}

html {
  touch-action: manipulation;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

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

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

/* the box of the whole piece: the plate on top, the pill underneath while it syncs */
.sync {
  position: relative;
  width: min(384px, 90vw);
  height: min(272px, 62vh);
}

/* ---------------------------------------------------------------- the pill */
.pill {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 176px;
  height: 60px;
  padding: 0;
  border: 0;
  border-radius: 30px;
  font: inherit;
  color: var(--ink);
  background: none;
  cursor: pointer;
  z-index: 2;
  will-change: transform;
}

.pill:focus-visible {
  outline: none;
}

.pill:focus-visible .pill__edge {
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 40%, transparent));
}

/* the soft light of the accent under the pill, only while it syncs */
.pill__glow {
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: -14px;
  height: 30px;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  filter: blur(10px);
  opacity: 0;
  pointer-events: none;
}

.pill__skin {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  overflow: hidden;
  background: radial-gradient(130% 100% at 50% 0%, var(--pill-top) 0%, var(--pill) 62%, #0a0b0c 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.6),
    0 1px 0 rgba(255, 255, 255, 0.03),
    0 10px 24px -10px rgba(0, 0, 0, 0.9),
    0 24px 50px -24px color-mix(in srgb, var(--accent) 16%, transparent);
  pointer-events: none;
}

.pill__grain,
.pill__light,
.pill__edge,
.plate__grain,
.plate__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
}

/* a very fine grain, so the dark reads as a material and not a flat colour */
.pill__grain,
.plate__grain {
  opacity: 0.16;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0.33 0.33 0.33 0 0 0.33 0.33 0.33 0 0 0.33 0.33 0.33 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");
}

/* the light that follows the pointer inside the pill */
.pill__light {
  opacity: 0;
  background: radial-gradient(60px 50px at var(--mx, 50%) 0%, rgba(255, 255, 255, 0.1), transparent 70%);
}

/* the 1px edge that catches the light from above, and from the pointer */
.pill__edge {
  padding: 1px;
  background:
    radial-gradient(70px 40px at var(--mx, 50%) 0%, color-mix(in srgb, var(--accent) calc(var(--hl, 0) * 70%), transparent), transparent 80%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 45%, rgba(255, 255, 255, 0.02) 70%, rgba(255, 255, 255, 0.07));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

/* the hairline at the bottom of the pill that fills while it syncs */
.pill__progress {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent) 30%, var(--accent) 70%, transparent);
  transform-origin: 0 50%;
  transform: scaleX(0);
  opacity: 0.85;
}

.pill__row {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
}

.pill__icon {
  position: relative;
  flex: none;
  width: 20px;
  height: 20px;
}

.arrows,
.tick {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.arrows {
  stroke: currentColor;
  stroke-width: 1.7;
}

.tick {
  stroke: var(--accent);
  stroke-width: 1.8;
  visibility: hidden;
}

.tick circle {
  stroke-width: 1.3;
  opacity: 0.55;
}

.tick [pathLength] {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.pill__words {
  position: relative;
  flex: none;
  height: 22px;
  overflow: hidden;
  margin: -2px 0;
}

.word {
  position: absolute;
  left: 0;
  top: 0;
  line-height: 22px;
  white-space: nowrap;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.005em;
  font-variation-settings: 'wdth' 100;
}

.word em {
  font-style: normal;
  font-weight: 470;
  color: var(--muted);
  font-variation-settings: 'wdth' 96;
}

/* ---------------------------------------------------------------- the glass plate with the devices */
.plate {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: calc(100% - 72px);
  border-radius: 22px;
  background:
    radial-gradient(120% 80% at 50% 0%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(180deg, #121417, #0b0c0e);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 1px 0 rgba(255, 255, 255, 0.02),
    0 20px 44px -22px rgba(0, 0, 0, 0.9),
    0 30px 60px -36px color-mix(in srgb, var(--accent) 14%, transparent);
  transform-origin: 50% 100%;
  opacity: 0;
  visibility: hidden;
  display: grid;
  grid-template-rows: auto 1fr;
  padding: clamp(10px, 3vh, 14px) 16px clamp(8px, 2.6vh, 14px);
}

.plate__edge {
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04) 40%, rgba(255, 255, 255, 0.015) 75%, rgba(255, 255, 255, 0.06));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}

.plate__head {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  line-height: 16px;
  padding-bottom: clamp(6px, 2vh, 10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.plate__brand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 620;
  font-variation-settings: 'wdth' 108;
  letter-spacing: 0.01em;
}

.plate__quill {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  stroke-linecap: round;
}

.plate__meta {
  color: var(--muted);
  font-weight: 500;
}

.wires {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
  fill: none;
  stroke-linecap: round;
}

.wire {
  stroke: var(--wire);
  stroke-width: 1;
  stroke-dasharray: 2 3;
}

.trail {
  stroke: var(--accent);
  stroke-width: 1;
  opacity: 0.5;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.beam {
  stroke: var(--accent);
  opacity: 0;
}

.beam--haze {
  stroke-width: 6;
}

.beam--tail {
  stroke-width: 1.2;
}

.beam--mid {
  stroke-width: 1.6;
}

.beam--head {
  stroke: #e6fffa;
  stroke-width: 2;
}

.devs {
  position: relative;
  align-self: center;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
}

.dev {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 72px;
}

.dev__icon {
  width: clamp(44px, 13vh, 64px);
  aspect-ratio: 48 / 40;
}

.dev__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.dev__off {
  stroke: var(--dim);
  stroke-width: 1.3;
}

.dev__on {
  stroke: var(--accent);
  stroke-width: 1.3;
  opacity: 0;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--accent) 55%, transparent));
}

.dev__glass {
  stroke: none;
  fill: color-mix(in srgb, var(--accent) 12%, transparent);
}

.dev__note {
  stroke-width: 1.1;
  opacity: 0.8;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

/* the soft contact shadow under each device */
.dev__shadow {
  stroke: rgba(255, 255, 255, 0.06);
  stroke-width: 3;
  filter: blur(1.5px);
}

.dev__name {
  margin-top: clamp(4px, 1.4vh, 8px);
  font-size: 11.5px;
  font-weight: 560;
  line-height: 14px;
  color: var(--ink);
  font-variation-settings: 'wdth' 104;
  opacity: 0.9;
}

.dev__count {
  font-size: 11px;
  line-height: 14px;
  color: var(--muted);
  white-space: nowrap;
}

.num {
  position: relative;
  display: inline-block;
  height: 14px;
  min-width: 1.15em;
  text-align: right;
  overflow: hidden;
  vertical-align: bottom;
}

.num > span {
  position: absolute;
  right: 0;
  top: 0;
}

@media (hover: hover) {
  .pill:hover .pill__light {
    opacity: 1;
  }
}
