/* The pool tab bar: a strip of pool water set in white stone, alone on a white page. The water, the tiles under it
   and the light on them are a WebGL canvas drawn by the script, which reads its colours from here. */
:root {
  --page: #ffffff;                  /* the page */
  --stone: #f4f1ec;                 /* the stone round the pool */
  --deep: #0f5560;                  /* the water over the tiles, in the shade */
  --tile: #2f8f97;                  /* the tiles, seen through the water */
  --grout: #7fc6c7;                 /* the lines between the tiles */
  --sun: #fff2c6;                   /* the sunlight on the bottom */
  --icon: #ffffff;                  /* the icons and the names */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

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

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

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

/* ---------------------------------------------------------------- the pool */
/* as wide as a phone's tab bar, never wider than 420 pixels nor than the screen */
.pool {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  width: min(420px, 100%);
  height: 70px;
  padding: 0 6px;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  background: var(--deep);
  box-shadow:
    0 0 0 5px var(--stone),
    0 0 0 6px rgba(80, 70, 50, 0.1),
    0 22px 34px -18px rgba(15, 60, 70, 0.45);
  -webkit-tap-highlight-color: transparent;
}

.pool__water {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
}

/* the stone lip throws a little shade on the water along the top */
.pool__lip {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: inset 0 6px 8px -4px rgba(4, 30, 36, 0.55), inset 0 -2px 3px -1px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

/* without WebGL: still water with a soft sun under the tab you are on */
.no-gl .pool {
  background:
    radial-gradient(70px 48px at var(--sun-x, 10%) 55%, rgba(255, 242, 198, 0.35), transparent 70%),
    repeating-linear-gradient(90deg, rgba(127, 198, 199, 0.25) 0 1px, transparent 1px 14px),
    repeating-linear-gradient(0deg, rgba(127, 198, 199, 0.25) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, var(--deep), var(--tile));
}

.no-gl .pool__water {
  display: none;
}

/* ---------------------------------------------------------------- the tabs */
.tab {
  position: relative;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 5px;
  margin: 0;
  padding: 2px 0 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--icon);
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  -webkit-user-select: none;
}

/* the float bobs with the water (the script), the icon inside answers the pointer (here) */
.tab__float {
  display: block;
  width: 24px;
  height: 24px;
  will-change: transform;
}

.tab__icon {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.66;
  filter: drop-shadow(0 1.5px 1.5px rgba(2, 30, 36, 0.45));
  transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.tab__name {
  display: block;
  font-size: 11px;
  line-height: 1;
  font-weight: 440;
  letter-spacing: 0.06em;
  opacity: 0.7;
  text-shadow: 0 1px 2px rgba(2, 30, 36, 0.6);
  transition: opacity 0.35s ease, font-weight 0.35s ease;
}

.tab[aria-current='page'] .tab__icon {
  opacity: 1;
  stroke-width: 1.9;
}

.tab[aria-current='page'] .tab__name {
  opacity: 1;
  font-weight: 560;
}

@media (hover: hover) and (pointer: fine) {
  .tab:not([aria-current='page']):hover .tab__icon {
    opacity: 0.9;
    transform: translateY(-1px);
  }
}

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

/* the focus, from the keyboard only */
.tab::after {
  content: '';
  position: absolute;
  inset: 8px 4px;
  border-radius: 14px;
  box-shadow: inset 0 0 0 1.5px var(--icon);
  opacity: 0;
  pointer-events: none;
}

.tab:focus-visible::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tab__icon,
  .tab__name {
    transition-duration: 0.2s;
  }
}
