/* ============================================================
   Gracie Barra header demo - 36 Chambers
   Values measured from gbbakersfield.com; brand tokens from the
   GB Global Brand Manual v1.3 design system.
   ============================================================ */

/* ---------- Fonts ---------- */
@font-face {
  font-family: 'AdihausDIN';
  src: url('../fonts/AdihausDIN-Regular.woff2') format('woff2'),
       url('../fonts/AdihausDIN-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AdihausDIN';
  src: url('../fonts/AdihausDIN-Medium.woff2') format('woff2'),
       url('../fonts/AdihausDIN-Medium.ttf') format('truetype');
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'AdihausDIN Condensed';
  src: url('../fonts/AdihausDIN-CnBold.woff2') format('woff2'),
       url('../fonts/AdihausDIN-CnBold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
  --gb-red: #E2211C;
  --gb-red-hover: #7C1313;
  --gb-red-pressed: #5E0F0F;
  --gb-almost-black: #1A1A1A;
  --gb-dark-gray: #333333;
  --gb-almost-white: #FCFCFC;
  --gb-blue: #0A99FF;
  --gb-accent: #0074C8;

  --font-display: 'AdihausDIN Condensed', 'Barlow Condensed', 'Oswald', Impact, sans-serif;
  --font-body: 'AdihausDIN', 'Barlow', system-ui, sans-serif;

  /* Header state (JS refines --header-h from offsetHeight after transitions) */
  --header-h: 110px;
  --logo-w: 100px;
  --logo-w-stuck: 77px;

  /* Glass recipes (measured) */
  --glass-bg: rgba(26, 26, 26, 0.70);
  --glass-blur: blur(10px) saturate(1.5);
  --dd-blur: blur(10px);

  /* Motion */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-underline: cubic-bezier(0.25, 1, 0.5, 1);

  /* Z scale */
  --z-header: 10;
  --z-progress: 20;
  --z-skip: 30;

  /* Header theme: JS samples the backdrop section's background luminance and
     toggles .header-on-light; stuck glass and the open menu force white ink. */
  --nav-ink: #fff;
  --nav-accent: var(--gb-blue);

  scrollbar-gutter: stable;
}
html.header-on-light:not(.is-stuck):not(.menu-open) {
  --nav-ink: var(--gb-almost-black);
  --nav-accent: var(--gb-accent); /* deeper blue holds AA on light */
}
@media (max-width: 1024px) {
  :root {
    --header-h: 90px;
    --logo-w: 70px;
    --logo-w-stuck: 50px;
    --glass-bg: rgba(26, 26, 26, 0.82);
    --glass-blur: blur(20px) saturate(1.6);
  }
}
html.is-stuck { --header-h: 80px; }
@media (max-width: 1024px) {
  html.is-stuck { --header-h: 70px; }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--gb-almost-white);
  color: var(--gb-dark-gray);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gb-almost-black);
  margin: 0 0 0.5em;
  text-wrap: balance;
}
p { margin: 0 0 1em; max-width: 68ch; text-wrap: pretty; }
a { color: inherit; }
:focus-visible {
  outline: 2px solid var(--gb-blue);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: var(--z-skip);
  background: var(--gb-almost-black);
  color: var(--gb-almost-white);
  padding: 10px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-weight: 500;
  transform: translateY(-200%);
  transition: transform 0.2s ease-out;
}
.skip-link:focus-visible { transform: translateY(0); }

/* ---------- Scroll progress bar ---------- */
.progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  background: var(--gb-accent);
  z-index: var(--z-progress);
  transition: width 0.1s linear;
  pointer-events: none;
}

/* ---------- Header shell ---------- */
.site-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: var(--z-header);
  min-height: var(--header-h);
  display: flex;
  align-items: stretch;
  /* No isolation:isolate here: it forms a backdrop root, which cuts the
     dropdowns' and sheet's backdrop-filter off from the page behind the header.
     position:fixed + z-index already provide the stacking context. */
  border-bottom: 1px solid rgba(255, 255, 255, 0);
  transition: min-height 0.4s, border-color 0.4s, box-shadow 0.4s;
}
html.is-stuck .site-header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.2);
}
.header-glass {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  opacity: 0;
  transition: opacity 0.4s;
}
html.is-stuck .header-glass { opacity: 1; }

.header-inner {
  position: relative;
  z-index: 4; /* above the full-screen mobile sheet so logo + burger stay usable */
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px clamp(16px, 4vw, 48px);
}

/* One-time entrance: logo, links, CTA cascade in on load */
@keyframes header-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}
.logo-stack { animation: header-in 0.5s var(--ease-underline) both; }
.main-nav > ul > li {
  animation: header-in 0.45s var(--ease-underline) both;
  animation-delay: calc(0.08s + var(--n, 0) * 0.05s);
}
.main-nav > ul > li:nth-child(1) { --n: 0; }
.main-nav > ul > li:nth-child(2) { --n: 1; }
.main-nav > ul > li:nth-child(3) { --n: 2; }
.main-nav > ul > li:nth-child(4) { --n: 3; }
.main-nav > ul > li:nth-child(5) { --n: 4; }
.main-nav > ul > li:nth-child(6) { --n: 5; }
.header-cta, .hamburger { animation: header-in 0.45s var(--ease-underline) 0.42s both; }

/* ---------- Logo morph ---------- */
.logo-stack {
  display: grid;
  place-items: center;
  width: var(--logo-w);
  height: var(--logo-w);
  flex: none;
  color: #fff; /* triangle G inherits white in the header */
  transition: width 0.4s, height 0.4s;
}
html.is-stuck .logo-stack {
  width: var(--logo-w-stuck);
  height: var(--logo-w-stuck);
}
.logo-stack > span {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
}
.logo-stack svg { display: block; width: 100%; height: auto; }

.logo-primary {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
  transition: opacity 0.5s, filter 0.5s, transform 0.5s var(--spring);
}
.logo-secondary {
  opacity: 0;
  filter: blur(6px);
  transform: scale(0.75);
  transition: opacity 0.5s 0.1s, filter 0.5s 0.1s, transform 0.5s var(--spring) 0.1s;
}
html.is-stuck .logo-primary {
  opacity: 0;
  filter: blur(6px);
  transform: scale(0.75);
}
html.is-stuck .logo-secondary {
  opacity: 1;
  filter: blur(0);
  transform: scale(1);
}

/* ---------- Desktop nav ---------- */
.main-nav { margin-left: clamp(24px, 3vw, 44px); }
.main-nav > ul {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
}
.main-nav > ul > li { position: relative; }
.main-nav > ul > li > a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 18px 15px;
  color: var(--nav-ink);
  text-decoration: none;
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  transition: color 0.3s;
}
.main-nav > ul > li > a:hover,
.main-nav > ul > li > a[aria-current] {
  color: var(--nav-accent);
}
.main-nav > ul > li > a::after {
  content: "";
  position: absolute;
  height: 2px;
  bottom: 5px;
  width: 80%;
  left: 50%;
  transform: translateX(-50%) scaleX(0);
  transform-origin: center;
  transition: transform 0.3s var(--ease-underline), background-color 0.3s;
  background: var(--nav-accent);
}
.main-nav > ul > li.has-sub > a::after { left: calc(50% - 8px); }
.main-nav > ul > li > a:hover::after,
.main-nav > ul > li > a[aria-current]::after {
  transform: translateX(-50%) scaleX(1);
}
.chev {
  width: 10px;
  height: 6px;
  flex: none;
  transition: transform 0.3s;
}
.main-nav li.has-sub:hover > a .chev,
.main-nav li.has-sub:focus-within > a .chev,
.main-nav li.has-sub.open > a .chev {
  transform: rotate(180deg);
}

/* ---------- Dropdown panels ---------- */
.sub-wrap {
  position: absolute;
  top: 100%;
  left: 0;
  padding-top: 21px; /* the visual gap, kept inside the hover area */
  z-index: 2;
  overflow: visible;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s ease-out 0.15s,
              transform 0.2s ease-out 0.15s,
              visibility 0s linear 0.35s; /* forgiving close delay */
}
.main-nav li.has-sub:hover > .sub-wrap,
.main-nav li.has-sub:focus-within > .sub-wrap,
.main-nav li.has-sub.open > .sub-wrap {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.2s ease-out, transform 0.2s ease-out, visibility 0s;
}
/* Esc closes; a resting pointer must not instantly reopen */
.main-nav li.has-sub.suppress-hover:hover > .sub-wrap {
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
}
.sub-menu {
  list-style: none;
  margin: 0;
  padding: 10px 0;
  min-width: 260px;
  background: var(--glass-bg);
  -webkit-backdrop-filter: var(--dd-blur);
  backdrop-filter: var(--dd-blur);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.4);
}
.sub-menu li { border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.sub-menu li:last-child { border-bottom: none; }
.sub-menu a {
  display: block;
  padding: 12px 30px;
  color: #fff;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  white-space: nowrap;
  transform: translateX(0);
  transition: color 0.3s, transform 0.3s;
}
.sub-menu a:hover,
.sub-menu a:focus-visible {
  color: var(--gb-blue);
  transform: translateX(10px);
}

/* ---------- CTA ---------- */
.cta {
  position: relative;
  overflow: hidden;
  display: inline-block;
  background: var(--gb-red);
  color: var(--gb-almost-white);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-align: center;
  padding: 15px 44px;
  border-radius: 5px;
  transform: translateY(0);
  transition: background-color 0.3s, transform 0.3s;
}
.cta:hover { background: var(--gb-red-hover); transform: translateY(-1px); }
.cta:active { background: var(--gb-red-pressed); transform: translateY(0); }
/* Sheen: the 36C deck/landing-page signature. A skewed light bar crosses the
   red; ::before fires once after load (hero CTA only), ::after replays on every
   hover. Transform-only and invisible at rest. */
.cta::before, .cta::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 0;
  width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.32), transparent);
  transform: skewX(-18deg) translateX(-160%);
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .hero .cta::before { animation: gb-sheen 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) 0.9s both; }
  .cta:hover::after, .cta:focus-visible::after {
    animation: gb-sheen 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
}
@keyframes gb-sheen {
  from { transform: skewX(-18deg) translateX(-160%); }
  to   { transform: skewX(-18deg) translateX(320%); }
}
.header-cta { margin-left: auto; flex: none; }
.cta-lg { font-size: 20px; padding: 17px 52px; }
.cta-block { display: block; }
/* Sheet CTA: comfortable button, not a slab (outranks the .leaf link styling) */
.sheet-list .sheet-cta-li a.cta {
  max-width: 340px;
  margin-inline: auto;
  padding: 14px 28px;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
}

/* ---------- Hamburger ---------- */
.hamburger {
  display: none;
  margin-left: auto;
  flex: none;
  width: 48px;
  height: 48px;
  padding: 10px;
  background: none;
  border: none;
  cursor: pointer;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
}
.hb-line {
  display: block;
  height: 2px;
  border-radius: 1px;
  background: var(--nav-ink);
  transform-origin: center;
  transition: width 0.3s var(--spring), transform 0.3s var(--spring),
              opacity 0.2s, background-color 0.3s;
}
.hb-1 { width: 28px; }
.hb-2 { width: 20px; }
.hb-3 { width: 24px; }
.hamburger:hover .hb-line,
.hamburger:focus-visible .hb-line { width: 28px; }
.hamburger[aria-expanded="true"] .hb-1 { width: 28px; transform: translateY(8px) rotate(45deg); }
.hamburger[aria-expanded="true"] .hb-2 { width: 0; opacity: 0; }
.hamburger[aria-expanded="true"] .hb-3 { width: 28px; transform: translateY(-8px) rotate(-45deg); }

/* ---------- Mobile sheet ---------- */
.sheet {
  position: fixed;
  inset: 0;
  height: 100dvh;
  z-index: 3; /* under .header-inner (z 4): the bar with logo + X rides on top */
  overflow-y: auto;
  background: rgba(26, 26, 26, 0.88);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  backdrop-filter: blur(24px) saturate(1.6);
  padding: calc(var(--header-h) + 20px) clamp(20px, 6vw, 40px)
           calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-2%);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0s linear 0.3s;
}
@supports not (height: 100dvh) {
  .sheet { height: 100vh; }
}
.sheet > nav { flex: 1; display: flex; flex-direction: column; }
.sheet > nav > ul { flex: 1; display: flex; flex-direction: column; }
.sheet-cta-li { margin-top: auto; }
.sheet.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out, visibility 0s, top 0.4s;
}
.sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sheet-list > li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}
.sheet.open .sheet-list > li {
  opacity: 1;
  transform: translateY(0);
  transition-delay: calc(var(--i, 0) * 40ms);
}
.sheet-list > li:last-child { border-bottom: none; }
.sheet-row { display: flex; align-items: center; }
.sheet-row .leaf { flex: 1; }
.sheet-list a.leaf {
  display: block;
  padding: 16px 4px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(26px, 4.5vh, 32px);
  text-transform: uppercase;
  transition: color 0.3s;
}
.sheet-list a.leaf:hover,
.sheet-list a.leaf[aria-current="page"] { color: var(--gb-blue); }
.sub-toggle {
  flex: none;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
}
.sub-toggle svg { width: 14px; height: 9px; transition: transform 0.3s; }
.sub-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
.sheet-sub-list {
  list-style: none;
  margin: 0;
  padding: 0 0 0 16px;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}
.sheet-sub.open > .sheet-sub-list { max-height: 400px; }
.sheet-sub-list a.leaf {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  text-transform: none;
  padding: 12px 4px;
  color: rgba(255, 255, 255, 0.85);
}
.sheet-cta-li { padding: 20px 0 8px; }

/* Body scroll lock (JS sets top offset) */
body.menu-locked {
  position: fixed;
  left: 0; right: 0;
  width: 100%;
  overflow: hidden;
}

/* ---------- Responsive switch ---------- */
@media (max-width: 1024px) {
  .main-nav, .header-cta { display: none; }
  .hamburger { display: flex; }
}
@media (min-width: 1025px) {
  .sheet { display: none; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: var(--gb-almost-black);
  overflow: hidden;
}
.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    rgba(26, 26, 26, 0.72) 0%,
    rgba(26, 26, 26, 0.52) 40%,
    rgba(26, 26, 26, 0.65) 100%);
}
.hero-content {
  position: relative;
  text-align: center;
  padding: 140px 24px 80px;
  max-width: 900px;
}
.hero-content h1 {
  color: var(--gb-almost-white);
  font-size: clamp(3rem, 8vw, 5.5rem);
  line-height: 0.95;
  margin-bottom: 0.35em;
}
.scroll-cue {
  position: absolute;
  bottom: 26px;
  left: 50%;
  margin-left: -11px;
  width: 22px;
  color: rgba(255, 255, 255, 0.8);
  animation: cue-drift 2.4s var(--ease-underline) infinite;
}
.scroll-cue svg { display: block; width: 100%; height: auto; }
@keyframes cue-drift {
  0%   { opacity: 0; transform: translateY(-6px); }
  35%  { opacity: 1; }
  70%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(8px); }
}
.hero-sub {
  color: rgba(255, 255, 255, 0.92);
  font-size: clamp(1.05rem, 2.2vw, 1.35rem);
  line-height: 1.6;
  margin: 0 auto 2em;
  max-width: 42ch;
}

/* ---------- Sections ---------- */
.section { padding: clamp(72px, 10vw, 128px) 0; }
.container {
  width: min(1140px, 92vw);
  margin-inline: auto;
}
.container.narrow { width: min(760px, 92vw); }
.center { text-align: center; }
.center p { margin-inline: auto; }
.section h2 { font-size: clamp(2rem, 4.5vw, 2.75rem); }
.section h3 { font-size: 1.375rem; margin-top: 0; }
.subsection { margin-top: 40px; }
.page-head {
  padding-top: calc(var(--header-h) + clamp(56px, 9vw, 104px));
}
.page-head h1 { font-size: clamp(2.5rem, 6vw, 4rem); line-height: 0.95; }
.section-dark { background: var(--gb-almost-black); }
.section-dark h2, .section-dark h3 { color: var(--gb-almost-white); }
.section-dark p { color: #DADADA; }
.section-cta { background: #EDEDED; }
[id] { scroll-margin-top: calc(var(--header-h) + 16px); }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--gb-almost-black);
  color: var(--gb-almost-white);
  text-align: center;
  padding: 64px 24px 48px;
}
.footer-mark { display: inline-block; width: 56px; color: var(--gb-red); }
.footer-mark svg { display: block; width: 100%; height: auto; }
.site-footer p {
  margin: 16px auto 0;
  font-family: var(--font-display);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 1.125rem;
  letter-spacing: 0.04em;
}
.footer-note {
  font-family: var(--font-body) !important;
  font-weight: 400 !important;
  text-transform: none !important;
  letter-spacing: 0 !important;
  font-size: 0.875rem !important;
  color: #AFAFAF;
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .logo-primary, .logo-secondary,
  .site-header, .header-glass, .logo-stack,
  .sub-wrap, .sub-menu a, .chev,
  .hb-line, .sheet, .sheet-list > li,
  .sheet-sub-list, .sub-toggle svg,
  .cta, .cta::before, .main-nav > ul > li > a::after,
  .progress-bar, .skip-link {
    transition: none !important;
  }
  .sheet.open .sheet-list > li { transition-delay: 0s; }
  .logo-stack, .main-nav > ul > li, .header-cta, .hamburger {
    animation: none !important;
  }
  .scroll-cue { animation: none !important; opacity: 0.6; }
}
