/* ==========================================================================
 * Moodlogue — the site header (frosted glass), its mobile menu and the cart
 * drawer's motion. Shared by the homepage and the information pages; loaded
 * after styles.css (and before home.css on the homepage).
 * ========================================================================== */

:root {
  /* The mobile menu and cart drawer: ease in and out like the homepage panel
   * slides, with a softer start so they visibly move as soon as they are
   * tapped. */
  --site-sheet-ms: 560ms;
  --site-sheet-ease: cubic-bezier(0.4, 0, 0.2, 1);
  /* The header's height (the sizes below), so a page can start its content
   * clear of it. */
  --site-header-h: 65px;
}

@media (max-width: 980px) {
  :root {
    --site-header-h: 61px;
  }
}

@media (max-width: 680px) {
  :root {
    --site-header-h: 57px;
  }
}

/* ---------- Header ----------
 * A smaller, frosted-glass version of the shared header, so whatever is
 * beneath it (the homepage photography, a page's text as it scrolls) shows
 * softly through. The look is the same at every scroll position: no
 * scrolled-state shadow or height change. Browsers without backdrop-filter
 * get a near-opaque background instead. */

.site-header,
.site-header.is-compact {
  background: rgb(255 255 255 / 60%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  backdrop-filter: blur(20px) saturate(160%);
  box-shadow: none;
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .site-header,
  .site-header.is-compact {
    background: rgb(255 255 255 / 94%);
  }
}

.site-header .header-inner,
.site-header.is-compact .header-inner {
  min-height: 64px;
  padding-block: 10px;
}

.site-header .brand-logo {
  height: 34px;
}

.site-header .desktop-nav {
  gap: 28px;
}

.site-header .desktop-nav a {
  font-size: 15px;
}

.site-header .icon-button {
  width: 36px;
  height: 36px;
}

.site-header .icon-button .material-symbols-outlined {
  font-size: 22px;
}

@media (max-width: 980px) {
  .site-header .header-inner,
  .site-header.is-compact .header-inner {
    min-height: 60px;
    padding-block: 8px;
  }

  .site-header .brand-logo {
    height: 32px;
  }

  .site-header .icon-button {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 680px) {
  .site-header .header-inner,
  .site-header.is-compact .header-inner {
    min-height: 56px;
  }

  .site-header .brand-logo {
    height: 28px;
  }
}

/* ---------- Mobile menu and cart ----------
 * The menu wherever the header shows the menu button (980px and narrower), and
 * the cart at every width. The header itself keeps the glass above. */

@media (max-width: 980px) {
  /* The menu: a pale sheet that slides in from the right, like the cart
   * drawer, while it fades in, its three destinations following it into
   * place one after another; closing runs the same way back. It stays laid
   * out while closed (hidden from view, taps and screen readers by
   * visibility) so both directions can animate, and a quick second tap simply
   * reverses it mid-way. */
  .site-header .mobile-menu,
  .site-header .mobile-menu[hidden] {
    display: grid !important;
    align-content: start;
    justify-items: stretch;
    gap: 0;
    color: #111111;
    text-align: left;
    transform: none;
    opacity: 1;
    visibility: visible;
    transition:
      transform var(--site-sheet-ms) var(--site-sheet-ease),
      opacity var(--site-sheet-ms) var(--site-sheet-ease),
      visibility 0s linear 0s;
  }

  .site-header .mobile-menu[hidden] {
    transform: translateX(100%);
    opacity: 0;
    visibility: hidden;
    transition:
      transform var(--site-sheet-ms) var(--site-sheet-ease),
      opacity var(--site-sheet-ms) var(--site-sheet-ease),
      visibility 0s linear var(--site-sheet-ms);
  }

  /* Each destination its own row between hairlines, the name in large
   * capitals at the end. */
  .site-header .mobile-menu a {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    padding-block: clamp(18px, 3.4svh, 30px);
    border-top: 1px solid rgb(17 17 17 / 14%);
    font-size: clamp(30px, 9.4vw, 52px);
    line-height: 1;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    transition:
      opacity var(--site-sheet-ms) var(--site-sheet-ease),
      transform var(--site-sheet-ms) var(--site-sheet-ease);
  }

  .site-header .mobile-menu a:last-child {
    border-bottom: 1px solid rgb(17 17 17 / 14%);
  }

  .site-header .mobile-menu a:nth-child(2) {
    transition-delay: 50ms;
  }

  .site-header .mobile-menu a:nth-child(3) {
    transition-delay: 100ms;
  }

  .site-header .mobile-menu[hidden] a {
    opacity: 0;
    transform: translateX(14px);
    transition-delay: 0s;
  }

  .site-header .mobile-menu :focus-visible {
    outline-color: #111111;
  }

  /* Nothing behind the open menu scrolls. */
  body:has(.mobile-menu:not([hidden])) {
    overflow: hidden;
  }
}

/* The cart, at every width: the overlay fades in as the drawer slides across,
 * on the same curve and duration as the mobile menu, and the drawer's contents
 * fade in just behind the edge; closing reverses all three. */
.cart-drawer {
  transition: background var(--site-sheet-ms) var(--site-sheet-ease);
}

.cart-panel {
  transition: transform var(--site-sheet-ms) var(--site-sheet-ease);
}

.cart-panel > * {
  opacity: 0;
  transition: opacity calc(var(--site-sheet-ms) * 0.6) var(--site-sheet-ease);
}

.cart-drawer.is-open .cart-panel > * {
  opacity: 1;
  transition-delay: calc(var(--site-sheet-ms) * 0.3);
}

/* Reduced motion: no movement and nothing waits on a transition that is no
 * longer running (styles.css already cuts every duration to almost nothing). */
@media (prefers-reduced-motion: reduce) {
  .site-header .mobile-menu,
  .site-header .mobile-menu[hidden],
  .site-header .mobile-menu a,
  .site-header .mobile-menu[hidden] a,
  .cart-drawer.is-open .cart-panel > * {
    transition-delay: 0s !important;
  }

  .site-header .mobile-menu[hidden] a {
    transform: none;
  }
}
