/* ==========================================================================
   Design tokens — used by the top menu, mirrored from the homepage design
   ========================================================================== */

:root {
  --color-surface-container-lowest: #ffffff;
  --color-on-surface: #2a170d;
  --color-outline-variant: #dac1ba;
  --color-primary-container: #6d2a12;
  --color-inverse-on-surface: #ffede6;
  --color-secondary: #815600;
  --color-secondary-container: #fdb742;
  --color-on-secondary-container: #6e4900;

  --space-xs: 0.375rem;
  --space-sm: 0.75rem;
  --space-md: 1.25rem;
  --space-lg: 2rem;
  --margin: 2rem;

  --font-label: 'Inter', sans-serif;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
  background: var(--color-surface-container-lowest);
  border-bottom: 1px solid var(--color-outline-variant);
  position: sticky;
  top: 0;
  z-index: 50;
}

.site-header__inner {
  max-width: 82.5rem;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-lg);
  padding: 0 var(--margin);
}

.site-header__logo {
  display: block;
}

.site-header__logo img {
  height: 52px;
  width: auto;
}

/* Nav toggle (mobile hamburger) */

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  background: #f9efd7;
  color: var(--color-primary-container);
  border: none;
  border-radius: 0.75rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease;
}

.nav-toggle:hover,
.nav-toggle.is-open {
  background: #f3e6c4;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--color-secondary);
  outline-offset: 2px;
}

.nav-toggle__icon {
  display: block;
  width: 24px;
  height: 24px;
  overflow: visible;
}

.nav-toggle__line {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s ease, opacity 0.2s ease;
}

/* Open: the three lines morph into an X */
.nav-toggle.is-open .nav-toggle__line--1 {
  transform: translateY(5px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle__line--2 {
  opacity: 0;
  transform: scaleX(0.2);
}

.nav-toggle.is-open .nav-toggle__line--3 {
  transform: translateY(-5px) rotate(-45deg);
}

/* Primary nav */

.primary-nav {
  flex: 1;
}

.primary-nav ul {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.primary-nav a {
  display: inline-block;
  font-family: var(--font-label);
  font-size: 1rem;
  font-weight: 500;
  color: var(--color-on-surface);
  text-decoration: none;
  padding: var(--space-xs) 0;
  border-bottom: 2px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.primary-nav a:hover,
.primary-nav a:focus-visible,
.primary-nav a[aria-current="page"] {
  color: var(--color-secondary);
  border-bottom-color: var(--color-secondary);
}

/* Cart */

.cart-link {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 14px;
  background: var(--color-primary-container);
  color: var(--color-inverse-on-surface);
  border-radius: 50px;
  transition: filter 0.2s ease;
}

.cart-link:hover,
.cart-link:focus-visible {
  color: var(--color-inverse-on-surface);
  filter: brightness(1.12);
}

.cart-icon {
  width: 1.25rem;
  height: 1.25rem;
}

.cart-count {
  position: absolute;
  top: 0;
  right: 0;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-secondary-container);
  color: var(--color-on-secondary-container);
  border-radius: 50px;
  font-family: var(--font-label);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1;
}

/* ==========================================================================
   Mobile header layout (nav collapses at 960px)
   ========================================================================== */

@media (max-width: 960px) {
  /* One row: [logo] ...space... [cart][menu button] */
  .site-header__inner {
    flex: 0 0 100%;
    width: 100%;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0 1rem;
  }

  .site-header__logo {
    order: 1;
    margin-right: auto;
  }

  .cart-link {
    order: 2;
  }

  .nav-toggle {
    display: flex;
    order: 3;
    margin-left: 0;
  }

  .primary-nav {
    order: 4;
    flex: 0 0 100%;
    display: none;
  }
}

/* Badge pulse when the cart fragment is swapped after add-to-cart */
@keyframes cart-bump {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.45); }
  100% { transform: scale(1); }
}

.cart-link.is-updated .cart-count {
  animation: cart-bump 0.5s ease;
}

/* ==========================================================================
   Mobile menu panel (below 960px): slides in from the left. Markup in
   template-parts/mobile-menu.php, behaviour in assets/js/header.js.
   ========================================================================== */

.mnav {
  display: none;
}

html.mnav-lock {
  overflow: hidden;
}

@media (max-width: 960px) {
  .mnav {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    visibility: hidden;
    pointer-events: none;
    transition: visibility 0s linear 0.3s;
  }

  .mnav.is-open {
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }

  .mnav__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(42, 23, 13, 0.52);
    opacity: 0;
    transition: opacity 0.28s ease;
  }

  .mnav.is-open .mnav__backdrop {
    opacity: 1;
  }

  .mnav__panel {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(86%, 340px);
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 16px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    background: #FFFDF8;
    box-shadow: 6px 0 28px rgba(42, 23, 13, 0.28);
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-102%);
    transition: transform 0.28s ease;
    font-family: 'Inter', sans-serif;
    color: #2A170D;
  }

  .mnav.is-open .mnav__panel {
    transform: none;
  }

  .mnav__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
  }

  .mnav__logo img {
    display: block;
    height: 44px;
    width: auto;
  }

  .mnav .mnav__close {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    color: #2A170D;
    border: 1.5px solid #DAC1BA;
    border-radius: 50%;
    cursor: pointer;
  }

  .mnav .mnav__close:hover,
  .mnav .mnav__close:focus-visible {
    background: #F3E6C4;
    color: #2A170D;
  }

  .mnav__close svg {
    width: 18px;
    height: 18px;
  }

  .mnav .mnav__panel :is(a, button, input):focus-visible {
    outline: 3px solid #6D2A12;
    outline-offset: 2px;
  }

  /* search */
  .mnav .mnav__search {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 44px;
    padding: 0 14px;
    background: #F3E6C4;
    border-radius: 999px;
    color: #54433D;
  }

  .mnav__search svg {
    width: 18px;
    height: 18px;
    flex: none;
  }

  .mnav .mnav__search input[type="search"] {
    flex: 1;
    min-width: 0;
    height: 100%;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    color: #2A170D;
    font: inherit;
    font-size: 16px; /* 16px stops iOS from zooming the page on focus */
    -webkit-appearance: none;
    appearance: none;
  }

  .mnav .mnav__search input::placeholder {
    color: #54433D;
    opacity: 1;
  }

  /* nav */
  .mnav__nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .mnav__label {
    margin: 0 0 8px;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #54433D;
  }

  .mnav__tiles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 10px !important;
  }

  .mnav__tiles .is-wide {
    grid-column: 1 / -1;
  }

  .mnav .mnav__panel a.mnav__tile {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 14px;
    min-height: 84px;
    padding: 12px;
    background: #F3E6C4;
    border-radius: 14px;
    color: #2A170D;
    font-family: 'Quicksand', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.15;
    text-decoration: none;
  }

  .mnav__tile::before {
    content: "";
    width: 22px;
    height: 25px;
    background: #FDB742;
    clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  }

  .mnav .mnav__panel .mnav__tiles .is-wide a.mnav__tile {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
    background: #FDB742;
    color: #4A3000;
  }

  .mnav__tiles .is-wide .mnav__tile::before {
    display: none;
  }

  /* the floating cookie pill would cover the cart row */
  html.mnav-lock .sffr-cc__revoke {
    display: none;
  }

  .mnav__arrow {
    width: 20px;
    height: 20px;
    flex: none;
  }

  .mnav .mnav__panel a.mnav__tile:hover,
  .mnav .mnav__panel a.mnav__tile:focus-visible {
    background: #EADBAE;
    color: #2A170D;
  }

  .mnav .mnav__panel .is-wide a.mnav__tile:hover,
  .mnav .mnav__panel .is-wide a.mnav__tile:focus-visible {
    background: #FFCB6B;
    color: #4A3000;
  }

  .mnav .mnav__panel a.mnav__tile.is-current {
    box-shadow: inset 0 0 0 2px #6D2A12;
  }

  .mnav__list li + li {
    border-top: 1px solid #DAC1BA;
  }

  .mnav__list li:first-child {
    border-top: 1px solid #DAC1BA;
  }

  .mnav__list li:last-child {
    border-bottom: 1px solid #DAC1BA;
  }

  .mnav .mnav__panel .mnav__list a {
    display: flex;
    align-items: center;
    min-height: 48px;
    color: #2A170D;
    font-size: 1.05rem;
    font-weight: 500;
    text-decoration: none;
  }

  .mnav .mnav__panel .mnav__list a:hover,
  .mnav .mnav__panel .mnav__list a:focus-visible {
    color: #815600;
  }

  .mnav .mnav__panel .mnav__list a.is-current {
    color: #6D2A12;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: #FDB742;
    text-decoration-thickness: 3px;
    text-underline-offset: 6px;
  }

  /* cart row, pushed to the bottom of the panel */
  .mnav .mnav__panel a.mnav__cart {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    min-height: 52px;
    padding: 10px 14px;
    background: #F3E6C4;
    border-radius: 14px;
    color: #2A170D;
    font-weight: 600;
    text-decoration: none;
  }

  .mnav .mnav__panel a.mnav__cart:hover,
  .mnav .mnav__panel a.mnav__cart:focus-visible {
    background: #EADBAE;
    color: #2A170D;
  }

  .mnav__cart-count {
    min-width: 28px;
    padding: 2px 10px;
    background: #FDB742;
    color: #4A3000;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mnav,
  .mnav__backdrop,
  .mnav__panel {
    transition: none !important;
  }
}

/* Drawer search: full-size field (it was squeezed by the flex column), white with a soft outline, honey focus ring. */
@media (max-width: 960px) {
  .mnav .mnav__search {
    flex: none;
    box-sizing: border-box;
    height: 52px;
    min-height: 52px;
    padding: 0 18px;
    gap: 12px;
    background: #fff;
    border: 1px solid #DAC1BA;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }

  .mnav__search svg {
    width: 20px;
    height: 20px;
  }

  .mnav .mnav__search input[type="search"] {
    height: 100%;
    line-height: 1.2;
    font-size: 16px;
    outline: none;
  }

  .mnav .mnav__search:focus-within {
    border-color: #FDB742;
    box-shadow: 0 0 0 4px rgba(253, 183, 66, 0.3);
  }
}
