/* The living icons tab bar: a white tab bar alone on a white page, with five icons drawn as strokes; the chosen one
   is tomato red, sits in a pale pill, and plays its move. */
:root {
  --page: #ffffff;          /* the page */
  --ink: #1f1d1a;           /* the dark mixed into the grey of an icon pointed at */
  --bar: #ffffff;           /* the tab bar */
  --icon: #a59f94;          /* an icon that is off */
  --on: #e2482b;            /* the chosen icon and its label */
  --pill: #fde6df;          /* the pill behind it */
  --smoke: #b8b2a8;         /* the smoke from the chimney */
}

* {
  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: 'Figtree Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 32px 16px;
}

/* ---------------------------------------------------------------- the tab bar */
/* as wide as a phone's tab bar, and never wider than the screen */
.bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  width: min(360px, 100%);
  height: 72px;
  padding: 0 6px;
  border-radius: 28px;
  background: var(--bar);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(30, 25, 20, 0.05),
    0 16px 30px -14px rgba(60, 40, 20, 0.3),
    0 4px 10px -4px rgba(60, 40, 20, 0.12);
}

/* the pill behind the chosen icon: moved and stretched by the script */
.bar__pill {
  position: absolute;
  left: 0;
  top: 9px;
  width: 56px;
  height: 36px;
  border-radius: 18px;
  background: var(--pill);
  transform-origin: 0 50%;
  will-change: transform;
}

.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 2px;
  padding: 13px 0 0;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--icon);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.tab__icon {
  width: 28px;
  height: 28px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab__icon .fill {
  fill: currentColor;
  stroke: none;
}

/* the colour layer over the grey one */
.tab__base {
  color: var(--icon);
}

.tab__ink {
  color: var(--on);
}

.tab__base path,
.tab__ink path {
  stroke: currentColor;
}

.tab__icon .smoke,
.tab__ink .smoke {
  fill: none;
  stroke: var(--smoke);
  stroke-width: 1.5;
}

/* the light behind the open door */
.tab__icon .glow {
  fill: #ffb547;
  stroke: none;
}

/* the label: every tab has one, only the chosen one's shows, rising from under the icon */
.tab__label {
  font-size: 11.5px;
  font-weight: 680;
  letter-spacing: 0.01em;
  line-height: 1.2;
  color: var(--on);
  opacity: 0;
  transform: translateY(5px);
  pointer-events: none;
}

.tab__dot {
  position: absolute;
  top: 8px;
  left: 50%;
  display: grid;
  place-items: center;
  min-width: 17px;
  height: 17px;
  margin-left: 4px;
  padding: 0 4px;
  border: 2px solid var(--bar);
  border-radius: 9px;
  background: var(--on);
  color: #fff;
  font-size: 10px;
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.tab__dot[hidden] {
  display: none;
}

@media (hover: hover) and (pointer: fine) {
  .tab:not([aria-current]):hover {
    color: color-mix(in srgb, var(--icon) 55%, var(--ink));
  }
}

.tab:active .tab__icon {
  transform: scale(0.88);
  transition: transform 0.08s ease-out;
}

.tab .tab__icon {
  transition: transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tab[aria-current] {
  color: var(--on);
  cursor: default;
}

.tab:focus-visible {
  outline: 2px solid var(--on);
  outline-offset: -4px;
}

html[data-using='pointer'] .tab:focus-visible {
  outline: none;
}
