/* ─── Header ─── */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: var(--z-sticky);
  background: rgba(242, 239, 232, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: background var(--duration-base) var(--ease-out),
              border-color var(--duration-base) var(--ease-out);
}

.header.is-scrolled {
  background: rgba(242, 239, 232, 0.95);
  border-bottom-color: var(--border-light);
}

.header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: 0 calc(var(--container-pad) * 3);
  height: 72px;
}

/* Logo */
.header__logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  z-index: calc(var(--z-sticky) + 1);
}

.header__logo svg,
.header__logo img {
  height: 24px;
  width: auto;
}

/* Nav */
.header__nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-left: auto;
  margin-right: var(--space-8);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  transition: color var(--duration-fast) var(--ease-out),
              background var(--duration-fast) var(--ease-out);
  cursor: pointer;
  position: relative;
}

.nav-link:hover,
.nav-link.is-active {
  color: var(--hot);
}

.nav-link__chevron {
  width: 14px;
  height: 14px;
  transition: transform var(--duration-base) var(--ease-out);
}

.nav-link.is-active .nav-link__chevron {
  transform: rotate(180deg);
}

/* Header actions */
.header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  z-index: calc(var(--z-sticky) + 1);
}

/* Header button overrides — no brutalist shadow in the nav */
.header__actions .btn--primary {
  background-color: var(--ink);
  color: var(--white);
  border-color: var(--ink);
  box-shadow: none;
}

.header__actions .btn--primary:hover {
  background-color: var(--ink-light);
  border-color: var(--ink-light);
  transform: none;
  box-shadow: none;
}

.header__actions .btn--primary:active {
  transform: none;
  box-shadow: none;
}

.header__actions .btn--secondary {
  background-color: transparent;
  color: var(--ink);
  border-color: var(--ink);
  box-shadow: none;
}

.header__actions .btn--secondary:hover {
  background-color: var(--ink);
  color: var(--white);
}

/* ─── Mega menu ─── */
.mega-menu {
  position: fixed;
  top: 72px;
  left: 0;
  right: 0;
  background: var(--white);
  border-bottom: 1px solid var(--border-light);
  box-shadow: var(--shadow-xl);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--duration-base) var(--ease-out);
  z-index: var(--z-dropdown);
}

.mega-menu.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.mega-menu__inner {
  max-width: var(--container-wide);
  margin: 0 auto;
  padding: var(--space-10) var(--container-pad);
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 280px;
  gap: var(--space-10);
}

.mega-menu__column {}

.mega-menu__column-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-light);
}

.mega-menu__link {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-3);
  border-radius: var(--radius-md);
  transition: background var(--duration-fast) var(--ease-out);
  margin: 0 calc(var(--space-3) * -1);
}

.mega-menu__link:hover {
  background: var(--paper);
}

.mega-menu__link-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: var(--mute);
  margin-top: 1px;
}

.mega-menu__link:hover .mega-menu__link-icon {
  color: var(--hot);
}

.mega-menu__link-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mega-menu__link-title {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
}

.mega-menu__link-desc {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  line-height: var(--leading-normal);
}

/* Promo panel */
.mega-menu__promo {
  background: var(--ink);
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  color: var(--white);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mega-menu__promo-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.025em;
  margin-bottom: var(--space-4);
}

.mega-menu__promo-text {
  font-size: var(--text-sm);
  color: rgba(255, 255, 255, 0.65);
  margin-bottom: var(--space-6);
  line-height: var(--leading-relaxed);
}

/* ─── Mobile nav ─── */
.mobile-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 24px;
  padding: 2px 0;
  z-index: calc(var(--z-sticky) + 2);
}

.mobile-toggle__bar {
  width: 100%;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
  transition: transform var(--duration-base) var(--ease-out),
              opacity var(--duration-fast) var(--ease-out);
}

.mobile-toggle.is-open .mobile-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.mobile-toggle.is-open .mobile-toggle__bar:nth-child(2) {
  opacity: 0;
}

.mobile-toggle.is-open .mobile-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--paper);
  /* Just under the header, so the logo and the cross that closes the menu
     stay on top of it (Danny, 4 Nov 2026) */
  z-index: calc(var(--z-sticky) - 1);
  padding: 72px var(--container-pad) var(--space-8); /* first item starts just under the logo */
  overflow-y: auto;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--duration-base) var(--ease-out),
              visibility var(--duration-base) var(--ease-out);
}

.mobile-nav.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-nav__section {
  border-bottom: 1px solid var(--border-light);
  padding: var(--space-4) 0;
}

/* Section titles (Solutions, Sectors, Company) look like the plain links
   beside them (Pricing, Resources), with a chevron to show they open
   (Danny, 4 Nov 2026) */
.mobile-nav__section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--space-3) 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
  line-height: 1.5; /* same row height as the plain links */
  color: var(--ink);
  text-align: left;
}

.mobile-nav__section-title::after {
  content: '';
  width: 9px;
  height: 9px;
  margin-right: 4px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-3px) rotate(45deg);
  transition: transform var(--duration-base) var(--ease-out);
}

.mobile-nav__section.is-open .mobile-nav__section-title::after {
  transform: translateY(2px) rotate(-135deg);
}

/* Links inside an opened section sit a step down from the titles; 10px
   above and below gives each one a 44px tap area */
[data-mobile-accordion-content] .mobile-nav__link {
  padding: 10px 0;
  min-height: 44px;
  font-size: var(--text-base);
  color: var(--text-secondary);
}

[data-mobile-accordion-content] .mobile-nav__link:last-child {
  padding-bottom: var(--space-3);
}

.mobile-nav__link {
  display: block;
  padding: var(--space-3) 0;
  font-size: var(--text-lg);
  font-weight: var(--weight-medium);
}

.mobile-nav__link:hover {
  color: var(--hot);
}

.mobile-nav__actions {
  display: flex;
  flex-direction: column;
  /* 14px clear between buttons once Sign up's 6px shadow is counted */
  gap: var(--space-5);
  padding-top: var(--space-6);
}

/* Sign up, Book a demo and Sign in stay pinned to the bottom of the open
   menu, even when a long section is opened (Danny, 4 Nov 2026) */
@media (max-width: 1024px) {
  .mobile-nav {
    flex-direction: column;
    padding-bottom: 0;
  }

  /* Opened sections make the menu longer and scroll, rather than squashing
     under the pinned buttons */
  .mobile-nav > * {
    flex-shrink: 0;
  }

  /* One line above the buttons, never two: the bar draws its own line only
     when the menu is long enough to scroll behind it, and the last section
     then drops its line */
  .mobile-nav:not(.has-overflow) .mobile-nav__actions {
    border-top-color: transparent;
  }

  .mobile-nav.has-overflow > .mobile-nav__section:nth-last-child(2) {
    border-bottom: none;
  }

  .mobile-nav__actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: var(--space-5) 0 calc(var(--space-5) + env(safe-area-inset-bottom));
    background: var(--paper);
    border-top: 1px solid var(--border-light);
  }

  /* Sign in is plain text, so it sits closer under Book a demo than the
     gap between the two boxed buttons */
  .mobile-nav__actions .btn--ghost {
    margin-top: calc(var(--space-2) * -1);
    padding-top: 10px;
    padding-bottom: 10px;
  }
}

/* ─── Responsive ─── */
@media (max-width: 1024px) {
  .header__nav {
    display: none;
  }

  .mobile-toggle {
    display: flex;
  }

  .mobile-nav {
    display: flex;
  }

  .header__actions {
    display: none;
  }

  .mega-menu {
    display: none;
  }
}
