/* ============================================================
   Mavericks Unlimited — Global Stylesheet
   Brand-led tokens, typography, layout primitives, shared
   nav/footer and parallax-friendly section scaffolding.
   ============================================================ */

/* ---------- 1. Fonts ----------------------------------------------------- */

@font-face {
  font-family: "Collier";
  src: url("../assets/fonts/Collier-Book.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Founders Grotesk";
  src: url("../assets/fonts/FoundersGrotesk-Light.otf") format("opentype");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* ---------- 2. Tokens --------------------------------------------------- */

:root {
  /* Brand palette */
  --c-yellow:        #ffa200;
  --c-green:         #065b30;
  --c-clay:          #cf5f2a;
  --c-green-grey:    #746d4e;
  --c-light:         #cbc8b9;
  --c-dark:          #110f0f;

  /* Semantic aliases */
  --bg:              var(--c-light);
  --bg-dark:         var(--c-dark);
  --ink:             var(--c-dark);
  --ink-on-dark:     var(--c-light);
  --accent:          var(--c-yellow);
  --accent-alt:      var(--c-clay);

  /* Typography */
  --font-heading:    "Collier", Georgia, serif;
  --font-body:       "Founders Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Type scale (fluid, clamp-driven) */
  --fs-xxl:  clamp(3rem, 7vw + 1rem, 7.5rem);   /* hero headlines */
  --fs-xl:   clamp(2.25rem, 4vw + 1rem, 4.5rem); /* section headlines */
  --fs-l:    clamp(1.5rem, 1.5vw + 1rem, 2.25rem);
  --fs-m:    clamp(1.125rem, 0.5vw + 1rem, 1.375rem);
  --fs-base: 1.0625rem;  /* 17px body */
  --fs-sm:   0.875rem;
  --fs-xs:   0.75rem;

  /* Spacing scale */
  --s-1: 0.5rem;
  --s-2: 1rem;
  --s-3: 1.5rem;
  --s-4: 2rem;
  --s-5: 3rem;
  --s-6: 5rem;
  --s-7: 8rem;
  --s-8: 12rem;

  /* Layout */
  --content-max: 1280px;
  --content-pad: clamp(1.25rem, 4vw, 3rem);
  --nav-height: 72px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- 3. Reset & base --------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Lenis takes over scroll on JS-enabled browsers, but keep this as a
     graceful fallback for users with JS disabled. */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  font-weight: 300;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden; /* prevent parallax horizontal jitter */
}

img, video, svg {
  display: block;
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 200ms var(--ease-out), opacity 200ms var(--ease-out);
}

a:hover, a:focus-visible {
  color: var(--accent);
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

::selection { background: var(--c-yellow); color: var(--c-dark); }

/* ---------- 4. Typography ----------------------------------------------- */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -0.01em;
  margin: 0 0 var(--s-3);
  text-wrap: balance;
}

h1 { font-size: var(--fs-xxl); }
h2 { font-size: var(--fs-xl); }
h3 { font-size: var(--fs-l); }
h4 { font-size: var(--fs-m); }

p { margin: 0 0 var(--s-3); max-width: 60ch; }

.eyebrow {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: var(--s-2);
  display: inline-block;
}

.lede {
  font-family: var(--font-heading);
  font-size: var(--fs-l);
  line-height: 1.25;
  max-width: 28ch;
}

/* ---------- 5. Layout primitives ---------------------------------------- */

.container {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding-inline: var(--content-pad);
}

.container--wide  { max-width: 1600px; }
.container--narrow { max-width: 880px; }

.section {
  position: relative;
  padding-block: var(--s-7);
  overflow: hidden; /* parallax layers shouldn't bleed outside section bounds */
}

.section--dark { background: var(--bg-dark); color: var(--ink-on-dark); }
.section--green { background: var(--c-green); color: var(--c-light); }
.section--clay  { background: var(--c-clay); color: var(--c-light); }

/* Stack utility */
.stack > * + * { margin-top: var(--s-3); }
.stack-lg > * + * { margin-top: var(--s-5); }

/* Grid utility */
.grid-2 {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}
@media (min-width: 880px) {
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: center; }
}

/* ---------- 6. Buttons -------------------------------------------------- */

/* Site-wide button/link style: underlined red text in Collier with an
   em-dash prefix. No background, no border, no border-radius. */
.btn,
.btn--ghost {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: var(--fs-base);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: #f11b34;
  background: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
  transition: color 200ms var(--ease-out);
}
.btn::before,
.btn--ghost::before {
  content: "— ";
}
.btn:hover, .btn:focus-visible,
.btn--ghost:hover, .btn--ghost:focus-visible {
  transform: none;
  background: none;
  color: var(--c-yellow);
}

/* ---------- 7. Navigation ----------------------------------------------- */
/* Layout: logo centered, burger top right, equal-width spacer on the left
   so the logo lands geometrically in the middle. Used at all viewport sizes —
   the nav is always the burger overlay; there is no inline link list. */

.site-nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: var(--s-2) var(--content-pad);
  height: var(--nav-height);
  background: transparent;
  color: var(--c-light);
  transition: background 300ms var(--ease-out), color 300ms var(--ease-out);
}

.site-nav.is-scrolled {
  background: rgba(17, 15, 15, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--c-light);
}

/* If the nav sits on a dark hero, force the dark theme right away (no flash) */
.site-nav[data-theme="dark"] { color: var(--c-light); }

.site-nav__logo {
  grid-column: 2;
  justify-self: center;
  display: inline-flex;
  align-items: center;
}

.site-nav__logo img {
  height: 32px;
  width: auto;
  filter: invert(1) brightness(2); /* logo asset is dark — invert on dark/transparent nav */
}

.site-nav.is-scrolled .site-nav__logo img,
.site-nav[data-theme="dark"] .site-nav__logo img {
  filter: none;
}

/* Burger button — animates to an X when the menu is open */
.site-nav__toggle {
  grid-column: 3;
  justify-self: end;
  width: 48px; height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 110; /* sits above the overlay so it's still clickable */
  color: currentColor;
}

.burger-icon,
.burger-icon::before,
.burger-icon::after {
  display: block;
  width: 28px;
  height: 2px;
  background: currentColor;
  transition: transform 300ms var(--ease-out),
              background 200ms var(--ease-out),
              top 200ms var(--ease-out);
}
.burger-icon { position: relative; }
.burger-icon::before,
.burger-icon::after {
  content: "";
  position: absolute;
  left: 0;
}
.burger-icon::before { top: -8px; }
.burger-icon::after  { top:  8px; }

/* Animate to X when open. We force the icon colour to light because the
   overlay backdrop is always dark, and we lift the whole nav above the
   overlay's stacking context so the X stays visible and clickable. */
.site-nav.is-menu-open {
  color: var(--c-light);
  z-index: 110; /* must exceed .menu-overlay's z-index (100) */
  background: transparent;
}
.site-nav.is-menu-open .burger-icon { background: transparent; }
.site-nav.is-menu-open .burger-icon::before { top: 0; transform: rotate(45deg); }
.site-nav.is-menu-open .burger-icon::after  { top: 0; transform: rotate(-45deg); }
/* Hide the centered logo while the menu is open so the X has visual focus */
.site-nav.is-menu-open .site-nav__logo { opacity: 0; pointer-events: none; transition: opacity 200ms var(--ease-out); }

/* ---------- 7b. Menu overlay -------------------------------------------- */

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(17, 15, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms var(--ease-out);
}

.menu-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.menu-overlay__nav {
  text-align: center;
}

.menu-overlay__links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s-3);
  font-family: var(--font-heading);
  font-size: clamp(2.25rem, 6vw, 4.5rem);
  line-height: 1.05;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: var(--c-light);
}

.menu-overlay__links li {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 500ms var(--ease-out), transform 500ms var(--ease-out);
}

.menu-overlay.is-open .menu-overlay__links li {
  opacity: 1;
  transform: none;
}

/* Stagger the links in */
.menu-overlay.is-open .menu-overlay__links li:nth-child(1) { transition-delay: 0.10s; }
.menu-overlay.is-open .menu-overlay__links li:nth-child(2) { transition-delay: 0.16s; }
.menu-overlay.is-open .menu-overlay__links li:nth-child(3) { transition-delay: 0.22s; }
.menu-overlay.is-open .menu-overlay__links li:nth-child(4) { transition-delay: 0.28s; }
.menu-overlay.is-open .menu-overlay__links li:nth-child(5) { transition-delay: 0.34s; }
.menu-overlay.is-open .menu-overlay__links li:nth-child(6) { transition-delay: 0.40s; }

.menu-overlay__links a {
  display: inline-block;
  padding: 0.15em 0.4em;
  position: relative;
  transition: color 200ms var(--ease-out);
}

.menu-overlay__links a:hover,
.menu-overlay__links a:focus-visible,
.menu-overlay__links a[aria-current="page"] {
  color: var(--c-yellow);
}

/* When the overlay is open, prevent the body from scrolling underneath */
body.has-menu-open {
  overflow: hidden;
}

/* ---------- 8. Footer --------------------------------------------------- */
/* Black footer with three columns:
   LEFT  — looping emblem GIF + © Mavericks Unlimited copyright
   CENTER — yellow "mavericks un — ltd" wordmark logo
   RIGHT — postal address + underlined email link */

.site-footer {
  background: var(--c-dark);
  color: var(--c-light);
  padding: var(--s-6) 0;
}

.site-footer__grid {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 760px) {
  .site-footer__grid {
    grid-template-columns: 1fr 1fr 1fr;
    gap: var(--s-6);
    align-items: center;
  }
}

/* On mobile (single column), the LEFT block (emblem + © Mavericks
   Unlimited) is naturally first in DOM. We re-order so that the
   © line is the LAST thing in the footer — the copyright sits at
   the very bottom of the section. The emblem stays at the top of
   its block; we split them visually using flex order on the
   .site-footer__left children. */
@media (max-width: 759px) {
  .site-footer__grid { display: flex; flex-direction: column; gap: var(--s-5); }
  .site-footer__left { display: contents; }
  .site-footer__emblem { order: 0; }
  .site-footer__center { order: 1; }
  .site-footer__right { order: 2; }
  .site-footer__copy { order: 3; margin-top: var(--s-3); }
}

/* ---------- Site-wide mobile section compression -----------------------
   On mobile every content section gets compressed top + bottom padding
   so headings sit closer to the top and the section ends shortly after
   the last content block. The home hero (.home-hero) has its own mobile
   layout and is explicitly excluded. Specificity of `main section:not(.home-hero)`
   (1 class + 2 elements) beats single-class padding rules in each
   page's inline <style>, so this wins without needing !important. */
@media (max-width: 760px) {
  main section:not(.home-hero) {
    padding-top: var(--s-4);
    padding-bottom: var(--s-4);
  }
}

/* --- Left column: looping emblem + copyright --- */
.site-footer__left {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  align-items: flex-start;
}
.site-footer__emblem {
  width: 48px; /* -50% from 96px */
  height: auto;
  display: block;
}
.site-footer__copy {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--c-light);
  margin: 0;
  opacity: 0.85;
}

/* --- Center column: yellow wordmark --- */
.site-footer__center {
  display: flex;
  justify-content: center;
}
.site-footer__wordmark {
  display: inline-block;
  line-height: 0;
}
.site-footer__wordmark img {
  display: block;
  width: 220px;
  height: auto;
  max-width: 100%;
}

/* --- Right column: address + email --- */
.site-footer__right {
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
  align-items: flex-start;
}
@media (min-width: 760px) {
  .site-footer__right { align-items: flex-end; text-align: right; }
}
.site-footer__address {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  line-height: 1.4;
  font-style: normal;
  color: var(--c-light);
  margin: 0;
  opacity: 0.95;
}
.site-footer__address span { display: block; }
.site-footer__email {
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  color: var(--c-light);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
.site-footer__email:hover { color: var(--c-yellow); }

/* ---------- 9. Hero (full-bleed video) ---------------------------------- */

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  color: var(--c-light);
  background: var(--c-dark);
}

.hero__video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
  /* Vimeo iframe wrapper trick: scale up, center, crop to cover */
}

.hero__video iframe {
  position: absolute;
  top: 50%; left: 50%;
  width: 100vw;
  height: 56.25vw;          /* 16:9 */
  min-height: 100vh;
  min-width: 177.77vh;      /* 16:9 inverse */
  transform: translate(-50%, -50%);
  border: 0;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
              rgba(17,15,15,0.15) 0%,
              rgba(17,15,15,0.0) 35%,
              rgba(17,15,15,0.0) 60%,
              rgba(17,15,15,0.7) 100%);
}

.hero__content {
  position: relative;
  padding-bottom: var(--s-6);
  max-width: 24ch;
}

/* ---------- 10. Parallax layer scaffolding ------------------------------ */

/* Authors apply data-parallax-speed (-1 to 1, where 0 = no parallax,
   negative = moves opposite to scroll, positive = moves with scroll).
   The JS engine reads these and animates via GSAP. */

[data-parallax-speed] {
  will-change: transform;
}

/* Reveal-on-scroll initial state. JS unsets the transform when in view. */

[data-reveal] {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 800ms var(--ease-out), transform 800ms var(--ease-out);
}

[data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* Honor user preference. JS also bails, but this is belt-and-braces. */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  [data-parallax-speed] { transform: none !important; }
  [data-hero-arrival] { opacity: 1; transform: none; }
  [data-shift-slide] { opacity: 1; transform: none; }
}

/* ---------- Bespoke signature animation initial states ----------------- */
/* Hero "train arrival" — lines start off-screen left on desktop, below
   on mobile, then JS animates them into place on page load. */

[data-hero-arrival] {
  opacity: 0;
  transform: translateX(-100px);
  will-change: opacity, transform;
}
@media (max-width: 760px) {
  [data-hero-arrival] {
    /* Mobile: rise-fade only, no horizontal slide per palette. */
    transform: translateY(30px);
  }
}

/* Section 2 italic "shift" — starts off-screen right, JS slides it in
   when the section enters viewport. inline-block needed to allow
   transforms on the inline <em> element. */
[data-shift-slide] {
  display: inline-block;
  opacity: 0;
  transform: translateX(80px);
  will-change: opacity, transform;
}
@media (max-width: 760px) {
  /* Mobile: fade only, no horizontal slide per palette. */
  [data-shift-slide] { transform: none; }
}

/* ---------- 11. Layered scene helper ------------------------------------ */
/* Use .scene to stack absolutely-positioned layers (background, midground,
   foreground) inside a section. Each layer can carry its own parallax speed. */

.scene {
  position: relative;
  min-height: 80vh;
  display: grid;
  place-items: center;
}

.scene__layer {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.scene__layer img { width: 100%; height: 100%; object-fit: cover; }

.scene__content {
  position: relative;
  z-index: 5;
  text-align: center;
  padding: var(--s-5);
  max-width: 50ch;
  pointer-events: auto;
}

/* ---------- 12. Five-phase strip (Home / Services) ---------------------- */
/* The 5 illustrated phases: truth, clarity, behaviour, system, integration. */

.phases {
  display: grid;
  gap: var(--s-5);
  grid-template-columns: 1fr;
}

@media (min-width: 760px) {
  .phases { grid-template-columns: repeat(5, 1fr); gap: var(--s-3); }
}

.phase {
  text-align: center;
}

.phase__art {
  aspect-ratio: 1 / 1;
  background: var(--c-light);
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: var(--s-3);
}

.phase__art img { width: 100%; height: 100%; object-fit: cover; }

.phase__title {
  font-family: var(--font-heading);
  font-size: var(--fs-l);
  margin-bottom: var(--s-1);
}

/* ---------- 13. 10 Traits interaction (Contact) ------------------------- */

.traits {
  background: var(--c-light);
  background-image: url("../assets/img/contact/10_traits_bg.jpg");
  background-size: cover;
  background-position: center;
  border-radius: 24px;
  padding: var(--s-5);
  color: var(--c-dark);
  position: relative;
  overflow: hidden;
}

.traits__title {
  font-family: var(--font-heading);
  font-size: var(--fs-l);
  margin-bottom: var(--s-4);
  max-width: 18ch;
}

.traits__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--s-2);
}

.traits__dot {
  position: relative;
  aspect-ratio: 1 / 1;
  background: transparent;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: transform 200ms var(--ease-out);
}

.traits__dot:hover { transform: scale(1.05); }

.traits__dot img {
  width: 100%; height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.traits__dot .dot-active { display: none; }
.traits__dot[aria-pressed="true"] .dot-inactive { display: none; }
.traits__dot[aria-pressed="true"] .dot-active { display: block; }

.traits__readout {
  margin-top: var(--s-4);
  min-height: 5rem;
  padding: var(--s-3);
  border-top: 1px solid rgba(17, 15, 15, 0.15);
  font-family: var(--font-heading);
  font-size: var(--fs-m);
  line-height: 1.3;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 400ms var(--ease-out), transform 400ms var(--ease-out);
}

.traits__readout.is-visible { opacity: 1; transform: none; }

.traits__readout::before {
  content: attr(data-prefix);
  display: inline-block;
  margin-right: 0.5em;
  color: var(--c-clay);
  font-feature-settings: "tnum";
}

/* ---------- 14. Mobile-only refinements --------------------------------- */

@media (max-width: 600px) {
  .section { padding-block: var(--s-5); }
  .traits__grid { grid-template-columns: repeat(5, 1fr); gap: 0.5rem; }
  .hero { min-height: 80svh; }
}
