/* =========================================================
   Worksonics — Header (global, loaded on every page)
   Dark green bar. Turns to glass on scroll.
   Desktop: two rows + mega menus. ≤ 1200px: burger + menu panel (bottom of file).
   ========================================================= */

.ws-header {
  --hdr-solid: rgba(6, 43, 38, 0.98);
  --hdr-bg: linear-gradient(90deg, var(--color-dark-deep) 0%, var(--color-dark) 45%, var(--color-dark-soft) 100%);
  --hdr-bg-glass: linear-gradient(90deg, rgba(3, 26, 23, 0.72) 0%, rgba(6, 43, 38, 0.66) 45%, rgba(11, 74, 64, 0.6) 100%);
  --hdr-line: rgba(255, 255, 255, 0.08);
  --hdr-text: #FFFFFF;
  --hdr-muted: rgba(255, 255, 255, 0.6);
  --hdr-gradient: linear-gradient(90deg, var(--link) 0%, var(--color-teal) 50%, var(--color-accent) 100%);
  --hdr-glow: 0 0 12px rgba(207, 245, 90, 0.7);

  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-header);
  font-family: var(--font);
  color: var(--hdr-text);
  background: var(--hdr-bg);
  border-bottom: var(--border-width) solid rgba(255, 255, 255, 0.28);
  -webkit-font-smoothing: antialiased;
  transition:
    box-shadow var(--dur-fill) var(--ease),
    border-color var(--dur-fill) var(--ease);
}
.ws-header *,
.ws-header *::before,
.ws-header *::after { box-sizing: border-box; }
.ws-header ul { list-style: none; margin: 0; padding: 0; }
.ws-header p { margin: 0; }
.ws-header a { text-decoration: none; }
.ws-header img { display: block; max-width: 100%; height: auto; }

/* Glass on scroll */
.ws-header.is-scrolled {
  background: var(--hdr-bg-glass);
  border-bottom-color: rgba(255, 255, 255, 0.32);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
          backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.35);
}

/* ---------- Layout: logo left spanning both rows, two rows on the right ---------- */
.ws-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-7);
  max-width: 1760px;
  min-height: calc(var(--header-top-height) + var(--header-main-height));
  transition: min-height var(--dur-fill) var(--ease);
}
.ws-header__logo {
  font-size: 40px;
  font-weight: var(--fw-bold);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--hdr-text);
  transition: font-size var(--dur-fill) var(--ease);
}
.ws-header__logo:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 4px; }
.ws-header__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* ---------- Upper row ---------- */
.ws-header__util {
  display: flex;
  align-items: center;
  height: var(--header-top-height);
  overflow: hidden;
  transition: height var(--dur-fill) var(--ease), opacity var(--dur-fast) var(--ease);
}
.ws-header__util li { display: flex; align-items: center; }
/* dot separators */
.ws-header__util li + li::before {
  content: "";
  width: 3px;
  height: 3px;
  margin: 0 var(--space-3);
  background: var(--hdr-text);
  border-radius: 50%;
  opacity: 0.8;
}
.ws-header__util a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  line-height: 1;
  color: var(--hdr-text);
  transition: color var(--dur-fast) var(--ease), text-shadow var(--dur-fast) var(--ease);
}
.ws-header__util a:hover,
.ws-header__util a:focus-visible { color: var(--color-accent); text-shadow: var(--shadow-link-hover); }
.ws-header__phone .ws-icon { width: 16px; height: 16px; }

/* ---------- Lower row ---------- */
.ws-header__bar {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: var(--header-main-height);
}

/* Scrolled: upper row collapses, logo shrinks */
.ws-header.is-scrolled .ws-header__util { height: 0; opacity: 0; }
.ws-header.is-scrolled .ws-header__inner { min-height: var(--header-main-height); }
.ws-header.is-scrolled .ws-header__logo { font-size: 30px; }

/* ---------- Nav ---------- */
/* Reset anything old page CSS puts on nav elements; static so the mega panel spans the full width */
.ws-header .ws-nav,
.ws-header .ws-nav__list,
.ws-header .ws-nav__item {
  position: static;
  margin: 0;
  background: none;
  border: 0;
  box-shadow: none;
  filter: none;
  transform: none;
  -webkit-backdrop-filter: none;
          backdrop-filter: none;
}
.ws-nav { height: 100%; }
.ws-nav__list { height: 100%; display: flex; align-items: stretch; gap: var(--space-2); }
.ws-nav__item { display: flex; align-items: stretch; }
.ws-nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 0 var(--space-4);
  font-size: var(--fs-small);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--hdr-text);
  transition: color var(--dur-fast) var(--ease), text-shadow var(--dur-fast) var(--ease);
}
/* Lime bar with glow grows under the active / hovered item */
.ws-nav__link::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 3px;
  background: var(--color-accent);
  box-shadow: var(--hdr-glow);
  transition: width var(--dur-line) var(--ease);
}
.ws-nav__link:hover,
.ws-nav__link:focus-visible,
.ws-nav__item.is-open > .ws-nav__link { color: var(--color-accent); }
.ws-nav__link:hover::after,
.ws-nav__link:focus-visible::after,
.ws-nav__item.is-open > .ws-nav__link::after,
.ws-nav__link[aria-current="page"]::after { width: 100%; }
.ws-nav__link:focus-visible { outline: none; }

/* ---------- CTA (button variant for dark backgrounds) ---------- */
.ws-header__cta { padding: 12px 22px; color: var(--hdr-text); }
.ws-header__cta.ws-gb::before {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.35) 0%, rgba(255, 255, 255, 0.35) 50%, var(--color-accent) 100%);
}
.ws-header__cta::after {
  background:
    linear-gradient(110deg, transparent 40%, rgba(255, 255, 255, 0.6) 50%, transparent 60%) no-repeat,
    var(--color-accent);
  background-size: 300% 100%, auto;
}
.ws-header__cta:hover,
.ws-header__cta:focus-visible { color: var(--color-dark); box-shadow: 0 0 20px rgba(207, 245, 90, 0.35); }

/* ---------- Mega menu ---------- */
.ws-mega {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  padding: var(--space-6) 0 var(--space-7);
  background: var(--glow-corner), var(--color-dark);
  border-bottom: var(--border-width) solid rgba(207, 245, 90, 0.35);
  box-shadow: 0 35px 80px rgba(0, 0, 0, 0.6), 0 0 35px rgba(207, 245, 90, 0.12);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition:
    opacity var(--dur-fast) var(--ease),
    transform var(--dur-fill) var(--ease),
    visibility 0s linear var(--dur-fast);
}
.ws-nav__item.is-open > .ws-mega {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fill) var(--ease), visibility 0s;
}
.ws-mega__inner {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: var(--space-7);
  align-items: start;
}
.ws-mega__intro { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-2); }
.ws-mega__eyebrow {
  font-size: var(--fs-small);
  font-weight: var(--fw-medium);
  letter-spacing: var(--ls-eyebrow);
  text-transform: uppercase;
  color: var(--color-accent);
}
.ws-mega__text { font-size: var(--fs-body); line-height: var(--lh-body); color: var(--text-on-dark-muted); }
.ws-mega__all {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-2);
  font-size: var(--fs-body);
  font-weight: var(--fw-medium);
  color: var(--color-accent);
}
.ws-mega__all:hover { color: #fff; text-shadow: var(--shadow-link-hover); }
.ws-mega__all .ws-icon { width: 18px; height: 18px; }

/* fixed card width, so cards are the same size in 4- and 5-card menus */
.ws-mega__grid {
  --card-w: 200px;
  display: grid;
  grid-template-columns: repeat(var(--cols, 4), minmax(0, var(--card-w)));
  gap: var(--space-5);
}
/* Cards: image sits above the card top; on hover a white fill rises
   out of the lime line, the title turns dark and the image lifts and shrinks */
.ws-mega__grid { padding-top: 44px; }
.ws-mega__card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 var(--space-3) var(--space-5);
  background: rgba(0, 0, 0, 0.28);
  color: var(--hdr-text);
  text-align: center;
  text-decoration: none;
  transition: color var(--dur-fill) var(--ease), box-shadow var(--dur-fill) var(--ease);
}
.ws-mega__card::before {
  content: "";
  position: absolute;
  inset: 0 10px 0;
  background: #FFFFFF;
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform var(--dur-fill) var(--ease), left var(--dur-fill) var(--ease), right var(--dur-fill) var(--ease);
}
.ws-mega__card::after {
  content: "";
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 0;
  height: 4px;
  background: var(--color-accent);
}
.ws-mega__card:hover,
.ws-mega__card:focus-visible { color: var(--color-dark); box-shadow: 0 20px 45px rgba(0, 0, 0, 0.45); }
.ws-mega__card:hover::before,
.ws-mega__card:focus-visible::before { left: 0; right: 0; transform: scaleY(1); }
.ws-mega__card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }
.ws-mega__media {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  aspect-ratio: 16 / 10;   /* same frame as before */
  overflow: hidden;
  margin-top: -44px;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent 95%);
  mask-image: linear-gradient(180deg, #000 55%, transparent 95%);
}
.ws-mega__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: drop-shadow(0 12px 20px rgba(0, 0, 0, 0.4));
  transition: transform var(--dur-fill) var(--ease);
}
.ws-mega__card:hover .ws-mega__media,
.ws-mega__card:focus-visible .ws-mega__media { -webkit-mask-image: none; mask-image: none; }
.ws-mega__card:hover .ws-mega__media img,
.ws-mega__card:focus-visible .ws-mega__media img { transform: translateY(-12px) scale(0.86); }
.ws-mega__title {
  position: relative;
  margin-top: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 2.5em;   /* room for two lines, so every card is the same height */
  font-size: var(--fs-lead);
  font-weight: var(--fw-bold);
  line-height: 1.25;
  text-wrap: balance;
}

/* ---------- Scroll progress ---------- */
.ws-header__progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 3px;
  pointer-events: none;
}
.ws-header__progress-bar {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--hdr-gradient);
  box-shadow: var(--hdr-glow);
  transform: scaleX(var(--progress, 0));
  transform-origin: left;
}

@media (prefers-reduced-motion: reduce) {
  .ws-header,
  .ws-header *,
  .ws-header *::before,
  .ws-header *::after { transition: none !important; }
}

/* Mega content lines up with the header edges */
.ws-mega > .ws-container { max-width: 1760px; }

/* =========================================================
   Tablet + mobile (≤ 1200px): burger button and a full-height
   menu panel. Mega menus become accordions with 2-column cards.
   ========================================================= */
.ws-header__burger { display: none; }

@media (max-width: 1200px) {
  .ws-header__inner,
  .ws-header.is-scrolled .ws-header__inner { min-height: var(--header-height); gap: var(--space-4); }
  .ws-header__logo,
  .ws-header.is-scrolled .ws-header__logo { font-size: 26px; }

  .ws-header__burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    padding: 0 10px;
    border: var(--border-width) solid rgba(255, 255, 255, 0.35);
    background: none;
    cursor: pointer;
  }
  .ws-header__burger span { display: block; height: 2px; background: var(--hdr-text); transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease); }
  .ws-header__burger:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
  .ws-header.is-menu-open .ws-header__burger span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .ws-header.is-menu-open .ws-header__burger span:nth-child(2) { opacity: 0; }
  .ws-header.is-menu-open .ws-header__burger span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  /* the panel */
  .ws-header__right {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-6);
    padding: var(--space-5) var(--container-padding) var(--space-8);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: var(--glow-corner), var(--color-dark);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fill) var(--ease), visibility 0s linear var(--dur-fast);
  }
  .ws-header.is-menu-open .ws-header__right { opacity: 1; visibility: visible; transform: none; transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fill) var(--ease), visibility 0s; }

  .ws-header__bar { order: 1; flex-direction: column; align-items: stretch; height: auto; gap: var(--space-5); }
  .ws-nav__list { flex-direction: column; gap: 0; }
  .ws-nav__item { flex-direction: column; border-bottom: var(--border-width) solid var(--line-on-dark); }
  .ws-nav__link { justify-content: space-between; padding: var(--space-4) 0; font-size: var(--fs-body); }
  .ws-nav__link::after { display: none; }
  .ws-nav__item--mega > .ws-nav__link::before {
    content: "";
    order: 2;
    width: 10px;
    height: 10px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg) translateY(-3px);
    transition: transform var(--dur-fast) var(--ease);
  }
  .ws-nav__item--mega.is-open > .ws-nav__link::before { transform: rotate(225deg) translateY(-3px); }

  /* mega panels: accordion */
  .ws-mega,
  .ws-nav__item.is-open > .ws-mega {
    position: static;
    display: none;
    padding: 0 0 var(--space-5);
    border: 0;
    background: none;
    box-shadow: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    transition: none;
  }
  .ws-nav__item.is-open > .ws-mega { display: block; }
  .ws-mega > .ws-container { padding: 0; }
  .ws-mega__inner { grid-template-columns: 1fr; gap: var(--space-4); }
  .ws-mega__eyebrow,
  .ws-mega__text { display: none; }
  .ws-mega__intro { order: 2; padding: 0; }
  .ws-mega__all { margin: 0; }
  .ws-mega__grid,
  .ws-mega__grid[style] { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 40px var(--space-3); padding-top: 36px; }
  .ws-mega__media { margin-top: -36px; }
  .ws-mega__title { font-size: var(--fs-body); }

  .ws-header__cta { justify-content: center; padding: 14px 22px; }

  .ws-header__util,
  .ws-header.is-scrolled .ws-header__util { order: 2; flex-direction: column; align-items: flex-start; gap: var(--space-4); height: auto; opacity: 1; overflow: visible; }
  .ws-header__util li + li::before { display: none; }
  .ws-header__util a { font-size: var(--fs-small); }

  .ws-header__progress { display: none; }
}

/* page behind the open menu does not scroll */
body.ws-menu-open { overflow: hidden; }
body.ws-menu-open .ws-dock { display: none; }

/* WordPress admin bar (logged-in editors): header sits below it */
.admin-bar .ws-header { top: 32px; }
@media (max-width: 782px) {
  .admin-bar .ws-header { top: 46px; }
  .admin-bar .ws-header__right { top: calc(var(--header-height) + 46px); }
}
@media (max-width: 600px) {
  .admin-bar .ws-header { top: 0; }
  .admin-bar .ws-header__right { top: var(--header-height); }
}
