/* Nexa — mobile premium drawer + fixed Home / hamburger (desktop unchanged) */

.nexa-section-anchor {
  position: relative;
  height: 0;
  width: 0;
  overflow: hidden;
  pointer-events: none;
}

#nexa-cocoa-ingredients.nexa-section-anchor {
  scroll-margin-top: max(72px, min(10vw, 120px));
}

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:root {
  --nexa-mobile-gold: #d4af37;
  --nexa-mobile-gold-mid: #c9a227;
  --nexa-mobile-gold-deep: #a67c00;
  --nexa-mobile-panel-bg: linear-gradient(
    165deg,
    #3d2a1f 0%,
    #2a1a14 38%,
    #1f1410 72%,
    #18100c 100%
  );
  --nexa-mobile-panel-edge: rgba(212, 175, 55, 0.12);
  --nexa-mobile-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --nexa-mobile-ease-soft: cubic-bezier(0.33, 1.24, 0.52, 1);
  --nexa-mobile-premium: cubic-bezier(0.25, 0.82, 0.2, 1);
  --nexa-mobile-drawer-dur: 0.95s;
  --nexa-mobile-toggle-dur: 0.82s;
}

/* ——— Desktop: show main menu, hide mobile-only UI ——— */
@media (min-width: 1025px) {
  .nexa-mobile-topbar,
  .nexa-mobile-drawer,
  .nexa-mobile-drawer-backdrop {
    display: none !important;
  }

  /*
   * Nexa desktop header: logo optical-aligns with menu cap height; nav pills use
   * flex + line-height:1 (no uneven vertical padding). Theme `.mask` disabled.
   */
  #header .container {
    width: 100% !important;
    max-width: none !important;
    justify-content: stretch !important;
    padding-left: clamp(0.65rem, 2.2vw, 1.35rem) !important;
    padding-right: clamp(0.65rem, 2.2vw, 1.35rem) !important;
    box-sizing: border-box;
  }

  #header .group {
    --nexa-header-row-h: 2.75rem;
    width: 100% !important;
    max-width: none !important;
    box-sizing: border-box;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap;
    border-radius: max(12px, min(1.389vw, 26px)) !important;
    padding-left: clamp(0.85rem, 2.2vw, 1.75rem) !important;
    padding-right: clamp(0.85rem, 2.2vw, 1.75rem) !important;
    padding-top: max(0.4rem, 0.5vw) !important;
    padding-bottom: max(0.4rem, 0.5vw) !important;
  }

  /* Theme animates this mask under links; our layout breaks alignment — hide on desktop */
  #header .group .mask {
    display: none !important;
  }

  #header .group .logo {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 7rem;
    max-width: min(240px, 34vw);
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    align-self: center !important;
    min-height: var(--nexa-header-row-h);
    line-height: 0 !important;
    transform: none !important;
  }

  /* Slight nudge down so wordmark matches Poppins menu optically (PNG cap vs text box) */
  #header .group .logo > img,
  #header .group .logo > svg {
    width: auto !important;
    max-width: 100%;
    height: clamp(24px, 2.95vw, 38px) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block !important;
    object-fit: contain;
    object-position: center center;
    transform: translateY(0.28rem);
  }

  #header .group .menu {
    flex: 1 1 auto;
    min-width: 0;
    display: flex !important;
    flex-wrap: nowrap;
    align-items: center !important;
    align-self: center !important;
    justify-content: flex-end;
    gap: max(0.15rem, 0.28vw);
  }

  #header .group .menu li {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  #header .group .menu li a {
    font-family: "Poppins", var(--font-primary, system-ui), sans-serif;
    white-space: nowrap;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-left: max(0.7rem, 0.95vw) !important;
    padding-right: max(0.7rem, 0.95vw) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    font-size: clamp(11.5px, 1.12vw, 15.5px) !important;
    line-height: 1 !important;
    height: var(--nexa-header-row-h) !important;
    min-height: var(--nexa-header-row-h) !important;
    max-height: var(--nexa-header-row-h) !important;
    border-radius: max(9.9pt, min(1.042vw, 20px)) !important;
    border: 1px solid transparent !important;
    background-color: transparent !important;
    transition:
      font-size 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      padding 0.4s cubic-bezier(0.22, 1, 0.36, 1),
      letter-spacing 0.35s ease,
      opacity 0.3s ease,
      background-color 0.25s ease,
      border-color 0.25s ease,
      box-shadow 0.3s ease;
  }

  #header .group .menu li.current-menu-item a {
    background-color: var(--black, #0a0a0a) !important;
    border-color: var(--black, #0a0a0a) !important;
    color: var(--white, #fff) !important;
    opacity: 1 !important;
  }

  #header .group .menu li a:hover,
  #header .group .menu li a:focus-visible {
    font-size: clamp(13.5px, 1.28vw, 18px) !important;
    padding-left: max(1rem, 1.35vw) !important;
    padding-right: max(1rem, 1.35vw) !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    letter-spacing: 0.02em;
    opacity: 1 !important;
    background-color: var(--black, #0a0a0a) !important;
    border-color: var(--black, #0a0a0a) !important;
    color: #fff !important;
    outline: none;
    line-height: 1 !important;
    height: auto !important;
    min-height: var(--nexa-header-row-h) !important;
    max-height: none !important;
  }
}

/* ——— Mobile / tablet ——— */
@media (max-width: 1024px) {
  #header #menu-main.menu {
    display: none !important;
  }

  /* Theme nav mask — JS positions it; with hidden menu it shows as a stray black sliver */
  #header .group .mask {
    display: none !important;
  }

  /*
   * Frosted bar (.group) must wrap BOTH logo and mobile controls. Fixed topbar
   * removed them from flow and collapsed the bar — use in-flow flex instead.
   */
  #header .container {
    display: flex !important;
    justify-content: center !important;
    align-items: flex-start !important;
    width: 100% !important;
    max-width: none !important;
    padding-top: calc(0.45rem + env(safe-area-inset-top, 0px)) !important;
    padding-left: clamp(0.45rem, 2vw, 0.85rem) !important;
    padding-right: clamp(0.45rem, 2vw, 0.85rem) !important;
    padding-bottom: 0.35rem !important;
    box-sizing: border-box;
  }

  #header .group {
    --nexa-mobile-header-hit: 2.75rem;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 0.65rem;
    width: 100% !important;
    max-width: 100% !important;
    min-height: clamp(3.45rem, 12vw, 4.65rem) !important;
    margin-top: clamp(0.2rem, 1.2vw, 0.55rem) !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding: clamp(0.55rem, 2.2vw, 0.95rem) clamp(0.85rem, 3.5vw, 1.25rem) !important;
    box-sizing: border-box;
    border-radius: max(14px, min(3vw, 22px)) !important;
    -webkit-backdrop-filter: blur(max(12px, min(3.5vw, 18px))) saturate(140%);
    backdrop-filter: blur(max(12px, min(3.5vw, 18px))) saturate(140%);
  }

  /* Same vertical “rail” as Home pill + menu; logo must not shrink (flex: 1 + min-width:0 was collapsing it). */
  #header .group .logo {
    flex: 0 0 auto !important;
    flex-shrink: 0 !important;
    min-width: auto !important;
    width: auto !important;
    max-width: min(58vw, 220px) !important;
    min-height: var(--nexa-mobile-header-hit) !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    align-self: center !important;
    line-height: 0 !important;
    overflow: visible !important;
  }

  /* Wordmark sits optically high in the bar vs Home + menu — nudge down (mobile/tablet only). */
  #header .group .logo > img,
  #header .group .logo > svg {
    height: clamp(22px, 6.8vw, 32px) !important;
    width: auto !important;
    max-width: min(52vw, 200px) !important;
    flex-shrink: 0 !important;
    object-position: center center;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    transform: translateY(clamp(0.14rem, 0.9vw, 0.26rem));
  }

  .nexa-mobile-topbar {
    position: static !important;
    top: auto !important;
    right: auto !important;
    flex: 0 0 auto;
    margin-left: auto !important;
    align-self: center !important;
    min-height: var(--nexa-mobile-header-hit) !important;
    z-index: 2;
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem;
    padding: 0 !important;
    pointer-events: none;
  }

  .nexa-mobile-topbar > * {
    pointer-events: auto;
  }

  .nexa-mobile-topbar__home {
    font-family: "Poppins", var(--font-primary, system-ui), sans-serif;
    font-weight: 600;
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.92);
    text-decoration: none;
    padding: 0.45rem 0.65rem;
    border-radius: 999px;
    background: rgba(20, 12, 8, 0.45);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.08),
      0 8px 28px rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(212, 175, 55, 0.22);
    transition: color 0.25s var(--nexa-mobile-ease), border-color 0.25s var(--nexa-mobile-ease),
      transform 0.35s var(--nexa-mobile-ease-soft);
  }

  .nexa-mobile-topbar__home:hover,
  .nexa-mobile-topbar__home:focus-visible {
    color: #fff;
    border-color: rgba(212, 175, 55, 0.45);
    transform: translateY(-1px);
    outline: none;
  }

  .nexa-mobile-topbar__toggle {
    position: relative;
    width: 2.75rem;
    height: 2.75rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: rgba(20, 12, 8, 0.5);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.1),
      0 10px 32px rgba(0, 0, 0, 0.28);
    border: 1px solid rgba(212, 175, 55, 0.28);
    transition:
      transform var(--nexa-mobile-toggle-dur) var(--nexa-mobile-premium),
      box-shadow 0.45s var(--nexa-mobile-ease),
      border-color 0.4s ease;
    transform: rotate(0deg);
    transform-origin: 50% 50%;
    will-change: transform;
  }

  .nexa-mobile-topbar__toggle:hover:not([aria-expanded="true"]),
  .nexa-mobile-topbar__toggle:focus-visible:not([aria-expanded="true"]) {
    transform: rotate(0deg) scale(1.04);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.14),
      0 12px 36px rgba(0, 0, 0, 0.32);
    outline: none;
  }

  .nexa-mobile-topbar__toggle[aria-expanded="true"] {
    transform: rotate(180deg);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.12),
      0 14px 40px rgba(0, 0, 0, 0.35);
  }

  .nexa-mobile-topbar__toggle[aria-expanded="true"]:hover,
  .nexa-mobile-topbar__toggle[aria-expanded="true"]:focus-visible {
    transform: rotate(180deg) scale(1.05);
    outline: none;
  }

  .nexa-mobile-topbar__toggle span {
    display: block;
    width: 1.05rem;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--nexa-mobile-gold-deep), var(--nexa-mobile-gold));
    transition:
      transform var(--nexa-mobile-toggle-dur) var(--nexa-mobile-premium),
      opacity 0.45s var(--nexa-mobile-ease);
    transform-origin: 50% 50%;
  }

  .nexa-mobile-topbar__toggle[aria-expanded="true"] span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .nexa-mobile-topbar__toggle[aria-expanded="true"] span:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .nexa-mobile-topbar__toggle[aria-expanded="true"] span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  .nexa-mobile-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10040;
    background: rgba(8, 4, 2, 0.42);
    opacity: 0;
    visibility: hidden;
    transition:
      opacity calc(var(--nexa-mobile-drawer-dur) * 0.65) var(--nexa-mobile-premium),
      visibility 0s linear calc(var(--nexa-mobile-drawer-dur) * 0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
  }

  .nexa-mobile-drawer-backdrop.is-open {
    opacity: 1;
    visibility: visible;
    transition:
      opacity calc(var(--nexa-mobile-drawer-dur) * 0.55) var(--nexa-mobile-premium),
      visibility 0s linear 0s;
  }

  .nexa-mobile-drawer {
    position: fixed;
    inset: 0;
    z-index: 10045;
    display: flex;
    flex-direction: column;
    pointer-events: none;
    overflow: hidden;
  }

  .nexa-mobile-drawer.is-open {
    pointer-events: auto;
  }

  .nexa-mobile-drawer__sheet {
    position: relative;
    flex: 1;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--nexa-mobile-panel-bg);
    box-shadow:
      inset 0 1px 0 var(--nexa-mobile-panel-edge),
      0 24px 80px rgba(0, 0, 0, 0.55);
    border-bottom-left-radius: clamp(1.25rem, 5vw, 2.25rem);
    border-bottom-right-radius: clamp(1.25rem, 5vw, 2.25rem);
    overflow: hidden;
    transform: translateY(-108%);
    transition: transform var(--nexa-mobile-drawer-dur) var(--nexa-mobile-premium);
    will-change: transform;
  }

  .nexa-mobile-drawer.is-open .nexa-mobile-drawer__sheet {
    transform: translateY(0);
  }

  /* Soft “fluffy” top edge */
  .nexa-mobile-drawer__sheet::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    top: 0;
    pointer-events: none;
    background: radial-gradient(120% 55% at 50% -8%, rgba(255, 248, 235, 0.06), transparent 55%);
    border-radius: inherit;
  }

  .nexa-mobile-drawer__inner {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: calc(4.5rem + env(safe-area-inset-top, 0px)) 1.75rem 1.5rem;
    padding-bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    opacity: 0;
    transform: translateY(-0.75rem);
    transition:
      opacity calc(var(--nexa-mobile-drawer-dur) * 0.55) var(--nexa-mobile-premium) 0.08s,
      transform calc(var(--nexa-mobile-drawer-dur) * 0.65) var(--nexa-mobile-premium) 0.06s;
  }

  .nexa-mobile-drawer.is-open .nexa-mobile-drawer__inner {
    opacity: 1;
    transform: translateY(0);
  }

  .nexa-mobile-drawer__close {
    position: absolute;
    top: calc(1rem + env(safe-area-inset-top, 0px));
    right: 1rem;
    width: 2.5rem;
    height: 2.5rem;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.06);
    color: var(--nexa-mobile-gold);
    font-size: 1.35rem;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.25s ease, transform 0.35s var(--nexa-mobile-ease-soft);
  }

  .nexa-mobile-drawer__close:hover,
  .nexa-mobile-drawer__close:focus-visible {
    background: rgba(212, 175, 55, 0.15);
    transform: rotate(90deg);
    outline: none;
  }

  .nexa-mobile-drawer__nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.15rem;
    padding: 1rem 0 2rem;
  }

  .nexa-mobile-drawer__nav a {
    font-family: "Poppins", var(--font-primary, system-ui), sans-serif;
    font-weight: 500;
    font-size: clamp(1.35rem, 5.2vw, 1.85rem);
    letter-spacing: 0.02em;
    text-decoration: none;
    padding: 0.55rem 0.5rem;
    background: linear-gradient(
      110deg,
      #f0e6c8 0%,
      var(--nexa-mobile-gold) 28%,
      #ffe9a8 48%,
      var(--nexa-mobile-gold-mid) 62%,
      #8a7020 100%
    );
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 42px rgba(212, 175, 55, 0.15);
    transition: transform 0.4s var(--nexa-mobile-ease-soft), filter 0.3s ease;
  }

  .nexa-mobile-drawer__nav a:hover,
  .nexa-mobile-drawer__nav a:focus-visible {
    transform: scale(1.03);
    filter: brightness(1.08);
    outline: none;
  }

  .nexa-mobile-drawer__footer {
    margin-top: auto;
    padding-top: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    border-top: 1px solid rgba(212, 175, 55, 0.12);
  }

  .nexa-mobile-drawer__footer img {
    height: clamp(22px, 6vw, 32px);
    width: auto;
    object-fit: contain;
    opacity: 0.88;
    filter: drop-shadow(0 2px 12px rgba(0, 0, 0, 0.35));
  }

  body.nexa-mobile-drawer-open {
    overflow: hidden;
    touch-action: none;
  }

  #who-we-are,
  #what-we-do,
  #blog,
  #lets-talk {
    scroll-margin-top: clamp(5.75rem, 22vw, 8rem);
  }
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
  .nexa-mobile-drawer__sheet {
    transition-duration: 0.2s !important;
    transition-timing-function: ease !important;
  }

  .nexa-mobile-topbar__toggle,
  .nexa-mobile-topbar__toggle span {
    transition-duration: 0.16s !important;
    transition-timing-function: ease !important;
  }

  .nexa-mobile-drawer__inner {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .nexa-mobile-drawer-backdrop {
    transition-duration: 0.2s !important;
  }
}
