/* ==========================================================================
   ALG header
   Namespaced .alg-hdr__* so it cannot collide with the legacy .navbar rules
   still present in main.css. Loaded after main.css.
   ========================================================================== */

:root {
  --alg-red: #d50a0a;
  --alg-red-dark: #b50909;
  --alg-ink: #111;
  --alg-ink-soft: #5f5f5f;
  --alg-paper: #fff;
  --alg-line: #e6e6e6;
  --alg-utility-bg: #111;
  --alg-utility-fg: #f2f2f2;

  --alg-bar-h: 84px;
  --alg-bar-h-sm: 64px;

  /* Angled brand block. --alg-angle must equal the bar height for a true 45deg. */
  --alg-angle: 64px;
  --alg-brand-block: 250px;
  --alg-utility-h: 40px;

  --alg-font: "Oswald", "Helvetica Neue", Arial, sans-serif;
  --alg-radius: 4px;
  --alg-speed: 220ms;
  --alg-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --alg-z-header: 100;
  --alg-z-drawer: 1000;
}

/* Screen-reader utility (theme does not reliably define one). */
.alg-hdr .screen-reader-text,
.alg-hdr__drawer .screen-reader-text {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- shell -- */

.alg-hdr {
  position: sticky;
  top: 0;
  z-index: var(--alg-z-header);
  background: var(--alg-paper);
  font-family: var(--alg-font);
  box-shadow: 0 1px 0 var(--alg-line);
}

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

.alg-hdr__inner {
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Skip link. */
.alg-hdr__skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: calc(var(--alg-z-drawer) + 10);
  padding: 12px 20px;
  background: var(--alg-red);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.alg-hdr__skip:focus {
  left: 8px;
  top: 8px;
}

/* ------------------------------------------------------- utility bar -- */

.alg-hdr__utility {
  display: none;
  background: var(--alg-utility-bg);
  color: var(--alg-utility-fg);
}

.alg-hdr__utility .alg-hdr__inner {
  min-height: var(--alg-utility-h);
  justify-content: flex-end;
  gap: 28px;
}

.alg-hdr__utility .alg-hdr__phone {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
}

.alg-hdr__phone-label {
  color: #9e9e9e;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.72rem;
}

.alg-hdr__phone-num {
  color: inherit;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.alg-hdr__phone-num:hover,
.alg-hdr__phone-num:focus-visible {
  color: #fff;
  text-decoration: underline;
}

/* ------------------------------------------------- language toggle -- */

.alg-hdr__lang {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid currentColor;
  border-radius: var(--alg-radius);
  overflow: hidden;
  line-height: 1;
  flex: none;
}

.alg-hdr__lang-opt {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: inherit;
  background: transparent;
  transition: background var(--alg-speed) var(--alg-ease),
              color var(--alg-speed) var(--alg-ease);
}

.alg-hdr__lang-opt + .alg-hdr__lang-opt {
  border-left: 1px solid currentColor;
}

.alg-hdr__lang-opt.is-current {
  background: var(--alg-red);
  color: #fff;
  cursor: default;
}

.alg-hdr__lang-opt:not(.is-current):hover,
.alg-hdr__lang-opt:not(.is-current):focus-visible {
  background: rgba(255, 255, 255, 0.16);
}

/* Mobile bar variant sits on white, so it needs its own colours. */
.alg-hdr__lang--bar {
  color: var(--alg-ink);
  border-color: var(--alg-line);
}

.alg-hdr__lang--bar .alg-hdr__lang-opt:not(.is-current):hover,
.alg-hdr__lang--bar .alg-hdr__lang-opt:not(.is-current):focus-visible {
  background: #f2f2f2;
}

/* --------------------------------------------------------- main bar -- */

.alg-hdr__bar .alg-hdr__inner {
  position: relative;
  min-height: var(--alg-bar-h-sm);
  justify-content: space-between;
  transition: min-height var(--alg-speed) var(--alg-ease);
}

.alg-hdr__brand {
  display: flex;
  align-items: center;
  flex: none;
  margin-right: auto;
}

.alg-hdr__brand img {
  display: block;
  width: auto;
  height: auto;
  max-height: 44px;
  transition: max-height var(--alg-speed) var(--alg-ease);
}

/* Black angled brand block. Bleeds to the viewport's left edge and cuts at 45deg.
   Uses the 50vw - 50% full-bleed trick, valid because .alg-hdr__inner is centred. */
.alg-hdr__bar .alg-hdr__inner::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(-1 * (50vw - 50%));
  width: calc((50vw - 50%) + var(--alg-brand-block));
  background: var(--alg-utility-bg);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--alg-angle)) 100%, 0 100%);
  z-index: 0;
  transition: width var(--alg-speed) var(--alg-ease);
}

/* Keep every real control above the block. */
.alg-hdr__brand,
.alg-hdr__nav,
.alg-hdr__bar-actions {
  position: relative;
  z-index: 1;
}

.alg-hdr__bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: none;
}

/* ------------------------------------------------------------- CTA -- */

.alg-hdr__cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 22px;
  border-radius: var(--alg-radius);
  background: var(--alg-red);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.15;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--alg-speed) var(--alg-ease),
              transform var(--alg-speed) var(--alg-ease);
}

.alg-hdr__cta:hover,
.alg-hdr__cta:focus-visible {
  background: var(--alg-red-dark);
  color: #fff;
  transform: translateY(-1px);
}

.alg-hdr__cta-text strong {
  display: block;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.alg-hdr__cta-arrow {
  width: 18px;
  height: 18px;
  flex: none;
}

/* Hidden on the small bar; it lives in the drawer instead. */
.alg-hdr__cta--bar {
  display: none;
}

/* ------------------------------------------------------- hamburger -- */

.alg-hdr__toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: var(--alg-radius);
  background: transparent;
  color: var(--alg-ink);
  cursor: pointer;
  flex: none;
}

.alg-hdr__toggle:hover {
  background: #f2f2f2;
}

.alg-hdr__burger {
  position: relative;
  display: block;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: background var(--alg-speed) var(--alg-ease);
}

.alg-hdr__burger::before,
.alg-hdr__burger::after {
  content: "";
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  background: currentColor;
  transition: transform var(--alg-speed) var(--alg-ease);
}

.alg-hdr__burger::before { top: -7px; }
.alg-hdr__burger::after  { top: 7px; }

.alg-hdr__toggle[aria-expanded="true"] .alg-hdr__burger {
  background: transparent;
}

.alg-hdr__toggle[aria-expanded="true"] .alg-hdr__burger::before {
  transform: translateY(7px) rotate(45deg);
}

.alg-hdr__toggle[aria-expanded="true"] .alg-hdr__burger::after {
  transform: translateY(-7px) rotate(-45deg);
}

.alg-hdr__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: var(--alg-radius);
  background: transparent;
  color: var(--alg-ink);
  cursor: pointer;
  flex: none;
}

.alg-hdr__close:hover {
  background: #f2f2f2;
}

.alg-hdr__close svg {
  width: 22px;
  height: 22px;
}

/* ---------------------------------------------------------- drawer -- */

.alg-hdr__scrim {
  position: fixed;
  inset: 0;
  z-index: calc(var(--alg-z-drawer) - 1);
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--alg-speed) var(--alg-ease), visibility var(--alg-speed);
}

.alg-hdr__scrim.is-open {
  opacity: 1;
  visibility: visible;
}

.alg-hdr__drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: var(--alg-z-drawer);
  width: min(380px, 88vw);
  display: flex;
  flex-direction: column;
  background: var(--alg-paper);
  transform: translateX(100%);
  transition: transform var(--alg-speed) var(--alg-ease);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.alg-hdr__drawer.is-open {
  transform: translateX(0);
  box-shadow: -8px 0 28px rgba(0, 0, 0, 0.22);
}

.alg-hdr__drawer-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--alg-line);
  position: sticky;
  top: 0;
  background: var(--alg-paper);
  z-index: 1;
}

.alg-hdr__drawer-body {
  padding: 8px 0 24px;
}

.alg-hdr__drawer-foot {
  margin-top: auto;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--alg-line);
  display: grid;
  gap: 14px;
}

.alg-hdr__drawer-foot .alg-hdr__phone {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.alg-hdr__drawer-foot .alg-hdr__phone-label {
  color: var(--alg-ink-soft);
}

.alg-hdr__drawer-foot .alg-hdr__phone-num {
  color: var(--alg-ink);
  font-size: 1.15rem;
}

.alg-hdr__drawer-foot .alg-hdr__cta {
  justify-content: center;
}

/* ------------------------------------------------------------- nav -- */

.alg-hdr__menu,
.alg-hdr__sub {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Mobile / drawer nav */
.alg-hdr__drawer .alg-hdr__item--top {
  border-bottom: 1px solid var(--alg-line);
}

.alg-hdr__drawer .alg-hdr__item {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.alg-hdr__drawer .alg-hdr__link {
  flex: 1 1 auto;
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--alg-ink);
  font-size: 1.02rem;
  text-decoration: none;
}

.alg-hdr__drawer .alg-hdr__item--child .alg-hdr__link {
  min-height: 46px;
  padding-left: 32px;
  font-size: 0.95rem;
  color: var(--alg-ink-soft);
}

.alg-hdr__drawer .alg-hdr__link:hover,
.alg-hdr__drawer .alg-hdr__link:focus-visible {
  background: #f7f7f7;
  color: var(--alg-red);
}

.alg-hdr__drawer .is-current > .alg-hdr__link {
  color: var(--alg-red);
  font-weight: 600;
}

.alg-hdr__disclosure {
  flex: none;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-left: 1px solid var(--alg-line);
  background: transparent;
  color: var(--alg-ink);
  cursor: pointer;
}

.alg-hdr__chev {
  width: 18px;
  height: 18px;
  transition: transform var(--alg-speed) var(--alg-ease);
}

.alg-hdr__disclosure[aria-expanded="true"] .alg-hdr__chev {
  transform: rotate(180deg);
}

/* Collapsed submenu in the drawer. */
.alg-hdr__drawer .alg-hdr__sub {
  flex: 1 0 100%;
  display: none;
  background: #fafafa;
}

.alg-hdr__drawer .alg-hdr__sub.is-open {
  display: block;
}

/* --------------------------------------------------- desktop layout -- */

@media (min-width: 992px) {

  .alg-hdr__utility {
    display: block;
  }

  .alg-hdr__bar .alg-hdr__inner {
    min-height: var(--alg-bar-h);
    gap: 32px;
    --alg-angle: var(--alg-bar-h);
    --alg-brand-block: 340px;
  }

  /* Condensed bar is shorter, so the 45deg run shortens with it. */
  .alg-hdr.is-scrolled .alg-hdr__bar .alg-hdr__inner {
    --alg-angle: var(--alg-bar-h-sm);
    --alg-brand-block: 300px;
  }

  .alg-hdr__brand img {
    max-height: 58px;
  }

  /* Condensed state once scrolled. */
  .alg-hdr.is-scrolled .alg-hdr__bar .alg-hdr__inner {
    min-height: var(--alg-bar-h-sm);
  }

  .alg-hdr.is-scrolled .alg-hdr__brand img {
    max-height: 42px;
  }

  .alg-hdr__toggle,
  .alg-hdr__lang--bar {
    display: none;
  }

  .alg-hdr__cta--bar {
    display: inline-flex;
  }

  /* The drawer markup is mobile-only. */
  .alg-hdr__drawer,
  .alg-hdr__scrim {
    display: none;
  }

  .alg-hdr__nav {
    display: block;
    margin-left: auto;
  }

  .alg-hdr__nav .alg-hdr__menu {
    display: flex;
    align-items: center;
    gap: 4px;
  }

  .alg-hdr__nav .alg-hdr__item--top {
    position: relative;
    display: flex;
    align-items: center;
  }

  /* Mega parents anchor to .alg-hdr__inner instead of themselves. */
  .alg-hdr__nav .alg-hdr__item--mega {
    position: static;
  }

  .alg-hdr__nav .alg-hdr__link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: var(--alg-ink);
    font-size: 0.98rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: color var(--alg-speed) var(--alg-ease),
                border-color var(--alg-speed) var(--alg-ease);
  }

  .alg-hdr__nav .alg-hdr__item--top > .alg-hdr__link:hover,
  .alg-hdr__nav .alg-hdr__item--top > .alg-hdr__link:focus-visible,
  .alg-hdr__nav .alg-hdr__item--top.is-current > .alg-hdr__link {
    color: var(--alg-red);
    border-bottom-color: var(--alg-red);
  }

  /* Disclosure collapses into a caret beside the link. */
  .alg-hdr__nav .alg-hdr__disclosure {
    display: inline-flex;
    width: 24px;
    height: 44px;
    border-left: 0;
    margin-left: -8px;
    color: var(--alg-ink-soft);
  }

  .alg-hdr__nav .alg-hdr__chev {
    width: 14px;
    height: 14px;
  }

  /* Dropdown panels. */
  .alg-hdr__nav .alg-hdr__sub {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 260px;
    padding: 10px 0;
    background: var(--alg-paper);
    border: 1px solid var(--alg-line);
    border-top: 3px solid var(--alg-red);
    border-radius: 0 0 var(--alg-radius) var(--alg-radius);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
    opacity: 0;
    visibility: hidden;
    transform: translateY(6px);
    transition: opacity var(--alg-speed) var(--alg-ease),
                transform var(--alg-speed) var(--alg-ease),
                visibility var(--alg-speed);
  }

  /* Open on hover, on keyboard focus, and on explicit click. */
  .alg-hdr__nav .alg-hdr__item--top:hover > .alg-hdr__sub,
  .alg-hdr__nav .alg-hdr__item--top:focus-within > .alg-hdr__sub,
  .alg-hdr__nav .alg-hdr__sub.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
  }

  /* Large submenus become a multi-column mega panel. */
  .alg-hdr__nav .alg-hdr__sub--mega {
    left: 0;
    right: 0;
    width: auto;
    column-count: 4;
    column-gap: 32px;
    padding: 24px 28px 28px;
    border-radius: 0 0 var(--alg-radius) var(--alg-radius);
  }

  @media (min-width: 1600px) {
    .alg-hdr__nav .alg-hdr__sub--mega {
      column-count: 4;
    }
  }

  .alg-hdr__nav .alg-hdr__sub--mega .alg-hdr__item--child {
    break-inside: avoid;
  }

  .alg-hdr__nav .alg-hdr__item--child {
    display: block;
  }

  .alg-hdr__nav .alg-hdr__item--child .alg-hdr__link {
    display: block;
    min-height: 0;
    padding: 8px 20px;
    font-size: 0.92rem;
    font-weight: 400;
    white-space: normal;
    border-bottom: 0;
    color: var(--alg-ink-soft);
  }

  .alg-hdr__nav .alg-hdr__sub--mega .alg-hdr__link {
    padding: 7px 0;
  }

  .alg-hdr__nav .alg-hdr__item--child .alg-hdr__link:hover,
  .alg-hdr__nav .alg-hdr__item--child .alg-hdr__link:focus-visible {
    color: var(--alg-red);
    text-decoration: underline;
  }
}

/* Below the breakpoint the desktop nav is not rendered inline. */
@media (max-width: 991.98px) {
  .alg-hdr__nav {
    display: none;
  }
}

/* ------------------------------------------------------ preferences -- */

@media (prefers-reduced-motion: reduce) {
  .alg-hdr *,
  .alg-hdr__drawer,
  .alg-hdr__scrim {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* Visible focus everywhere in the header. */
.alg-hdr a:focus-visible,
.alg-hdr button:focus-visible,
.alg-hdr__drawer a:focus-visible,
.alg-hdr__drawer button:focus-visible {
  outline: 3px solid var(--alg-red);
  outline-offset: 2px;
}

/* Body lock while the drawer is open. */
body.alg-drawer-open {
  overflow: hidden;
}
