/* ==========================================================================
   Nav / site header
   Figma "Home Page": logo 171x52 at (102,54); nav group 607x59 at (1213,55)
   right-aligned to x=1820. Hero starts at y=114 = header bottom, so the
   header owns the full 54px top gap and no bottom padding.
   Figma "Mobile Home": logo 130x40 at (21,50); hamburger 25x17 at (357,60);
   hero starts at y=107 -> (107-90)/2 = 8px bottom padding.
   ========================================================================== */

/* The header is fixed (it lives outside #smooth-wrapper in index.html because
   ScrollSmoother transforms the page content). The page-shell side of that —
   --nav-h / --nav-stuck-h and the #smooth-content top padding that keeps the
   hero at y=114 like the Figma — lives in css/base.css so it applies even when
   this file is not enqueued. js/main.js adds .is-stuck once the page has
   scrolled (compact, blurred bar) and .is-hidden while scrolling down;
   scrolling up brings the bar back. This file styles .site-header* only. */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding-top: 54px;
  padding-bottom: 0;
  /* Frosted glass: translucent page colour + blur of whatever scrolls beneath */
  background: rgba(13, 13, 13, .55);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid transparent;
  transform: translateY(0);
  transition: transform .45s cubic-bezier(.22, .61, .36, 1), padding .3s ease, background-color .3s ease, border-color .3s ease;
  will-change: transform;
}
.site-header.is-stuck {
  padding-top: 18px;
  padding-bottom: 12px;
  background: rgba(13, 13, 13, .6);
  border-bottom-color: rgba(255, 255, 255, .07);   /* hairline edge so the glass reads as a bar */
}
.site-header.is-hidden { transform: translateY(-100%); }

.site-header__inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  min-height: 60px; /* y 54 -> 114 */
}

/* ---- Logo ----------------------------------------------------------------- */
/* Lockup = inline white X (40×40, 6px down) + wordmark image (112×52) 19.5px to
   its right: the same 171×52 box the old landscape PNG filled (X at x 0–40,
   text from x 59.5). js/logo-loop.js plays MX's original logo animation on load
   (the X's outline drawn in place at the left, then the words come out from beside it);
   when it does not run (no JS, reduced motion) nothing is hidden or moved. */
.site-header__logo {
  display: flex;
  align-items: flex-start;
  gap: 19.5px;
  flex: 0 0 auto;
  height: 52px;
  margin-left: 2px; /* Figma x=102 inside the 100px gutter */
}
.site-header__mark {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  margin-top: 6px;
}
.site-header__mark-draw,
.site-header__mark-final {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.site-header__mark-draw { opacity: 0; }        /* js/logo-loop.js shows it while the outline is drawn */
.site-header__mark-final { object-fit: contain; }   /* the exact logo bitmap: the resting state */
.site-header__wordmark {
  overflow: hidden;   /* the words slide out from behind this edge, beside the X (js/logo-loop.js) */
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  width: 112px;
  height: 52px;
}
.site-header__word { display: block; width: 112px; height: auto; }

/* ---- Desktop nav ---------------------------------------------------------- */
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 63px;        /* "About" right edge 1550 -> pill left 1613 */
  height: 59px;     /* Group 148 */
  margin-top: 1px;  /* Group 148 y=55 vs logo y=54 */
  flex: 0 0 auto;
}

.site-header__links {
  display: flex;
  align-items: center;
  gap: 47px;            /* 1318 -> 1365, 1429 -> 1476 */
  padding-bottom: 10px; /* text box y 68->91 sits 5px above the pill centre (84.5) */
}

.site-header__link {
  display: block;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 0.98;
  text-transform: capitalize;
  color: var(--fg);
  white-space: nowrap;
  transition: color .25s ease;
}
.site-header__link:hover,
.site-header__link:focus-visible {
  color: var(--accent);
}

/* Contact pill: 207x59, logomark 27px from the left edge, text 36px from the right */
.site-header .site-header__cta {
  min-width: 207px;
  padding: 0 36px 0 27px;
  justify-content: space-between;
  line-height: 0.98;
}

/* ---- Hamburger (mobile only) --------------------------------------------- */
.site-header__toggle {
  display: none;
  position: relative;
  flex: 0 0 auto;
  width: 25px;
  height: 18px; /* three 1px lines at y = 0, 8, 17 */
}
.site-header__toggle::before {
  /* enlarge the tap target without changing layout */
  content: "";
  position: absolute;
  inset: -12px;
}
.site-header__toggle span {
  position: absolute;
  left: 0;
  width: 25px;
  height: 1px;
  background: var(--fg);
  transition: transform .25s ease, opacity .25s ease;
}
.site-header__toggle span:nth-child(1) { top: 0; }
.site-header__toggle span:nth-child(2) { top: 8px; }
.site-header__toggle span:nth-child(3) { top: 17px; }

/* Open state (toggled by js/main.js: .is-open on .site-header, aria-expanded on the button;
   the full-screen menu itself is src/overlays/menu.html, opened by js/menu.js on the same click) */
.site-header.is-open .site-header__toggle span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.site-header.is-open .site-header__toggle span:nth-child(2) { opacity: 0; }
.site-header.is-open .site-header__toggle span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* ---- Tablet / mobile ------------------------------------------------------- */
@media (max-width: 1024px) {
  .site-header__toggle {
    display: block;
    align-self: center;
    order: 3;
  }

  /* The desktop links row is replaced by the full-screen menu overlay
     (css/overlays/menu.css); the old dropdown panel under the bar is retired. */
  .site-header__nav { display: none; }
}

@media (max-width: 640px) {
  .site-header {
    padding-top: 50px;
    padding-bottom: 8px;
  }
  .site-header__inner {
    min-height: 40px; /* y 50 -> 90 */
  }
  /* Figma logo 130×40: the lockup scaled to 30 + 15 + 85 */
  .site-header__logo {
    gap: 15px;
    height: 40px;
    margin-left: 1px; /* Figma x=21 inside the 20px gutter */
  }
  .site-header__mark {
    width: 30px;
    height: 30px;
    margin-top: 4.5px;
  }
  .site-header__wordmark {
    width: 85px;
    height: 39.5px;
  }
  .site-header__word { width: 85px; }
  .site-header__toggle {
    align-self: flex-start;
    margin-top: 10px; /* Group 9 y=60 */
  }
}

/* Compact (stuck) bar on small screens: 14 + 40 + 10 (+1px border) = 65px = --nav-stuck-h (css/base.css) */
@media (max-width: 640px) {
  .site-header.is-stuck { padding-top: 14px; padding-bottom: 10px; }
}

/* ---- Contact pill hover: reverse of the outlined buttons (green pill → black
   fill wiping in, green outline + green text + green logomark). Uses .btn--wipe. */
.site-header__cta { --wipe-fill: var(--bg); --wipe-txt: var(--accent); }
.site-header__cta:hover,
.site-header__cta:focus-visible { --wipe-edge: var(--accent); box-shadow: none; }
.site-header__cta-mark { position: relative; display: inline-flex; width: 36px; height: 36px; flex: 0 0 auto; }
.site-header__cta-mark img { position: absolute; inset: 0; width: 36px; height: 36px; transition: opacity .3s ease; }
.site-header__cta-mark--green { opacity: 0; }
.site-header__cta:hover .site-header__cta-mark--black,
.site-header__cta:focus-visible .site-header__cta-mark--black { opacity: 0; }
.site-header__cta:hover .site-header__cta-mark--green,
.site-header__cta:focus-visible .site-header__cta-mark--green { opacity: 1; }
