
:root {
  --sft-bottomnav-h: 42px;
  --sft-bottomnav-inset: env(safe-area-inset-bottom, 0px);
}

/* Markup is always printed; visibility is purely a breakpoint concern. */
.sft-bottomnav {
  display: none;
}

@media (max-width: 1024px) {
  .sft-header {
    position: sticky;
    top: 0;
    z-index: 99600;
    background: transparent;
    border-bottom: 0;
  }

  .sft-header-sticky {
    position: relative;
    z-index: 2;
    background: #ffffff;
    border-bottom: 1px solid #eef0f3;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1),
      box-shadow 0.24s ease;
  }

  .sft-header.is-scrolled .sft-header-sticky {
    box-shadow: 0 2px 4px rgba(15, 23, 42, 0.05),
      0 8px 24px rgba(15, 23, 42, 0.07);
  }

  .sft-header.is-nav-hidden .sft-header-sticky {
    transform: translateY(-100%);
  }

  .sft-header.is-nav-hidden {
    pointer-events: none;
  }

  .sft-header.is-nav-hidden .sft-header-sticky,
  .sft-header.is-nav-hidden .offcanvas-menu,
  .sft-header.is-nav-hidden .menu-overlay.is-active {
    pointer-events: auto;
  }
}

@media (max-width: 1024px) {

  /* Reachable without stretching, and never smaller than a fingertip. */
  .sft-header-actions .sft-header-action {
    min-width: 38px;
    min-height: 38px;
    justify-content: center;
  }

  /* Compact hamburger: 38px border-box minus 1px borders and 10px padding leaves 16px, so 2px bars sit 7px apart and the X offset is exactly 7px. */
  .sft-header-main .mobile-menu-trigger,
  .mobile-menu-trigger {
    box-sizing: border-box;
    width: 38px;
    height: 38px;
    padding: 10px 9px;
    border-radius: 8px;
  }

  .sft-header-main .mobile-menu-trigger .hamburger-bar {
    height: 2px;
  }

  .mobile-menu-trigger.is-open .hamburger-bar:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .mobile-menu-trigger.is-open .hamburger-bar:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* Tablet: logo a touch smaller than desktop. Phones override below. */
  .sft-header .sft-header-brand-logo {
    height: 40px;
    min-height: 40px;
    max-height: 40px;
  }
}

@media (max-width: 767px) {

  /* Slimmer top row: 52px instead of 64px, so more product shows above the fold. */
  .sft-header-main {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .sft-header .sft-header-brand-logo {
    height: 34px;
    min-height: 34px;
    max-height: 34px;
  }

  .sft-header-action--account,
  .sft-header-action--wishlist {
    display: none;
  }
}

@media (max-width: 1024px) {
  .sft-header-main {
    position: relative;
    grid-template-columns: 1fr auto 1fr;
    gap: 0 10px;
  }

  .sft-header-main .mobile-menu-trigger {
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
  }

  .sft-header-brand {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .sft-header-actions {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    gap: 4px;
  }

  .sft-header-searchwrap {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  /* The category selector has no room inside a dropdown field. */
  .sft-header-search-cat-wrap {
    display: none;
  }

  /* No-JS: the trigger would do nothing, so it is not shown. */
  .sft-header-action--search {
    display: none;
  }

  .sft-header.has-js-search .sft-header-action--search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    background: none;
    color: #0f172a;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease;
  }

  .sft-header.has-js-search .sft-header-action--search svg {
    width: 21px;
    height: 21px;
  }

  .sft-header.has-js-search.is-search-open .sft-header-action--search {
    color: #0e7490;
  }

  /* ---- The dropdown itself ---- */

  .sft-header.has-js-search .sft-header-searchwrap {
    grid-area: auto;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 3;
    padding: 10px 14px 12px;
    background: #ffffff;
    border-top: 1px solid #f1f4f8;
    box-shadow: 0 10px 20px rgba(15, 23, 42, 0.09);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.18s ease,
      transform 0.22s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0.22s;
  }

  .sft-header.has-js-search.is-search-open .sft-header-searchwrap {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity 0.18s ease,
      transform 0.26s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s;
  }

  .sft-header.has-js-search .sft-header-searchwrap .sft-header-search {
    width: 100%;
    height: 44px;
  }

  /* Backdrop — a sibling of .sft-header-sticky, so it sits under the bar. */
  .sft-search-backdrop {
    position: fixed;
    top: var(--sft-header-h, 120px);
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 0;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0s linear 0.2s;
  }

  .sft-header.is-search-open .sft-search-backdrop {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.2s ease, visibility 0s;
  }
}

@media (min-width: 1025px) {

  /* The wrapper now occupies the grid slot the form used to hold. Capped by
     that column, so it shrinks beside the wide logo instead of overlapping it. */
  .sft-header-searchwrap {
    justify-self: center;
    width: min(600px, 100%);
    min-width: 0;
  }

  .sft-header-searchwrap .sft-header-search {
    width: 100%;
  }

  .sft-header-action--search,
  .sft-search-backdrop {
    display: none !important;
  }
}

.sft-quicklinks {
  display: none;
}

@media (max-width: 1024px) {
  .sft-quicklinks {
    display: block;
    border-top: 1px solid #f1f4f8;
    background: #fbfcfd;
  }

  .sft-quicklinks__list {
    list-style: none;
    margin: 0;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-padding-inline: 14px;
  }

  .sft-quicklinks__list::-webkit-scrollbar {
    display: none;
  }

  .sft-quicklinks__list>li {
    margin: 0;
    flex: 0 0 auto;
  }

  .sft-quicklinks__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid #e3e8ef;
    border-radius: 999px;
    background: #ffffff;
    color: #334155;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  .sft-quicklinks__chip:active {
    background: #f1f5f9;
    color: #0f172a;
    text-decoration: none;
  }

  /* Deals stays highlighted by colour and dot only, so it never reads as the selected chip */
  .sft-quicklinks__chip--accent {
    border-color: #a5f3fc;
    background: #ffffff;
    color: #155e75;
  }

  .sft-quicklinks__chip--accent:active {
    background: #ecfeff;
    color: #164e63;
  }

  .sft-quicklinks__chip.is-active,
  .sft-quicklinks__chip.is-active:active {
    border-color: #0f172a;
    background: #0f172a;
    color: #ffffff;
  }

  .sft-quicklinks__chip--accent.is-active,
  .sft-quicklinks__chip--accent.is-active:active {
    border-color: #0e7490;
    background: #0e7490;
    color: #ffffff;
  }

  .sft-quicklinks__chip--accent.is-active .sft-quicklinks__dot {
    background: #ffffff;
  }

  .sft-quicklinks__dot {
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: #0e7490;
    flex: 0 0 auto;
  }
}

/* Phones: tighter chips so more shortcuts fit before the strip scrolls. */
@media (max-width: 767px) {
  .sft-quicklinks__list {
    padding: 9px 12px;
    gap: 6px;
    scroll-padding-inline: 12px;
  }

  .sft-quicklinks__chip {
    gap: 5px;
    /* Inter sits ~0.6px low in its line box; the extra bottom pixel optically centres the caps. */
    padding: 5px 10px 6px;
    font-size: 12px;
  }

  /* Tap target >=44px tall without making the chip look bigger. */
  .sft-quicklinks__chip {
    position: relative;
  }

  .sft-quicklinks__chip::after {
    content: "";
    position: absolute;
    inset: -9px -3px;
  }

  .sft-quicklinks__dot {
    width: 5px;
    height: 5px;
  }
}

@media (max-width: 1024px) {
  .sft-bottomnav {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99500;
    background: #ffffff;
    border-top: 1px solid #e8ecf1;
    box-shadow: 0 -2px 14px rgba(15, 23, 42, 0.07);
    padding-bottom: var(--sft-bottomnav-inset);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  }

  /* Reserve the bar's footprint so nothing sits under it. */
  body {
    padding-bottom: calc(var(--sft-bottomnav-h) + var(--sft-bottomnav-inset));
  }

  :root {
    --sft-wa-offset: calc(var(--sft-bottomnav-h) + 12px);
  }

  .sft-bottomnav__item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: var(--sft-bottomnav-h);
    padding: 0 2px;
    margin: 0;
    border: 0;
    background: none;
    color: #64748b;
    font-family: inherit;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.1;
    text-decoration: none;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s ease;
  }

  .sft-bottomnav__item:hover,
  .sft-bottomnav__item:focus-visible {
    color: #0f172a;
    text-decoration: none;
  }

  .sft-bottomnav__item:focus-visible {
    outline: 2px solid #0e7490;
    outline-offset: -3px;
    border-radius: 6px;
  }

  .sft-bottomnav__item:active {
    background: #f8fafc;
  }

  .sft-bottomnav__item.is-active {
    color: #0e7490;
  }

  .sft-bottomnav__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
  }

  .sft-bottomnav__svg {
    width: 20px;
    height: 20px;
  }

  .sft-bottomnav__item.is-active .sft-bottomnav__svg {
    stroke-width: 2;
  }

  /* Without visible labels, the active tab is marked by a dot under its icon. */
  .sft-bottomnav__item.is-active::after,
  .sft-bottomnav__item--categories[aria-expanded="true"]::after {
    content: "";
    position: absolute;
    bottom: 3px;
    left: 50%;
    width: 4px;
    height: 4px;
    margin-left: -2px;
    border-radius: 999px;
    background: #0e7490;
  }

  /* The label is a tooltip above the icon; opacity (not display/visibility) keeps it in the accessible name. */
  .sft-bottomnav__label {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    z-index: 1;
    padding: 5px 9px;
    border-radius: 6px;
    background: #0f172a;
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, 4px);
    transition: opacity 0.15s ease, transform 0.15s ease;
  }

  .sft-bottomnav__label::after {
    content: "";
    position: absolute;
    top: 100%;
    left: 50%;
    margin-left: -5px;
    border: 5px solid transparent;
    border-top-color: #0f172a;
  }

  /* Edge tabs anchor their tooltip inward so it never leaves the screen. */
  .sft-bottomnav__item:first-child .sft-bottomnav__label {
    left: 8px;
    transform: translate(0, 4px);
  }

  .sft-bottomnav__item:first-child .sft-bottomnav__label::after {
    left: 18px;
  }

  .sft-bottomnav__item:last-child .sft-bottomnav__label {
    left: auto;
    right: 8px;
    transform: translate(0, 4px);
  }

  .sft-bottomnav__item:last-child .sft-bottomnav__label::after {
    left: auto;
    right: 13px;
  }

  /* Touch shows the tooltip on long-press (.is-tip, set by js/mobile-nav.js); keyboard on focus. */
  .sft-bottomnav__item.is-tip .sft-bottomnav__label,
  .sft-bottomnav__item:focus-visible .sft-bottomnav__label {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .sft-bottomnav__item:first-child.is-tip .sft-bottomnav__label,
  .sft-bottomnav__item:first-child:focus-visible .sft-bottomnav__label,
  .sft-bottomnav__item:last-child.is-tip .sft-bottomnav__label,
  .sft-bottomnav__item:last-child:focus-visible .sft-bottomnav__label {
    transform: translate(0, 0);
  }

  /* Long-press must show the tooltip, not the browser's link preview or text selection. */
  .sft-bottomnav__item {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
  }
}

@media (max-width: 1024px) and (hover: hover) {
  .sft-bottomnav__item:hover .sft-bottomnav__label {
    opacity: 1;
    transform: translate(-50%, 0);
  }

  .sft-bottomnav__item:first-child:hover .sft-bottomnav__label,
  .sft-bottomnav__item:last-child:hover .sft-bottomnav__label {
    transform: translate(0, 0);
  }
}

@media (max-width: 1024px) {

  /* Cart badge */
  .sft-bottomnav__badge {
    position: absolute;
    top: -5px;
    right: -8px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: #0e7490;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
    box-shadow: 0 0 0 2px #ffffff;
  }

  .sft-bottomnav__badge.is-empty {
    display: none;
  }

  /* The drawer tab reflects the drawer's state. */
  .sft-bottomnav__item--categories[aria-expanded="true"] {
    color: #0e7490;
  }
}

@media (min-width: 600px) and (max-width: 1024px) {
  .sft-bottomnav {
    grid-template-columns: repeat(5, minmax(0, 108px));
    justify-content: center;
    column-gap: 10px;
  }
}

/* Narrow phones: slightly smaller icons. */
@media (max-width: 359px) {
  .sft-bottomnav__svg {
    width: 19px;
    height: 19px;
  }
}

/* Landscape phones have very little height. */
@media (max-width: 1024px) and (max-height: 460px) and (orientation: landscape) {
  :root {
    --sft-bottomnav-h: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sft-header-sticky {
    transition: none;
  }

  .sft-bottomnav__item {
    transition: none;
  }
}

@media print {

  .sft-bottomnav,
  .sft-quicklinks {
    display: none !important;
  }

  body {
    padding-bottom: 0 !important;
  }
}

@media (max-width: 1024px) {
  .sft-header-sticky {
    position: relative;
    z-index: 2;
  }

  #offcanvas-menu {
    display: block;
    position: fixed;
    top: var(--sft-header-h, 120px);
    left: 0;
    right: auto;
    width: min(78vw, 320px);
    max-width: 320px;
    height: calc(100vh - var(--sft-header-h, 120px));
    height: calc(100dvh - var(--sft-header-h, 120px));
    max-height: none;
    padding: 0;
    background: #ffffff;
    box-shadow: 6px 0 26px rgba(15, 23, 42, 0.16);
    border-top: 1px solid #eef0f3;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    z-index: 1;
    transform: translateX(-100%);
    /* Closed drawer leaves the tab order; delay lets the slide-out finish. */
    visibility: hidden;
    transition:
      transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s linear 0.3s;
    will-change: transform;
  }

  #offcanvas-menu.is-active {
    transform: translateX(0);
    visibility: visible;
    transition:
      transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
      visibility 0s;
  }

  .menu-overlay {
    top: var(--sft-header-h, 168px);
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: auto;
    z-index: 0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background-color: rgba(15, 23, 42, 0.4);
  }

  .offcanvas-header {
    display: none !important;
  }

  #offcanvas-menu .offcanvas-body {
    padding: 0;
  }

  #offcanvas-menu .sft-header-nav-inner,
  #offcanvas-menu .sft-menu-container,
  #offcanvas-menu .sft-header-nav-list {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    overflow: visible;
  }

  /* ---- Rows ---- */

  #offcanvas-menu .menu-item {
    position: relative;
    display: block;
    margin: 0;
    border-bottom: 1px solid #f1f4f8;
  }

  #offcanvas-menu .menu-item a {
    display: block !important;
    padding: 14px 52px 14px 18px !important;
    min-height: 48px;
    font-size: 14.5px !important;
    line-height: 1.4;
    color: #1f2937;
    border-bottom: 0 !important;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
  }

  #offcanvas-menu .menu-item-has-children>a {
    padding-right: 52px !important;
  }

  #offcanvas-menu .menu-item a:active {
    background: #f8fafc;
  }

  /* Open parent is highlighted, matching the reference. */
  #offcanvas-menu .menu-item.sub-menu-open>a {
    color: #0e7490;
    font-weight: 600;
  }

  /* ---- Plus / minus toggle ---- */

  #offcanvas-menu .dropdown-toggle-btn {
    display: flex !important;
    position: absolute;
    right: 0;
    top: 0;
    width: 52px;
    height: 48px;
    align-items: center;
    justify-content: center;
    background: none;
    border: 0;
    cursor: pointer;
    z-index: 5;
    -webkit-tap-highlight-color: transparent;
  }

  #offcanvas-menu .dropdown-toggle-btn::before,
  #offcanvas-menu .dropdown-toggle-btn::after {
    content: "";
    position: absolute;
    background: #94a3b8;
    border: 0;
    border-radius: 1px;
    transform: none;
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  }

  /* Horizontal bar — always visible. */
  #offcanvas-menu .dropdown-toggle-btn::before {
    width: 13px;
    height: 1.6px;
  }

  /* Vertical bar — hidden when open, turning the plus into a minus. */
  #offcanvas-menu .dropdown-toggle-btn::after {
    width: 1.6px;
    height: 13px;
  }

  #offcanvas-menu .menu-item.sub-menu-open>.dropdown-toggle-btn::after {
    opacity: 0;
    transform: rotate(90deg);
  }

  #offcanvas-menu .menu-item.sub-menu-open>.dropdown-toggle-btn::before {
    background: #0e7490;
  }

  /* ---- Nested levels ---- */

  #offcanvas-menu .sub-menu {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    background: #fbfcfd !important;
    border-left: 0 !important;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  #offcanvas-menu .menu-item.sub-menu-open>.sub-menu {
    max-height: 1600px;
  }

  #offcanvas-menu .sub-menu .menu-item {
    border-bottom: 1px solid #eef2f7;
  }

  #offcanvas-menu .sub-menu .menu-item:last-child {
    border-bottom: 0;
  }

  #offcanvas-menu .sub-menu .menu-item a {
    padding-left: 34px !important;
    font-size: 14px !important;
    color: #475569;
  }

  #offcanvas-menu .sub-menu .sub-menu .menu-item a {
    padding-left: 50px !important;
    font-size: 13.5px !important;
  }

  /* ---- Deals button ---- */

  #offcanvas-menu .sft-header-deal {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin: 14px 16px 20px;
    padding: 10px 14px;
    border-radius: 8px;
    background: #0e7490;
    color: #ffffff !important;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.3;
    text-decoration: none;
  }

  /* The flex gap already spaces the dot; its own margin doubled it. */
  #offcanvas-menu .sft-header-deal-dot {
    width: 6px;
    height: 6px;
    margin: 0;
  }
}

@media (prefers-reduced-motion: reduce) {

  #offcanvas-menu,
  #offcanvas-menu .sub-menu,
  #offcanvas-menu .dropdown-toggle-btn::before,
  #offcanvas-menu .dropdown-toggle-btn::after {
    transition: none;
  }
}

html.sft-menu-open {
  overflow-x: clip;
  overflow-y: hidden;
  overscroll-behavior: none;
}

@media (max-width: 1024px) {
  html.sft-menu-open #menu-overlay {
    touch-action: none;
  }
}

@media (max-width: 1024px) {
  html:has(#offcanvas-menu.is-active) {
    overflow-x: clip;
    overflow-y: hidden;
    overscroll-behavior: none;
  }
}

/* Logged-in admins: keep the sticky header below #wpadminbar.
   Admin bar is fixed 32px (>782px), fixed 46px (601-782px) and scrolls away
   (position:absolute) at <=600px, where the header can stick to the top. */
@media (max-width: 1024px) {
  body.admin-bar .sft-header {
    top: 32px;
  }
}

@media (max-width: 782px) {
  body.admin-bar .sft-header {
    top: 46px;
  }
}

@media (max-width: 600px) {
  body.admin-bar .sft-header {
    top: 0;
  }
}
