/* The balloon letters nav: the top bar of a party studio on a white page, with the current link spelled in rose gold
   foil balloons. The foil is lit by an SVG filter that the script builds from the colours below. */
:root {
  --page: #ffffff;          /* the page */
  --bar: #ffffff;           /* the bar */
  --edge: rgba(60, 30, 40, 0.08);   /* the bar's edge */
  --ink: #2a1c24;           /* the brand, the button and a link pointed at */
  --muted: #8b7c83;         /* the other links */
  --ring: #c0396b;          /* the outline of the keyboard focus */
  --foil-dark: #5e2a2c;     /* the foil: the folds turned away from the light */
  --foil-deep: #a65a52;
  --foil: #d98d7c;          /* rose gold */
  --foil-light: #f3c2b3;
  --foil-glint: #fff3ee;    /* where it catches the light */
  --seam: #c47a6a;          /* the flat seam round the edge of each letter */
  --lift: #7a3a36;          /* the soft shadow the balloons cast on the bar */
}

* {
  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(--ink);
  font-family: 'Fredoka Variable', 'Arial Rounded MT Bold', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.stage {
  min-height: 100svh;
  display: grid;
  /* one column as wide as the window: the links that do not fit scroll inside the bar instead of widening it */
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 48px 16px;
}

/* ---------------------------------------------------------------- the bar */
.bar {
  /* the sizes of the letters, read by the script: flat, and blown up into balloons */
  --flat-size: 16;
  --balloon-size: 26;
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: min(1000px, 100%);
  height: 64px;
  padding: 0 12px 0 24px;
  border-radius: 20px;
  background: var(--bar);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    0 1px 2px rgba(60, 30, 40, 0.05),
    0 22px 44px -28px rgba(90, 40, 50, 0.38);
}

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

a:focus {
  outline: none;
}

/* ---------------------------------------------------------------- the brand */
.brand {
  flex: none;
  padding: 6px 6px;
  border-radius: 10px;
  font-size: 20px;
  font-stretch: 112%;
  font-weight: 620;
  letter-spacing: -0.01em;
  line-height: 1;
}

/* ---------------------------------------------------------------- the links */
/* the links scroll sideways inside the bar when they do not fit; auto margins centre them without cutting the first */
.strip {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  --fade-l: 0px;
  --fade-r: 0px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 calc(100% - var(--fade-r)), transparent);
}

.strip::-webkit-scrollbar {
  display: none;
}

.strip.is-after {
  --fade-l: 28px;
}

.strip.is-before {
  --fade-r: 28px;
}

.list {
  position: relative;
  display: flex;
  flex: none;
  height: 100%;
  margin: 0 auto;
  /* room for the ring of the keys round the first and the last link */
  padding: 0 4px;
  list-style: none;
}

/* each link is as tall as the bar; the script gives it room for its word blown up, so nothing moves when it fills */
.link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 7px;
  color: var(--muted);
  font-size: calc(var(--flat-size) * 1px);
  font-weight: 460;
  line-height: 1;
  white-space: nowrap;
}

/* the words themselves: read by screen readers and shown as they are until the script draws the letters */
.link__word {
  display: block;
}

.is-drawn .link__word {
  opacity: 0;
}

.link__art {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

/* the flat letters: plain text, grey, dark for the link pointed at */
.link__flat {
  fill: var(--muted);
  transition: fill 0.2s ease;
}

.link:focus-visible .link__flat,
.link[aria-current='page'] .link__flat {
  fill: var(--ink);
}

@media (hover: hover) {
  .link:hover .link__flat {
    fill: var(--ink);
  }
}

/* the letters blown up: what they are filled with does not show, the filter paints the foil over their shape */
.link__foil {
  fill: #000;
}

/* the keys: a rounded ring round the room of the word */
.link::after {
  content: '';
  position: absolute;
  inset: 7px -3px;
  border: 2px solid var(--ring);
  border-radius: 16px;
  opacity: 0;
  pointer-events: none;
}

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

/* ---------------------------------------------------------------- the button */
.cta {
  display: flex;
  flex: none;
  align-items: center;
  height: 40px;
  padding: 0 19px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bar);
  font-size: 15px;
  font-stretch: 108%;
  font-weight: 560;
  white-space: nowrap;
  transition: background-color 0.22s ease, transform 0.35s cubic-bezier(0.34, 1.8, 0.64, 1);
}

.cta__label {
  display: block;
}

@media (hover: hover) {
  .cta:hover {
    background: color-mix(in srgb, var(--ink) 84%, var(--foil-deep));
    transform: scale(1.04);
  }
}

.cta:active {
  transform: scale(0.96);
  transition-duration: 0.12s;
}

/* ---------------------------------------------------------------- the keys */
.brand:focus-visible,
.cta:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 3px;
}

/* ---------------------------------------------------------------- narrow screens */
/* the button goes, and the links get a little less air */
@media (max-width: 900px) {
  .bar {
    gap: 8px;
    padding: 0 8px 0 20px;
  }

  .cta {
    display: none;
  }

  .link {
    padding: 0 6px;
  }
}

/* on a phone the letters are smaller, the links scroll inside the bar and the one chosen comes to the middle */
@media (max-width: 560px) {
  .bar {
    --flat-size: 15;
    --balloon-size: 23;
    gap: 4px;
    padding: 0 4px 0 16px;
    border-radius: 18px;
  }

  .brand {
    font-size: 17px;
    padding: 6px 4px;
  }

  .link {
    padding: 0 5px;
  }
}

/* on the narrowest phones the name gives its room to the links */
@media (max-width: 359px) {
  .brand {
    display: none;
  }

  .bar {
    padding-left: 4px;
  }
}

/* with less motion the button does not grow or shrink */
@media (prefers-reduced-motion: reduce) {
  .cta,
  .cta:active {
    transform: none;
  }
  @media (hover: hover) {
    .cta:hover {
      transform: none;
    }
  }
}
