/* OG header mini-cart popover
 *
 * Desktop (≥821px): click-open panel under Cart.
 * Mobile: panel stays hidden; Cart link navigates.
 */

.og-header-cart-menu {
  position: relative;
  display: inline-flex;
}

/* Subtle Cart control hover / focus (keeps theme pill shape). */
.og-header-cart {
  transition:
    border-color 0.16s ease,
    background 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.og-header-cart:hover {
  border-color: rgba(0, 108, 255, 0.45);
  background: rgba(238, 245, 255, 0.95);
  color: var(--og-brand, #006cff);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.og-header-cart:focus-visible {
  outline: 2px solid var(--og-brand, #006cff);
  outline-offset: 2px;
}

.og-header-cart-count {
  transition: transform 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.og-header-cart:hover .og-header-cart-count {
  transform: scale(1.06);
  box-shadow: 0 1px 4px rgba(0, 82, 195, 0.28);
}

.og-header-cart-count[hidden] {
  display: none !important;
}

.og-header-mini-cart {
  display: none;
}

@media (min-width: 821px) {
  .og-header-mini-cart {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1200;
    display: block;
    width: min(400px, calc(100vw - 24px));
    max-height: min(70vh, 520px);
    margin: 0;
    border: 1px solid rgba(219, 230, 243, 0.95);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
    transition:
      opacity 0.17s ease,
      transform 0.17s ease,
      visibility 0.17s ease;
  }

  .og-header-cart-menu.is-open > .og-header-mini-cart:not([hidden]) {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .og-header-cart-menu.is-closing > .og-header-mini-cart:not([hidden]) {
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    pointer-events: none;
  }

  .og-header-mini-cart[hidden] {
    display: none !important;
  }

  .og-header-mini-cart-inner {
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 520px);
    overflow: hidden;
  }

  .og-header-mini-cart-list {
    list-style: none;
    margin: 0;
    padding: 8px 10px;
    overflow-y: auto;
    overscroll-behavior: contain;
    flex: 1 1 auto;
    min-height: 0;
  }

  .og-header-mini-cart-item {
    display: grid;
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 12px;
    padding: 10px 8px;
    border-radius: 12px;
    border-bottom: none;
    transition: background 0.15s ease;
  }

  .og-header-mini-cart-item + .og-header-mini-cart-item {
    margin-top: 2px;
  }

  .og-header-mini-cart-item:hover {
    background: rgba(238, 245, 255, 0.72);
  }

  .og-header-mini-cart-thumb-link {
    display: block;
    overflow: hidden;
    border-radius: 10px;
    border: 1px solid rgba(219, 230, 243, 0.95);
    background: #f8fafc;
    aspect-ratio: 1 / 1;
  }

  .og-header-mini-cart-thumb-img,
  .og-header-mini-cart-thumb-link img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.15s ease;
  }

  .og-header-mini-cart-item:hover .og-header-mini-cart-thumb-img,
  .og-header-mini-cart-item:hover .og-header-mini-cart-thumb-link img {
    transform: scale(1.03);
  }

  .og-header-mini-cart-item-body {
    min-width: 0;
  }

  .og-header-mini-cart-item-top {
    display: flex;
    align-items: flex-start;
    gap: 8px;
  }

  .og-header-mini-cart-item-name {
    flex: 1 1 auto;
    min-width: 0;
    color: var(--og-ink, #0f172a);
    font-size: 0.9rem;
    font-weight: 800;
    line-height: 1.3;
    text-decoration: none;
    transition: color 0.15s ease;
  }

  .og-header-mini-cart-item:hover a.og-header-mini-cart-item-name,
  .og-header-mini-cart-item-name:hover,
  .og-header-mini-cart-item-name:focus-visible {
    color: var(--og-brand, #006cff);
  }

  .og-header-mini-cart-remove {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin: -4px -4px 0 0;
    border-radius: 8px;
    color: var(--og-muted, #64748b);
    font-size: 1.15rem;
    line-height: 1;
    text-decoration: none;
    transition: color 0.15s ease, background 0.15s ease;
  }

  .og-header-mini-cart-remove:hover,
  .og-header-mini-cart-remove:focus-visible {
    color: #b91c1c;
    background: rgba(185, 28, 28, 0.08);
    outline: none;
  }

  .og-header-mini-cart-remove:focus-visible {
    box-shadow: 0 0 0 2px rgba(0, 108, 255, 0.35);
  }

  .og-header-mini-cart-item-meta {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    display: grid;
    gap: 2px;
  }

  .og-header-mini-cart-item-meta li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    font-size: 0.75rem;
    line-height: 1.35;
  }

  .og-header-mini-cart-meta-label {
    color: var(--og-muted, #64748b);
    font-weight: 700;
  }

  .og-header-mini-cart-meta-label::after {
    content: ":";
  }

  .og-header-mini-cart-meta-value {
    color: var(--og-ink, #0f172a);
    font-weight: 600;
    overflow-wrap: anywhere;
  }

  .og-header-mini-cart-item-price {
    margin-top: 6px;
    color: var(--og-ink, #0f172a);
    font-size: 0.88rem;
    font-weight: 800;
  }

  .og-header-mini-cart-item-price .amount,
  .og-header-mini-cart-subtotal-value .amount {
    font-weight: 800;
  }

  .og-header-mini-cart-footer {
    flex: 0 0 auto;
    padding: 12px 14px 14px;
    border-top: 1px solid rgba(219, 230, 243, 0.95);
    background: #fff;
  }

  .og-header-mini-cart-totals {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
  }

  .og-header-mini-cart-count-label {
    color: var(--og-muted, #64748b);
    font-size: 0.8rem;
    font-weight: 700;
  }

  .og-header-mini-cart-subtotal {
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    font-size: 0.86rem;
  }

  .og-header-mini-cart-subtotal-label {
    color: var(--og-muted, #64748b);
    font-weight: 700;
  }

  .og-header-mini-cart-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .og-header-mini-cart-actions .og-button {
    min-height: 40px;
    justify-content: center;
    font-size: 0.84rem;
    text-align: center;
  }

  .og-header-mini-cart-empty {
    padding: 22px 18px 20px;
    text-align: center;
  }

  .og-header-mini-cart-empty-text {
    margin: 0 0 14px;
    color: var(--og-ink, #0f172a);
    font-size: 0.95rem;
    font-weight: 700;
  }

  .og-header-mini-cart-shop {
    min-height: 40px;
  }
}

@media (min-width: 821px) and (prefers-reduced-motion: reduce) {
  .og-header-cart,
  .og-header-cart-count,
  .og-header-mini-cart,
  .og-header-mini-cart-item,
  .og-header-mini-cart-thumb-img,
  .og-header-mini-cart-thumb-link img,
  .og-header-mini-cart-item-name,
  .og-header-mini-cart-remove {
    transition: none !important;
  }

  .og-header-cart:hover {
    transform: none;
  }

  .og-header-cart:hover .og-header-cart-count,
  .og-header-mini-cart-item:hover .og-header-mini-cart-thumb-img,
  .og-header-mini-cart-item:hover .og-header-mini-cart-thumb-link img {
    transform: none;
  }

  .og-header-mini-cart {
    transform: none;
  }

  .og-header-cart-menu.is-open > .og-header-mini-cart:not([hidden]),
  .og-header-cart-menu.is-closing > .og-header-mini-cart:not([hidden]) {
    transform: none;
  }
}

/* Mobile: never show popover; keep Cart as navigation. */
@media (max-width: 820px) {
  .og-header-mini-cart {
    display: none !important;
  }

  .og-mobile-bottom-nav-badge[hidden] {
    display: none !important;
  }
}
