/*
 * The storefront page shell (layouts/site): the header bar, a frosted card on a soft
 * champagne-to-blue haze, and the full-width footer at the bottom. Mobile-first.
 *
 * --site-gutter is the space beside the header and card. --site-inset is how far the header's
 * logo sits inside the bar; the footer's content starts on the same line.
 */

.mx-site {
  --site-gutter: 12px;
  --site-inset: 15px;
  --site-border: 10px;
  --site-radius: 28px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  justify-items: center;
  gap: var(--mx-space-md);
  min-height: 100svh;
  padding: 10px var(--site-gutter) 0;
  overflow-x: clip;
  background:
    radial-gradient(55% 45% at 8% 6%, color-mix(in srgb, var(--mx-color-gold-tint) 90%, transparent), transparent 70%),
    radial-gradient(50% 45% at 95% 95%, color-mix(in srgb, var(--mx-color-info) 26%, transparent), transparent 70%),
    linear-gradient(160deg,
      color-mix(in oklab, var(--mx-color-cream-alt), var(--mx-color-info) 10%),
      color-mix(in oklab, var(--mx-color-cream), var(--mx-color-info) 30%));
}

/*
 * The card and footer are frosted without blurring what's behind them: behind them is only the
 * smooth haze, which looks the same blurred, and a large blur is the costliest thing to draw on a
 * phone. Only the header blurs, because the page scrolls under it.
 */

/* The card */

.mx-site__card {
  position: relative;
  isolation: isolate;
  align-self: start;
  width: min(1180px, 100%);
  padding: var(--mx-space-xxl) var(--mx-space-md) 56px;
  border: var(--site-border) solid var(--mx-color-surface);
  border-radius: var(--site-radius);
  background: color-mix(in srgb, var(--mx-color-surface) 70%, transparent);
  box-shadow:
    0 50px 90px -40px color-mix(in srgb, var(--mx-color-navy) 40%, transparent),
    0 18px 36px -24px color-mix(in srgb, var(--mx-color-navy) 25%, transparent);
}

/* The home page's card fills the rest of the first screen and centres its message. */
.mx-site__card--hero {
  display: grid;
  place-items: center;
  min-height: min(680px, calc(100svh - 120px));
}

/* Soft colour pooled in two corners of the card. */
.mx-site__card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: calc(var(--site-radius) - var(--site-border));
  background:
    radial-gradient(40% 45% at 0% 0%, color-mix(in srgb, var(--mx-color-gold-tint) 85%, transparent), transparent 70%),
    radial-gradient(45% 50% at 100% 100%, color-mix(in srgb, var(--mx-color-info) 14%, transparent), transparent 70%);
  pointer-events: none;
}

/* The footer (shared/_footer) runs edge to edge, out through the gutter, and sits on the bottom of
   the screen when the page is short. */
.mx-site .mx-footer {
  align-self: end;
  justify-self: stretch;
  margin: var(--mx-space-xl) calc(var(--site-gutter) * -1) 0;
}

@media (min-width: 768px) {
  .mx-site {
    --site-gutter: 32px;
    --site-inset: 23px;
    --site-radius: 40px;
    gap: var(--mx-space-lg);
    padding-top: 16px;
  }

  .mx-site .mx-footer {
    margin-top: 56px;
  }

  .mx-site__card {
    padding: 72px 48px;
  }

  .mx-site__card--hero {
    min-height: min(720px, calc(100svh - 136px));
  }
}

/*
 * The first page: the header drops into place and the card settles in under it, quickly. Pages
 * opened from a link after that show at once (application.js marks the visit).
 */

@media (prefers-reduced-motion: no-preference) {
  /* On the surface, not the header: an animating parent would cut the bar's blur off from the page. */
  :root:not(.mx-turbo-visited) .mx-header__surface {
    animation: mx-site-drop 500ms cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  :root:not(.mx-turbo-visited) .mx-site__card {
    animation: mx-site-rise 560ms cubic-bezier(0.22, 1, 0.36, 1) 40ms both;
  }
}

@keyframes mx-site-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes mx-site-drop {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }
}
