/* =============================================================================
   HEADER - the logo + menu bar at the top of every page
   The HTML for it is copied at the top of every page (look for <header class="site-header">).
   Behaviour (black bar on scroll, menu arrows, phone menu) is in js/header.js
   ============================================================================= */

/* ---------- The bar ---------------------------------------------------------

   Pick the look on each page with extra classes on <header>:
     site-header                       floats over the top of the page and is
                                       see-through until you scroll (home, about...)
     site-header site-header--black    floats over the page, always black
     + site-header--sticky             takes up its own space and stays at the top
     + site-header--scrolls-away       takes up its own space and scrolls away     */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  height: max(6.35cqw, calc(64px + 1.62cqw));   /* never shorter than about 80px */
  display: flex;
  align-items: center;
  transition: background-color 0.3s ease;
}

/* body is the "page width" container, so a fixed header must get its width from it */
.site-header { width: 100cqw; }

.site-header--black,
.site-header.is-scrolled {          /* "is-scrolled" is added by js/header.js */
  background-color: var(--black);
}

.site-header--sticky {
  position: sticky;
}

/* the black header's menu text is a little smaller */
.site-header--black .main-menu__link { font-size: 0.906cqw; }
.site-header--black .main-menu__scroll { height: calc(1.12 * 0.906cqw + 14px); }

.site-header--scrolls-away {
  position: relative;
}


/* ---------- Logo ----------------------------------------------------------- */
.site-header__logo {
  position: absolute;
  left: 6.98cqw;
  width: 14.44cqw;
  height: 4.83cqw;
}

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


/* ---------- Menu (desktop) --------------------------------------------------
   A see-through rounded box holding the links. If the links don't fit (small
   window or zoomed-in browser) the list scrolls sideways and arrow buttons
   appear at the ends.                                                         */
.main-menu {
  position: absolute;
  left: 31.44cqw;
  width: 61.57cqw;
  height: 3.94cqw;
  padding: 0 0.79cqw;
  background-color: rgba(0, 0, 0, 0.1);
  border: 0.8px solid rgba(255, 255, 255, 0.1);
  border-radius: 0.792cqw;
}

/* the row of links */
.main-menu__list {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;            /* hide the scrollbar (Firefox) */
}
.main-menu__list::-webkit-scrollbar { display: none; }   /* (Chrome, Safari) */

/* centre the links when they fit; when they don't, start from the left so they can scroll */
.main-menu__list > li:first-child { margin-left: auto; }
.main-menu__list > li:last-child  { margin-right: auto; }

.main-menu__item {
  position: relative;
  flex-shrink: 0;
}

/* each link (and the CAPABILITIES button) */
.main-menu__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  font-family: var(--font-body);
  font-size: 0.976cqw;
  line-height: normal;
  color: var(--white);
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;

  /* hover: a yellow highlight that grows from left to right */
  background-image: linear-gradient(var(--yellow), var(--yellow));
  background-repeat: no-repeat;
  background-position: left center;
  background-size: 0% 100%;
  transition: background-size 0.35s ease;
}

.main-menu__link:hover,
.main-menu__item.is-open > .main-menu__link {
  background-size: 100% 100%;
}

/* the page you are on: solid yellow */
.main-menu__link[aria-current="page"] {
  background-color: var(--yellow);
  background-image: none;
}

/* little down-arrow next to CAPABILITIES */
.main-menu__arrow {
  width: 10px;
  height: 7px;
  fill: currentColor;
}

/* drop-down list (CAPABILITIES -> Logistics, Cranes & Rigging, Transportation).
   It sits outside the scrolling row (js/header.js moves it under the button)
   so it isn't cut off. */
.main-menu__dropdown {
  position: fixed;
  z-index: 60;
  display: none;
  min-width: 155px;
  margin: 0;
  padding: 5px 10px;
  list-style: none;
  background-color: var(--yellow);
  border-radius: 5px;
}
.main-menu__dropdown.is-open { display: block; }

.main-menu__dropdown a {
  display: block;
  padding: 8px 0;
  font-family: var(--font-small-details);
  font-size: 14px;
  line-height: 20px;
  color: var(--white);
  text-align: center;
  white-space: nowrap;
}
.main-menu__dropdown a:hover { color: var(--black); }

/* arrow buttons at the ends of the menu (only shown when the links don't fit) */
.main-menu__scroll {
  position: absolute;
  top: 50%;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: calc(1.12 * 0.976cqw + 14px);   /* same height as a menu link */
  padding: 0;
  border: 0;
  border-radius: 5px;
  background-color: var(--yellow);
  transform: translateY(-50%);
  cursor: pointer;
}
.main-menu__scroll[hidden] { display: none; }
.main-menu__scroll svg { width: 5px; height: 10px; fill: var(--white); }
.main-menu__scroll--back    { left: 0.79cqw; }
.main-menu__scroll--forward { right: 0.79cqw; }


/* ---------- Menu button + full-screen menu (tablet & phone) ----------------- */
.menu-button {
  display: none;                     /* only shown on tablet & phone (see below) */
  position: absolute;
  align-items: center;
  justify-content: center;
  padding: 0;
  background-color: rgba(0, 0, 0, 0.1);
  border: 0.8px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
}
.menu-button svg { width: 30px; height: 22px; fill: var(--white); }

/* The menu that opens from the menu button: a dimmed page with a black panel
   (the panel fills a phone screen; on a tablet it is 360px wide on the right). */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  background-color: rgba(0, 0, 0, 0.6);
  opacity: 0;
  transition: opacity 0.4s ease;
}
.mobile-menu.is-visible { display: block; }   /* added by js/header.js ...      */
.mobile-menu.is-open { opacity: 1; }          /* ... then this one fades it in */

.mobile-menu__panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 360px;
  padding: 110px 30px 40px;
  overflow-y: auto;
  background-color: var(--black);
}

.mobile-menu__list {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: center;
}

.mobile-menu__item {
  margin-bottom: 10px;
  padding-bottom: 10px;
}

.mobile-menu__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  border: 0;
  background: none;
  font-family: var(--font-small-details);
  font-size: 18px;
  line-height: normal;
  color: var(--white);
  text-transform: uppercase;
  cursor: pointer;
}
.mobile-menu__link .main-menu__arrow { transition: transform 0.2s ease; }
.mobile-menu__item.is-open .main-menu__arrow { transform: rotate(180deg); }

/* CAPABILITIES' sub-links (opened with a tap) */
.mobile-menu__sublist {
  display: none;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mobile-menu__item.is-open .mobile-menu__sublist { display: block; }
.mobile-menu__sublist a {
  display: block;
  padding: 8px 0;
  margin-bottom: 12px;
  font-family: var(--font-small-details);
  font-size: 13px;
  line-height: 18px;
  color: var(--white);
}

/* the X in the top corner */
.mobile-menu__close {
  position: absolute;
  top: 30px;
  right: 45px;
  width: 40px;
  height: 40px;
  padding: 10px;
  border: 0;
  background: none;
  cursor: pointer;
}
.mobile-menu__close svg { display: block; width: 20px; height: 20px; fill: var(--white); }

/* stop the page behind the menu (or a pop-up) from scrolling */
html.no-scroll,
html.no-scroll body { overflow: hidden; }


/* ---------- Tablet (751px - 1000px) ----------------------------------------- */
@media (max-width: 1000px) {
  .site-header { height: 12.89cqw; }

  .site-header__logo {
    left: 3.95cqw;
    width: 26.78cqw;
    height: 8.93cqw;
  }

  .main-menu { display: none; }

  .menu-button {
    display: flex;
    right: 3.95cqw;
    width: max(50px, 6.67cqw);
    height: max(50px, 6.67cqw);
    border-radius: 0.79cqw;
  }
  .site-header--black .menu-button { right: 4.02cqw; width: 6.64cqw; height: 5.72cqw; }
}


/* ---------- Phone (750px and narrower) ------------------------------------- */
@media (max-width: 750px) {
  .site-header { height: 20.8cqw; }

  .site-header__logo {
    left: 5.33cqw;
    width: 42.93cqw;
    height: 14.4cqw;
  }

  .menu-button {
    right: 5.6cqw;
    width: 13.33cqw;
    height: 13.6cqw;
    border-radius: 1.34cqw;
  }
  .site-header--black .menu-button { right: 5.45cqw; width: 10.67cqw; height: 10.8cqw; }

  /* the menu fills the screen, with thin yellow lines between the links,
     and the page you are on is yellow */
  .mobile-menu__panel { width: 100%; padding-top: 80px; }
  .mobile-menu__item:not(:last-child) { border-bottom: 0.8px solid var(--yellow); }
  .mobile-menu__link[aria-current="page"] { color: var(--yellow); }
  .mobile-menu__close { right: 35px; }
  .mobile-menu__close svg { fill: var(--yellow); }
}
