/* Wishlist hearts, and the bottom menu on phones and tablets (its sizes scale with --u). */
.mi-tabbar {
  display: none;
}

.mi-wish {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: block;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(17, 17, 17, 0.08);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23111' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.5-1.46 3-3.2 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E") center 53% / 18px no-repeat;
  box-shadow: 0 3px 10px -3px rgba(0, 0, 0, 0.25);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 160ms ease;
}

.image-wrapper {
  position: relative; /* Keeps the heart on the product's main photo. */
}

/* A finger-sized tap area. */
.mi-wish::after {
  content: "";
  position: absolute;
  inset: -6px;
}

[data-wish-count][hidden] {
  display: none;
}

.mi-wish:hover {
  transform: scale(1.08);
}

.mi-wish:focus-visible {
  outline: 2px solid #111;
  outline-offset: 2px;
}

.mi-wish:active {
  transform: scale(0.85);
}

.mi-wish[aria-pressed="true"] {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23e5252a' stroke='%23e5252a' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M19 14c1.5-1.46 3-3.2 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z'/%3E%3C/svg%3E");
}

/* Taken off the wishlist: it stays, faded, until the page is left, so a slip can be undone. */
.mi-wishlist .na-card:has(.mi-wish[aria-pressed="false"]) {
  opacity: 0.5;
}

@media (max-width: 992px) {
  .mi-tabbar {
    --u: calc(min(100vw, 420px) / 370);
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 1000; /* Below every popup and drawer. */
    display: flex;
    box-sizing: border-box;
    height: calc(62 * var(--u) + env(safe-area-inset-bottom, 0px));
    padding: 0 calc(33 * var(--u)) env(safe-area-inset-bottom, 0px);
    transition: opacity 160ms ease, visibility 160ms;
  }

  .mi-tabbar__shade,
  .mi-tabbar__glass,
  .mi-tabbar__glass svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
  }

  .mi-tabbar__glass {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.16));
    -webkit-backdrop-filter: blur(7px) saturate(1.8);
    backdrop-filter: blur(7px) saturate(1.8);
  }

  .mi-tabbar.is-over-dark .mi-tabbar__glass {
    background: rgba(255, 255, 255, 0.09);
  }

  /* Edge of the glass: a soft shadow behind it, and a thin bright rim with a glow inside it
     (the outer half of those two is cut off by the glass). */
  .mi-tabbar path {
    transition: stroke 250ms ease;
  }

  .mi-tabbar__shade,
  .mi-tabbar__glass path {
    overflow: visible;
    fill: none;
    stroke: #fff;
    stroke-width: 2.4;
  }

  .mi-tabbar__shade {
    stroke: rgba(0, 0, 0, 0.28);
    stroke-width: 5;
    filter: blur(4px);
  }

  .mi-tabbar__glass .mi-tabbar__glow {
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 12;
    filter: blur(4px);
  }

  .mi-tabbar.is-over-dark .mi-tabbar__glass path {
    stroke: rgba(255, 255, 255, 0.6);
  }

  .mi-tabbar.is-over-dark .mi-tabbar__glass .mi-tabbar__glow {
    stroke: rgba(255, 255, 255, 0.32);
  }

  .mi-tabbar__bubble {
    position: absolute;
    top: calc(-21 * var(--u));
    left: calc(var(--x, 0px) - 23 * var(--u));
    z-index: 1;
    box-sizing: border-box;
    width: calc(46 * var(--u));
    height: calc(46 * var(--u));
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: radial-gradient(circle at 35% 25%, #ffe566, #fdc404 62%, #eeb200);
    box-shadow: 0 6px 16px -4px rgba(0, 0, 0, 0.45), 0 0 18px -2px rgba(253, 196, 4, 0.5);
    transform: scale(var(--depth, 1));
    pointer-events: none;
  }

  .mi-tabbar a {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 0;
    color: #111;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1), color 200ms ease;
  }

  /* Keeps the icons clear of a photo behind the glass. */
  .mi-tabbar a:not(.is-active) svg {
    filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.9));
  }

  .mi-tabbar.is-over-dark a {
    color: #fff;
  }

  .mi-tabbar.is-over-dark a:not(.is-active) svg {
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
  }

  .mi-tabbar.is-over-dark a.is-active,
  .mi-tabbar a.is-active {
    color: #0b0b0f;
    transform: translateY(calc(-29 * var(--u)));
  }

  .mi-tabbar a:focus-visible {
    outline: 2px solid #fdc404;
    outline-offset: -6px;
    border-radius: 18px;
  }

  .mi-tabbar a svg {
    width: calc(24 * var(--u));
    height: calc(24 * var(--u));
  }

  .mi-tabbar__count {
    position: absolute;
    top: 50%;
    left: 50%;
    min-width: 17px;
    margin: -21px 0 0 4px;
    padding: 0 4px;
    box-sizing: border-box;
    border-radius: 9px;
    background: #fdc404;
    color: #0b0b0f;
    font-size: 10px;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
  }

  .mi-tabbar a.is-active .mi-tabbar__count {
    background: #0b0b0f;
    color: #fff;
  }

  /* Room for the end of the page and for the floating buttons. */
  body:has(.mi-tabbar) .footer-info {
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  }

  /* Out of the way while the chat is open or the keyboard is up. */
  body:has(#mi-chat-panel:not([hidden])) .mi-tabbar,
  body:has(:is(textarea, input:not([type="checkbox"], [type="radio"], [type="range"], [type="button"], [type="submit"], [readonly])):focus) .mi-tabbar {
    visibility: hidden;
    opacity: 0;
  }
}

.mi-wishlist__shop {
  display: inline-block;
  margin-top: 16px;
  padding: 12px 22px;
  border-radius: 10px;
  background: #fdc404;
  color: #111;
  font-weight: 700;
  text-decoration: none;
}

@media (max-width: 768px) {
  /* Products in stock have their own buy bar at the bottom. */
  body:has(.sticky-cart-wrapper) .mi-tabbar {
    display: none;
  }

  body:has(.mi-tabbar):not(:has(.sticky-cart-wrapper)) #pd-download-app-btn,
  body:has(.mi-tabbar):not(:has(.sticky-cart-wrapper)) #pd-whatsapp-toggle.pd-whatsapp-fab {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  }
}

@media (min-width: 769px) and (max-width: 992px) {
  body:has(.mi-tabbar) #pd-download-app-btn,
  body:has(.mi-tabbar) #pd-whatsapp-toggle.pd-whatsapp-fab {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 100px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .mi-tabbar,
  .mi-tabbar a {
    transition: none;
  }
}
