/* ============================================================
   WOODLEY COLLISION — HEADER + MEGA MENUS
   Desktop header bar, nav, and the two mega-menu panels.
   (Mobile nav styles will be appended in a later pass.)
   ============================================================ */

/* ----- Header shell ----- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  width: 100%;
  background: var(--white);
  -webkit-backdrop-filter: blur(var(--blur-header));
  backdrop-filter: blur(var(--blur-header));
  border-bottom: 1px solid var(--gray-50);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-24);
  padding-block: var(--sp-12);
  padding-inline: var(--gutter);
  max-width: var(--container-outer);
  margin-inline: auto;
}

/* ----- Logo ----- */
.site-logo {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
}
.site-logo img { height: 50px; width: auto; }

/* ----- Right cluster (nav + actions) ----- */
.header-cluster {
  display: flex;
  align-items: center;
  gap: clamp(2rem, 1rem + 4vw, 7.5rem);   /* 40 → 120 */
}

/* ----- Primary nav ----- */
.main-nav { display: flex; }
.main-nav__list {
  display: flex;
  align-items: center;
  gap: clamp(1.25rem, 0.5rem + 2vw, 2.5rem);  /* 20 → 40 */
}
.main-nav__item { position: static; }   /* mega menu is positioned to header, not item */

.main-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-4);
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--gray-900);
  padding-block: var(--sp-8);
  transition: color var(--dur) var(--ease);
}
.main-nav__link:hover { color: var(--color-red); }

.main-nav__caret {
  width: 18px; height: 18px;
  transition: transform var(--dur) var(--ease);
}
.main-nav__caret svg { width: 100%; height: 100%; stroke-width: 2; }

/* caret flips when its menu is open */
.main-nav__item.is-open .main-nav__caret { transform: rotate(180deg); }
.main-nav__item.is-open .main-nav__link { color: var(--color-red); }

/* ----- Header actions ----- */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
}

/* ============================================================
   MEGA MENU
   Shared shell for both Services & About panels.
   Positioned relative to the header, centered, animated.
   ============================================================ */
.mega {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  width: min(1122px, calc(100vw - 2 * var(--header-pad-x)));
  background: var(--white);
  border: 1px solid var(--gray-50);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-menu);
  padding: var(--sp-36);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              visibility 0s linear var(--dur);
  z-index: 90;
}

/* Invisible bridge that fills the 8px gap between the nav bar and the
   panel, so moving the cursor down keeps it inside the hover zone. */
.mega::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -12px;        /* covers the gap + a little slack above */
  height: 14px;
}
.mega.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(-50%) translateY(0);
  transition: opacity var(--dur) var(--ease),
              transform var(--dur) var(--ease),
              visibility 0s;
}

/* layout: menu columns on the left, feature photo on the right */
.mega__inner {
  display: flex;
  gap: var(--sp-36);
  align-items: stretch;
}
.mega__cols {
  display: flex;
  gap: var(--sp-32);
  flex: 1;
}
.mega__col {
  display: flex;
  flex-direction: column;
  gap: var(--sp-24);
  flex: 1;
  min-width: 0;
}

/* ----- Menu link item (icon chip + text) ----- */
.mega-item {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  border-radius: var(--radius-sm);
  transition: transform var(--dur) var(--ease);
}
.mega-item:hover { transform: translateX(2px); }

.mega-item__icon {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-pill);
  color: var(--gray-900);
  transition: border-color var(--dur) var(--ease),
              background-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}
.mega-item__icon svg { width: 20px; height: 20px; stroke-width: 1.75; fill: none; }
.mega-item:hover .mega-item__icon {
  background: var(--gray-900);
  border-color: var(--gray-900);
  color: var(--white);
}

.mega-item__text { display: flex; flex-direction: column; gap: var(--sp-2); }
.mega-item__title {
  font-size: var(--fs-body);
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--gray-900);
}
.mega-item__desc {
  font-size: var(--fs-body-s);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--gray-300);
}

/* ----- Feature photo card ----- */
.mega__feature {
  position: relative;
  flex-shrink: 0;
  width: 286px;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.mega__feature img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.mega__feature::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 8%, rgba(0,0,0,0.45) 38%, rgba(0,0,0,0.85) 65%, rgba(0,0,0,0.95) 90%);
}
.mega__feature-text {
  position: absolute;
  inset: auto 0 0 0;
  z-index: 1;
  padding: var(--sp-16);
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
}
.mega__feature-title {
  font-size: var(--fs-h3);
  font-weight: 600;
  line-height: var(--lh-snug);
  color: var(--white);
}
.mega__feature-desc {
  font-size: var(--fs-body-s);
  font-weight: 400;
  line-height: var(--lh-body);
  color: var(--gray-200);
}
.mega__feature-towing {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: var(--fs-body-s);
  line-height: 1.4;
  color: #fff;
}
.mega__feature-towing svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--color-red, #e11a17);
}

/* Services feature photo is a touch taller than About's in the design;
   both adapt to content via min-height. */
.mega--services .mega__feature { min-height: 328px; }
.mega--about .mega__feature { min-height: 258px; }

/* ============================================================
   MOBILE NAV  (drawer + accordion) — shown < 1024px
   Slide-in panel from the right with Services/About accordions,
   CTA buttons, and contact details.
   ============================================================ */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  color: var(--gray-900);
  border-radius: var(--radius-sm);
}

/* Drawer container (overlay + panel), hidden by default */
.mobile-nav {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  z-index: 200;
  visibility: hidden;
  pointer-events: none;
}
.mobile-nav.is-open { visibility: visible; pointer-events: auto; }

.mobile-nav__overlay {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  transition: opacity var(--dur) var(--ease);
}
.mobile-nav.is-open .mobile-nav__overlay { opacity: 1; }

.mobile-nav__panel {
  position: absolute;
  top: 0; right: 0;
  height: 100%;
  width: min(380px, 94vw);
  background: var(--white);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
  box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
}
.mobile-nav.is-open .mobile-nav__panel { transform: translateX(0); }

@media (max-width: 360px) {
  .mobile-nav__panel { width: 100%; }
}

/* Top bar inside drawer */
.mobile-nav__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-16) var(--sp-20);
  border-bottom: 1px solid var(--gray-50);
  flex-shrink: 0;
}
.mobile-nav__top .site-logo img { height: 44px; }
.mobile-nav__close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  color: var(--gray-900);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-round);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.mobile-nav__close:hover { color: var(--color-red); border-color: var(--color-red); }
.mobile-nav__close svg { width: 18px; height: 18px; fill: none; stroke-width: 2; }

/* Scrollable nav body */
.mobile-nav__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-8) var(--sp-20) var(--sp-20);
  -webkit-overflow-scrolling: touch;
}

/* ----- Accordion ----- */
.m-acc { display: flex; flex-direction: column; }
.m-acc__item { border-bottom: 1px solid var(--gray-50); }

.m-acc__head,
.m-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: var(--sp-16) 0;
  font-size: 1.0625rem;          /* 17px */
  font-weight: 500;
  line-height: var(--lh-snug);
  color: var(--gray-900);
  text-align: left;
}
.m-link { border-bottom: 1px solid var(--gray-50); }
.m-acc__head:hover, .m-link:hover { color: var(--color-red); }

.m-acc__caret {
  width: 20px; height: 20px;
  flex-shrink: 0;
  transition: transform var(--dur) var(--ease);
}
.m-acc__caret svg { width: 100%; height: 100%; fill: none; stroke-width: 2; }
.m-acc__item.is-open .m-acc__head { color: var(--color-red); }
.m-acc__item.is-open .m-acc__caret { transform: rotate(180deg); }

/* Accordion panel — animated via max-height (set in JS) */
.m-acc__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur) var(--ease);
}
.m-acc__panel-inner {
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  padding-bottom: var(--sp-12);
}

/* Sub-item (icon chip + text), compact version of the mega-item */
.m-sub {
  display: flex;
  align-items: center;
  gap: var(--sp-12);
  padding: var(--sp-8);
  border-radius: var(--radius-sm);
  transition: background-color var(--dur) var(--ease);
}
.m-sub:hover { background: var(--gray-50); }
.m-sub__icon {
  flex-shrink: 0;
  width: 40px; height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-pill);
  color: var(--gray-900);
}
.m-sub__icon svg { width: 18px; height: 18px; fill: none; stroke-width: 1.75; }
.m-sub__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.m-sub__title { font-size: 0.9375rem; font-weight: 500; line-height: 1.4; color: var(--gray-900); }
.m-sub__desc { font-size: 0.8125rem; font-weight: 400; line-height: 1.4; color: var(--gray-300); }

/* ----- Drawer footer (CTAs + contact) ----- */
.mobile-nav__footer {
  flex-shrink: 0;
  padding: var(--sp-16) var(--sp-20) var(--sp-20);
  border-top: 1px solid var(--gray-50);
  display: flex;
  flex-direction: column;
  gap: var(--sp-12);
}
.mobile-nav__footer .btn { width: 100%; justify-content: space-between; }
.mobile-nav__footer .btn--outline { min-width: 0; }

.mobile-contact {
  display: flex;
  flex-direction: column;
  gap: var(--sp-8);
  margin-top: var(--sp-4);
}
.mobile-contact a,
.mobile-contact p {
  display: flex;
  align-items: center;
  gap: var(--sp-8);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--gray-300);
}
.mobile-contact svg { width: 15px; height: 15px; fill: none; stroke-width: 1.75; flex-shrink: 0; color: var(--gray-900); }
.mobile-contact a:hover { color: var(--color-red); }

/* ----- Breakpoint switch ----- */
@media (max-width: 1024px) {
  .main-nav,
  .header-actions { display: none; }
  /* The mega panels are siblings of .main-nav — without this they keep
     their layout box (visibility:hidden only) and force horizontal
     scrolling on mobile. */
  .mega { display: none; }
  .nav-toggle { display: inline-flex; justify-content: flex-end; }
}
