/* The mobile navigation floats over the page so the current section shows through the glass. */
@media (max-width: 767px) {
  :root {
    --floating-nav-top: calc(env(safe-area-inset-top, 0px) + clamp(14px, 4.2vw, 21px));
    --floating-nav-height: 59px;
    --floating-nav-margin: clamp(12px, calc(18vw - 45px), 33px);
    --floating-nav-left: max(var(--floating-nav-margin), calc(env(safe-area-inset-left, 0px) + 8px));
    --floating-nav-right: max(var(--floating-nav-margin), calc(env(safe-area-inset-right, 0px) + 8px));
    --floating-nav-end: calc(var(--floating-nav-top) + var(--floating-nav-height));
  }

  html { scroll-padding-top: calc(var(--floating-nav-end) + 14px); }

  .header,
  #mobile-nav {
    position: fixed;
    left: var(--floating-nav-left);
    right: var(--floating-nav-right);
    width: auto;
    max-width: 460px;
    margin-inline: auto;
    border: 1px solid rgb(255 255 255 / 91%);
    color: #252229;
    background: #f6f3ed;
    background-image: linear-gradient(160deg, rgb(255 255 255 / 55%), transparent 59%);
    box-shadow:
      0 0 0 1px rgb(49 34 58 / 10%),
      0 5px 13px -5px rgb(38 25 46 / 22%),
      inset 0 1px 0 rgb(255 255 255 / 48%);
  }

  .header {
    top: var(--floating-nav-top);
    height: var(--floating-nav-height);
    padding: 0 7px 0 9px;
    gap: 5px;
    border-radius: 999px;
  }

  .header::before, .header::after { content: none; }
  .official-brand { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; }
  .official-brand img { width: 42px; height: 42px; }
  .header .header-actions { gap: clamp(3px, 1.3vw, 10px); }

  .header .app-demo-launch,
  .header .header-actions .button,
  .header .menu-toggle {
    min-height: 44px;
    border-radius: 999px;
    flex-shrink: 0;
  }

  .header .app-demo-launch {
    padding-inline: 10px;
    border: 0;
    color: #27382b;
    background: transparent;
    font-size: .85rem;
  }

  .header .header-actions .button {
    padding: 0 15px;
    background: #28252a;
    color: #fffef8;
    font-size: .85rem;
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 13%);
  }

  .header .menu-toggle {
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
  }

  .header .menu-toggle span { width: 19px; background: #2a2630; }
  .header .menu-toggle[aria-expanded='true'], .header .app-demo-launch:active { background: rgb(255 255 255 / 70%); }

  /* Preserve the heading clearance formerly provided by the in-flow bar. */
  main > .hero:first-child,
  main > .story-hero:first-child {
    padding-top: calc(var(--floating-nav-end) + clamp(25px, 7vw, 41px));
  }

  #mobile-nav {
    top: calc(var(--floating-nav-end) + 8px);
    padding: 6px 12px;
    border-radius: 24px;
    max-height: calc(100dvh - var(--floating-nav-end) - max(20px, env(safe-area-inset-bottom, 0px)));
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  #mobile-nav a { min-height: 46px; padding: 12px 9px; }

  @supports ((-webkit-backdrop-filter: blur(16px)) or (backdrop-filter: blur(16px))) {
    .header,
    #mobile-nav {
      -webkit-backdrop-filter: blur(20px) saturate(145%);
      backdrop-filter: blur(20px) saturate(145%);
    }
    .header { background-color: rgb(251 249 245 / 66%); }
    #mobile-nav { background-color: rgb(251 249 245 / 88%); }
  }
}

@media (max-width: 350px) {
  .header:has(.app-demo-launch), .header .header-actions { gap: 3px; }
  .header .app-demo-launch { padding-inline: 4px; font-size: .8125rem; }
  .header .header-actions .button { padding-inline: 8px; font-size: .8125rem; }
}

@media (max-width: 767px) and (prefers-reduced-transparency: reduce) {
  .header, #mobile-nav { background: #f6f3ed; -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  .header *, #mobile-nav * { transition: none; animation: none; }
}
