:root{
  --ugh-green:#0e7d43;
  --ugh-green-dark:#0a5c31;
  --ugh-text:#1c1c1c;
  --ugh-border:#e5e7eb;
  --ugh-search-bg:#f2f2f2;
  --ugh-max-width:1400px;
  --ugh-font:'Segoe UI', system-ui, -apple-system, Arial, sans-serif;
  --ugh-logo-height:70px;
  --ugh-logo-max-width:300px;
  --ugh-logo-height-mobile:48px;
  --ugh-logo-height-drawer:40px;
  --ugh-logo-justify-desktop:start;
  --ugh-logo-justify-tablet:start;
  --ugh-logo-justify-mobile:center;
  --ugh-logo-offset-x:0px;
  --ugh-logo-offset-y:0px;
  --ugh-logo-padding:0px;
  --ugh-logo-margin:0px;
  --ugh-header-bg:#fff;
  --ugh-nav-bg-desktop:#fff;
  --ugh-nav-bg-tablet:#fff;
  --ugh-nav-bg-mobile:#fff;
  --ugh-dropdown-bg-desktop:#fff;
  --ugh-dropdown-bg-tablet:#fafafa;
  --ugh-dropdown-bg-mobile:#fafafa;
  --ugh-menu-font-weight:600;
}

/* ===== BASE RESET (scoped to plugin elements) ===== */
.ugh-header, .ugh-header *,
.ugh-drawer, .ugh-drawer *{ box-sizing:border-box; }

.ugh-header{
  font-family:var(--ugh-font);
  background:var(--ugh-header-bg, #fff);
  color:var(--ugh-text);
  position:sticky;
  top:0;
  z-index:999;
  width:100%;
  /* Prevents any theme JS from inadvertently causing layout shifts by
     locking the element in the stacking context. */
  will-change:transform;
}
.ugh-header a{ color:inherit; text-decoration:none; }
.ugh-header button{ font-family:inherit; }

/* ================= TICKER ================= */
.ugh-ticker{
  width:100%;
  background:var(--ugh-green);
  color:#fff;
  overflow:hidden;
  height:38px;
  display:flex;
  align-items:center;
  font-size:13px;
  font-weight:500;
}
.ugh-ticker__track{
  display:flex;
  align-items:center;
  white-space:nowrap;
  animation:ugh-scroll 22s linear infinite;
  gap:60px;
  padding-left:60px;
}
.ugh-ticker__track span{ display:inline-block; }
@keyframes ugh-scroll{
  0%{ transform:translateX(0); }
  100%{ transform:translateX(-50%); }
}
@media(prefers-reduced-motion: reduce){
  .ugh-ticker__track{ animation:none; }
}

/* ================= MAIN ROW ================= */
.ugh-main{
  max-width:var(--ugh-max-width);
  margin:0 auto;
  padding:18px 32px;
  display:grid;
  grid-template-columns:1fr minmax(240px, 640px) 1fr;
  align-items:center;
  gap:28px;
}

/* ===== LOGO =====
 * FIX (mobile visibility): Using the full ancestor chain
 * `.ugh-header .ugh-logo img` instead of just `.ugh-logo img` gives us
 * specificity 0,2,1 vs 0,1,1. Among competing !important declarations,
 * CSS picks the one with HIGHER specificity — so our rules now win even
 * when a theme stylesheet writes `header img { height:auto !important; }`.
 *
 * flex-shrink:0 on the img prevents flex-layout from collapsing the image
 * when sibling elements compete for space on narrow screens.
 */
.ugh-logo{
  display:flex;
  align-items:center;
  gap:6px;
  color:var(--ugh-green);
  flex-shrink:0;
  overflow:visible;
  justify-self:var(--ugh-logo-justify-desktop);
  grid-column:1;
  transform:translate(var(--ugh-logo-offset-x), var(--ugh-logo-offset-y));
  padding:var(--ugh-logo-padding);
  margin:var(--ugh-logo-margin);
}
/* Desktop — high-specificity selector defeats theme overrides */
.ugh-header .ugh-logo img{
  height:var(--ugh-logo-height, 70px) !important;
  width:var(--ugh-logo-width-desktop, auto) !important;
  max-width:var(--ugh-logo-max-width, 300px) !important;
  object-fit:contain !important;
  display:block !important;
  flex-shrink:0 !important;
  will-change:auto;
}
.ugh-logo svg{ width:30px; height:30px; }
.ugh-logo span{ font-size:26px; font-weight:700; line-height:1; }

/* ================= SEARCH ================= */
.ugh-search{ max-width:640px; width:100%; justify-self:center; grid-column:2; }
.ugh-search form{ position:relative; display:flex; width:100%; align-items:center; }
.ugh-search input[type="search"]{
  width:100%;
  background:var(--ugh-search-bg);
  border:2px solid transparent;
  border-radius:12px;
  padding:12px 16px 12px 44px;
  font-size:14px;
  outline:none;
  transition:all .25s ease;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  font-family:var(--ugh-font);
}
.ugh-search input[type="search"]:focus{
  background:#fff;
  border-color:var(--ugh-green);
  box-shadow:0 4px 16px rgba(14,125,67,.15);
}
.ugh-search input[type="search"]:hover:not(:focus){
  box-shadow:0 3px 12px rgba(0,0,0,.12);
}
.ugh-search input::placeholder{ color:#999; font-weight:500; }
.ugh-search svg{
  position:absolute;
  left:14px;
  top:50%;
  transform:translateY(-50%);
  width:18px;
  height:18px;
  color:#999;
  pointer-events:none;
  transition:color .2s ease;
}
.ugh-search input[type="search"]:focus ~ svg,
.ugh-search input[type="search"]:focus + svg{ color:var(--ugh-green); }

/* Search button — sits inside the search field, flush to the right */
.ugh-search--has-btn input[type="search"]{ padding-right:100px; }
.ugh-search-btn{
  position:absolute;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  display:flex;
  align-items:center;
  justify-content:center;
  gap:6px;
  background:linear-gradient(135deg, var(--ugh-green) 0%, #0a5c31 100%);
  color:#fff;
  border:none;
  border-radius:8px;
  padding:8px 16px;
  font-size:13px;
  font-weight:600;
  cursor:pointer;
  transition:all .25s ease;
  box-shadow:0 2px 6px rgba(14,125,67,.2);
  white-space:nowrap;
}
.ugh-search-btn:hover{
  background:linear-gradient(135deg, #0a5c31 0%, var(--ugh-green) 100%);
  box-shadow:0 4px 12px rgba(14,125,67,.3);
  transform:translateY(calc(-50% - 1px));
}
.ugh-search-btn:active{
  transform:translateY(-50%);
  box-shadow:0 2px 4px rgba(14,125,67,.2);
}
.ugh-search-btn svg{
  width:15px;
  height:15px;
  color:#fff;
  flex-shrink:0;
  pointer-events:none;
}
.ugh-search-btn span{ white-space:nowrap; }

/* ================= ACTION ICONS ================= */
.ugh-actions{ display:flex; align-items:center; gap:22px; flex-shrink:0; justify-self:end; grid-column:3; }
.ugh-icon-link{ position:relative; display:flex; align-items:center; color:var(--ugh-text); }
.ugh-icon-link svg{ width:24px; height:24px; transition:color .2s ease; }
.ugh-icon-link:hover svg{ color:var(--ugh-green); }
.ugh-icon-link:focus-visible{ outline:2px solid var(--ugh-green); outline-offset:3px; border-radius:4px; }

.ugh-cart-count{
  position:absolute;
  top:-7px;
  right:-9px;
  background:var(--ugh-green);
  color:#fff;
  font-size:10px;
  font-weight:700;
  min-width:16px;
  height:16px;
  border-radius:50%;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:0 3px;
  line-height:1;
  transition:transform .2s ease;
}

/* ================= BURGER (mobile only) ================= */
.ugh-burger{
  display:none;
  background:none;
  border:none;
  cursor:pointer;
  padding:4px;
  order:-1;
  -webkit-tap-highlight-color:transparent;
}
.ugh-burger svg{ width:26px; height:26px; color:var(--ugh-text); }
.ugh-burger:focus{ outline:none; }
.ugh-burger:focus-visible{ outline:2px solid var(--ugh-green); outline-offset:2px; border-radius:4px; }

/* ================= NAV ROW (desktop dropdowns) ================= */
.ugh-nav{
  max-width:var(--ugh-max-width);
  margin:0 auto;
  padding:0 32px 16px;
  border-bottom:1px solid var(--ugh-border);
  background:var(--ugh-nav-bg-desktop);
}
.ugh-menu{
  display:flex;
  justify-content:center;
  gap:8px;
  flex-wrap:wrap;
  list-style:none;
  margin:0;
  padding:0;
}
.ugh-menu-item{ position:relative; }
.ugh-menu-link{
  display:flex;
  align-items:center;
  gap:5px;
  font-size:var(--ugh-menu-font-size, 13.5px);
  font-weight:var(--ugh-menu-font-weight, 600);
  letter-spacing:.02em;
  color:var(--ugh-menu-text, var(--ugh-text));
  padding:6px 12px 8px;
  border-bottom:2px solid transparent;
  transition:color .25s ease, border-color .25s ease;
}
.ugh-menu-link:hover{
  color:var(--ugh-menu-hover-text, var(--ugh-green));
  border-bottom-color:var(--ugh-menu-hover-text, var(--ugh-green));
}
/* Active state: matches items where WP adds current-menu-item / current-menu-ancestor
   on the <li>. The walker now also adds it to the <a> so these selectors fire. */
.ugh-menu-link.current-menu-item,
.ugh-menu-link.current-menu-parent,
.ugh-menu-link.current-menu-ancestor,
.ugh-menu-link.current_page_item,
.ugh-menu-link.current_page_parent{
  color:var(--ugh-menu-active-text, var(--ugh-green));
  border-bottom-color:var(--ugh-menu-active-text, var(--ugh-green));
}
.ugh-chevron{ transition:transform .25s ease; color:var(--ugh-menu-icon, inherit); }
.ugh-menu-item.has-children:hover .ugh-chevron{
  transform:rotate(180deg);
  color:var(--ugh-menu-hover-icon, var(--ugh-menu-hover-text, var(--ugh-green)));
}
.ugh-menu-item.has-children.current-menu-item .ugh-chevron,
.ugh-menu-item.has-children.current-menu-ancestor .ugh-chevron{
  color:var(--ugh-menu-active-icon, var(--ugh-menu-active-text, var(--ugh-green)));
}

/* ===== Dropdown / mega panel ===== */
.ugh-dropdown{
  display:none;
  position:absolute;
  top:100%;
  left:50%;
  transform:translateX(-50%);
  background:var(--ugh-dropdown-bg-desktop, #fff);
  border:1px solid var(--ugh-border);
  border-radius:10px;
  box-shadow:0 12px 32px rgba(0,0,0,.12);
  padding:18px 22px;
  margin-top:6px;
  min-width:220px;
  z-index:50;
}
/* Invisible bridge fills the gap between the link and the panel so
   moving the mouse into the dropdown doesn't momentarily leave the
   hoverable area — this fixed intermittently unclickable submenu items. */
.ugh-dropdown::before{
  content:"";
  position:absolute;
  left:0;
  right:0;
  top:-6px;
  height:6px;
  background:transparent;
}
/* Scoped to the DIRECT child dropdown only so hovering a parent item
   opens just its own panel — not every nested panel at once. */
.ugh-menu-item.has-children:hover > .ugh-dropdown,
.ugh-menu-item.has-children:focus-within > .ugh-dropdown{ display:block; }

.ugh-dropdown-list{
  list-style:none;
  margin:0;
  padding:0;
  column-width:170px;
  column-gap:28px;
}
.ugh-dropdown-list li{ break-inside:avoid; position:relative; }
.ugh-dropdown-link{
  display:block;
  padding:7px 0;
  font-size:13.5px;
  font-weight:500;
  color:var(--ugh-menu-text, var(--ugh-text));
  white-space:nowrap;
  border-bottom:1px solid transparent;
  transition:color .25s ease;
}
.ugh-dropdown-link:hover{ color:var(--ugh-menu-hover-text, var(--ugh-green)); }
.ugh-dropdown-link.current-menu-item,
.ugh-dropdown-link.current_page_item{
  color:var(--ugh-menu-active-text, var(--ugh-green));
  font-weight:600;
}

/* Nested submenu (depth 2+): flies out to the side */
.ugh-dropdown--nested{
  top:-19px;
  left:100%;
  right:auto;
  transform:none;
  margin-top:0;
  margin-left:6px;
  column-width:auto;
}
.ugh-dropdown--nested::before{
  left:-6px;
  right:auto;
  top:0;
  bottom:0;
  width:6px;
  height:auto;
}
.ugh-dropdown-list .ugh-dropdown-list{ column-width:auto; column-gap:0; }

/* Items with children inside a panel: chevron sits right, indicating flyout */
.ugh-menu-item.has-children > .ugh-dropdown-link{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.ugh-menu-item.has-children > .ugh-dropdown-link .ugh-chevron{
  transform:rotate(-90deg);
  flex-shrink:0;
}
.ugh-menu-item.has-children:hover > .ugh-dropdown-link .ugh-chevron{
  transform:rotate(0deg);
}

/* ================= OVERLAY + DRAWER (mobile) ================= */
.ugh-overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.45);
  z-index:1000;
  opacity:0;
  transition:opacity .25s ease;
}
.ugh-overlay.ugh-open{ display:block; opacity:1; }

.ugh-drawer{
  position:fixed;
  top:0;
  left:0;
  height:100%;
  width:86%;
  max-width:360px;
  background:#fff;
  z-index:1001;
  transform:translateX(-100%);
  transition:transform .3s ease;
  display:flex;
  flex-direction:column;
  font-family:var(--ugh-font);
  color:var(--ugh-text);
  /* Promote to its own GPU layer so the slide animation is smooth */
  will-change:transform;
}
.ugh-drawer.ugh-open{ transform:translateX(0); }

.ugh-drawer__head{
  position:relative;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:16px 44px;
  border-bottom:1px solid var(--ugh-border);
  flex-shrink:0;
  min-height:56px;
}
.ugh-drawer__logo{
  display:flex;
  align-items:center;
  justify-content:center;
  color:var(--ugh-green);
  max-width:100%;
}
.ugh-drawer__logo img{
  height:var(--ugh-logo-height-drawer);
  width:var(--ugh-logo-width-drawer, auto);
  max-width:100%;
  object-fit:contain;
}
.ugh-drawer__logo span{ font-size:17px; font-weight:700; line-height:1; }
.ugh-drawer__title{ display:none; }
.ugh-drawer__close{
  position:absolute;
  top:50%;
  right:16px;
  transform:translateY(-50%);
  background:none;
  border:none;
  cursor:pointer;
  padding:4px;
  -webkit-tap-highlight-color:transparent;
}
.ugh-drawer__close svg{ width:22px; height:22px; color:var(--ugh-text); }
.ugh-drawer__close:focus{ outline:none; }
.ugh-drawer__close:focus-visible{ outline:2px solid var(--ugh-green); outline-offset:2px; border-radius:4px; }

.ugh-drawer__search{
  padding:14px 20px;
  border-bottom:1px solid var(--ugh-border);
  flex-shrink:0;
}
.ugh-drawer__search form{ position:relative; display:flex; width:100%; align-items:center; }
.ugh-drawer__search input[type="search"]{
  width:100%;
  background:var(--ugh-search-bg);
  border:2px solid transparent;
  border-radius:10px;
  padding:11px 14px 11px 40px;
  font-size:14px;
  outline:none;
  transition:all .25s ease;
  box-shadow:0 2px 8px rgba(0,0,0,.08);
  font-family:var(--ugh-font);
}
.ugh-drawer__search input[type="search"]:focus{
  background:#fff;
  border-color:var(--ugh-green);
  box-shadow:0 3px 12px rgba(14,125,67,.15);
}
.ugh-drawer__search svg{
  position:absolute;
  left:13px;
  top:50%;
  transform:translateY(-50%);
  width:16px;
  height:16px;
  color:#999;
  pointer-events:none;
  transition:color .2s ease;
}
.ugh-drawer__search input[type="search"]:focus ~ svg,
.ugh-drawer__search input[type="search"]:focus + svg{ color:var(--ugh-green); }

/* Compact icon-only search button inside the narrower drawer */
.ugh-drawer__search.ugh-search--has-btn input[type="search"]{ padding-right:48px; }
.ugh-drawer__search .ugh-search-btn{
  padding:7px 10px;
  right:6px;
  top:50%;
  transform:translateY(-50%);
  background:var(--ugh-green);
  box-shadow:0 2px 6px rgba(14,125,67,.2);
}
.ugh-drawer__search .ugh-search-btn:hover{
  background:var(--ugh-green-dark);
  box-shadow:0 3px 10px rgba(14,125,67,.25);
  transform:translateY(-50%);
}
.ugh-drawer__search .ugh-search-btn span{ display:none; }

.ugh-drawer__menu{
  list-style:none;
  margin:0;
  padding:6px 0;
  overflow-y:auto;
  flex:1 1 auto;
  /* Smooth momentum scrolling on iOS */
  -webkit-overflow-scrolling:touch;
  overscroll-behavior:contain;
}
.ugh-drawer__menu .ugh-menu-item{ border-bottom:1px solid var(--ugh-border); }
.ugh-drawer__menu .ugh-menu-link{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:14px 20px;
  font-size:var(--ugh-menu-font-size, 14.5px);
  font-weight:var(--ugh-menu-font-weight, 600);
  border-bottom:none;
  gap:8px;
  color:var(--ugh-menu-text, var(--ugh-text));
  transition:color .25s ease;
}
.ugh-drawer__menu .ugh-menu-link:hover{ color:var(--ugh-menu-hover-text, var(--ugh-green)); }
.ugh-drawer__menu .ugh-menu-link.current-menu-item,
.ugh-drawer__menu .ugh-menu-link.current-menu-parent,
.ugh-drawer__menu .ugh-menu-link.current-menu-ancestor,
.ugh-drawer__menu .ugh-menu-link.current_page_item,
.ugh-drawer__menu .ugh-menu-link.current_page_parent{
  color:var(--ugh-menu-active-text, var(--ugh-green));
}
.ugh-drawer__menu .ugh-chevron{
  transform:rotate(0deg);
  flex-shrink:0;
  color:var(--ugh-menu-icon, inherit);
  transition:transform .25s ease, color .25s ease;
}
.ugh-drawer__menu .ugh-menu-item.ugh-accordion-open > .ugh-menu-link .ugh-chevron{
  transform:rotate(180deg);
  color:var(--ugh-menu-active-icon, var(--ugh-menu-active-text, var(--ugh-green)));
}

.ugh-drawer__menu .ugh-dropdown,
.ugh-drawer__menu .ugh-dropdown--nested{
  display:none;
  position:static;
  left:auto;
  top:auto;
  transform:none;
  border:none;
  box-shadow:none;
  border-radius:0;
  margin:0;
  padding:0 20px 10px 32px;
  background:#fafafa;
}
.ugh-drawer__menu .ugh-menu-item.ugh-accordion-open > .ugh-dropdown{ display:block; }
.ugh-drawer__menu .ugh-dropdown-list{ column-width:auto; column-gap:0; }
.ugh-drawer__menu .ugh-dropdown-link{ padding:9px 0; white-space:normal; }

/* In the mobile accordion, nested chevrons behave like the top-level one
   (pointing down, flipping to open) rather than the desktop flyout's
   sideways-pointing arrow. */
.ugh-drawer__menu .ugh-menu-item.has-children > .ugh-dropdown-link .ugh-chevron{ transform:rotate(0deg); }
.ugh-drawer__menu .ugh-menu-item.ugh-accordion-open > .ugh-dropdown-link .ugh-chevron{ transform:rotate(180deg); }

.ugh-drawer__foot{
  display:flex;
  flex-direction:column;
  gap:2px;
  padding:10px 20px 20px;
  border-top:1px solid var(--ugh-border);
  flex-shrink:0;
}
.ugh-drawer__foot a{
  display:flex;
  align-items:center;
  gap:10px;
  padding:12px 0;
  font-size:14px;
  font-weight:600;
}
.ugh-drawer__foot svg{ width:20px; height:20px; flex-shrink:0; }

/* ================= RESPONSIVE ================= */
@media(max-width:900px){
  .ugh-main{
    grid-template-columns:1fr auto 1fr;
    grid-template-areas:
      "burger logo actions"
      "search search search";
    row-gap:14px;
    column-gap:14px;
    padding:14px 20px;
  }
  .ugh-burger{ display:inline-flex; grid-area:burger; justify-self:start; }
  .ugh-logo{
    grid-area:logo;
    justify-self:var(--ugh-logo-justify-tablet);
  }
  /* High-specificity selector so theme stylesheets cannot override via
     `header img { height:auto !important; }` — see logo section above. */
  .ugh-header .ugh-logo img{
    height:var(--ugh-logo-height-mobile, 48px) !important;
    width:var(--ugh-logo-width-tablet, auto) !important;
    max-width:var(--ugh-logo-max-width, 300px) !important;
  }
  .ugh-actions{ grid-area:actions; justify-self:end; }
  .ugh-search{ grid-area:search; max-width:100%; }
  .ugh-hide-mobile{ display:none; }

  /* Desktop nav row is fully replaced by the drawer on mobile */
  .ugh-nav{ display:none; }

  /* FIX: Removed duplicate rule block that was previously copy-pasted
     verbatim twice in this media query (search button sizing). */
  .ugh-search-btn span{ display:none; }
  .ugh-search--has-btn input[type="search"]{ padding-right:46px; }
  .ugh-search-btn{ padding:8px 10px; }
}

/* Tablet-only drawer colors (601px–900px) */
@media(min-width:601px) and (max-width:900px){
  .ugh-drawer__menu{ background:var(--ugh-nav-bg-tablet); }
  .ugh-drawer__menu .ugh-dropdown{ background:var(--ugh-dropdown-bg-tablet, #fafafa); }
}

@media(max-width:600px){
  .ugh-main{ padding:12px 16px; row-gap:12px; column-gap:12px; }
  .ugh-logo{ justify-self:var(--ugh-logo-justify-mobile); }
  /* Re-declare height at this breakpoint so the rule is explicit even if
     the 900px cascade is somehow blocked by a theme's own media queries. */
  .ugh-header .ugh-logo img{
    height:var(--ugh-logo-height-mobile, 48px) !important;
    width:var(--ugh-logo-width-mobile, auto) !important;
    max-width:min(180px, 40vw) !important;
  }
  .ugh-logo span{ font-size:20px; }
  .ugh-actions{ gap:16px; }
  .ugh-search input[type="search"]{
    padding:11px 14px 11px 40px;
    font-size:14px;
    border-radius:10px;
    box-shadow:0 2px 6px rgba(0,0,0,.08);
  }
  .ugh-search input[type="search"]:focus{
    box-shadow:0 3px 10px rgba(14,125,67,.15);
  }
  .ugh-search--has-btn input[type="search"]{ padding-right:46px; }
  .ugh-search-btn{ padding:8px 10px; }
  .ugh-ticker__track{ gap:40px; padding-left:40px; font-size:12px; }
  .ugh-drawer{ width:88%; }

  /* Mobile-specific drawer colors */
  .ugh-drawer__menu{ background:var(--ugh-nav-bg-mobile); }
  .ugh-drawer__menu .ugh-dropdown{ background:var(--ugh-dropdown-bg-mobile, #fafafa); }
}
