/* The music app tab bar with the sliding album cover: a graphite tab bar alone on black. The marker of the chosen
   tab is the cover of the song playing; the thin progress line runs along the top edge. */
:root {
  --page: #000000;          /* the page */
  --bar: #141416;           /* the tab bar */
  --bar-top: #1d1d21;       /* the light top of the bar */
  --edge: rgba(255, 255, 255, 0.09); /* the hairline around the bar */
  --icon: #7c7c84;          /* an icon that is off */
  --icon-hover: #b9b9c0;    /* an icon under the pointer */
  --on: #ffffff;            /* the chosen icon and its label */
  --track: rgba(255, 255, 255, 0.08); /* the empty part of the progress line */
  --accent: #ff8a5b;        /* the progress line (it takes the colour of each cover) */
}

* { box-sizing: border-box; }

html { touch-action: manipulation; }

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

body {
  min-height: 100vh;
  background: var(--page);
  color: var(--on);
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

/* the bar: graphite, a hairline that takes the light on top, shadows in three layers */
.bar {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: min(384px, calc(100vw - 32px));
  height: 72px;
  padding: 0 6px;
  border-radius: 24px;
  background: linear-gradient(180deg, var(--bar-top), var(--bar) 60%);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    0 1px 2px rgba(0, 0, 0, 0.6),
    0 12px 28px -8px rgba(0, 0, 0, 0.8),
    0 30px 60px -20px rgba(0, 0, 0, 0.9);
  isolation: isolate;
}

/* a soft light along the top edge, a little brighter in the middle */
.bar__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(120% 60% at 50% -20%, rgba(255, 255, 255, 0.06), transparent 60%);
  pointer-events: none;
}

/* the progress of the song: a hairline on the top edge, inset from the corners */
.prog {
  position: absolute;
  left: 22px;
  right: 22px;
  top: 0;
  height: 2px;
  border-radius: 2px;
  background: var(--track);
  overflow: hidden;
  pointer-events: none;
  z-index: 3;
}

.prog__fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 55%, transparent), var(--accent) 92%, color-mix(in srgb, var(--accent) 40%, #ffffff));
  transform-origin: 0 50%;
  transform: scaleX(0);
}

/* the cover: GSAP moves .cover across, the tilt and the lift live on .cover__tilt */
.cover {
  position: absolute;
  left: 0;
  top: 9px;
  width: 38px;
  height: 38px;
  z-index: 1;
  pointer-events: none;
  will-change: transform;
}

.cover__glow {
  position: absolute;
  inset: 4px;
  border-radius: 12px;
  filter: blur(12px);
  opacity: 0.5;
  transform: translateY(7px);
}

.cover__tilt {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  overflow: hidden;
  box-shadow:
    0 1px 1px rgba(0, 0, 0, 0.5),
    0 6px 14px -4px rgba(0, 0, 0, 0.7);
}

.cover__art {
  position: absolute;
  inset: 0;
}

.art {
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

/* a darker middle, so the white icon reads on any cover */
.art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 60% at 50% 48%, rgba(0, 0, 0, 0.32), transparent 75%);
}

/* the gloss of the cover: a soft band that moves with the tilt, and a hairline that takes the light */
.cover__sheen {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(var(--sheen-a, 125deg), rgba(255, 255, 255, 0) 30%, rgba(255, 255, 255, 0.28) 46%, rgba(255, 255, 255, 0) 60%);
  background-size: 260% 260%;
  background-position: var(--sheen-x, 80%) 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  mix-blend-mode: screen;
}

/* the three covers, drawn with gradients */
.art--tide {
  background:
    linear-gradient(180deg, transparent 62%, rgba(20, 8, 40, 0.55) 62.5%, rgba(20, 8, 40, 0.85)),
    radial-gradient(circle at 50% 62%, #ffe2a6 0 16%, #ffb36b 17%, transparent 34%),
    linear-gradient(180deg, #ff9a5a 0%, #e24f6a 45%, #5a2470 100%);
}

.art--tide::before {
  content: "";
  position: absolute;
  inset: 66% 18% 0;
  background: repeating-linear-gradient(180deg, rgba(255, 196, 140, 0.55) 0 1px, transparent 1px 4px);
  opacity: 0.6;
}

.art--moons {
  background:
    radial-gradient(circle at 63% 36%, #0f2550 0 19%, transparent 20%),
    radial-gradient(circle at 55% 40%, #e9f0ff 0 22%, transparent 23%),
    radial-gradient(120% 90% at 20% 110%, #3d7cf0 0%, transparent 60%),
    linear-gradient(160deg, #0b1c3d, #12306a 60%, #1d4fb0);
}

.art--moons::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 22% 24%, rgba(255, 255, 255, 0.8) 0 1px, transparent 1.5px),
    radial-gradient(circle at 80% 72%, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.5px),
    radial-gradient(circle at 30% 76%, rgba(255, 255, 255, 0.5) 0 0.8px, transparent 1.3px);
}

.art--bloom {
  background:
    repeating-radial-gradient(circle at 34% 66%, rgba(10, 40, 30, 0.35) 0 2px, transparent 2px 6px),
    conic-gradient(from 210deg at 34% 66%, #d6ff6a, #46d9a8, #0f6e6a, #d6ff6a);
}

/* the tabs */
.tab {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 8px;
  padding-top: 18px;
  height: 100%;
  color: var(--icon);
  border-radius: 18px;
  outline: none;
}

.tab__icon {
  display: block;
  width: 22px;
  height: 22px;
  overflow: visible;
  transition: color 0.25s;
  will-change: transform;
}

.tab__line {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab__fill {
  fill: var(--on);
  stroke: var(--on);
  stroke-width: 1.7;
  stroke-linejoin: round;
}

.tab__fill--lens {
  fill: rgba(255, 255, 255, 0.26);
  stroke-width: 2.3;
}

.tab__fill--stroke {
  stroke-width: 2.3;
  fill: none;
  stroke-linecap: round;
}

.tab__label {
  font-size: 10.5px;
  line-height: 1;
  letter-spacing: 0.01em;
  font-weight: 500;
  font-stretch: 100%;
  white-space: nowrap;
  transition: color 0.3s, font-weight 0.3s;
}

.tab[aria-current="page"] {
  color: var(--on);
}

.tab[aria-current="page"] .tab__line {
  stroke: rgba(255, 255, 255, 0.35);
}

.tab[aria-current="page"] .tab__label {
  font-weight: 640;
}

.tab:focus-visible::after {
  content: "";
  position: absolute;
  inset: 6px 4px;
  border-radius: 16px;
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.55);
}

@media (hover: hover) {
  .tab:not([aria-current="page"]):hover {
    color: var(--icon-hover);
  }
}

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

/* the drawn pointer of the autopilot */
.ghost {
  position: absolute;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  margin: -3px 0 0 -4px;
  fill: #ffffff;
  stroke: #111114;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, 0.5));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (prefers-reduced-motion: reduce) {
  .ghost { display: none; }
}
