/* A phone launcher: rounded app icons with their names under them. New apps add to
   the grid, and it scrolls once they pass the bottom of the screen. */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #23241f;
}

nav {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 24px 12px;
  max-width: 560px;
  margin: 0 auto;
  /* The top clears the Share bar and its tap area, which follow the same inset. */
  padding: calc(env(safe-area-inset-top) + 56px) max(20px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: #eff0eb;
  font: 500 12px/1.25 system-ui, sans-serif;
  text-align: center;
  text-decoration: none;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.app:focus-visible {
  outline: 2px solid #eff0eb;
  outline-offset: 4px;
  border-radius: 16px;
}

.icon {
  display: block;
  width: 100%;
  max-width: 68px;
  aspect-ratio: 1;
  border-radius: 22%;
}

.name {
  /* One line, like a home screen. A name too long for its cell gets an ellipsis
     rather than breaking mid-word. */
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Icons don't say what an unfamiliar app does, so screen readers get the blurb too. */
.blurb {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: no-preference) {
  .icon {
    transition: scale 120ms ease;
  }

  .app:active .icon {
    scale: 0.92;
  }
}
