/* ══════════════════════════════════════════
   FIRE SITE KIT: THE HEADER
   The Fire Header (fire-design skill), as fire.co draws it
   (fire-devspace/fire-marketing, public/css/nav.css): fixed over the top of
   the page, no fill, the page blurred behind it; the mark and FIRE (or FIRE
   and the product's name in weight 500) at the left; the menu's links, then
   at most one primary action, at the right. A link with a dropdown opens it
   while pointed at or while a keyboard is inside it.

   Under 768px the links fold behind a 44px menu button, and open as a panel
   sliding in from the right over the dimmed page. The panel is the links'
   own element, a popover (HTML's popover attribute), so it opens, closes on
   Esc or a tap outside, and returns focus with no script; menu.js only
   closes it when one of its links is followed, or when the window grows
   past a phone's width.
   ══════════════════════════════════════════ */

/* --- Fire Mark --- */
.fire-mark {
  width: 24px;
  height: 24px;
  color: var(--text);
  flex-shrink: 0;
}

/* --- The bar --- */
.site-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: background var(--duration-slow) var(--ease-in-out);
}

.site-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-4) var(--space-6);
}

/* --- The brand --- */
.site-nav__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
}

.site-nav__wordmark {
  font-family: var(--sans);
  font-size: var(--text-base);
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--text);
}

/* A product's own site: FIRE, then its name in weight 500, the mark 24px
   (owner, 2026-11-17; 28px until then). */
.site-nav__product {
  font-weight: 500;
}

.site-nav__brand:has(.site-nav__product) .fire-mark {
  width: 1.5rem;
  height: 1.5rem;
}

/* --- The end slot: the menu, then the one action --- */
/* The row is a button's height with or without a button, so every Fire header is 76px. */
.site-nav__end {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  min-height: var(--target);
}

/* On a wide screen the menu is only its links, in the row. */
.site-nav__menu {
  display: block;
  position: static;
  inset: auto;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: visible;
  background: none;
  color: inherit;
}

.site-nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  list-style: none;
}

.site-nav__link {
  font-size: var(--text-sm);
  color: var(--text-2);
  text-decoration: none;
  padding: 14px 0;
  transition: color var(--duration-slow) var(--ease-out);
  position: relative;
}

.site-nav__link:hover,
.site-nav__link-active {
  color: var(--text);
  opacity: 1;
}

/* --- Dropdown --- */
.site-nav__dropdown {
  position: relative;
}

.site-nav__dropdown-menu {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  background: var(--dropdown-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: var(--space-2) 0;
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-normal) var(--ease-out),
              visibility var(--duration-normal) var(--ease-out);
}

/* A dropdown whose label is a button, for a group with no page of its own (Fire Studio's Work, Studio and Admin): the same look as a link, a count beside it where something waits. */
.site-nav__dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 14px 0;
  background: none;
  border: 0;
  font: inherit;
  font-size: var(--text-sm);
  color: var(--text-2);
  cursor: pointer;
}

.site-nav__dropdown-toggle:hover,
.site-nav__dropdown-toggle[aria-expanded="true"] {
  color: var(--text);
}

/* Open while pointed at, or while a keyboard is inside it. */
.site-nav__dropdown:hover .site-nav__dropdown-menu,
.site-nav__dropdown:focus-within .site-nav__dropdown-menu,
.site-nav__dropdown:has(.site-nav__dropdown-toggle[aria-expanded="true"]) .site-nav__dropdown-menu {
  opacity: 1;
  visibility: visible;
}

.site-nav__dropdown-item {
  display: block;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  color: var(--text-2);
  text-decoration: none;
  transition: color var(--duration-slow) var(--ease-out),
              background var(--duration-slow) var(--ease-out);
}

.site-nav__dropdown-item:hover,
.site-nav__dropdown-item[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  opacity: 1;
}

/* --- The menu button and the panel's close button: phones only --- */
.site-nav__menu-btn,
.site-nav__close {
  display: none;
  width: var(--target);
  height: var(--target);
  align-items: center;
  justify-content: center;
  padding: 0;
  background: none;
  border: none;
  color: var(--text);
  cursor: pointer;
}

.site-nav__menu-btn svg,
.site-nav__close svg {
  width: 24px;
  height: 24px;
}

/* --- Phones: the slide-in menu --- */
@media (max-width: 768px) {
  .site-nav__inner {
    padding: var(--space-3) var(--space-4);
  }

  .site-nav__end {
    gap: var(--space-2);
  }

  .site-nav__menu-btn {
    display: inline-flex;
  }

  /* The panel: the window's full height at its right, the page dimmed
     behind. It slides in at the normal pace and out at the exit pace. */
  .site-nav__menu {
    position: fixed;
    inset: 0 0 0 auto;
    width: var(--menu-width);
    height: 100vh;
    height: 100dvh;
    padding: var(--space-16) var(--space-6) var(--space-8);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--bg);
    color: var(--text);
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform var(--duration-exit) var(--ease-in),
                overlay var(--duration-exit) var(--ease-in) allow-discrete,
                display var(--duration-exit) var(--ease-in) allow-discrete;
  }

  .site-nav__menu:not(:popover-open) {
    display: none;
  }

  .site-nav__menu:popover-open {
    transform: none;
    transition-duration: var(--duration-normal);
    transition-timing-function: var(--ease-out);
  }

  .site-nav__menu::backdrop {
    background: transparent;
    transition: background var(--duration-exit) var(--ease-in),
                overlay var(--duration-exit) var(--ease-in) allow-discrete,
                display var(--duration-exit) var(--ease-in) allow-discrete;
  }

  .site-nav__menu:popover-open::backdrop {
    background: var(--overlay-bg);
    transition-duration: var(--duration-normal);
    transition-timing-function: var(--ease-out);
  }

  @starting-style {
    .site-nav__menu:popover-open {
      transform: translateX(100%);
    }

    .site-nav__menu:popover-open::backdrop {
      background: transparent;
    }
  }

  .site-nav__close {
    display: inline-flex;
    position: absolute;
    top: var(--space-3);
    right: var(--space-4);
  }

  /* A column of links, each a finger's height; a dropdown's entries
     indented beneath their page. */
  .site-nav__links {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-1);
  }

  .site-nav__link,
  .site-nav__dropdown-item {
    display: flex;
    align-items: center;
    min-height: var(--target);
    padding: 0;
    font-size: var(--text-base);
  }

  .site-nav__dropdown-menu {
    position: static;
    transform: none;
    min-width: 0;
    border: none;
    background: none;
    padding: 0 0 0 var(--space-4);
    opacity: 1;
    visibility: visible;
  }

  .site-nav__dropdown-item:hover,
  .site-nav__dropdown-item[aria-current="page"] {
    background: none;
  }
}

@media (max-width: 400px) {
  .site-nav__inner .btn {
    font-size: var(--text-xs);
    padding: var(--space-2) var(--space-4);
    min-height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-nav__menu,
  .site-nav__menu::backdrop {
    transition: none;
  }
}
