/* ==========================================================================
   TWJ Custom Header
   Lightweight replacement for Divi Theme Builder header
   ========================================================================== */

:root {
  --twj-utility-bg: #484847;
  --twj-nav-bg: #6a6a6a;
  --twj-nav-hover: #484847;
  --twj-nav-active: #b7aa75;
  --twj-dropdown-bg: #3F3F3E;
  --twj-dropdown-active: #AAA06C;
  --twj-cta-bg: #744242;
  --twj-cta-hover: #484847;
  --twj-white: #ffffff;
  --twj-nav-height: 70px;
  --twj-utility-height: 36px;
  --twj-logo-width: 179px;
  --twj-font: 'Lato', 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Utility bar ---------- */
.twj-header-utility {
  background: var(--twj-utility-bg);
  height: var(--twj-utility-height);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 30px;
  font-family: var(--twj-font);
  font-size: 12px;
}

.twj-header-utility-wrap {
  background: var(--twj-utility-bg);
}

/* ---------- Slogan ---------- */
.twj-header-slogan {
  color: var(--twj-white);
  letter-spacing: 0.5px;
  font-style: italic;
  opacity: 0.85;
  margin-left: auto;
}

/* ---------- Utility bar nav ---------- */
.twj-header .twj-utility-nav {
  display: flex !important;
  align-items: center !important;
}

.twj-header .twj-utility-nav ul {
  list-style: none !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
}

.twj-header .twj-utility-nav li {
  display: inline-block !important;
  padding: 0 !important;
  margin: 0 !important;
}

.twj-header-utility a {
  color: var(--twj-white);
  text-decoration: none;
  margin-left: 18px;
  letter-spacing: 0.5px;
  transition: opacity 0.2s;
}

.twj-header-utility a:hover {
  opacity: 0.8;
}

/* ---------- Main nav bar ---------- */
.twj-header-main {
  background: var(--twj-nav-bg);
  height: var(--twj-nav-height);
  position: relative;
  z-index: 9999;
  transition: height 0.3s ease, background 0.3s ease;
  overflow: visible !important;
}

/* ---------- Scrolled / fixed state ---------- */
.twj-header.twj-scrolled .twj-header-main {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Offset for WP admin bar */
.admin-bar .twj-header.twj-scrolled .twj-header-main {
  top: 32px;
}

@media screen and (max-width: 782px) {
  .admin-bar .twj-header.twj-scrolled .twj-header-main {
    top: 46px;
  }
}

.twj-header.twj-scrolled .twj-header-logo img {
  width: 90px;
  top: 4px;
}

/* Desktop only: match scrolled nav bar height */
@media (min-width: 1380px) {
  .twj-header.twj-scrolled .twj-nav > ul {
    height: 56px;
  }
}

.twj-header.twj-scrolled .twj-search-toggle {
  height: 56px;
}

.twj-header-container {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 30px;
}

/* ---------- Logo ---------- */
.twj-header .twj-header-logo,
.twj-header .twj-header-logo:link,
.twj-header .twj-header-logo:visited,
.twj-header .twj-header-logo:hover,
.twj-header .twj-header-logo:active,
.twj-header .twj-header-logo:focus,
.twj-header .twj-header-logo:focus-visible {
  display: block;
  position: relative;
  z-index: 10001;
  flex-shrink: 0;
  padding-top: 26px;
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  text-decoration: none !important;
}

.twj-header .twj-header-logo img {
  width: var(--twj-logo-width);
  height: auto;
  display: block;
  position: relative;
  top: 12px;
  transition: width 0.3s ease, top 0.3s ease;
  outline: none !important;
  border: none !important;
  box-shadow: none !important;
  -webkit-box-shadow: none !important;
}

/* Kill any Divi-injected borders on header links/images */
.twj-header a,
.twj-header a *,
.twj-header img {
  outline: none !important;
  border-color: transparent !important;
}

/* ---------- Desktop nav ---------- */
.twj-nav {
  display: flex;
  align-items: center;
  height: 100%;
  margin-left: auto;
}

.twj-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: stretch;
}

.twj-nav > ul {
  height: var(--twj-nav-height);
}

.twj-nav > ul > li {
  position: relative;
  display: flex;
  align-items: stretch;
}

.twj-nav > ul > li > a {
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--twj-white);
  text-decoration: none;
  text-transform: uppercase;
  font-family: var(--twj-font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 1px;
  transition: background 0.2s;
  white-space: nowrap;
}

.twj-nav > ul > li > a:hover,
.twj-nav > ul > li:hover > a {
  background: var(--twj-nav-hover);
}

.twj-nav > ul > li.current-menu-item > a,
.twj-nav > ul > li.current-menu-ancestor > a {
  color: var(--twj-nav-active);
}

/* ---------- Desktop dropdown indicator ---------- */
.twj-nav > ul > li.menu-item-has-children > a::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1.5px solid var(--twj-white);
  border-bottom: 1.5px solid var(--twj-white);
  transform: rotate(45deg);
  margin-left: 6px;
  margin-bottom: 2px;
  opacity: 0.7;
  transition: transform 0.2s;
}

.twj-nav > ul > li.menu-item-has-children:hover > a::after {
  transform: rotate(-135deg);
  opacity: 1;
}

/* ---------- CTA (GIVE) button ---------- */
.twj-nav > ul > li.twj-cta > a {
  background: var(--twj-cta-bg);
  margin-left: 0;
  padding: 0 22px;
  font-weight: 700;
}

.twj-nav > ul > li.twj-cta > a:hover {
  background: var(--twj-cta-hover);
}

/* ---------- Search icon ---------- */
.twj-search-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: var(--twj-nav-height);
  color: var(--twj-white);
  cursor: pointer;
  background: none;
  border: none;
  font-size: 18px;
  padding: 0;
  transition: background 0.2s;
}

.twj-search-toggle:hover {
  background: var(--twj-nav-hover);
}

.twj-search-toggle svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* ---------- Dropdown menus ---------- */
.twj-header .twj-nav > ul > li > ul,
.twj-header .twj-nav > ul > li > ul.sub-menu {
  position: absolute !important;
  top: 100% !important;
  left: 0 !important;
  background: var(--twj-dropdown-bg) !important;
  min-width: 280px !important;
  flex-direction: column !important;
  display: none !important;
  padding: 0 !important;
  margin: 0 !important;
  z-index: 10000 !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25) !important;
  list-style: none !important;
  border: none !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.twj-header .twj-nav > ul > li:hover > ul,
.twj-header .twj-nav > ul > li:hover > ul.sub-menu {
  display: flex !important;
}

.twj-header .twj-nav > ul > li > ul > li {
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  background: transparent !important;
}

.twj-header .twj-nav > ul > li > ul > li > a {
  display: block !important;
  padding: 12px 20px !important;
  color: var(--twj-white) !important;
  text-decoration: none !important;
  font-family: var(--twj-font) !important;
  font-size: 14px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.5px !important;
  transition: background 0.2s, color 0.2s !important;
  line-height: 1.3 !important;
  background: transparent !important;
}

.twj-header .twj-nav > ul > li > ul > li > a:hover {
  background: rgba(0, 0, 0, 0.15) !important;
}

.twj-header .twj-nav > ul > li > ul > li.current-menu-item > a {
  color: var(--twj-dropdown-active) !important;
}

/* ---------- Hamburger ---------- */
.twj-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 10002;
}

.twj-hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--twj-white);
  transition: transform 0.3s, opacity 0.3s;
  margin: 4px 0;
}

.twj-hamburger[aria-expanded="true"] span:nth-child(1) {
  transform: translateY(10px) rotate(45deg);
}

.twj-hamburger[aria-expanded="true"] span:nth-child(2) {
  opacity: 0;
}

.twj-hamburger[aria-expanded="true"] span:nth-child(3) {
  transform: translateY(-10px) rotate(-45deg);
}

/* ---------- Mobile submenu toggle ---------- */
.twj-submenu-toggle {
  display: none;
}

/* ---------- Search overlay ---------- */
.twj-search-overlay {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--twj-dropdown-bg);
  padding: 12px 16px;
  z-index: 10000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.twj-search-overlay.twj-open {
  display: block;
}

.twj-search-overlay form {
  display: flex;
  align-items: center;
}

.twj-search-overlay input[type="search"] {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--twj-white);
  padding: 8px 12px;
  font-family: var(--twj-font);
  font-size: 14px;
  width: 240px;
  outline: none;
}

.twj-search-overlay input[type="search"]::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* ==========================================================================
   Mobile (< 1380px)
   ========================================================================== */

@media (max-width: 1379px) {
  .twj-header-utility-wrap {
    display: none;
  }

  .twj-header .twj-header-logo {
    padding-top: 6px;
  }

  .twj-header .twj-header-logo img {
    width: 100px;
    top: 5px;
  }

  .twj-header.twj-scrolled .twj-header-logo img {
    width: 80px;
    top: 2px;
  }

  .twj-hamburger {
    display: flex;
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
  }

  .twj-header .twj-header-container {
    overflow: visible !important;
  }

  .twj-header .twj-nav,
  .twj-header nav.twj-nav,
  #twj-primary-nav.twj-nav {
    display: none !important;
    position: fixed !important;
    top: 70px !important;
    left: 0 !important;
    right: 0 !important;
    bottom: auto !important;
    background: var(--twj-nav-bg) !important;
    flex-direction: column !important;
    align-items: stretch !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 80vh !important;
    margin: 0 !important;
    z-index: 99999 !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
  }

  .twj-header .twj-nav.twj-open,
  .twj-header nav.twj-nav.twj-open,
  #twj-primary-nav.twj-nav.twj-open {
    display: flex !important;
  }

  .admin-bar .twj-header .twj-nav,
  .admin-bar #twj-primary-nav.twj-nav {
    top: 102px !important;
  }

  .twj-nav ul {
    flex-direction: column;
    height: auto;
  }

  .twj-nav > ul {
    height: auto;
    padding-bottom: 12px;
  }

  .twj-nav > ul > li {
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }

  .twj-nav > ul > li:last-child {
    border-bottom: none;
  }

  .twj-nav > ul > li > a {
    padding: 14px 24px;
    height: auto;
  }

  /* Hide desktop chevron on mobile — the +/− button is used instead */
  .twj-nav > ul > li.menu-item-has-children > a::after {
    display: none;
  }

  .twj-nav > ul > li.twj-cta > a {
    margin-left: 0;
    padding: 14px 24px;
  }

  /* Parent items with submenus: flex row for link + toggle */
  .twj-nav > ul > li.menu-item-has-children {
    position: relative;
  }

  .twj-nav > ul > li.menu-item-has-children > a {
    padding-right: 56px;
  }

  /* Submenu toggle button */
  .twj-submenu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    right: 0;
    top: 0;
    width: 50px;
    height: 48px;
    background: none;
    border: none;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--twj-white);
    font-size: 20px;
    cursor: pointer;
    font-family: var(--twj-font);
    transition: background 0.2s;
  }

  .twj-submenu-toggle:hover {
    background: rgba(0, 0, 0, 0.15);
  }

  /* Mobile dropdown */
  .twj-header .twj-nav > ul > li > ul,
  .twj-header .twj-nav > ul > li > ul.sub-menu {
    position: static !important;
    display: none !important;
    background: var(--twj-dropdown-bg) !important;
    box-shadow: none !important;
    min-width: 100% !important;
  }

  .twj-header .twj-nav > ul > li > ul.twj-open,
  .twj-header .twj-nav > ul > li > ul.sub-menu.twj-open {
    display: flex !important;
  }

  .twj-header .twj-nav > ul > li > ul > li > a {
    padding-left: 40px !important;
  }

  /* Override desktop hover on mobile */
  .twj-header .twj-nav > ul > li:hover > ul,
  .twj-header .twj-nav > ul > li:hover > ul.sub-menu {
    display: none !important;
  }

  .twj-header .twj-nav > ul > li > ul.twj-open,
  .twj-header .twj-nav > ul > li > ul.sub-menu.twj-open {
    display: flex !important;
  }

  .twj-search-toggle {
    position: absolute;
    right: 58px;
    top: 50%;
    transform: translateY(-50%);
    height: 44px;
    width: 44px;
  }
	.nav-cta a {
    margin-left: 0px !important;
}
}
