/* ═══════════════════════════════════════════════════════
   NexStone — site menu overlay
   Loaded on every page. On the film it is the only navigation;
   on inner pages it sits alongside the sticky header.

   Open state is driven two ways on purpose:
     :target            — works with JavaScript disabled
     [data-open="true"] — set by js/menu.js, which also freezes the film
   ═══════════════════════════════════════════════════════ */

/* ─── Light theme: the overlay itself opts back out ───
   Same reasoning as css/style.css's film section: css/design-system.css's
   light override lives at :root, so it reaches .site-menu's own text too
   (brand, close, links, foot). The overlay used to pin those back to dark
   values in both themes, so that light-theme visitors met a dark panel.
   That pin is gone: the overlay now follows the theme like the rest of the
   site, which is what --menu-bg and --menu-media-scrim in
   css/design-system.css light block are for. CLAUDE.md's Navigation
   section still describes the old always-dark behaviour and needs updating.
   .menu-trigger was never pinned: on the film it lives inside
   .chrome--top, already dark by css/style.css; on inner pages it lives in
   .site-header and follows the theme. */

/* ─── Trigger ─── */
.menu-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--menu-trigger-gap);
  min-height: var(--tap-target-min);
  font-size: var(--font-size-3xs);
  letter-spacing: var(--tracking-caps-lg);
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-decoration: none;
  text-shadow: var(--shadow-text-sm);
  transition: color var(--duration-base) var(--ease-soft);
}
.menu-trigger:hover { color: var(--color-text-strong); }

/* the two-rule mark beside the word */
.menu-trigger__mark {
  display: inline-flex;
  flex-direction: column;
  gap: var(--space-1);
  width: var(--menu-rule-width);
}
.menu-trigger__mark::before,
.menu-trigger__mark::after {
  content: "";
  height: var(--border-width-hairline);
  background: currentColor;
  transition: transform var(--duration-smooth) var(--ease-cine);
}
.menu-trigger:hover .menu-trigger__mark::after { transform: scaleX(var(--alpha-60)); transform-origin: right center; }

/* While the menu is open the page chrome underneath would show through as a
   second wordmark. Hide it. The class is set by js/menu.js; without JS the
   scrim alone carries the contrast. */
body.nexstone-menu-open .chrome,
body.nexstone-menu-open .roomnav,
body.nexstone-menu-open .counter,
body.nexstone-menu-open .site-header {
  opacity: var(--alpha-00);
  pointer-events: none;
  transition: opacity var(--duration-base) var(--ease-soft);
}

/* ─── Overlay ─── */
.site-menu {
  position: fixed;
  inset: var(--layout-inset-full);
  z-index: var(--z-menu);
  display: flex;
  flex-direction: column;
  /* Top gutter matches .site-header and .chrome--top so CLOSE sits exactly
     where MENU was; the bottom keeps the overlay's own roomier padding. */
  padding: var(--layout-gutter-block-sm) var(--layout-container-pad) var(--menu-pad-block);
  background: var(--menu-bg);
  backdrop-filter: blur(var(--menu-blur));
  -webkit-backdrop-filter: blur(var(--menu-blur));
  /* Never parked off-screen: a fixed element beyond the viewport extends the
     document and overflow-x: clip on an ancestor will not contain it. */
  opacity: var(--alpha-00);
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-soft),
              visibility var(--duration-base);
  overflow-y: auto;
}
.site-menu:target,
.site-menu[data-open="true"] { opacity: var(--alpha-100); visibility: visible; }

.site-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.site-menu__brand {
  font-family: var(--font-family-logo);
  font-weight: var(--font-weight-hairline);
  font-size: var(--font-size-md);
  letter-spacing: var(--tracking-caps);
  color: var(--color-text-strong);
  text-decoration: none;
}
.site-menu__brand span { color: var(--color-text-accent); }

.site-menu__close {
  display: inline-flex;
  align-items: center;
  gap: var(--menu-trigger-gap);
  min-height: var(--tap-target-min);
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--font-size-3xs);
  letter-spacing: var(--tracking-caps-lg);
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-decoration: none;
  cursor: pointer;
  transition: color var(--duration-base) var(--ease-soft);
}
.site-menu__close:hover { color: var(--color-text-accent); }

/* ─── Header actions ───
   The theme toggle and MENU - or, in the overlay head, CLOSE - as one group,
   in all three chromes. MENU and CLOSE take one slot width and right-align
   inside it, so the toggle beside them lands on the same point whether the
   menu is open or shut: they measured 78 and 45 px, which moved it 33 px. */
.chrome-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--chrome-actions-gap);
}
.chrome-actions > .menu-trigger,
.chrome-actions > .site-menu__close {
  justify-content: flex-end;
  min-inline-size: var(--chrome-action-slot);
}

/* ─── Theme toggle (template-parts/theme-toggle.php) ─── */
.theme-toggle {
  /* Hidden until js/theme-init.js adds .js-theme: without JavaScript the
     button cannot do anything. */
  display: none;
  align-items: center;
  justify-content: center;
  gap: var(--menu-trigger-gap);
  min-inline-size: var(--tap-target-min);
  min-block-size: var(--tap-target-min);
  padding: var(--space-0);
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--font-size-3xs);
  letter-spacing: var(--tracking-caps-lg);
  text-transform: uppercase;
  color: var(--color-text-muted);
  text-shadow: var(--shadow-text-sm);
  cursor: pointer;
  transition: color var(--duration-base) var(--ease-soft);
}
.js-theme .theme-toggle { display: inline-flex; }
.theme-toggle:hover { color: var(--color-text-strong); }
/* Keyed off the attribute theme-init.js sets in the head, not aria-pressed,
   which the footer script syncs later - a returning light-theme visitor would
   otherwise see the unpressed colour first. */
:root[data-theme="light"] .theme-toggle { color: var(--color-text-accent); }
:root[data-theme="light"] .theme-toggle:hover { color: var(--color-text-strong); }

/* A half-lit disc that turns over when the light theme is on. */
.theme-toggle__mark {
  inline-size: var(--theme-toggle-mark-size);
  block-size: var(--theme-toggle-mark-size);
  border: var(--border-width-hairline) solid currentColor;
  border-radius: var(--radius-pill);
  background: var(--theme-toggle-mark-fill);
  transition: transform var(--duration-smooth) var(--ease-cine);
}
:root[data-theme="light"] .theme-toggle__mark { transform: var(--theme-toggle-mark-turn); }

/* Mark only on the narrowest phones: at 320 px the wordmark leaves 73 px for
   the whole group. The aria-label names the button either way. */
.theme-toggle__label { display: none; }
@media (min-width: 360px) {
  /* 360px === --breakpoint-xs */
  .theme-toggle__label { display: inline; }
}

/* The head sits over the top of the plate, which can be bright. */
.site-menu__brand,
.site-menu__close,
.site-menu__head .theme-toggle { text-shadow: var(--shadow-text-onimage); }

.site-menu__body {
  flex: 1 1 auto;
  display: grid;
  gap: var(--space-10);
  align-content: center;
  justify-items: center;
  padding-block: var(--menu-pad-block);
  text-align: center;
}

/* ─── Primary links ─── */
.site-menu__pages {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--menu-link-gap);
}
.site-menu__pages a {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  /* The links sit directly on photography now, and the receded ones are only
     60% opaque - they need to hold against a bright frame. */
  text-shadow: var(--shadow-text-body);
  font-family: var(--font-family-serif);
  font-weight: var(--font-weight-light);
  font-size: var(--menu-link-size);
  line-height: var(--leading-snug);
  color: var(--color-text-strong);
  text-decoration: none;
  transition: color var(--duration-base) var(--ease-soft);
}
.site-menu__pages a:hover,
.site-menu__pages a:focus-visible,
.site-menu__item.is-current > a { color: var(--color-text-accent); }

/* While the pointer is anywhere in the list, everything it is not on recedes.
   The hovered item is then the only lit thing on the page. */
.site-menu__pages:hover a { color: var(--color-text-muted); }
.site-menu__pages:hover a:hover { color: var(--color-text-strong); }

/* ─── Hover reveal ─── */
.site-menu__media {
  /* Full bleed. An absolutely positioned child resolves against the padding
     box, so inset:0 is exactly the viewport - never past it, because an
     element beyond the edge extends the document and body { overflow-x:
     hidden } only hides that, it does not fix it. */
  position: absolute;
  inset: var(--layout-inset-full);
  z-index: var(--menu-media-z);
  overflow: hidden;
}

/* The drift layer. Inset outward inside the clipping parent, so it can move
   without ever exposing a strip of background - and the over-scaled images
   are clipped by the parent rather than spilling across the viewport. */
.site-menu__media-inner {
  position: absolute;
  inset: calc(var(--menu-media-bleed) * -1);
  transform: translate3d(var(--menu-media-x, 0), var(--menu-media-y, 0), 0);
  transition: transform var(--duration-ambient) var(--ease-soft);
}

/* A veil over the image. Over the bare overlay it is ink on ink - invisible
   until an image is behind it. */
.site-menu__media::after {
  content: "";
  position: absolute;
  inset: var(--layout-inset-full);
  background: var(--menu-media-scrim);
  pointer-events: none;
}

/* No pointer, no hover, so the background can never change: below
   --breakpoint-md the images would be bandwidth spent on something that
   cannot happen. */
.site-menu__media { display: none; }

/* Content sits above the plate. Each is a sibling of the media, never a
   parent of it - a positioned ancestor would become its containing block and
   the plate would resolve against that box instead of the viewport. */
.site-menu__head,
.site-menu__body,
.site-menu__foot { position: relative; z-index: var(--menu-content-z); }

.site-menu__image {
  position: absolute;
  inset: var(--layout-inset-full);
  width: var(--layout-size-full);
  height: var(--layout-size-full);
  object-fit: cover;
  /* Resting state: wiped away downward, waiting below the frame. */
  clip-path: var(--menu-clip-below);
  transform: scale(var(--menu-media-scale-in));
  transition: clip-path var(--menu-media-exit) var(--ease-cine),
              transform var(--menu-media-exit) var(--ease-cine);
}

/* Leaving: the curtain drops from the bottom rather than snapping back. */
.site-menu__image.is-leaving {
  clip-path: var(--menu-clip-above);
  transform: scale(var(--menu-media-scale-out));
}

.site-menu__image.is-active {
  clip-path: var(--menu-clip-shown);
  transform: scale(var(--scale-none));
  transition: clip-path var(--menu-media-enter) var(--ease-cine),
              transform var(--menu-media-enter) var(--ease-cine);
}

.site-menu__foot {
  text-align: center;
  font-size: var(--font-size-3xs);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  color: var(--color-text-faint);
}
.site-menu__foot a { color: inherit; text-decoration: none; }
.site-menu__foot a:hover { color: var(--color-text-accent); }

/* ─── Entrance stagger ─── */
.site-menu__body > * ,
.site-menu__foot {
  opacity: var(--alpha-00);
  transform: translateY(var(--menu-rise));
  transition: opacity var(--duration-base) var(--ease-soft),
              transform var(--duration-smooth) var(--ease-cine);
}
.site-menu:target .site-menu__body > *,
.site-menu:target .site-menu__foot,
.site-menu[data-open="true"] .site-menu__body > *,
.site-menu[data-open="true"] .site-menu__foot {
  opacity: var(--alpha-100);
  transform: none;
}
.site-menu__foot { transition-delay: var(--menu-stagger-step); }

/* ═══════════════ 900px — --breakpoint-md ═══════════════ */
@media (min-width: 900px) {
  /* 900px === --breakpoint-md */
  .site-menu { padding-top: var(--layout-gutter-block); }
  .site-menu { padding-inline: var(--layout-container-pad-lg); }
  .site-menu__media { display: block; }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle__mark { transition: none; }
  .site-menu__media-inner { transition: none; }
  .site-menu__image,
  .site-menu__image.is-active,
  .site-menu__image.is-leaving {
    transition: none;
    transform: none;
  }

  .site-menu,
  .site-menu__body > *,
  .site-menu__foot { transition-duration: var(--delay-none); }
  .site-menu__body > *,
  .site-menu__foot { transform: none; }
}
