/* home-menu.css - Yard.me-style overlay wired to the home-page more
   button (bottom-right). ALL rules are scoped under `.home-menu` so
   nothing here can leak into the ride, hero, chrome, preloader, or
   any other page. Do not add global selectors below.

   The overlay markup is injected by js/home-menu.js on load. */

/* One font-face declaration, aliased to a unique name so it can't
   clash with the site's existing `New Black` alias. */
@font-face {
  font-family: 'HomeMenuBlack';
  src: url('../fonts/NewBlackTypeface-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.home-menu {
  /* Design tokens, prefixed so they only live inside .home-menu. */
  --hm-overlay-bg:  #000000;
  --hm-overlay-ink: #f0f2f1;
  --hm-rule:        rgba(240, 242, 241, 0.12);

  --hm-ease:         cubic-bezier(0.65, 0.02, 0.24, 1);
  --hm-ease-elastic: cubic-bezier(0.22, 1.4, 0.36, 1);
  --hm-overlay-dur:  600ms;
  --hm-rise-dur:     700ms;
  --hm-rise-step:    80ms;
  --hm-rise-open:    250ms;
  --hm-swap-dur:     500ms;
  --hm-marquee-dur:  20s;

  /* z:5000 so About / Case Study high-z page content (e.g.
     body.is-night-mode .contact at z:1000, .fade-curtain at 900,
     etc.) sits BELOW the black BG when the menu opens. Chrome and
     toggles get bumped above 5000 in the desktop-parity block below
     so they stay reachable while the menu is open. */
  position: fixed;
  inset: 0;
  z-index: 5000;
  color: var(--hm-overlay-ink);
  background: var(--hm-overlay-bg);
  display: flex;
  flex-direction: column;
  justify-content: center;      /* rows vertically centred as a group */
  padding: 0;
  clip-path: inset(100% 0 0 0);   /* starts at bottom edge → grows upward */
  pointer-events: none;
  transition: clip-path var(--hm-overlay-dur) var(--hm-ease);

  font-family: 'Inter', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.home-menu-open .home-menu {
  clip-path: inset(0);
  pointer-events: auto;
}
body.home-menu-open { overflow: hidden; }

/* Safari fix - REAL root cause:
   styles.css line 78 does `.is-safari .hero { position: fixed; inset: 0; }`.
   In Safari that makes .hero a stacking context at root z-auto (~0).
   Every descendant's z-index becomes LOCAL to .hero, so .hero__chrome's
   z:1010 is really just "1010 within .hero", and the whole .hero group
   sits at level 0 in root - below this overlay's z:505.
   Chrome/Firefox use `.hero { position: relative; }` (no stacking
   context), so chrome's 1010 goes directly to root and wins there.

   Fix: while the menu is open on Safari, override .hero back to
   `position: relative`. That kills its stacking context; .hero__chrome
   returns to root at z:1010, above this overlay's z:505. .hero's own
   `fixed` positioning only matters for scroll-syncing, which is disabled
   here anyway (body has overflow:hidden while menu is open). Reverts
   when the body class is removed. */
.is-safari body.home-menu-open .hero {
  position: relative !important;
}

/* Desktop chrome parity across every page that loads this file.
   About/Case Study only load their own page CSS (about.css /
   case-study1.css) and their .hero__chrome rules live inside a
   mobile media query — so on desktop there's NO styling for the
   chrome. These rules recreate the home page's exact bottom-chrome
   styling from styles.css, scoped to desktop, so About / Case Study
   / Game all match Home pixel-for-pixel. Home already gets the same
   values from styles.css; these rules match and win the cascade
   only because they're loaded after and are equally specific.

   Mobile is untouched. */
@media (min-width: 768px) {
  /* Hide the old top nav (About / Case Study). Home has no .nav. */
  .nav { display: none !important; }

  /* Bottom chrome row. `position: fixed` so it stays pinned to the
     viewport bottom on About / Case Study (which scroll long pages)
     - `absolute` would anchor to the tall document and cause paint
     lag on every scroll frame. Home is unaffected: on Home the same
     row sat inside .hero (100vh) so absolute vs fixed rendered the
     same visually. z:6000 keeps the chrome above the .home-menu
     overlay (z:5000) so the more/close button is always clickable. */
  .hero__chrome {
    display: flex !important;
    position: fixed;
    left: 60px;
    right: 60px;
    bottom: 40px;
    top: auto;
    width: auto;
    height: auto;
    padding: 0;
    background: transparent;
    z-index: 6000;
    align-items: flex-end;
    grid-template-columns: none;   /* undo About's grid rules */
    grid-template-rows: none;
    column-gap: 0;
    row-gap: 0;
    gap: 24px;
    mix-blend-mode: normal;
    pointer-events: none;
  }
  .hero__chrome > * { pointer-events: auto; }

  /* Brand logo — 100 px wide, aspect 186:148. */
  .brand {
    flex-shrink: 0;
    display: block;
    width: 100px;
    height: auto;
    aspect-ratio: 186 / 148;
    cursor: pointer;
    grid-column: auto;
    grid-row: auto;
  }
  .brand__img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Audio rule / music line. */
  .hero__rule {
    flex: 1 1 auto;
    height: 1px;
    background: #fff;
    opacity: 0.5;
    margin-bottom: 4px;
    width: auto;
    grid-column: auto;
    grid-row: auto;
  }
  .hero__rule--audio {
    position: relative;
    height: 1px;
    background: transparent;
    overflow: visible;
    opacity: 1;
    mix-blend-mode: normal;
    pointer-events: none;
  }
  /* The audio rule's line is drawn by an inline SVG, not the parent's
     background. Bring the home-page SVG styles so the white line
     renders on About / Case Study / Game too. */
  .hero__rule__svg {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 40px;
    overflow: visible;
    display: block;
    pointer-events: auto;
  }
  .hero__rule__path {
    fill: none;
    stroke: #fff;
    stroke-width: 2;
    stroke-linecap: round;
  }

  /* Site-nav container that holds the More button. */
  .site-nav {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 10px;
    width: auto;
    grid-column: auto;
    grid-row: auto;
    align-self: auto;
  }
  .site-nav a {
    display: inline-block;
    font-family: inherit;
    color: #fff;
    text-decoration: none;
    line-height: 1;
    letter-spacing: 0;
    text-transform: uppercase;
    width: auto;
    transition: opacity 200ms ease;
  }
  .site-nav a:hover { opacity: 0.7; }

  /* The More/Close icon inside the site-nav. Height fixed at 15 px,
     width scales proportionally. */
  .site-nav__more {
    display: block;
    height: 15px;
    width: auto;
    max-height: 15px;
  }

  /* Home page's top toggles (sound top-left, night top-right).
     Sit above the menu overlay (5000) so they stay visible and
     usable while the menu is open. About/Case Study don't render
     these; the rule is a no-op there. */
  .sound-toggle,
  .night-toggle {
    z-index: 6100 !important;
  }
}

/* ── Head ──────────────────────────────────────────────────────── */
.home-menu__head {
  text-align: center;
  padding-bottom: 32px;
}
.home-menu__head__title {
  margin: 0;
  font-family: 'HomeMenuBlack', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(48px, 6vw, 88px);
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}
.home-menu__head__sub {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.9;
}

/* ── Rows ───────────────────────────────────────────────────────── */
.home-menu__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--hm-rule);
  display: flex;
  flex-direction: column;
  flex: none;                   /* don't stretch - sit centred */
}
.home-menu__row {
  position: relative;
  border-bottom: 1px solid var(--hm-rule);
  height: clamp(90px, 13vh, 140px);
  overflow: hidden;
  transition: opacity 400ms var(--hm-ease);
}
.home-menu__rows:hover .home-menu__row { opacity: 0.15; }
.home-menu__rows:hover .home-menu__row:hover { opacity: 1; }

/* Current-page row: not a link, struck through, no hover behaviour.
   Signals "you are already here". Kept in flow so all four rows stay
   visually aligned; still gets the elastic rise on menu open. */
.home-menu__row.is-current {
  cursor: default;
  pointer-events: none;
}
.home-menu__rows:hover .home-menu__row.is-current { opacity: 0.35; }
/* Line-through has to land on the .rise span (display:inline-block),
   because text-decoration on an inline-block parent doesn't propagate
   to its inline-block children. Also apply to the title container for
   safety across browsers. */
.home-menu__row.is-current .home-menu__title,
.home-menu__row.is-current .home-menu__title .rise {
  text-decoration: line-through;
  text-decoration-thickness: 0.08em;
  text-decoration-color: currentColor;
  text-decoration-skip-ink: none;
  opacity: 0.6;
}
.home-menu__row.is-current .home-menu__side { opacity: 0.4; }

.home-menu__row__link {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  color: var(--hm-overlay-ink);
  text-decoration: none;
  overflow: hidden;
  cursor: pointer;
}

.home-menu__row__still {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 32px;
  transform: translateY(0);
  transition: transform var(--hm-swap-dur) var(--hm-ease);
  will-change: transform;
}
.home-menu__row__link:hover .home-menu__row__still { transform: translateY(-100%); }

.home-menu__side {
  overflow: hidden;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.85;
  white-space: nowrap;
}
.home-menu__side--left  { justify-self: start; }
.home-menu__side--right { justify-self: end; }

.home-menu__title {
  overflow: hidden;
  display: block;
  font-family: 'HomeMenuBlack', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 6.5vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  justify-self: center;
  text-align: center;
}

.home-menu__row__marquee {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  overflow: hidden;
  transform: translateY(100%);
  transition: transform var(--hm-swap-dur) var(--hm-ease);
  will-change: transform;
  font-family: 'HomeMenuBlack', 'Inter', sans-serif;
  font-weight: 700;
  font-size: clamp(40px, 6.5vw, 96px);
  line-height: 0.92;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  white-space: nowrap;
}
.home-menu__row__link:hover .home-menu__row__marquee { transform: translateY(0); }

.home-menu__row__marquee__track {
  display: inline-flex;
  align-items: center;
  gap: 48px;
  padding-left: 32px;
  animation: home-menu-marquee var(--hm-marquee-dur) linear infinite;
  animation-play-state: paused;
}
.home-menu__row__link:hover .home-menu__row__marquee__track { animation-play-state: running; }
.home-menu__row__marquee__track > span { display: inline-block; }
.home-menu__row__marquee__track .ff {
  font-size: 0.55em;
  opacity: 0.9;
  transform: translateY(-0.08em);
}
@keyframes home-menu-marquee {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* ── Rise reveal (elastic scale-Y + slide-up) ───────────────────── */
.home-menu .rise {
  display: inline-block;
  transform: translateY(110%) scaleY(0.35);
  transform-origin: bottom center;
  opacity: 0;
  transition:
    transform var(--hm-rise-dur) var(--hm-ease-elastic),
    opacity  300ms var(--hm-ease);
}
body.home-menu-open .home-menu .rise {
  transform: translateY(0) scaleY(1);
  opacity: 1;
}
body.home-menu-open .home-menu__head__title .rise { transition-delay: calc(var(--hm-rise-open) + 0ms); }
body.home-menu-open .home-menu__head__sub   .rise { transition-delay: calc(var(--hm-rise-open) + 100ms); }
body.home-menu-open .home-menu__row .rise         { transition-delay: calc(var(--hm-rise-open) + 200ms + var(--hm-index, 0) * var(--hm-rise-step)); }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .home-menu { padding: 0; }
  .home-menu__row__still {
    grid-template-columns: 1fr;
    padding: 0 20px;
    text-align: center;
  }
  .home-menu__side { display: none; }
  .home-menu__title, .home-menu__row__marquee { font-size: clamp(40px, 13vw, 88px); }

  /* Home mobile disables logo taps via `pointer-events: none` on
     .brand (styles.css). Re-enable on mobile so tapping the logo
     leads back to the video home page from any state (open or
     closed menu). About / Case Study .brand already has
     data-about-return which navigates home; this line doesn't
     affect them. */
  .brand {
    pointer-events: auto !important;
    cursor: pointer;
  }

  /* Mobile More/Close button - sits in the right cell of the mobile
     bottom chrome (.hero__chrome), replaces the old "WHO'S RIDING"
     text. Same click wiring as desktop (home-menu.js finds
     .site-nav__more everywhere). Slightly larger tap size (18 px)
     than desktop (15 px) so a finger can hit it comfortably. */
  .site-nav__more {
    display: block;
    height: 11px;              /* another 20% smaller (18 → 14 → 11 px) */
    width: auto;
    max-height: 11px;
  }

  /* No game on mobile - hide "The Game" row entirely. */
  .home-menu__row[data-action="game"] { display: none; }

  /* On About / Case Study mobile, hide the standalone mute and close
     buttons. The chrome bar (logo + line + more button) now handles
     both nav to home (via the menu's "The Ride" row) and sound (the
     waveform tap). Home doesn't have these classes, so this is a
     no-op there. */
  .about-mobile-sound,
  .about-mobile-close {
    display: none !important;
  }

  /* Mobile menu: no hover interactions. Rows sit static - the still
     title stays visible; no marquee, no still-slide-up, no dim of
     non-hovered rows. The curtain reveal on open still runs. */
  .home-menu__rows:hover .home-menu__row,
  .home-menu__rows:hover .home-menu__row:hover { opacity: 1; }

  .home-menu__row__link:hover .home-menu__row__still { transform: none; }
  .home-menu__row__link:hover .home-menu__row__marquee { transform: translateY(100%); }
  .home-menu__row__marquee { display: none; }
  /* Container `<a>` — align the icon flush to the right and give
     the whole anchor a bigger hit area than the icon itself.
     `width: auto !important` undoes styles.css line 1385
     (`.site-nav a { width: min-content }`) which was written for
     the old "WHO'S RIDING" two-line text and now collapses the
     anchor around the <img> to 0 px wide. */
  .site-nav a {
    display: inline-flex !important;
    align-items: center;
    padding: 8px 0;
    line-height: 1;
    text-decoration: none;
    width: auto !important;
  }

  /* When the menu opens, the mobile chrome (and top toggles) must
     stay above the overlay so the visitor can tap Close. About's
     mobile .hero__chrome is at z:1200; menu is z:5000, so without
     this the chrome disappears under the black BG. */
  body.home-menu-open .hero__chrome {
    z-index: 6000 !important;
  }
  body.home-menu-open .sound-toggle,
  body.home-menu-open .night-toggle,
  body.home-menu-open .about-mobile-sound,
  body.home-menu-open .about-mobile-close {
    z-index: 6100 !important;
  }

  /* Reduce the too-tall mobile chrome on About / Case Study only
     so the audio line sits closer to the bottom - balanced breathing
     above and below. Home is untouched (mobile chrome there is
     already sized correctly by styles.css). */
  html.is-about-page .hero__chrome,
  html.is-case-study-page .hero__chrome {
    height: 84px !important;
    padding: 18px 20px 18px !important;
    row-gap: 14px !important;
  }

  /* Halve the bottom gradient-blur strip on About / Case Study
     (was 200 px per about.css line 1992). */
  html.is-about-page .about-blur,
  html.is-case-study-page .about-blur {
    height: 100px !important;
  }
}

/* Tablet only (touch device, viewport 768 px+): no hover marquee.
   Tablets fall into the desktop @media block above and would get
   sticky-hover states on tap, which reads as a stuck animation. Kill
   all hover-driven row effects here - static rows, tap navigates.
   Desktop (hover: hover) and phones (max-width: 767px, covered
   above) are untouched. */
@media (hover: none) and (min-width: 768px) {
  .home-menu__rows:hover .home-menu__row,
  .home-menu__rows:hover .home-menu__row:hover { opacity: 1; }

  .home-menu__row__link:hover .home-menu__row__still { transform: none; }
  .home-menu__row__link:hover .home-menu__row__marquee { transform: translateY(100%); }
  .home-menu__row__marquee { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .home-menu,
  .home-menu .rise,
  .home-menu__row__still,
  .home-menu__row__marquee,
  .home-menu__row {
    transition-duration: 0ms !important;
  }
  .home-menu__row__marquee__track { animation: none !important; }
}
