/*
 * Sticky mobile Add-to-Cart bar — Glacier Minimal variant.
 *
 * Z-index policy:
 *   Cart drawer:    100 (bar hides via .is-suppressed when drawer opens)
 *   Sticky buy bar: 50
 *   Popup backdrop: 200
 *   Popup dialog:   201
 *
 * Visible: only ≤749px. Hidden by default; JS toggles .is-visible.
 */

sticky-buy-bar {
  display: none;
}

@media screen and (max-width: 749px) {
  sticky-buy-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: block;
    background: rgb(var(--color-background));
    color: rgb(var(--color-foreground));
    border-top: 1px solid rgba(var(--color-foreground), 0.08);
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.06);
    padding-bottom: env(safe-area-inset-bottom, 0);
    transform: translateY(100%);
    transition: transform 240ms cubic-bezier(0.2, 0, 0, 1), opacity 120ms linear;
    will-change: transform;
  }

  sticky-buy-bar.is-visible {
    transform: translateY(0);
  }

  sticky-buy-bar.is-suppressed {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
  }

  .sticky-buy-bar__inner {
    display: flex;
    align-items: stretch;
    height: 56px;
  }

  .sticky-buy-bar__thumb {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    background: rgba(var(--color-foreground), 0.05);
    overflow: hidden;
  }

  .sticky-buy-bar__thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
  }

  .sticky-buy-bar__info {
    flex: 1;
    padding: 8px 12px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
  }

  .sticky-buy-bar__name {
    font-size: 1.3rem;
    line-height: 1.2;
    color: rgba(var(--color-foreground), 0.7);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sticky-buy-bar__variant {
    color: rgba(var(--color-foreground), 0.5);
  }

  .sticky-buy-bar__price {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.2;
    color: rgb(var(--color-foreground));
    margin-top: 2px;
  }

  .sticky-buy-bar__cta {
    flex: 0 0 auto;
    padding: 0 22px;
    min-width: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgb(var(--color-foreground));
    color: rgb(var(--color-background));
    border: 0;
    font-family: inherit;
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background 120ms ease;
  }

  .sticky-buy-bar__cta:hover,
  .sticky-buy-bar__cta:focus-visible {
    background: rgba(var(--color-foreground), 0.85);
  }

  .sticky-buy-bar__cta:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  .sticky-buy-bar__cta-spinner {
    display: inline-flex;
    align-items: center;
    width: 16px;
    height: 16px;
  }

  .sticky-buy-bar__cta-spinner svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
  }

  .sticky-buy-bar__cta.is-loading .sticky-buy-bar__cta-label {
    visibility: hidden;
  }

  .sticky-buy-bar__cta.is-loading .sticky-buy-bar__cta-spinner {
    display: inline-flex;
    position: absolute;
  }
}

@media print {
  sticky-buy-bar {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  sticky-buy-bar {
    transition: opacity 120ms linear !important;
    transform: none !important;
  }

  sticky-buy-bar:not(.is-visible) {
    opacity: 0;
    pointer-events: none;
  }

  sticky-buy-bar.is-visible {
    opacity: 1;
    pointer-events: auto;
    transform: none !important;
  }
}
