/* The app grid menu: the app switcher of a work suite, alone on a white page. The nine app icons of the menu are
   the nine little squares of the button, flown out and grown; the script moves them. On a real site the button
   sits in the header and the board drops below it. */
:root {
  --page: #ffffff;          /* the page */
  --surface: #ffffff;       /* the button and the board */
  --edge: #e6e6ea;          /* their hairline */
  --text: #17171b;          /* the words, and the little squares of the button */
  --muted: #74747e;         /* the names of the apps */
  --hover: #f3f3f6;         /* the tile under the pointer */
  --focus: #3b6cf6;         /* the focus from the keyboard */
  --glyph: #ffffff;         /* the drawing on each icon */
}

* {
  box-sizing: border-box;
}

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

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

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--text);
  font-family: 'Geist Variable', 'Geist', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

a,
button {
  color: inherit;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

a:focus,
button:focus {
  outline: none;
}

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

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 24px 16px;
}

/* ---------------------------------------------------------------- the frame */
.suite {
  position: relative;
  width: min(352px, 100%);
  height: 470px;
}

/* ---------------------------------------------------------------- the button */
/* the script moves it: in the middle of the frame while closed, at the top while open */
.apps {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 50px;
  margin: 0;
  padding: 0 22px 0 16px;
  border: 1px solid var(--edge);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  font-weight: 560;
  letter-spacing: -0.005em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 1px 2px rgba(23, 23, 27, 0.06), 0 8px 18px -12px rgba(23, 23, 27, 0.35);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

@media (hover: hover) and (pointer: fine) {
  .apps:hover {
    border-color: #d4d4da;
    box-shadow: 0 1px 2px rgba(23, 23, 27, 0.08), 0 12px 22px -12px rgba(23, 23, 27, 0.45);
  }
}

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

/* the nine little squares; the script spreads them a hair under the pointer */
.apps__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 5px);
  gap: 2.5px;
  width: 20px;
  height: 20px;
  place-content: center;
}

.apps__grid i {
  width: 5px;
  height: 5px;
  border-radius: 1.4px;
  background: var(--text);
  transition: transform 0.45s cubic-bezier(0.34, 1.9, 0.5, 1);
}

/* under the pointer the nine squares part a hair, from the middle out */
@media (hover: hover) and (pointer: fine) {
  .apps:hover i:nth-child(1) { transform: translate(-1px, -1px); }
  .apps:hover i:nth-child(2) { transform: translate(0, -1px); }
  .apps:hover i:nth-child(3) { transform: translate(1px, -1px); }
  .apps:hover i:nth-child(4) { transform: translate(-1px, 0); }
  .apps:hover i:nth-child(6) { transform: translate(1px, 0); }
  .apps:hover i:nth-child(7) { transform: translate(-1px, 1px); }
  .apps:hover i:nth-child(8) { transform: translate(0, 1px); }
  .apps:hover i:nth-child(9) { transform: translate(1px, 1px); }
}

.apps__cross {
  position: absolute;
  inset: 0;
  width: 20px;
  height: 20px;
  margin: auto;
  fill: none;
  stroke: var(--text);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0;
}

/* Apps and Close share one place; the word that is not shown waits below it, out of the mask */
.apps__words {
  display: grid;
  overflow: clip;
  height: 1.35em;
  line-height: 1.35em;
}

.apps__word {
  grid-area: 1 / 1;
}

/* ---------------------------------------------------------------- the board */
.board {
  position: absolute;
  left: 0;
  right: 0;
  top: 64px;
  z-index: 2;
  padding: 12px 12px 8px;
  visibility: hidden;
}

/* the board's ground, apart from the icons: the script fades it while the icons fly over it */
.board__ground {
  position: absolute;
  inset: 0;
  border: 1px solid var(--edge);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 2px 4px rgba(23, 23, 27, 0.04), 0 28px 48px -28px rgba(23, 23, 27, 0.4);
  transform-origin: 50% 0;
}

.board.is-open {
  visibility: visible;
}

.board__grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
}

.tile {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 9px;
  padding: 14px 4px 12px;
  border-radius: 16px;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
}

/* the tile's ground, which lights up under the pointer: a layer of its own, so the script can move the tile */
.tile::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--hover);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.tile.is-here::before {
  opacity: 1;
}

.tile:focus-visible::before {
  opacity: 1;
  box-shadow: inset 0 0 0 2px var(--focus);
}

.tile__icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--tint);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), inset 0 -2px 0 rgba(0, 0, 0, 0.1), 0 6px 12px -8px var(--tint);
  will-change: transform;
}

.tile__icon svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: var(--glyph);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tile__name {
  position: relative;
  font-size: 13px;
  font-weight: 480;
  color: var(--muted);
  transition: color 0.25s ease;
}

.tile.is-here .tile__name {
  color: var(--text);
}

/* the app you are in: its name in full ink, and a thin line of its colour under the icon */
.tile[aria-current='page'] .tile__name {
  color: var(--text);
  font-weight: 620;
}

.tile[aria-current='page'] .tile__icon::after {
  content: '';
  position: absolute;
  left: 30%;
  right: 30%;
  bottom: -6px;
  height: 2px;
  border-radius: 2px;
  background: var(--tint);
  transition: opacity 0.3s ease;
}

/* while the icons fly they pass over the button: the board goes above it */
.board.is-flying {
  z-index: 4;
}

/* while the icons fly, the line waits */
.board.is-flying .tile__icon::after {
  opacity: 0;
  transition: none;
}

.board__all {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 6px 0 0;
  padding: 12px;
  border-top: 1px solid var(--edge);
  font-size: 13.5px;
  font-weight: 520;
  color: var(--text);
}

.board__all svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.4s cubic-bezier(0.34, 1.8, 0.5, 1);
}

@media (hover: hover) and (pointer: fine) {
  .board__all:hover svg {
    transform: translateX(3px);
  }
}

.board__all:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -4px;
  border-radius: 12px;
}

@media (max-width: 420px) {
  .suite {
    height: 480px;
  }
}
