/* =========================================================================
   Mobile navigation overhaul — drawer + bottom bar.
   Uses the same --fmke-* variables already defined in style.css.
   ========================================================================= */

/* -------------------------------------------------------------------- *
 * 0. Menu button — smaller, consistent pill instead of the default
 *    boxy Storefront button.
 * -------------------------------------------------------------------- */
@media (max-width: 782px) {
  /* Same declarations as the critical inline CSS in mobile-nav.php (keep the
     two in sync). The hamburger icon is a background image on the button, so
     it is in place from first paint and never swapped by script. */
  button.menu-toggle {
    display: inline-flex !important;
    align-items: center;
    height: 34px;
    padding: 0 14px 0 35px !important;
    border-radius: 999px !important;
    border: 1px solid var(--fmke-border, #F0E4D8) !important;
    background-color: #fff !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23FF6A00' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M4 6h16M4 12h16M4 18h16'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: 14px 50% !important;
    background-size: 15px 15px !important;
    color: var(--fmke-dark, #1F3D2C) !important;
    font-size: 12.5px !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: .3px;
    line-height: 1 !important;
  }
  button.menu-toggle:hover {
    background-color: var(--fmke-primary-light, #FFF1E0) !important;
    border-color: var(--fmke-primary, #FF6A00) !important;
  }
  /* Storefront draws its own 3-bar icon with pseudo-elements on the button and
     its label. We draw our own, so switch Storefront's off. */
  button.menu-toggle::before,
  button.menu-toggle::after,
  button.menu-toggle > span::before,
  button.menu-toggle > span::after { display: none !important; content: none !important; }
}
/* Desktop: leave Storefront's own display:none for .menu-toggle untouched —
   the drawer/bottom-bar system below is mobile-only by design. */

/* -------------------------------------------------------------------- *
 * 1. Drawer
 * -------------------------------------------------------------------- */
.fmke-mnav {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 300; pointer-events: none;
  /* Clip the off-screen drawer so it can never add scrollable width to the page */
  overflow: hidden; contain: paint;
  visibility: hidden; transition: visibility 0s linear .28s;
}
.fmke-mnav.is-open { visibility: visible; transition-delay: 0s; }
.fmke-mnav__overlay {
  position: absolute; inset: 0; background: rgba(15, 25, 18, .45);
  opacity: 0; transition: opacity .25s ease; pointer-events: none;
}
.fmke-mnav.is-open .fmke-mnav__overlay { opacity: 1; pointer-events: auto; }

.fmke-mnav__drawer {
  position: absolute; top: 0; right: 0; height: 100%; width: min(84%, 340px); max-width: 100%;
  background: #fff; box-shadow: -12px 0 32px rgba(0,0,0,.18);
  transform: translateX(100%); transition: transform .28s cubic-bezier(.22,.8,.2,1);
  pointer-events: auto; overflow-y: auto; padding: 6px 0 24px;
  display: flex; flex-direction: column;
}
.fmke-mnav.is-open .fmke-mnav__drawer { transform: translateX(0); }
body.fmke-mnav-lock { overflow: hidden; }

.fmke-mnav__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; font-weight: 800; color: var(--fmke-dark, #1F3D2C);
  border-bottom: 1px solid var(--fmke-border, #F0E4D8); font-size: 15px;
}
.fmke-mnav__close {
  border: none; background: none; padding: 4px; color: var(--fmke-dark, #1F3D2C);
  display: flex; cursor: pointer;
}

.fmke-mnav__shop {
  display: flex; align-items: center; gap: 10px; margin: 14px 18px;
  padding: 12px 16px; border-radius: 10px;
  background: var(--fmke-primary, #FF6A00); color: #fff !important;
  font-weight: 800; font-size: 14.5px; text-decoration: none !important;
}
.fmke-mnav__shop svg { flex: 0 0 auto; }

.fmke-mnav__link,
.fmke-mnav__group-toggle,
.fmke-mnav__group a {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 12px 18px; font-size: 13.5px; font-weight: 600;
  color: var(--fmke-text, #1F3D2C); text-decoration: none !important;
  background: none; border: none; text-align: left; cursor: pointer;
}
.fmke-mnav__link svg,
.fmke-mnav__group-toggle svg,
.fmke-mnav__group a svg { flex: 0 0 auto; color: var(--fmke-primary, #FF6A00); }

.fmke-mnav__group-toggle span:first-of-type { flex: 1; }
.fmke-mnav__chevron { display: flex; transition: transform .2s ease; color: var(--fmke-muted, #767676) !important; }
.fmke-mnav__group-toggle[aria-expanded="true"] .fmke-mnav__chevron { transform: rotate(90deg); }
.fmke-mnav__group-toggle[aria-expanded="true"] .fmke-mnav__chevron svg { color: var(--fmke-muted, #767676); }

.fmke-mnav__group {
  display: flex; flex-direction: column;
  background: var(--fmke-primary-light, #FFF1E0);
}
.fmke-mnav__group a { padding-left: 42px; font-size: 13px; }

.fmke-mnav__link { border-top: 1px solid var(--fmke-border, #F0E4D8); }

/* -------------------------------------------------------------------- *
 * 2. Bottom nav bar — mobile only, 4 actions
 *    Account · Search · Shop (raised) · Cart
 *
 *    Selectors are doubled up (.fmke-bnav .fmke-bnav__item, button.…) and
 *    key properties are !important because Storefront and the marketplace
 *    plugin both style bare <button>/<a> (background, padding, uppercase,
 *    hover colours) and the Search item is a real <button>.
 * -------------------------------------------------------------------- */

/* Storefront ships its own sticky icon-only bar (z-index 9999) that sat on
   top of this one and hid it. This bar replaces it. */
.storefront-handheld-footer-bar { display: none !important; }

.fmke-bnav {
  display: none; position: fixed !important; left: 0; right: 0; bottom: 0; z-index: 250;
  background: rgba(255,255,255,.97);
  -webkit-backdrop-filter: saturate(160%) blur(10px);
          backdrop-filter: saturate(160%) blur(10px);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 28px rgba(31,61,44,.12), 0 -1px 0 var(--fmke-border, #F0E4D8);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px));
  align-items: stretch;
  gap: 2px;
}
.fmke-bnav .fmke-bnav__item {
  position: relative;
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  margin: 0; padding: 6px 2px 6px !important;
  border: 0 !important; border-radius: 14px !important;
  background: none !important; box-shadow: none !important;
  color: #6F6A64 !important;
  font: inherit; font-size: 11px !important; font-weight: 700 !important; line-height: 1.1 !important;
  text-transform: none !important; letter-spacing: .1px !important;
  text-decoration: none !important;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: color .15s ease, transform .12s ease;
}
.fmke-bnav .fmke-bnav__item svg {
  box-sizing: content-box; width: 23px; height: 23px; padding: 5px 17px;
  border-radius: 999px; background: transparent; color: inherit;
  transition: background .18s ease, color .18s ease, transform .15s ease;
}
.fmke-bnav .fmke-bnav__item:active { transform: scale(.93); }
.fmke-bnav .fmke-bnav__item:focus-visible { outline: 2px solid var(--fmke-primary, #FF6A00); outline-offset: -2px; }
/* Defeat sticky "hover" on touch screens (global button:hover turns it orange) */
.fmke-bnav .fmke-bnav__item:hover { background: none !important; color: #6F6A64 !important; }

/* Active page: the icon pops out of the bar as a raised orange bubble.
   Whichever tab you're on (Account, Shop, Cart…) gets it — no tab owns it. */
.fmke-bnav .fmke-bnav__item.is-active,
.fmke-bnav .fmke-bnav__item.is-active:hover { color: var(--fmke-primary-dark, #CC5500) !important; }
.fmke-bnav .fmke-bnav__item.is-active::before { display: none !important; }
.fmke-bnav .fmke-bnav__item.is-active svg {
  box-sizing: content-box; width: 24px; height: 24px; padding: 15px;
  /* lift the bubble 26px above the bar, but give back the extra height below so
     the label stays on the same line as the other tabs */
  margin: -26px 0 -3px;
  border-radius: 50%; color: #fff;
  background: linear-gradient(145deg, #FF8A2B, var(--fmke-primary, #FF6A00));
  border: 4px solid #fff;
  box-shadow: 0 8px 18px rgba(255,106,0,.38);
  animation: fmke-bnav-pop .28s cubic-bezier(.2,.9,.3,1.3) both;
}
@keyframes fmke-bnav-pop { from { transform: translateY(8px) scale(.82); opacity: .4; } to { transform: none; opacity: 1; } }
.fmke-bnav .fmke-bnav__item.is-active:active svg { transform: scale(.94); }

.fmke-bnav__icon-wrap { position: relative; display: inline-flex; }
.fmke-bnav .is-active .fmke-bnav__badge { top: 6px; right: 4px; background: var(--fmke-dark, #1F3D2C); }
.fmke-bnav__badge {
  position: absolute; top: 0; right: 8px;
  background: var(--fmke-primary, #FF6A00); color: #fff;
  font-size: 10px; font-weight: 800; line-height: 1;
  min-width: 17px; height: 17px; padding: 0 4px; box-sizing: border-box;
  border: 2px solid #fff; border-radius: 999px;
  display: flex; align-items: center; justify-content: center;
}

/* Search sheet, slides up over the bar */
.fmke-bnav__search {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 260;
  background: #fff;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(31,61,44,.16);
  /* taller than the bar so the raised Shop bubble can't poke through */
  padding: 34px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .22s ease; display: none;
}
.fmke-bnav__search::before {
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 4px; border-radius: 4px; background: #E3DACF;
}
.fmke-bnav__search[hidden] { display: none; }
.fmke-bnav__search:not([hidden]) { display: block; }
.fmke-bnav__search.is-open { transform: translateY(0); }
.fmke-bnav__search form {
  display: flex; align-items: center; gap: 10px;
  background: #F6F3EE; border: 1.5px solid var(--fmke-border, #F0E4D8);
  border-radius: 999px; padding: 4px 6px 4px 16px; color: var(--fmke-primary, #FF6A00);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.fmke-bnav__search form:focus-within {
  background: #fff; border-color: var(--fmke-primary, #FF6A00); box-shadow: 0 0 0 3px rgba(255,106,0,.16);
}
.fmke-bnav__search input[type="search"] {
  flex: 1; min-width: 0; height: 42px; border: 0 !important; outline: none !important; box-shadow: none !important;
  background: none !important; font-size: 16px; /* 16px stops iOS zooming on focus */ color: var(--fmke-dark, #1F3D2C);
}
.fmke-bnav__search button {
  flex: 0 0 auto; width: 36px; height: 36px; padding: 0 !important; justify-content: center; align-items: center;
  border: 0 !important; border-radius: 50% !important; background: #fff !important; box-shadow: none !important;
  display: flex; color: var(--fmke-muted, #767676) !important;
}
.fmke-bnav__search button:hover { background: var(--fmke-primary-light, #FFF1E0) !important; color: var(--fmke-primary, #FF6A00) !important; }

/* Shop menu sheet — slides up over the bar when the Shop tab is tapped.
   Lists the Flowers / Gifts / Event Rentals category pages. */
.fmke-bnav__backdrop {
  position: fixed; inset: 0; z-index: 255; background: rgba(15,25,18,.4);
  opacity: 0; transition: opacity .22s ease; display: none;
}
.fmke-bnav__backdrop:not([hidden]) { display: block; }
.fmke-bnav__backdrop.is-open { opacity: 1; }

.fmke-bnav__shop {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 260;
  background: #fff; border-radius: 20px 20px 0 0;
  box-shadow: 0 -10px 30px rgba(31,61,44,.16);
  padding: 30px 14px calc(18px + env(safe-area-inset-bottom, 0px));
  transform: translateY(100%); transition: transform .22s ease; display: none;
}
.fmke-bnav__shop::before {
  content: ""; position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
  width: 38px; height: 4px; border-radius: 4px; background: #E3DACF;
}
.fmke-bnav__shop[hidden] { display: none; }
.fmke-bnav__shop:not([hidden]) { display: block; }
.fmke-bnav__shop.is-open { transform: translateY(0); }

.fmke-bnav__shop-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 4px 10px; font-size: 15px; font-weight: 800; color: var(--fmke-dark, #1F3D2C);
}
.fmke-bnav__shop-head button {
  width: 34px; height: 34px; padding: 0 !important; display: flex; align-items: center; justify-content: center;
  border: 0 !important; border-radius: 50% !important; background: #F6F3EE !important; box-shadow: none !important;
  color: var(--fmke-muted, #767676) !important; cursor: pointer;
}
.fmke-bnav__shop-head button:hover { background: var(--fmke-primary-light, #FFF1E0) !important; color: var(--fmke-primary, #FF6A00) !important; }

.fmke-bnav__shop-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.fmke-bnav__shop-list li { margin: 0; padding: 0; }
.fmke-bnav__shop-list a {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: #F6F3EE; border: 1.5px solid transparent; border-radius: 14px;
  color: var(--fmke-dark, #1F3D2C) !important; font-size: 15px; font-weight: 700;
  text-decoration: none !important; -webkit-tap-highlight-color: transparent;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
.fmke-bnav__shop-list a:hover,
.fmke-bnav__shop-list a:focus-visible { background: var(--fmke-primary-light, #FFF1E0); border-color: var(--fmke-primary, #FF6A00); }
.fmke-bnav__shop-list a:active { transform: scale(.98); }
.fmke-bnav__shop-list a.is-current { background: var(--fmke-primary-light, #FFF1E0); border-color: var(--fmke-primary, #FF6A00); }
.fmke-bnav__shop-icon {
  flex: 0 0 auto; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: #fff; color: var(--fmke-primary, #FF6A00);
}
.fmke-bnav__shop-icon svg { width: 20px; height: 20px; }
.fmke-bnav__shop-label { flex: 1; min-width: 0; }
.fmke-bnav__shop-arrow { display: flex; color: var(--fmke-muted, #767676); }
.fmke-bnav__shop-arrow svg { width: 16px; height: 16px; }

@media (max-width: 782px) {
  .fmke-bnav { display: flex; }
  body { padding-bottom: 76px; }
}
@media (min-width: 783px) {
  .fmke-mnav, .fmke-bnav, .fmke-bnav__search, .fmke-bnav__shop, .fmke-bnav__backdrop { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  .fmke-bnav .fmke-bnav__item.is-active svg { animation: none; }
  .fmke-mnav__drawer, .fmke-mnav__overlay, .fmke-bnav__search, .fmke-bnav__shop, .fmke-bnav__backdrop, .fmke-mnav__chevron { transition: none !important; }
}

/* -------------------------------------------------------------------- *
 * 3. Small-screen safety for the bottom bar.
 *    - The page content can't push the layout wider than the screen (a stray
 *      wide element would make phones widen the layout, so the fixed bar
 *      looked cut off/overflowing).
 *    - The bar is capped at the screen width, and the icon pills shrink with
 *      the screen instead of using a fixed 57px, so 4 tabs always fit.
 * -------------------------------------------------------------------- */
@media (max-width: 782px) {
  body.fmke-mnav-lock { overflow: hidden; touch-action: none; }

  /* Stop the page scrolling sideways into empty space. The clip goes on the
     page wrapper (#page) ONLY - not on html/body - so the fixed bottom bar
     (which lives outside #page, directly under <body>) is not affected, and
     `clip` (unlike `hidden`) keeps the sticky header working. */
}
@supports (overflow: clip) {
  @media (max-width: 782px) {
    #page, .site { overflow-x: clip; }
  }
}
@media (max-width: 782px) {
  /* Hard stop for sideways scrolling on phones. `hidden` goes on <html> only:
     it propagates to the viewport, so it does NOT turn <body> into a scroll
     container (which would break the sticky header and the fixed bottom bar).
     <body> uses `clip` where supported, plus max-width as a fallback. */
  html { overflow-x: hidden; max-width: 100%; }
  body { max-width: 100%; position: relative; }
  #page, .site, .site-header, .site-footer, .col-full { max-width: 100%; }
  /* Media and embeds can never be wider than the screen. */
  img, video, iframe, embed, object, table { max-width: 100%; }
  img, video { height: auto; }

  .fmke-bnav {
    /* own compositing layer so the bar stays glued to the screen while the
       browser's address bar collapses/expands during scroll */
    -webkit-transform: translateZ(0); transform: translateZ(0);
    box-sizing: border-box; width: 100%; max-width: 100vw;
    padding-left: max(6px, env(safe-area-inset-left, 0px));
    padding-right: max(6px, env(safe-area-inset-right, 0px));
  }
  .fmke-bnav .fmke-bnav__item { max-width: 25%; overflow: visible; white-space: nowrap; }
  .fmke-bnav .fmke-bnav__item svg { padding: 5px clamp(4px, 3.6vw, 17px); }
  .fmke-bnav .fmke-bnav__item.is-active svg { padding: clamp(11px, 3.6vw, 15px); }
}
@media (max-width: 360px) {
  .fmke-bnav { gap: 0; }
  .fmke-bnav .fmke-bnav__item { font-size: 10px !important; }
  .fmke-bnav__badge { right: 4px; }
}

@supports (overflow: clip) {
  @media (max-width: 782px) {
    body { overflow-x: clip; }
  }
}
