/* Site header / nav — minimal structural start for the
   full-visual-replacement route. Build the real header on top of this. */

.site-header {
  position: fixed;
  top: var(--theme-section-padding);
  left: var(--theme-section-padding);
  right: var(--theme-section-padding);

  /* No explicit width — left+right alone already size a fixed-position
     element correctly (100% minus both insets). A hardcoded "width:
     calc(100% - 6rem)" used to duplicate that math (6rem = 2x the old
     fixed --theme-section-padding) and silently went stale once the
     token became responsive; removing it means there's nothing left to
     go out of sync. */
  z-index: 50;
  height: var(--theme-header-height);
  backdrop-filter: blur(var(--theme-blur));
  transition: translate 0.35s var(--theme-ease-signature), background-color 0.35s ease-in-out;
}

/* Auto-hide (header-autohide.js): out of view once the page has scrolled
   past its hero, back as soon as the visitor scrolls up. `translate`,
   not `transform` — front-page.css animates the header's transform for
   its own entrance, so the two never compete. */
.is-header-hidden .site-header {
  translate: 0 calc(-100% - var(--theme-section-padding));
}

/* The sticky page-background bars that cover the strip above the fixed
   header (section-padding tall, top: 0 — section-cta.css, about.css,
   coming-soon.css) slide up with it: nothing to cover while the header is
   out of view. Same timing as the header. Not a single object's
   .single-object__nav-scope bar: its section nav stays in the header's
   slot while the header hides, so the strip above it still needs
   covering. */
:is(.section-cta__frame, .section-team__frame, .coming-soon__frame)::before {
  transition: translate 0.35s var(--theme-ease-signature);
}

.is-header-hidden :is(.section-cta__frame, .section-team__frame, .coming-soon__frame)::before {
  translate: 0 -100%;
}


/* Shared by .single-post__hero img and .single-object__hero img — same
   parallax/scale-up-on-scroll effect, kept here since header.css loads
   on every page and this is a pure visual utility, not structural. */
@keyframes single-hero-parallax {
  from {
    transform: translateY(0) scale(1);
  }

  to {
    transform: translateY(25%) scale(1.15);
  }
}


.site-header__inner {
  border: var(--theme-line-width) solid var(--theme-line-color);
  display: grid;
  grid-template-columns: repeat(var(--theme-grid-columns), 1fr);
  height: 100%;
}

.site-header__cell {
  display: flex;
  align-items: center;
  padding: 0 var(--theme-section-padding);
}

.site-header__cell--logo {
  /* Zeroed back out — this cell only picked up .site-header__cell's
     base padding once the class was added (needed for display:flex,
     so justify-content: center below actually does something); the
     logo itself fills the cell edge-to-edge and never had side
     padding before. */
  padding: 0;
  justify-content: center;
  border-right: var(--theme-line-width) solid var(--theme-line-color);
  background-color: rgb(0 0 0 / 20%);
  z-index: 1;
  overflow: clip;

  @starting-style {
    background-color: var(--brand-color-dark);
  }
}

.site-header__cell--nav {
  justify-content: flex-start;
  gap: 0;
  background-color: rgb(48 54 76 / 35%);
}

.site-header--coming-soon .site-header__cell--logo {
  border-right-width: 0;
}

.site-header .site-logo {
  display: block;
}

.site-header .site-logo {
  display: block;
  width: 100%;
  height: 101%;
  color: var(--theme-color-contrast);
  background-color: white;
  mask-image:
    linear-gradient(#fff, #fff),
    url("../media/logo/gh-co-themed.svg");
  mask-repeat: no-repeat;
  mask-position: center;
  /* Logo cut-out: at most 60% of the cell wide and 40% of the header
     tall — the same rendered size it always had in the (formerly
     shrunk) header, back when this read 0.2 of the full, unshrunk
     header height. */
  mask-size: 100% 100%, 60% calc(var(--theme-header-height) * 0.4);
  mask-composite: exclude;

  @starting-style {
    margin-right: -200%;
  }
}

.site-header .site-logo svg {
  display: block;
  height: 2.5rem;
  width: auto;
  opacity: 0;
  visibility: hidden;
}


.site-header__nav {
  display: flex;
  align-items: center;
  gap: var(--theme-space-xs);
  height: 100%;
}

.site-header__nav-list {
  display: flex;
  align-items: center;
  gap: var(--theme-space-xs);
  list-style: none;
  height: 100%;

  color: white;
  font-weight: 500;
  letter-spacing: .05em;
}

.site-header__nav-list li {
  height: 100%;
  align-content: center;
}

/* :is(...) instead of repeating this same list on every selector below
   — every footer link list (menu, social, legal) and a single object's
   section nav links (template-parts/object-section-nav.php — the list
   only, not its trailing .button, which has its own hover) get the
   identical header-nav hover/current treatment, see footer.php for each
   one's matching .button__label markup. */
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) a {
  position: relative;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-transform: uppercase;
  display: block;

  height: 100%;
  align-content: center;
}

/* Same push-up/color-swap hover mechanic as the CTA buttons
   (.button--underline in button.css, .*-cta-cell--action across the
   sticky CTA sections). Label is height: 100% of the link and is what
   translateY(-100%) measures against, so the push-up distance matches
   the link's real rendered height instead of the label's own inline
   text height (same fix/rationale as button.css's .button--underline)
   — otherwise both labels stay visible within the taller clipped box
   instead of one sliding fully out of view. In the footer's own
   auto-height lists this just resolves to the label's natural height
   instead of a shared fixed height, same effect either way. */
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) .button__label {
  position: relative;
  display: flex;
  align-items: center;
}

/* Opacity lives on this inner span, not .button__label itself — the
   ::after duplicate below is generated content OF .button__label, so
   fading .button__label's own opacity would fade the incoming ::after
   text too instead of just the outgoing real label. */
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) .button__label-text {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  opacity: 1;
  transform: translateY(0);
  transition: transform 0.3s var(--theme-ease-signature), opacity 0.3s var(--theme-ease-signature);
}

:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) .button__label::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-color-accent);
  opacity: 0;
  transform: translateY(100%);
  transition: transform 0.3s var(--theme-ease-signature), opacity 0.3s var(--theme-ease-signature);
}

/* Header nav's cells are centered (fixed-width flex cells); every
   footer list is left-aligned (address, legal, etc.), so the shared
   centering above needs undoing for all of them here. */
:is(.site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) .button__label-text,
:is(.site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) .button__label::after {
  justify-content: flex-start;
}

:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) a:hover .button__label-text,
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) a:focus-visible .button__label-text,
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) li.current-menu-item a .button__label-text {
  opacity: 0;
  transform: translateY(-100%);
}

:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) a:hover .button__label::after,
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) a:focus-visible .button__label::after,
:is(.site-header__nav, .single-object__section-nav-list, .site-footer__nav, .site-footer__social-list, .site-footer__legal-list, .nav-overlay__nav) li.current-menu-item a .button__label::after {
  opacity: 1;
  transform: translateY(0);
}

/* Last header menu item (Contact) as a CTA cell: one grid column wide at
   the nav cell's right edge (the nav cell is col-4, so 25% of it), dark
   like the sticky CTA bar's action cell (sticky-cta.css
   .brand-frame__cta-cell--action) and with its hover too — the label
   slides out to the left while an accent copy slides in from the right,
   instead of the other links' push-up. The current page keeps the accent
   copy in view. Desktop only: below 769px the list is hidden for the
   toggle. */
.site-header__cell--nav {
  position: relative;
}

.site-header__nav-list > li:last-child {
  position: absolute;
  inset-block: 0;
  right: 0;
  /* border-left: var(--theme-line-width) solid var(--theme-line-color); */
  /* background-color: var(--brand-color-dark); */
}

.site-header__nav-list > li:last-child a {
  padding: .2rem;
  
}

.site-header__nav-list > li:last-child .button__label {
  justify-content: center;
  width: 100%;
  height: 100%;
  transform: translateX(0);
  padding: 0 var(--theme-section-padding);
  transition: transform 0.5s var(--theme-ease-signature), opacity 0.2s var(--theme-ease-signature);
}

.site-header__nav-list > li:last-child .button__label::after {
  background-color: var(--theme-color-accent);
  color: var(--brand-color-light);
  opacity: 1;
  transform: translateX(100%);
  transition: transform 0.5s var(--theme-ease-signature);
}

.site-header__nav-list > li:last-child a:is(:hover, :focus-visible) .button__label,
.site-header__nav-list > li.current-menu-item:last-child a .button__label {
  transform: translateX(0%);
}

/* Keep the real label in place — it rides out with .button__label. */
.site-header__nav-list > li:last-child a:is(:hover, :focus-visible) .button__label-text,
.site-header__nav-list > li.current-menu-item:last-child a .button__label-text {
  opacity: 0;
  transform: none;
}

.site-header__nav-list > li:last-child a:is(:hover, :focus-visible) .button__label::after,
.site-header__nav-list > li.current-menu-item:last-child a .button__label::after {
  transform: translateX(0%);
}

/* Mobile nav — a toggle button replaces the inline nav list inside the
   existing .site-header__cell--nav grid cell. .site-header and
   .site-header__inner themselves stay untouched (same grid, same
   logo mask/starting-style reveal) — only the two cells' own column spans are rebalanced, since
   the nav cell no longer needs col-4 once it's just holding a small
   toggle button: the logo gets that freed-up width instead of it
   sitting empty. The overlay itself is a sibling of .site-header,
   styled in nav-overlay.css.

   <=768px, not <=640px — at 682px wide (still >640) five real nav
   links plus padding already didn't fit their col-4 track and clipped
   off-screen, so the toggle needs to take over at the same tablet tier
   as the rest of this batch's fixes, not just at phone width.

   Compound selectors (.site-header__cell.site-header__cell--X) are
   required, not a style choice — header.css loads before
   brand-grid.css (see cascade note in the batch A plan), so a bare
   single-class override here would lose to .col-2/.col-4 on source
   order even inside a matching media query. */
@media (width <= 768px) {
  /* The front page's mobile pre-reveal offset (margin-right) lives in
     front-page.css, not here — header.css loads on every page, and a
     permanent negative margin here pushed the logo cell over the menu
     toggle on all other pages (and its !important kept the front page's
     own reveal from ever winning). */
  .site-header__cell.site-header__cell--logo {
    grid-column: span 4;
  }

  .site-header__cell.site-header__cell--nav {
    grid-column: span 2;
    justify-content: center;
    padding: 0;
  }

  .site-header__nav-list {
    display: none;
  }
}

.site-header__nav-toggle {
  display: none;
}

@media (width <= 768px) {
  /* Fills the whole cell (not just a small icon-sized hit target) so
     the entire nav cell is clickable to open the menu — the icon
     itself stays a fixed 2rem via .site-header__nav-toggle-bars below,
     centered inside this now-full-size button by the flex properties
     here. */
  .site-header__nav-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    border: 0;
    background: none;
    color: var(--brand-color-accent);
    cursor: pointer;
  }

  .site-header__nav-toggle-bars {
    position: relative;
    display: block;
    width: 1.5rem;
    height: 2px;
    background: currentcolor;
  }

  .site-header__nav-toggle-bars::before,
  .site-header__nav-toggle-bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentcolor;
    transition: transform 0.3s var(--theme-ease-signature), opacity 0.3s var(--theme-ease-signature);
  }

  .site-header__nav-toggle-bars::before {
    top: -6px;
  }

  .site-header__nav-toggle-bars::after {
    top: 6px;
  }

  body.nav-overlay-open .site-header__nav-toggle-bars {
    background: transparent;
  }

  body.nav-overlay-open .site-header__nav-toggle-bars::before {
    top: 0;
    transform: rotate(45deg);
  }

  body.nav-overlay-open .site-header__nav-toggle-bars::after {
    top: 0;
    transform: rotate(-45deg);
  }
}

