/* The design canvas context menu born at the click point: the canvas of Tessel, a made-up design tool, on white.
   The canvas, its three frames and the selection are the least the menu needs to act on; the menu and its submenu
   are positioned by the script in canvas pixels, and GSAP only moves, scales and fades them. */
:root {
  --page: #ffffff;           /* the page */
  --canvas: #f6f5f3;         /* the canvas of the design tool */
  --grid: rgba(20, 20, 24, 0.045); /* the lines of its grid */
  --ink: #18181b;            /* the words */
  --muted: #8b8b93;          /* the small words */
  --menu: #ffffff;           /* the menu */
  --accent: #3d5afe;         /* the selection blue: the outline, the highlight, the flash */
  --danger: #e0412f;         /* Delete */
  --key: #f4f3f1;            /* the face of a key */
  --dark: #1b1b1f;           /* the pricing card */
}

* {
  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;
}

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

/* ---------------------------------------------------------------- the canvas */
.canvas {
  position: relative;
  width: min(94vw, 660px);
  height: min(88vh, 430px);
  border-radius: 18px;
  background: var(--canvas);
  box-shadow:
    0 0 0 1px rgba(20, 20, 24, 0.06),
    0 1px 2px rgba(20, 20, 24, 0.04),
    0 18px 40px -22px rgba(20, 20, 24, 0.18);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  outline: none;
  opacity: 0;
}

.canvas:focus-visible {
  box-shadow:
    0 0 0 1px rgba(20, 20, 24, 0.06),
    0 0 0 4px rgba(61, 90, 254, 0.22),
    0 18px 40px -22px rgba(20, 20, 24, 0.18);
}

.canvas__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: -1px -1px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 45%, #000 40%, transparent 100%);
  mask-image: radial-gradient(120% 90% at 50% 45%, #000 40%, transparent 100%);
  pointer-events: none;
}

.canvas__file,
.canvas__zoom {
  position: absolute;
  top: 12px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--muted);
  pointer-events: none;
}

.canvas__file {
  left: 14px;
}

.canvas__file b {
  color: var(--ink);
  font-weight: 620;
}

.canvas__sep {
  margin: 0 6px;
  opacity: 0.5;
}

.canvas__zoom {
  right: 14px;
  font-variant-numeric: tabular-nums;
}

/* ---------------------------------------------------------------- the frames */
.layer {
  position: absolute;
  left: calc(var(--x) + var(--dx, 0px));
  top: calc(var(--y) + var(--dy, 0px));
  width: var(--w);
  height: var(--h);
  border-radius: 12px;
  overflow: hidden;
  padding: clamp(10px, 3.2%, 18px);
  display: flex;
  flex-direction: column;
  gap: clamp(5px, 1.6vh, 8px);
  box-shadow:
    0 0 0 1px rgba(20, 20, 24, 0.07),
    0 1px 2px rgba(20, 20, 24, 0.05),
    0 10px 24px -14px rgba(20, 20, 24, 0.22);
  transition: opacity 0.3s ease;
}

.layer.is-hidden {
  opacity: 0.22;
}

.layer--hero {
  background: linear-gradient(180deg, #ffffff, #fbfaf9);
}

.layer--price {
  background: linear-gradient(165deg, #26262b, var(--dark) 60%);
  color: #f2f2f4;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 1px 2px rgba(20, 20, 24, 0.1),
    0 14px 30px -14px rgba(20, 20, 24, 0.45);
}

.layer--quote {
  background: linear-gradient(180deg, #efece6, #e9e5dd);
}

.mock {
  display: block;
  height: 5px;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.12;
}

.mock--short {
  width: 58%;
}

.mock--nav {
  display: flex;
  gap: 6px;
  height: 4px;
  background: none;
  opacity: 1;
  margin-bottom: 4px;
}

.mock--nav i {
  width: 18%;
  border-radius: 2px;
  background: rgba(20, 20, 24, 0.12);
}

.mock--nav i:first-child {
  width: 10%;
  background: var(--ink);
  opacity: 0.8;
}

.mock__title {
  font-size: clamp(12px, 2.6vmin, 19px);
  line-height: 1.05;
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: -0.02em;
}

.mock__cta {
  align-self: flex-start;
  margin-top: auto;
  padding: 0.5em 0.95em;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: clamp(8.5px, 1.6vmin, 11px);
  font-weight: 560;
}

.mock__tag {
  align-self: flex-start;
  padding: 0.25em 0.7em;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-size: clamp(8px, 1.5vmin, 10px);
  font-weight: 560;
  color: rgba(255, 255, 255, 0.8);
}

.mock__price {
  font-size: clamp(16px, 4vmin, 28px);
  font-weight: 640;
  font-stretch: 108%;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.mock__price small {
  font-size: 0.42em;
  font-weight: 500;
  letter-spacing: 0;
  opacity: 0.55;
  margin-left: 2px;
}

.layer--price .mock {
  opacity: 0.16;
}

.mock__btn {
  margin-top: auto;
  height: clamp(14px, 3.2vmin, 22px);
  border-radius: 7px;
  background: linear-gradient(180deg, #fafafa, #e9e9ec);
}

.mock__mark {
  font-size: clamp(20px, 5vmin, 34px);
  line-height: 0.6;
  height: 0.45em;
  font-weight: 700;
  color: var(--ink);
  opacity: 0.28;
}

.mock__who {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
}

.mock__who i {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: linear-gradient(135deg, #c9c2b5, #a99f8e);
}

.mock__who b {
  width: 34%;
  height: 4px;
  border-radius: 2px;
  background: rgba(20, 20, 24, 0.18);
}

/* ---------------------------------------------------------------- the selection */
.sel {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 50;
  border: 1.5px solid var(--accent);
  border-radius: 12px;
  pointer-events: none;
  opacity: 0;
}

.sel__name {
  position: absolute;
  left: -1.5px;
  bottom: calc(100% + 5px);
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 560;
  color: var(--accent);
  white-space: nowrap;
}

.sel__lock {
  width: 0;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.2;
  transition: width 0.25s ease;
}

.sel.is-locked .sel__lock {
  width: 11px;
}

.sel__size {
  position: absolute;
  left: 50%;
  top: calc(100% + 6px);
  transform: translateX(-50%);
  padding: 2px 6px;
  border-radius: 5px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 560;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sel__h {
  position: absolute;
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--accent);
  border-radius: 2px;
  background: #fff;
}

.sel__h--tl { left: -4.5px; top: -4.5px; }
.sel__h--tr { right: -4.5px; top: -4.5px; }
.sel__h--bl { left: -4.5px; bottom: -4.5px; }
.sel__h--br { right: -4.5px; bottom: -4.5px; }

/* ---------------------------------------------------------------- the safe triangle */
.safe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 59;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
}

.safe polygon {
  fill: rgba(61, 90, 254, 0.07);
  stroke: rgba(61, 90, 254, 0.22);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}

/* ---------------------------------------------------------------- the menu */
.menu {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 60;
  width: 214px;
}

.menu[hidden] {
  display: block;
  visibility: hidden;
}

.menu--sub {
  z-index: 61;
  width: 182px;
}

.menu__far,
.menu__rest {
  position: absolute;
  inset: 0;
  border-radius: 12px;
  pointer-events: none;
}

/* the shadow of the menu still lifted: wide, soft and low; it gathers into the resting one as the menu lands */
.menu__far {
  box-shadow: 0 26px 50px -12px rgba(20, 20, 24, 0.28), 0 10px 18px -8px rgba(20, 20, 24, 0.12);
}

.menu__rest {
  box-shadow:
    0 0 0 1px rgba(20, 20, 24, 0.07),
    0 1px 1px rgba(20, 20, 24, 0.05),
    0 4px 8px -2px rgba(20, 20, 24, 0.07),
    0 14px 28px -10px rgba(20, 20, 24, 0.16);
}

.menu__body {
  position: relative;
  padding: 5px;
  border-radius: 12px;
  background: var(--menu);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.menu__hl {
  position: absolute;
  left: 5px;
  right: 5px;
  top: 0;
  height: 30px;
  border-radius: 7px;
  background: rgba(61, 90, 254, 0.09);
  box-shadow: inset 0 0 0 1px rgba(61, 90, 254, 0.08);
  opacity: 0;
  pointer-events: none;
}

.menu__hl.is-danger {
  background: rgba(224, 65, 47, 0.09);
  box-shadow: inset 0 0 0 1px rgba(224, 65, 47, 0.08);
}

.menu__hl.is-flash {
  background: var(--accent);
  box-shadow: none;
}

.menu__hl.is-flash.is-danger {
  background: var(--danger);
}

.menu__sep {
  display: block;
  height: 1px;
  margin: 4px 8px;
  background: rgba(20, 20, 24, 0.07);
}

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 30px;
  padding: 0 6px 0 10px;
  border: 0;
  border-radius: 7px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 470;
  text-align: left;
  cursor: default;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.row__label {
  flex: 1;
  white-space: nowrap;
  font-stretch: 100%;
  transition: font-stretch 0.3s cubic-bezier(0.22, 1, 0.36, 1), color 0.12s ease;
}

.row.is-on .row__label {
  font-stretch: 105%;
}

.row--danger.is-on .row__label {
  color: var(--danger);
}

.row.is-flash .row__label {
  color: #fff;
}

.row[aria-disabled='true'] {
  color: rgba(20, 20, 24, 0.3);
}

.row__chev {
  width: 12px;
  height: 12px;
  margin-right: 2px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.row.is-on .row__chev {
  transform: translateX(1.5px);
  opacity: 0.9;
}

.keys {
  display: flex;
  gap: 3px;
}

kbd {
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 5px;
  background: linear-gradient(180deg, #ffffff, var(--key));
  box-shadow:
    0 0 0 1px rgba(20, 20, 24, 0.09),
    0 1px 0 rgba(20, 20, 24, 0.1),
    inset 0 -1px 0 rgba(20, 20, 24, 0.04);
  color: rgba(20, 20, 24, 0.55);
  font: inherit;
  font-size: 10.5px;
  font-weight: 560;
  line-height: 1;
}

kbd svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.1;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.row.is-on kbd {
  color: rgba(20, 20, 24, 0.75);
}

.row.is-flash kbd {
  background: rgba(255, 255, 255, 0.18);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.28);
  color: #fff;
}

.row[aria-disabled='true'] kbd {
  opacity: 0.5;
}

/* ---------------------------------------------------------------- the note */
.note {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: 55;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(24, 24, 27, 0.92);
  color: #f4f4f5;
  font-size: 11.5px;
  font-weight: 500;
  white-space: nowrap;
  box-shadow: 0 6px 16px -8px rgba(20, 20, 24, 0.5);
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
}

/* ---------------------------------------------------------------- the pilot's pointer */
.hand {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 70;
  width: 20px;
  height: 20px;
  margin: -2px 0 0 -4px;
  fill: var(--ink);
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.22));
  pointer-events: none;
  opacity: 0;
}

@media (max-width: 520px), (max-height: 470px) {
  .menu {
    width: 196px;
  }
  .menu--sub {
    width: 168px;
  }
  .row {
    height: 27px;
    font-size: 12.5px;
  }
  .menu__hl {
    height: 27px;
  }
  .menu__sep {
    margin: 3px 8px;
  }
  kbd {
    min-width: 16px;
    height: 16px;
    font-size: 10px;
  }
  .canvas__file,
  .canvas__zoom {
    top: 10px;
    font-size: 10px;
  }
}

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