/*
 * The parts of the storefront that are on every page of the site.
 *
 * Fire Shop renders two floating controls in wp_footer everywhere it is
 * installed: the mini cart, with its drawer and overlay, and the wishlist
 * button. They are meant to be reachable from a blog post, so their styling has
 * to be there too.
 *
 * Everything else in fire-storefront.css describes a shop page and used to load
 * on every page alongside it: product grids, single-product layouts, archive
 * filters and a lightbox, plus three webfont families, on pages with no shop on
 * them.
 *
 * So this file is what the always-on markup actually needs, and nothing else.
 * fire-storefront.css declares it as a dependency and keeps the rest, so a shop
 * page still gets every rule it had, in the same order, and a blog post gets
 * only this.
 *
 * Extracted by whole numbered sections rather than by picking rules, so the
 * boundary is one somebody can check against the section headers in the file it
 * came out of:
 *
 *   2.  Typography utilities     the drawer title is a fire-heading
 *   3.  Buttons                  the drawer's checkout and view-cart buttons
 *   30. Mini Cart Drawer         the drawer and its overlay
 *   31. Cart Count Badge         the number on the floating button
 *   32. Loading States           the drawer's async refresh
 *   35. Button Utility Classes   fire-btn--block, on those same buttons
 *   plus the floating cart button itself, and the reduced-motion block
 */
   2. Typography utilities
   Scale from DESIGN.md:
     Display  28px / 1.2
     H1       24px / 1.3
     H2       20px / 1.3
     H3       16px / 1.4
     Body     16px / 1.5  (storefront — avoids iOS auto-zoom)
     Small    12px / 1.5
     Data     13px / 1.4  tabular-nums
   ============================================================ */

/**
 * Display — reserved for hero headings and marketing copy.
 * Uses Satoshi bold for maximum visual impact.
 */
.fire-heading-display {
  font-family:    var(--fire-font-display);
  font-size:      28px;
  font-weight:    700;
  line-height:    1.2;
  color:          var(--fire-text);
  letter-spacing: -0.01em;
  margin:         0;
}

/**
 * H1 — primary page title inside content regions.
 */
.fire-heading-1 {
  font-family:    var(--fire-font-display);
  font-size:      24px;
  font-weight:    700;
  line-height:    1.3;
  color:          var(--fire-text);
  letter-spacing: -0.01em;
  margin:         0;
}

/**
 * H2 — section headings (e.g. "Order summary", "Shipping").
 */
.fire-heading-2 {
  font-family:    var(--fire-font-display);
  font-size:      20px;
  font-weight:    500;
  line-height:    1.3;
  color:          var(--fire-text);
  margin:         0;
}

/**
 * H3 — sub-section headings, card titles.
 */
.fire-heading-3 {
  font-family: var(--fire-font-body);
  font-size:   16px;
  font-weight: 600;
  line-height: 1.4;
  color:       var(--fire-text);
  margin:      0;
}

/**
 * Body — default paragraph and label text.
 */
.fire-body {
  font-family: var(--fire-font-body);
  font-size:   16px;
  font-weight: 400;
  line-height: 1.5;
  color:       var(--fire-text);
}

/**
 * Small — fine print, helper text, timestamps.
 */
.fire-body-small {
  font-family: var(--fire-font-body);
  font-size:   12px;
  font-weight: 400;
  line-height: 1.5;
  color:       var(--fire-text-muted);
}

/**
 * Data — numeric values, table cells, stats.
 * tabular-nums ensures digits align in columns.
 */
.fire-data {
  font-family:           var(--fire-font-data);
  font-size:             13px;
  font-weight:           400;
  line-height:           1.4;
  color:                 var(--fire-text);
  font-variant-numeric:  tabular-nums;
}

/**
 * Mono — order IDs, transaction hashes, code snippets.
 */
.fire-mono {
  font-family: var(--fire-font-mono);
  font-size:   13px;
  font-weight: 400;
  line-height: 1.4;
  color:       var(--fire-text-muted);
}

/* ============================================================
   3. Buttons
   All buttons share base resets.  Variants layer colour on top.
   ============================================================ */

/**
 * Shared reset — applied to all .fire-btn-* variants.
 */
.fire-btn,
.fire-btn-primary,
.fire-btn-secondary,
.fire-btn-tertiary,
.fire-btn-ghost,
.fire-btn-danger {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--fire-space-xs);
  padding:         0 var(--fire-space-lg);
  border-radius:   var(--fire-radius-md);
  font-family:     var(--fire-font-body);
  font-size:       14px;
  font-weight:     500;
  line-height:     1;
  height:          44px;
  text-decoration: none;
  cursor:          pointer;
  transition:
    background-color var(--fire-duration-short) var(--fire-ease-move),
    border-color     var(--fire-duration-short) var(--fire-ease-move),
    color            var(--fire-duration-short) var(--fire-ease-move),
    box-shadow       var(--fire-duration-short) var(--fire-ease-move),
    opacity          var(--fire-duration-short) var(--fire-ease-move);
  white-space:     nowrap;
  user-select:     none;
  border:          1px solid transparent;
  box-sizing:      border-box;
}

/* Focus ring — shared across all button variants */
.fire-btn:focus-visible,
.fire-btn-primary:focus-visible,
.fire-btn-secondary:focus-visible,
.fire-btn-tertiary:focus-visible,
.fire-btn-ghost:focus-visible,
.fire-btn-danger:focus-visible {
  outline:        2px solid var(--fire-primary);
  outline-offset: 2px;
}

/* Disabled state — shared */
.fire-btn:disabled,
.fire-btn-primary:disabled,
.fire-btn-secondary:disabled,
.fire-btn-tertiary:disabled,
.fire-btn-ghost:disabled,
.fire-btn-danger:disabled,
.fire-btn[aria-disabled="true"],
.fire-btn-primary[aria-disabled="true"],
.fire-btn-secondary[aria-disabled="true"],
.fire-btn-tertiary[aria-disabled="true"],
.fire-btn-ghost[aria-disabled="true"],
.fire-btn-danger[aria-disabled="true"] {
  opacity: 0.4;
  cursor:  not-allowed;
  pointer-events: none;
}

/**
 * Primary — high-emphasis CTA (e.g. "Place order", "Add to cart").
 * .fire-btn alone acts as primary.
 */
.fire-btn,
.fire-btn-primary {
  background-color: var(--fire-primary);
  color:            #ffffff;
  border-color:     var(--fire-primary);
}

.fire-btn:hover:not(:disabled),
.fire-btn-primary:hover:not(:disabled) {
  background-color: var(--fire-primary-hover);
  border-color:     var(--fire-primary-hover);
  color:            #ffffff;
}

.fire-btn:active:not(:disabled),
.fire-btn-primary:active:not(:disabled) {
  background-color: var(--fire-primary-hover);
  box-shadow:       inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

/**
 * Secondary — outlined action (e.g. "Apply coupon", "Add to cart" on cards).
 * Black outline with black text, transparent background.
 */
.fire-btn-secondary {
  background-color: transparent;
  color:            var(--fire-text);
  border-color:     var(--fire-text);
}

.fire-btn-secondary:hover:not(:disabled) {
  background-color: var(--fire-text);
  color:            var(--fire-surface);
  border-color:     var(--fire-text);
}

.fire-btn-secondary:active:not(:disabled) {
  background-color: var(--fire-text);
  color:            var(--fire-surface);
  box-shadow:       inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

/**
 * Tertiary — helper controls (e.g. quantity +/-, filter).
 * Light border, dark text. Subtle at rest, darkens on hover.
 */
.fire-btn-tertiary {
  background-color: transparent;
  color:            var(--fire-text);
  border-color:     var(--fire-border);
}

.fire-btn-tertiary:hover:not(:disabled) {
  background-color: var(--fire-surface-alt);
  border-color:     var(--fire-text-muted);
}

.fire-btn-tertiary:active:not(:disabled) {
  background-color: var(--fire-surface-alt);
  box-shadow:       inset 0 1px 3px rgba(0, 0, 0, 0.08);
}

/**
 * Ghost — low-emphasis / tertiary action (e.g. "Cancel", navigation links).
 * No visible border at rest — border appears on hover for affordance.
 */
.fire-btn-ghost {
  background-color: transparent;
  color:            var(--fire-text-muted);
  border-color:     transparent;
}

.fire-btn-ghost:hover:not(:disabled) {
  background-color: var(--fire-surface-alt);
  color:            var(--fire-text);
  border-color:     var(--fire-border);
}

.fire-btn-ghost:active:not(:disabled) {
  background-color: var(--fire-border);
}

/**
 * Danger — destructive action (e.g. "Remove item", "Cancel order").
 */
.fire-btn-danger {
  background-color: var(--fire-error);
  color:            #ffffff;
  border-color:     var(--fire-error);
}

.fire-btn-danger:hover:not(:disabled) {
  filter:       brightness(0.9);
}

.fire-btn-danger:active:not(:disabled) {
  filter:       brightness(0.85);
  box-shadow:   inset 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* ============================================================
   30. Mini Cart Drawer
   ============================================================ */

.fire-mini-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--fire-duration-normal, 200ms) ease,
              visibility var(--fire-duration-normal, 200ms) ease;
}

.fire-mini-cart-overlay--active {
  opacity: 1;
  visibility: visible;
}

.fire-mini-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 90vw;
  max-width: 450px;
  background: var(--fire-surface);
  z-index: 9999;
  transform: translateX(100%);
  transition: transform var(--fire-duration-normal, 200ms) ease;
  display: flex;
  flex-direction: column;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
  font-family: var(--fire-font-body);
}

.fire-mini-cart-drawer--open {
  transform: translateX(0);
}

.fire-mini-cart-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--fire-space-md) var(--fire-space-lg);
  border-bottom: 1px solid var(--fire-border);
  flex-shrink: 0;
}

.fire-mini-cart-drawer__title {
  margin: 0;
  font-family: var(--fire-font-body);
  font-size: 14px;
  font-weight: 600;
}

.fire-mini-cart-drawer__close {
  background: none;
  border: none;
  font-size: 24px;
  line-height: 1;
  color: var(--fire-text-muted);
  cursor: pointer;
  padding: var(--fire-space-sm);
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--fire-radius-sm);
  transition: color var(--fire-duration-fast, 100ms) ease;
}

.fire-mini-cart-drawer__close:hover {
  color: var(--fire-text);
}

.fire-mini-cart-contents {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* Reaching the end of the item list must not start scrolling the page
     behind the drawer, which is how a touch scroll escapes the panel. */
  overscroll-behavior: contain;
}

/* Dropdown mode */
.fire-mini-cart-drawer[data-mode="dropdown"] {
  position: absolute;
  top: 100%;
  right: 0;
  bottom: auto;
  width: 360px;
  max-height: 480px;
  border-radius: var(--fire-radius-md);
  border: 1px solid var(--fire-border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
  transform: translateY(-8px);
  opacity: 0;
  visibility: hidden;
}

.fire-mini-cart-drawer[data-mode="dropdown"].fire-mini-cart-drawer--open {
  transform: translateY(0);
  opacity: 1;
  visibility: visible;
}

.fire-mini-cart-overlay[data-mode="dropdown"] {
  display: none;
}

/* Mini cart items */
.fire-mini-cart__items {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.fire-mini-cart__item {
  display: flex;
  align-items: center;
  gap: var(--fire-space-sm);
  padding: var(--fire-space-md) var(--fire-space-lg);
  border-bottom: 1px solid var(--fire-border);
}

.fire-mini-cart__item-image img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  border-radius: var(--fire-radius-sm);
  display: block;
}

.fire-mini-cart__item-placeholder {
  width: 60px;
  height: 60px;
  background: var(--fire-surface-alt);
  border-radius: var(--fire-radius-sm);
}

.fire-mini-cart__item-details {
  flex: 1;
  min-width: 0;
}

.fire-mini-cart__item-name {
  display: block;
  font-family: var(--fire-font-body);
  font-weight: 500;
  font-size: 13px;
  color: var(--fire-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fire-mini-cart__item-meta {
  display: block;
  font-size: 12px;
  color: var(--fire-text-muted);
  margin-top: var(--fire-space-2xs);
  font-family: var(--fire-font-data);
}

.fire-mini-cart__item-remove {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: var(--fire-text-muted);
  cursor: pointer;
  padding: var(--fire-space-xs);
  flex-shrink: 0;
  border-radius: var(--fire-radius-sm);
  transition: color var(--fire-duration-fast, 100ms) ease;
}

.fire-mini-cart__item-remove:hover {
  color: var(--fire-error);
}

/* Mini cart totals */
.fire-mini-cart__totals {
  padding: var(--fire-space-md) var(--fire-space-lg);
  border-top: 1px solid var(--fire-border);
}

.fire-mini-cart__totals-row {
  display: flex;
  justify-content: space-between;
  font-family: var(--fire-font-body);
  font-size: 13px;
  padding: var(--fire-space-xs) 0;
  color: var(--fire-text-muted);
}

.fire-mini-cart__totals-row--total {
  font-family: var(--fire-font-body);
  font-weight: 600;
  font-size: 14px;
  color: var(--fire-text);
  border-top: 1px solid var(--fire-border);
  padding-top: var(--fire-space-sm);
  margin-top: var(--fire-space-xs);
}

.fire-mini-cart__totals-value {
  font-family: var(--fire-font-data);
  font-variant-numeric: tabular-nums;
}

/* Mini cart buttons */
.fire-mini-cart__buttons {
  padding: var(--fire-space-md) var(--fire-space-lg);
  display: flex;
  flex-direction: column;
  gap: var(--fire-space-sm);
  border-top: 1px solid var(--fire-border);
}

/* Mini cart empty state */
.fire-mini-cart-empty {
  padding: var(--fire-space-2xl) var(--fire-space-lg);
  text-align: center;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.fire-mini-cart-empty__message {
  color: var(--fire-text-muted);
  font-size: 14px;
  margin-bottom: var(--fire-space-md);
}

/* Body scroll lock when mini cart is open */
body.fire-mini-cart-open {
  overflow: hidden;
}

/* ============================================================
   31. Cart Count Badge
   ============================================================ */

.fire-cart-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--fire-radius-full);
  background: var(--fire-primary);
  color: #fff;
  font-family: var(--fire-font-data);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.fire-cart-count:empty,
.fire-cart-count:not(.fire-cart-count--has-items) {
  display: none;
}

/* ============================================================
   32. Loading States
   ============================================================ */

.fire-loading {
  position: relative;
  pointer-events: none;
}

.fire-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.6);
  z-index: 10;
  border-radius: inherit;
}

.fire-loading::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid var(--fire-border);
  border-top-color: var(--fire-primary);
  border-radius: 50%;
  animation: fire-spin 0.6s linear infinite;
  z-index: 11;
}

@keyframes fire-spin {
  to {
    transform: rotate(360deg);
  }
}

/* ============================================================
   35. Button Utility Classes
   ============================================================ */

/* Width: block (full width) */
.fire-btn--block,
.fire-btn--full {
  width: 100%;
}

/* ============================================================
/* ──────────────────────────────────────────────────────────
   Mini Cart FAB (floating action button)
   ────���───────────────────────────────────────────────────── */
.fire-mini-cart-fab {
  position: fixed;
  z-index: 9997;
}

.fire-mini-cart-fab--bottom-right {
  bottom: 32px;
  right: 32px;
}

.fire-mini-cart-fab--top-right {
  top: 32px;
  right: 32px;
}

.fire-mini-cart-fab__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--fire-radius-full);
  border: none;
  background: var(--fire-text);
  color: var(--fire-bg);
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
  transition: transform var(--fire-duration-fast) var(--fire-ease-move),
              box-shadow var(--fire-duration-fast) var(--fire-ease-move);
  position: relative;
}

.fire-mini-cart-fab__btn svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}

.fire-mini-cart-fab__btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
}

.fire-mini-cart-fab__btn:active {
  transform: scale(0.97);
}

.fire-mini-cart-fab__btn .fire-cart-count {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: var(--fire-radius-full);
  background: var(--fire-primary);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
}

.fire-mini-cart-fab__btn .fire-cart-count--hidden {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .fire-mini-cart-fab__btn {
    transition: none;
  }
}
