:root {
  --header-progress-gold: #dfbc66;
  --header-progress-track: rgba(223, 188, 102, 0.14);
  --header-ivory: #f6f2e8;
  --header-silver: #b9cbe0;
}

/* The header remains sticky while its compact state is controlled with
   scroll hysteresis in the shared script. This prevents top-edge oscillation. */
.global-header {
  isolation: isolate;
  backface-visibility: hidden;
  transform: translateZ(0);
  border-bottom-color: rgba(223, 188, 102, 0.24);
}

.global-header.is-scrolled {
  box-shadow: 0 12px 36px rgba(4, 12, 30, 0.4);
}

/* Final navigation hierarchy: labels lead, while the icons act as a quiet
   orientation aid. The active route keeps the strongest gold treatment. */
.global-header .hd-nav a {
  gap: 7px;
  color: rgba(185, 203, 224, 0.84);
  font-weight: 600;
  letter-spacing: 0.045em;
}

.global-header .hd-nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  stroke-width: 1.4;
  transition: opacity 180ms ease, stroke 180ms ease, transform 180ms ease;
}

.global-header .hd-nav a:hover .hd-nav-icon,
.global-header .hd-nav a:focus-visible .hd-nav-icon,
.global-header .hd-nav a[aria-current="page"] .hd-nav-icon {
  opacity: 1;
}

.global-header .hd-nav a::after {
  left: 27%;
  right: 27%;
  bottom: 11px;
  height: 2px;
  border-radius: 999px;
}

.global-header .hd-nav a[aria-current="page"]::after {
  background: linear-gradient(90deg, #b98b35 0%, #f1d685 100%);
  box-shadow: 0 0 8px rgba(223, 188, 102, 0.3);
}

/* Brand and action columns retain their separation without looking boxed in. */
.global-header .hd-brand {
  position: relative;
  border-right: 0;
}

.global-header .hd-brand::after {
  content: "";
  position: absolute;
  top: 24%;
  right: 0;
  width: 1px;
  height: 52%;
  background: linear-gradient(180deg, transparent, rgba(223, 188, 102, 0.42), transparent);
}

.global-header .hd-actions {
  position: relative;
  border-left: 0;
}

.global-header .hd-actions::before {
  content: "";
  position: absolute;
  top: 24%;
  left: 0;
  width: 1px;
  height: 52%;
  background: linear-gradient(180deg, transparent, rgba(223, 188, 102, 0.42), transparent);
}

.global-header .hd-cta {
  min-height: 46px;
  padding-inline: 20px;
  border-radius: 1px;
  box-shadow: 0 8px 20px rgba(1, 9, 25, 0.2);
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease,
    transform 180ms ease, box-shadow 180ms ease;
}

.global-header .hd-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(1, 9, 25, 0.28);
}

.global-header.is-scrolled .brand-logo-frame {
  transform: scale(0.96);
  transform-origin: left center;
}

.global-header .brand-logo-frame {
  transition: transform 220ms ease;
}

.global-header.is-scrolled .brand-slogan {
  opacity: 0.72;
}

.global-header .brand-slogan {
  transition: opacity 180ms ease;
}

.global-header + .reading-progress {
  position: fixed;
  top: var(--hd-height);
  right: 0;
  left: 0;
  z-index: 1002;
  display: block;
  width: 100%;
  max-width: none;
  height: 3px;
  overflow: hidden;
  pointer-events: none;
  background: var(--header-progress-track);
  transition: top 220ms ease;
}

.global-header.is-scrolled + .reading-progress {
  top: var(--hd-height-scroll);
}

.global-header + .reading-progress > span {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #9c752e 0%, var(--header-progress-gold) 70%, #f2d98f 100%);
  box-shadow: 0 0 9px rgba(223, 188, 102, 0.42);
  transform: scaleX(var(--reading-progress, 0));
  transform-origin: left center;
  will-change: transform;
}

/* Keep all eight routes balanced on medium desktop screens without forcing an
   early mobile menu. */
@media (min-width: 1101px) and (max-width: 1380px) {
  .global-header .hd-shell {
    grid-template-columns: minmax(220px, 250px) minmax(0, 1fr) minmax(148px, 170px);
    width: calc(100% - 24px);
  }

  .global-header .hd-brand {
    padding-inline: 10px 14px;
  }

  .global-header .brand-logo-frame {
    width: clamp(136px, 11.5vw, 160px);
  }

  .global-header .brand-slogan {
    font-size: 0.49rem;
    letter-spacing: 0.1em;
  }

  .global-header .hd-nav a {
    padding-inline: 3px;
    font-size: 0.54rem;
  }

  .global-header .hd-nav-icon {
    width: 17px;
    height: 17px;
  }

  .global-header .hd-actions {
    padding-inline: 10px;
  }

  .global-header .hd-cta {
    min-height: 42px;
    padding-inline: 14px;
    font-size: 0.64rem;
  }
}

@media (max-width: 1100px) {
  .global-header .hd-shell {
    width: min(calc(100% - 24px), var(--hd-max));
  }

  .global-header .hd-brand::after,
  .global-header .hd-actions::before {
    display: none;
  }

  .global-header .hd-nav {
    padding: 12px clamp(12px, 3vw, 28px) 24px;
    border-top: 1px solid rgba(223, 188, 102, 0.16);
    background:
      linear-gradient(180deg, rgba(20, 43, 77, 0.38), transparent 90px),
      var(--hd-navy);
  }

  .global-header .hd-nav a {
    gap: 15px;
    min-height: 52px;
    padding: 13px 18px;
    border-left-width: 2px;
    border-bottom: 1px solid rgba(185, 203, 224, 0.09);
    font-size: 0.75rem;
  }

  .global-header .hd-nav a:last-child {
    border-bottom-color: transparent;
  }

  .global-header .hd-nav a::after {
    display: none;
  }

  .global-header .hd-nav a:hover,
  .global-header .hd-nav a:focus-visible {
    background: rgba(223, 188, 102, 0.07);
  }

  .global-header .hd-nav a[aria-current="page"] {
    background: linear-gradient(90deg, rgba(223, 188, 102, 0.13), rgba(223, 188, 102, 0.025));
  }

  .global-header .nav-toggle {
    border-color: rgba(223, 188, 102, 0.46);
    background: rgba(255, 255, 255, 0.025);
  }

  body.nav-open::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 998;
    background: rgba(1, 8, 22, 0.56);
    backdrop-filter: blur(2px);
  }

  .global-header + .reading-progress {
    top: var(--hd-height-tablet);
  }

  .global-header.is-scrolled + .reading-progress {
    top: 72px;
  }
}

@media (max-width: 680px) {
  .global-header .hd-shell {
    width: calc(100% - 16px);
  }

  .global-header .hd-brand {
    padding-inline: 8px;
  }

  .global-header .hd-actions {
    gap: 8px;
    padding-left: 8px;
  }

  .global-header .hd-cta {
    min-height: 40px;
    padding-inline: 11px;
    box-shadow: none;
  }

  .global-header .nav-toggle {
    width: 40px;
    height: 40px;
  }

  .global-header .hd-nav {
    padding-inline: 8px;
  }

  .global-header .hd-nav a {
    min-height: 50px;
    padding-inline: 14px;
  }

  .global-header + .reading-progress {
    top: var(--hd-height-mobile);
  }

  .global-header.is-scrolled + .reading-progress {
    top: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .global-header,
  .global-header + .reading-progress,
  .global-header .brand-logo-frame,
  .global-header .brand-slogan,
  .global-header .hd-cta,
  .global-header .hd-nav-icon {
    transition: none !important;
  }

  .global-header .hd-cta:hover {
    transform: none;
  }
}

.qa-full-capture .global-header + .reading-progress {
  display: none;
}
