/*
 * The buy bar every template carries, in this one's colours: the gold on the night.
 *
 * The blur is a ramp rather than a single sheet: one `backdrop-filter` can only
 * blur by one radius, and masking it merely fades a uniformly blurred sheet in
 * and out, which leaves a seam where the sheet ends. Six sheets whose radius
 * doubles, each masked to fade out higher than the one below it, ramp the real
 * radius - nothing at the top, all six sheets' worth against the bottom edge.
 *
 * It reaches well above the bar's own box, because a ramp only as tall as the
 * button has to go from nothing to full blur in eighty pixels, and that is a
 * gradient steep enough to read as an edge.
 *
 * Capped to the page's own column, as the bar at the top of this template is:
 * on a wide screen the invitation is 393px and a bar across the whole window
 * would be the only thing on the page that was not.
 */
.buy-bar {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 35; /* over the top bar, under the calendar and map sheets */
  width: 100%;
  max-width: var(--screen-w);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
  text-decoration: none;
  opacity: 0;
  visibility: hidden;
  translate: 0 12px;
  transition: opacity 0.5s ease, translate 0.5s ease, visibility 0.5s;
}

@media (max-width: 600px) {
  .buy-bar { max-width: none; }
}

.buy-bar[data-shown='true'] {
  opacity: 1;
  visibility: visible;
  translate: none;
}

.buy-bar__blur {
  position: absolute;
  inset: -120px 0 0;
  pointer-events: none;
}

.buy-bar__blur::after {
  content: "";
  position: absolute;
  inset: 0;
  /* The page's own night, so the ramp reads as the sky dissolving into the bar
     rather than as a grey sheet laid over it - over the paper screens too. */
  background: color-mix(in srgb, var(--night) 34%, transparent);
  -webkit-mask-image: linear-gradient(to top, black 30%, transparent 85%);
  mask-image: linear-gradient(to top, black 30%, transparent 85%);
}

.buy-bar__blur > div {
  position: absolute;
  inset: 0;
  backdrop-filter: blur(var(--radius));
  -webkit-backdrop-filter: blur(var(--radius));
  -webkit-mask-image: linear-gradient(to top, black var(--solid), transparent var(--fade));
  mask-image: linear-gradient(to top, black var(--solid), transparent var(--fade));
}

.buy-bar__blur > div:nth-child(1) { --radius: 0.5px; --solid: 60%; --fade: 100%; }
.buy-bar__blur > div:nth-child(2) { --radius: 1px; --solid: 48%; --fade: 84%; }
.buy-bar__blur > div:nth-child(3) { --radius: 2px; --solid: 36%; --fade: 68%; }
.buy-bar__blur > div:nth-child(4) { --radius: 4px; --solid: 24%; --fade: 52%; }
.buy-bar__blur > div:nth-child(5) { --radius: 8px; --solid: 12%; --fade: 36%; }
.buy-bar__blur > div:nth-child(6) { --radius: 16px; --solid: 0%; --fade: 20%; }

/* Lifted over the blur, which is positioned and would otherwise paint on top. */
.buy-bar__button {
  position: relative;
  z-index: 1;
  flex: none;
  padding: 14px 32px;
  border-radius: 999px;
  background: var(--gold);
  color: var(--night);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 20px;
  letter-spacing: -0.01em;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.buy-bar:hover .buy-bar__button { opacity: 0.88; }
.buy-bar:active .buy-bar__button { transform: translateY(1px); }

/*
 * Room under the last screen for the bar, so the footer's logo and its arrow
 * back to the top are not left underneath it. Only when there is a bar: in the
 * portal's gallery (`?embed=1`) the page ends where the design ends.
 */
.app:has(> .buy-bar) { padding-bottom: 76px; background: var(--night); }

/*
 * While the star wheel holds the page (style.css hides every screen after the
 * date until it is set), the bar stays: it is not a screen.
 */
.is-held #date ~ .buy-bar { display: flex; }

@media (prefers-reduced-motion: reduce) {
  .buy-bar,
  .buy-bar__button { transition: none; }
}
