/* The honeycomb of integrations to drag. A frosted panel on a near black page with two soft lights
   behind it and a little grain. In the middle a field of glass bubbles: each bubble (.hb) is moved only by the script,
   one transform per frame; its face (.hb__face) is styled and lifted only by the CSS. The rim of the panel catches a
   light that follows the pointer (--mx, --my). */
:root {
  --page: #08080b;            /* the page */
  --panel: rgba(21, 21, 27, 0.86); /* the frosted panel */
  --edge: rgba(255, 255, 255, 0.09); /* the edge at rest */
  --ink: #f2f2f5;             /* the words */
  --muted: #8b8b98;           /* the small words */
  --accent: #8d7dff;          /* the bubble in the middle and its light */
  --accent-2: #5f8bff;        /* the second colour of its gradient */
  --on: #6fe3bf;              /* connected */
  --button: #f3f3f6;          /* the Connect button */
  --button-ink: #0b0b0e;      /* the words on the button */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

body {
  min-height: 100svh;
  background:
    radial-gradient(60vmax 40vmax at 20% 12%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
    radial-gradient(55vmax 40vmax at 85% 92%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
    var(--page);
  color: var(--ink);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* a little grain over everything */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.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: 16px;
  overflow: hidden;
}

.panel {
  --mx: 30%;
  --my: 0%;
  position: relative;
  width: min(92vw, 372px);
  padding: clamp(12px, 3.4vh, 18px) clamp(12px, 4vw, 16px) clamp(10px, 2.8vh, 14px);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0) 38%),
    var(--panel);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.5),
    0 12px 30px -10px rgba(0, 0, 0, 0.6),
    0 50px 90px -40px rgba(0, 0, 0, 0.9);
  opacity: 0;
}

/* the rim catches a light where the pointer is: a radial gradient masked down to the 1px border */
.panel__rim {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  pointer-events: none;
  background: radial-gradient(180px 140px at var(--mx) var(--my), color-mix(in srgb, var(--accent) 80%, #fff), transparent 70%);
  -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);
  opacity: 0.85;
}

.panel__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.panel__title {
  margin: 0;
  font-size: 16px;
  font-weight: 620;
  font-variation-settings: 'wdth' 106;
  letter-spacing: 0.005em;
}

.panel__sub {
  margin: 3px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.panel__count {
  margin: 1px 0 0;
  display: flex;
  align-items: baseline;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 560;
  color: var(--ink);
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.panel__of {
  color: var(--muted);
  font-weight: 450;
}

/* numbers that roll: one column of digits per place */
.roll {
  display: inline-flex;
  align-items: flex-start;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  height: 1.2em;
  overflow: hidden;
  flex: none;
}

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

.roll__col span,
.roll__sym {
  display: block;
  height: 1.2em;
}

/* the honeycomb */
.field {
  position: relative;
  height: clamp(150px, 46vh, 262px);
  margin: clamp(8px, 2.2vh, 14px) 0 clamp(8px, 2vh, 12px);
  border-radius: 20px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
  background: radial-gradient(closest-side, rgba(255, 255, 255, 0.035), transparent);
  -webkit-mask: radial-gradient(closest-side, #000 72%, transparent 100%) center / 118% 118% no-repeat;
  mask: radial-gradient(closest-side, #000 72%, transparent 100%) center / 118% 118% no-repeat;
  -webkit-user-select: none;
  user-select: none;
}

.field.is-grabbing {
  cursor: grabbing;
}

.field__glow {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  aspect-ratio: 1;
  margin: -23% 0 0 -23%;
  border-radius: 50%;
  background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 34%, transparent), transparent);
  filter: blur(10px);
  pointer-events: none;
}

.field__layer {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
}

.hb {
  position: absolute;
  left: 0;
  top: 0;
  width: var(--b, 64px);
  height: var(--b, 64px);
  margin: calc(var(--b, 64px) / -2) 0 0 calc(var(--b, 64px) / -2);
  will-change: transform, opacity;
}

.hb__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0) 55%),
    linear-gradient(160deg, #23232c, #121218);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.1),
    inset 0 -6px 12px rgba(0, 0, 0, 0.35),
    0 8px 18px -8px rgba(0, 0, 0, 0.8);
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.4s ease;
}

/* the accent fill of the bubble in the middle, faded in on its own layer */
.hb__face::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0) 52%),
    linear-gradient(150deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), inset 0 -8px 14px rgba(20, 10, 70, 0.35);
  opacity: 0;
  transition: opacity 0.35s ease;
}

.hb__face svg {
  position: relative;
  width: 40%;
  height: 40%;
  fill: none;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hb.is-focus .hb__face {
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.2),
    0 10px 26px -6px color-mix(in srgb, var(--accent) 70%, transparent),
    0 0 0 5px color-mix(in srgb, var(--accent) 14%, transparent);
}

.hb.is-focus .hb__face::before {
  opacity: 1;
}

.hb.is-focus .hb__face svg {
  stroke: #fff;
}

/* the small badge of a connected tool: a mint disc with a drawn check */
.hb__badge {
  position: absolute;
  right: 2%;
  top: 2%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: var(--on);
  box-shadow: 0 0 0 2.5px #121218, 0 4px 10px -2px rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
  transform: scale(0);
}

.hb__badge svg {
  width: 62%;
  height: 62%;
  fill: none;
  stroke: #0b231b;
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (hover: hover) {
  .hb:hover .hb__face {
    transform: translateY(-2px) scale(1.05);
  }
  .field.is-grabbing .hb:hover .hb__face {
    transform: none;
  }
}

/* the dock: the tool in the middle and its button */
.dock {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.035);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.dock__icon {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0) 55%),
    linear-gradient(150deg, var(--accent), var(--accent-2));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22), 0 6px 16px -6px color-mix(in srgb, var(--accent) 80%, transparent);
}

.dock__icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock__text {
  flex: 1;
  min-width: 0;
}

.dock__name {
  margin: 0;
  font-size: 14.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 104;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock__meta {
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
}

/* the category gives way first; the number never does */
.dock__cat {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dock__events {
  flex: none;
  display: inline-flex;
  align-items: baseline;
  color: var(--ink);
  font-weight: 520;
}

.dock__unit {
  color: var(--muted);
  font-weight: 450;
}

.dock__btn {
  flex: none;
  height: 44px;
  min-width: 112px;
  padding: 0 16px 0 13px;
  border: 0;
  border-radius: 999px;
  background: var(--button);
  color: var(--button-ink);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.1), 0 6px 16px -8px rgba(255, 255, 255, 0.35);
  transition: background-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

.dock__btn.is-on {
  background: color-mix(in srgb, var(--on) 14%, transparent);
  color: var(--on);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--on) 40%, transparent);
}

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

.dock__btn-face {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 100%;
}

.dock__btn-words {
  font-size: 13.5px;
  font-weight: 600;
  font-variation-settings: 'wdth' 100;
  transition: font-variation-settings 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@media (hover: hover) {
  .dock__btn:hover .dock__btn-words {
    font-variation-settings: 'wdth' 112;
  }
}

.dock__btn-icon {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
}

.dock__spin {
  stroke-dasharray: 0.3 0.7;
  opacity: 0;
  transform-origin: 8px 8px;
}

.dock__check {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

@media (max-width: 400px) {
  .dock {
    gap: 10px;
  }
  .dock__icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
  .dock__btn {
    min-width: 0;
    padding: 0 14px 0 12px;
  }
  .dock__btn-face {
    gap: 6px;
  }
  .dock__btn-words {
    font-size: 13px;
  }
  .dock__meta {
    font-size: 11px;
    gap: 5px;
  }
}

@media (max-width: 360px) {
  .stage {
    padding: 12px;
  }
}
