/* The canvas toolbar you throw that snaps to the edges: the canvas of a design tool on a near black page. The toolbar's
   body is an SVG path drawn every frame through the tools (a thick round stroke, its 1px rim, a soft sheen and a
   blurred shadow); the tools are HTML buttons placed on the chain by the script. Every size comes from --s, the
   spacing between two tools, which the script works out from the smaller side of the page. */
:root {
  --page: #0b0c10;            /* the page */
  --body: #16171d;            /* the toolbar's body */
  --ink: #f2f3f7;             /* the active icon and the words */
  --muted: #8b8d99;           /* the icons at rest */
  --violet: #8b7bff;          /* the first light */
  --cyan: #5fd8ff;            /* the second light */
  --board: #121318;           /* the frame on the canvas */
  --s: 46px;                  /* set by the script */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow: hidden;
}

body {
  height: 100vh;
  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: rect(0 0 0 0);
  white-space: nowrap;
}

.stage {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, 0.025), transparent 60%),
    var(--page);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* grain over everything, very fine */
.stage::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0.09;
  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='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .7 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

.glow {
  position: absolute;
  z-index: 0;
  width: min(70vw, 70vh);
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(min(9vw, 9vh));
  opacity: 0.16;
  pointer-events: none;
}

.glow--a {
  left: -18%;
  top: -22%;
  background: var(--violet);
}

.glow--b {
  right: -20%;
  bottom: -26%;
  background: var(--cyan);
  opacity: 0.09;
}

/* the canvas grid: thin lines, fading towards the edges */
.grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: calc(var(--s) * 0.5) calc(var(--s) * 0.5);
  background-position: center;
  -webkit-mask-image: radial-gradient(70% 65% at 50% 48%, #000 20%, transparent 85%);
  mask-image: radial-gradient(70% 65% at 50% 48%, #000 20%, transparent 85%);
}

/* the selected frame in the middle of the canvas */
.board {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 46%;
  width: min(54vw, 62vh);
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.board__head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: clamp(9px, min(1.6vw, 2vh), 11px);
  font-variation-settings: 'wdth' 92;
  letter-spacing: 0.01em;
  color: var(--muted);
}

.board__frame {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: 3px;
  background: linear-gradient(180deg, #15161c, var(--board));
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05), 0 24px 60px -20px rgba(0, 0, 0, 0.8);
  overflow: hidden;
}

.board__img {
  position: absolute;
  right: 7%;
  top: 14%;
  width: 40%;
  height: 72%;
  border-radius: 6px;
  background:
    radial-gradient(80% 70% at 30% 30%, rgba(139, 123, 255, 0.55), transparent 70%),
    radial-gradient(70% 60% at 80% 80%, rgba(95, 216, 255, 0.4), transparent 70%),
    #1b1c24;
}

.board__line {
  position: absolute;
  left: 7%;
  height: 7%;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.14);
}

.board__line--a {
  top: 24%;
  width: 38%;
}

.board__line--b {
  top: 36%;
  width: 28%;
  background: rgba(255, 255, 255, 0.08);
}

.board__cta {
  position: absolute;
  left: 7%;
  top: 58%;
  width: 18%;
  height: 11%;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.85);
}

.board__sel {
  position: absolute;
  left: 5%;
  top: 19%;
  width: 43%;
  height: 25%;
  border: 1px solid var(--violet);
}

.board__sel i {
  position: absolute;
  width: 5px;
  height: 5px;
  background: #fff;
  border: 1px solid var(--violet);
}

.board__sel i:nth-child(1) { left: -3px; top: -3px; }
.board__sel i:nth-child(2) { right: -3px; top: -3px; }
.board__sel i:nth-child(3) { left: -3px; bottom: -3px; }
.board__sel i:nth-child(4) { right: -3px; bottom: -3px; }

/* the light under the toolbar, stronger when it moves */
.halo {
  position: absolute;
  z-index: 2;
  left: 0;
  top: 0;
  width: calc(var(--s) * 5);
  height: calc(var(--s) * 3);
  margin: calc(var(--s) * -1.5) 0 0 calc(var(--s) * -2.5);
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(139, 123, 255, 0.5), rgba(95, 216, 255, 0.12) 55%, transparent);
  filter: blur(14px);
  opacity: 0.25;
  pointer-events: none;
  will-change: transform, opacity;
}

/* the toolbar's body */
.tb {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.tb path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tb__shadow {
  stroke: rgba(0, 0, 0, 0.75);
}

.tb__body {
  stroke: var(--body);
}

.tb__sheen {
  stroke: rgba(255, 255, 255, 0.05);
}

.tb__shine {
  opacity: 0;
}

.tb__hit {
  stroke: transparent;
  pointer-events: stroke;
  cursor: grab;
}

.tb__zones rect {
  fill: none;
  stroke: rgba(255, 255, 255, 0.12);
  stroke-width: 1;
  stroke-dasharray: 3 5;
}

.tb__zones rect.is-near {
  stroke: var(--cyan);
  stroke-dasharray: none;
  stroke-opacity: 0.55;
}

/* the selected tool's soft glass square */
.pick {
  position: absolute;
  z-index: 4;
  left: 0;
  top: 0;
  width: calc(var(--s) * 0.82);
  height: calc(var(--s) * 0.82);
  margin: calc(var(--s) * -0.41) 0 0 calc(var(--s) * -0.41);
  border-radius: calc(var(--s) * 0.26);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06),
    0 4px 10px -4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  will-change: transform;
}

.tools {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.tool {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(var(--s) * 0.82);
  height: calc(var(--s) * 0.82);
  margin: calc(var(--s) * -0.41) 0 0 calc(var(--s) * -0.41);
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  will-change: transform;
}

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

.tool:focus-visible .tool__face {
  box-shadow: 0 0 0 1.5px var(--cyan);
}

.tool__face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border-radius: calc(var(--s) * 0.26);
  transition: color 0.25s;
}

.tool svg {
  width: 52%;
  height: 52%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool[aria-pressed='true'] {
  color: var(--ink);
}

.tool--grip {
  cursor: grab;
  color: rgba(255, 255, 255, 0.28);
}

.tool--grip svg {
  width: 46%;
  height: 46%;
}

.tool--ai {
  color: var(--ink);
}

.tool__ring {
  position: absolute;
  inset: 12%;
  border-radius: calc(var(--s) * 0.22);
  background:
    linear-gradient(var(--body), var(--body)) padding-box,
    linear-gradient(135deg, var(--violet), var(--cyan)) border-box;
  border: 1px solid transparent;
  box-shadow: 0 0 14px -4px rgba(139, 123, 255, 0.8);
}

.tool--ai svg {
  position: relative;
}

.spark {
  fill: #fff;
  stroke: none;
}

.spark--s {
  fill: var(--cyan);
}

@media (hover: hover) {
  .tool:hover {
    color: var(--ink);
  }

  .tool--grip:hover {
    color: rgba(255, 255, 255, 0.6);
  }
}

/* the name of the tool, on the outer side of the bar */
.tip {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 0;
  pointer-events: none;
  will-change: transform, opacity;
  opacity: 0;
}

.tip__inner {
  display: flex;
  align-items: center;
  gap: 7px;
  transform: translate(-50%, -50%);
  padding: 5px 6px 5px 10px;
  border-radius: 9px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 520;
  font-variation-settings: 'wdth' 96;
  color: var(--ink);
  background: rgba(30, 31, 39, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 10px 24px -8px rgba(0, 0, 0, 0.8);
}

.tip kbd {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  font: inherit;
  font-size: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.4);
}

/* the hand of the walk on its own: a plain arrow */
.cursor {
  position: absolute;
  z-index: 8;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -5px;
  opacity: 0;
  pointer-events: none;
  overflow: visible;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.55));
  will-change: transform, opacity;
}

.cursor path {
  fill: #fff;
  stroke: #0b0c10;
  stroke-width: 1.2;
  stroke-linejoin: round;
}
