/* ============================================================
   AF NAV — mega menu + mobile drawer + page loader
   Namespaced af-* so it doesn't fight legacy style6.css.
   Loaded by functions.php af_nav_enqueue() at priority 20.
============================================================ */

:root {
  --af-brand-dark:  #281d17;  /* dark brown */
  --af-brand-mid:   #54585b;
  --af-cream:       #e8e3d7;
  --af-cream-soft:  #f1eee7;
  --af-sage:        #b9c48a;
  --af-sage-dk:     #97a36a;
  --af-olive:       #a29061;
  --af-rust:        #c03130;  /* logo red — used for hover + mega titles */
  --af-text:        #281d17;
  --af-text-soft:   #5e5651;
  --af-white:       #ffffff;
  --af-nav-bg:      #e9f2bf;
  --af-nav-height:  140px;
  --af-nav-stuck-h: 92px;
  --af-nav-font:    'Bebas Neue', 'Oswald', sans-serif;
}

/* ── Hide legacy nav so new one can take over.
   The old header markup still renders inside #site-header-wrap → #header.
   We disable it on the new nav build and use the new <header id="af-nav"> instead. */
body[data-template] #site-header-wrap { display: none !important; }

/* ── Override legacy content-wrapper padding-top.
   html-header.twig still injects `.wh-page-content-wrapper { padding-top: 124px }`
   (and 80px on mobile) which was the offset for the OLD fixed header. We own the
   offset now via body padding-top below, so neutralize the legacy rule. */
body[data-template] .wh-page-content-wrapper { padding-top: 0 !important; }

/* Account for the fixed nav so page content doesn't sit under it.
   One element (body) owns the offset, calc math stays reliable. */
body[data-template] { padding-top: var(--af-nav-height); }
.admin-bar[data-template] { padding-top: calc(var(--af-nav-height) + 32px); }
@media (max-width: 782px) {
  .admin-bar[data-template] { padding-top: calc(var(--af-nav-height) + 46px); }
}

/* ============================================================
   DESKTOP NAV (default)
============================================================ */
.af-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--af-nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 40px;
  background-color: var(--af-nav-bg);
  background-image: url('../img/header-back2.jpg');
  background-position: center top;
  background-repeat: no-repeat;
  background-size: cover;
  border-bottom: 1px solid rgba(40, 29, 23, 0.1);
  box-shadow: 0 1px 4px rgba(40, 29, 23, 0.06);
  font-family: var(--af-nav-font);
  transition: height 0.25s ease, box-shadow 0.25s ease;
}
.admin-bar .af-nav { top: 32px; }
@media (max-width: 782px) { .admin-bar .af-nav { top: 46px; } }

/* Scrolled state */
.af-nav.af-nav-stuck {
  height: var(--af-nav-stuck-h);
  box-shadow: 0 2px 12px rgba(40, 29, 23, 0.18);
}

.af-nav-logo {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  text-decoration: none;
  padding-left: 4px;
}
.af-nav-logo img {
  max-width: 420px;
  width: 100%;
  height: auto;
  display: block;
  transition: max-width 0.25s ease;
}
.af-nav.af-nav-stuck .af-nav-logo img { max-width: 260px; }

/* ── Top-level links ── */
.af-nav-links {
  display: flex;
  align-items: stretch;
  height: 100%;
  gap: 4px;
  flex: 1 1 auto;
  justify-content: flex-end;
}

/* Full-height items keep hover continuous as mouse drops toward dropdown
   (no dead zone between link bottom and dropdown top) */
.af-nav-item {
  position: relative;
  display: flex;
  align-items: center;
  height: 100%;
}

.af-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  font-family: var(--af-nav-font);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #5b623f;
  text-decoration: none;
  border-radius: 3px;
  transition: color 0.18s ease, background 0.18s ease;
  line-height: 1;
}
.af-nav-link:hover,
.af-nav-link:focus-visible,
.af-nav-item:hover > .af-nav-link {
  color: var(--af-rust);
  background: rgba(192, 49, 48, 0.07);
}
.af-nav-arrow {
  font-size: 10px;
  transition: transform 0.2s ease;
  opacity: 0.7;
}
.af-nav-item:hover > .af-nav-link .af-nav-arrow { transform: rotate(180deg); }

/* ── Standard dropdown ──
   Sits flush against bottom of nav (top: 100%, no translateY gap) so the
   hover bridge between link and dropdown is continuous. */
.af-nav-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 240px;
  background: #fffcee;
  border: 1px solid rgba(40, 29, 23, 0.08);
  border-radius: 0 0 6px 6px;
  box-shadow: 0 10px 30px rgba(40, 29, 23, 0.14);
  padding: 8px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}
.af-nav-item:hover > .af-nav-dropdown,
.af-nav-item:focus-within > .af-nav-dropdown {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.af-nav-dropdown-link {
  display: block;
  padding: 11px 20px;
  font-family: var(--af-nav-font);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.03em;
  color: var(--af-text);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.af-nav-dropdown-link:hover {
  background: rgba(192, 49, 48, 0.07);
  color: var(--af-rust);
  transform: translateX(2px);
}

/* ── MEGA MENU (cannabis) ──
   Positioned FIXED (anchored to viewport, not menu item) so it cannot overflow
   the right edge regardless of where CANNABIS & HASH sits in the menu order. */
.af-nav-dropdown.af-nav-mega {
  position: fixed;
  top: var(--af-nav-height);
  right: 24px;
  left: auto;
  width: min(820px, calc(100vw - 48px));
  padding: 22px 26px;
  background: #fffcee;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.admin-bar .af-nav-dropdown.af-nav-mega { top: calc(var(--af-nav-height) + 32px); }
@media (max-width: 782px) {
  .admin-bar .af-nav-dropdown.af-nav-mega { top: calc(var(--af-nav-height) + 46px); }
}
/* When nav is stuck, mega dropdown follows the shorter nav height */
.af-nav.af-nav-stuck ~ .af-nav-dropdown.af-nav-mega,
.af-nav-stuck .af-nav-dropdown.af-nav-mega { top: var(--af-nav-stuck-h); }

/* Banner-style "All Cannabis & Hash" link spanning top of the mega menu */
.af-nav-mega-all {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  margin-bottom: 6px;
  background: rgba(192, 49, 48, 0.07);
  border-bottom: 1px solid rgba(40, 29, 23, 0.12);
  border-radius: 4px 4px 0 0;
  font-family: var(--af-nav-font);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--af-rust);
  text-decoration: none;
  transition: background 0.18s ease, color 0.18s ease;
}
.af-nav-mega-all:hover {
  background: rgba(192, 49, 48, 0.13);
  color: var(--af-rust);
}
.af-nav-mega-all i {
  font-size: 16px;
  transition: transform 0.2s ease;
}
.af-nav-mega-all:hover i { transform: translateX(4px); }

.af-nav-mega-col {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}
.af-nav-mega-title {
  display: block;
  padding: 0 0 9px 0;
  margin-bottom: 6px;
  font-family: var(--af-nav-font);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--af-rust);
  border-bottom: 1px solid rgba(40, 29, 23, 0.1);
}
.af-nav-mega-link {
  display: block;
  padding: 3px 0 0 0;  /* top -2 → ~10px visual, bottom -5 → ~10px visual (Bebas Neue line-box compensates) */
  font-family: var(--af-nav-font);
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--af-text);
  text-decoration: none;
  border-bottom: 1px solid rgba(40, 29, 23, 0.08);
  transition: color 0.15s ease, transform 0.15s ease;
}
.af-nav-mega-link:last-child { border-bottom: 0; }
.af-nav-mega-link:hover {
  color: var(--af-rust);
  transform: translateX(2px);
}

/* ── Hamburger (hidden on desktop) ── */
.af-nav-hamburger {
  display: none;
  width: 44px;
  height: 44px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 0;
}
.af-nav-hamburger span {
  display: block;
  width: 26px;
  height: 2px;
  background: var(--af-text);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* ============================================================
   MOBILE NAV
============================================================ */
.af-mob-overlay {
  position: fixed;
  inset: 0;
  background: rgba(40, 29, 23, 0.55);
  opacity: 0;
  visibility: hidden;
  z-index: 1100;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.af-mob-overlay.af-mob-overlay-active {
  opacity: 1;
  visibility: visible;
}

.af-mob-nav {
  position: fixed;
  top: 0;
  right: -340px;
  width: 320px;
  max-width: 88vw;
  height: 100vh;
  height: 100lvh;
  background: var(--af-cream);
  z-index: 1101;
  transition: right 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 20px rgba(40, 29, 23, 0.18);
  font-family: var(--af-nav-font);
}
.af-mob-nav.af-mob-nav-open { right: 0; }

.af-mob-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(40, 29, 23, 0.1);
  flex: 0 0 auto;
}
.af-mob-logo img {
  max-height: 44px;
  width: auto;
  display: block;
}
.af-mob-close {
  width: 40px;
  height: 40px;
  background: transparent;
  border: 0;
  color: var(--af-text);
  font-size: 20px;
  cursor: pointer;
}
.af-mob-close:hover { color: var(--af-rust); }

.af-mob-links {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 8px 0 32px 0;
}

.af-mob-item { border-bottom: 1px solid rgba(40, 29, 23, 0.06); }

.af-mob-link,
.af-mob-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 11px 18px;
  font-size: 17px;
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--af-text);
  background: transparent;
  border: 0;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}
.af-mob-link:hover,
.af-mob-toggle:hover { color: var(--af-rust); }

.af-mob-chev {
  font-size: 12px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}
.af-mob-toggle[aria-expanded="true"] .af-mob-chev { transform: rotate(180deg); }

.af-mob-submenu {
  display: none;
  padding: 2px 0 8px 0;
  background: rgba(40, 29, 23, 0.025);
}
.af-mob-item-open .af-mob-submenu { display: block; }

.af-mob-sub-heading {
  display: block;
  padding: 10px 18px 3px 18px;
  font-family: var(--af-nav-font);
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--af-rust);
}
.af-mob-sub-heading:first-child { padding-top: 6px; }

.af-mob-sub-link {
  display: block;
  padding: 6px 18px 6px 25px;  /* 7px deeper left to indent under category */
  font-family: var(--af-nav-font);
  font-size: 16px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--af-text);
  text-decoration: none;
}
.af-mob-sub-link:hover,
.af-mob-sub-link:focus-visible {
  color: var(--af-rust);
  background: rgba(192, 49, 48, 0.07);
}
/* "All <parent>" link sits flush left at base indent (no extra indent) */
.af-mob-sub-all {
  padding-left: 18px;
  font-weight: 400;
  color: var(--af-rust);
  border-bottom: 1px dotted rgba(40, 29, 23, 0.15);
  margin-bottom: 4px;
}

/* ============================================================
   BREAKPOINTS
============================================================ */
@media (max-width: 1199px) {
  :root { --af-nav-height: 120px; }
  .af-nav-logo img { max-width: 340px; }
  .af-nav-link { font-size: 18px; padding: 10px 14px; }
}
@media (max-width: 991px) {
  .af-nav-links { display: none; }
  .af-nav-hamburger { display: inline-flex; }
  :root { --af-nav-height: 100px; }
  .af-nav { padding: 0 24px; }
  .af-nav-logo img { max-width: 300px; }
}
@media (max-width: 600px) {
  .af-nav { padding: 0 16px; }
  :root { --af-nav-height: 80px; }
  .af-nav-logo img { max-width: 230px; }
}

/* ============================================================
   PAGE LOADER (entry) + CLICK LOADER (exit)
============================================================ */
html { background-color: var(--af-brand-dark); }
html.af-pg-loaded { background-color: var(--af-white); }

#af-page-loader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 99999;
  background: var(--af-brand-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  transition: opacity 2s ease, visibility 2s ease;
}
#af-page-loader.af-loader-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.af-loader-logo {
  width: 320px;
  max-width: 70vw;
  height: auto;
  padding: 14px 22px;
  background: #fffcee;
  border-radius: 8px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
  opacity: 0;
  transform: translateY(10px);
  animation: af-fadeUp 0.7s 0.2s forwards ease-out;
}
@keyframes af-fadeUp { to { opacity: 1; transform: translateY(0); } }

.af-loader-bar {
  width: 180px;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  opacity: 0;
  animation: af-fadeUp 0.4s 0.5s forwards ease-out;
}
.af-loader-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--af-sage), var(--af-olive));
  animation: af-barFill 1.5s 0.6s forwards ease;
}
@keyframes af-barFill {
  0% { width: 0%; }
  65% { width: 72%; }
  100% { width: 100%; }
}
.af-loader-tag {
  font-family: 'Urbanist', 'Lato', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  opacity: 0;
  animation: af-fadeUp 0.4s 0.9s forwards ease-out;
}

#af-click-loader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100lvh;
  z-index: 99998;
  background: var(--af-brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}
#af-click-loader.af-click-loader-active {
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.af-cl-dots { display: flex; gap: 10px; }
.af-cl-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--af-sage);
  animation: af-dotPulse 1.1s infinite ease-in-out;
}
.af-cl-dots span:nth-child(2) {
  animation-delay: 0.18s;
  background: var(--af-olive);
}
.af-cl-dots span:nth-child(3) {
  animation-delay: 0.36s;
  background: rgba(255, 255, 255, 0.3);
}
@keyframes af-dotPulse {
  0%, 80%, 100% { transform: scale(0.55); opacity: 0.3; }
  40% { transform: scale(1.1); opacity: 1; }
}
