/* ============================================================
   Shared UI components
   Loaded on every page IN ADDITION to that page's stylesheet.
   Relies on the CSS custom properties (--text, --line, --bg ...)
   defined in :root by each page stylesheet.
   ============================================================ */

/* Dark only — keep native UI (scrollbars, form controls, autofill) dark
   regardless of the OS colour-scheme preference. */
:root {
  color-scheme: dark;
}

/* Scroll lock — used by the gallery modal (.no-scroll, set in site.js)
   and by the mobile menu (.menu-open). */
body.no-scroll,
body.menu-open {
  overflow: hidden;
}

/* Sticky footer — on short pages keep the footer at the bottom of the
   viewport instead of floating mid-screen with empty space beneath it.
   (The footer is the last child of <main> on every page.) */
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body > main {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
}

main > footer {
  margin-top: auto;
}

/* ============================================================
   Header nav (desktop)
   The primary nav holds the links AND the Contact CTA; the bar's
   space-between keeps the brand on the left and this group right-aligned.
   ============================================================ */
header nav[aria-label="Primary"] {
  display: flex;
  align-items: center;
  gap: 14px;
}

/* ============================================================
   Mobile navigation (hamburger)
   The desktop nav (`nav ul`) is hidden at <=940px by each page
   stylesheet; this toggle + full-screen overlay take its place.
   The overlay links are cloned from the page's primary nav by site.js.
   ============================================================ */

/* Toggle button — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  width: 44px;
  height: 44px;
  padding: 0;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(127, 127, 127, .06);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle span {
  position: absolute;
  left: 11px;
  right: 11px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform .25s ease, opacity .2s ease, top .25s ease;
}

.nav-toggle span:nth-child(1) { top: 15px; }
.nav-toggle span:nth-child(2) { top: 21px; }
.nav-toggle span:nth-child(3) { top: 27px; }

/* Open state: morph into an X */
.nav-toggle[aria-expanded="true"] span:nth-child(1) { top: 21px; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

/* Full-screen translucent overlay menu */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 45;                       /* below the sticky header (z 50) so the toggle stays clickable */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 96px 24px 32px;           /* clear the sticky header */
  background: rgba(12, 13, 16, .8);  /* ~80% opaque — the page stays faintly visible behind */
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .28s ease, visibility .28s ease;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu__nav {
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  width: min(420px, 100%);
}

.mobile-menu__nav a {
  font-size: 1.35rem;
  letter-spacing: .12em;
  color: var(--text);
  padding: .5rem .8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: .2s ease;
}

.mobile-menu__nav a:hover,
.mobile-menu__nav a:focus-visible {
  border-color: var(--line);
  background: rgba(127, 127, 127, .1);
}

/* Subtle accent for the Contact CTA inside the overlay menu */
.mobile-menu__nav a.is-cta {
  margin-top: 6px;
  border-color: var(--line);
  background: rgba(127, 127, 127, .12);
  font-weight: 600;
}

.mobile-menu__nav a.is-cta:hover,
.mobile-menu__nav a.is-cta:focus-visible {
  background: rgba(127, 127, 127, .18);
}

@media (max-width: 940px) {
  .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .nav-cta { display: none; }                  /* hide the Contact CTA in the bar; it lives in the menu */
  .nav > a:not(.brand) { display: none; }      /* hide trailing section label; it lives in the menu */
}

@media (prefers-reduced-motion: reduce) {
  .mobile-menu,
  .nav-toggle span { transition: none; }
}
