/* ============================================================
   shopify-store.css — Perelandra Publishing Company
   Styles for the Shopify Storefront integration.
   Works on any page that includes this file and calls
   ShopifyStore.init(). Covers only what Bootstrap and
   custom.css do not: cart drawer, availability badges,
   greyscale filter, nav cart toggle, product modal,
   and store-specific typography.

   CSS custom properties at the top are the retheme surface —
   change them to adapt the store to a new brand.
   ============================================================ */


/* ── Store design tokens ────────────────────────────────────── */
:root {
  --store-in-stock:      #2d8a4e;
  --store-in-stock-bg:   rgba(45, 138, 78, 0.12);
  --store-preorder:      #a07800;
  --store-preorder-bg:   rgba(160, 120, 0, 0.12);
  --store-oos-filter:    grayscale(100%) opacity(0.45);
  --store-cart-width:    380px;
  --store-cart-bg:       #161616;
  --store-cart-border:   #2a2a2a;
  --store-cart-z:        1055;
  --store-overlay-z:     1050;
}


/* ── Product card — image wrapper ───────────────────────────── */
/* Relative positioning so the pre-order badge can be absolutely placed */
.store-card-img-wrap {
  position: relative;
  overflow: hidden;
}

.store-card-img-wrap .card-img-top {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;
  background-color: var(--brand-surface);
}


/* ── Pre-order image badge ──────────────────────────────────── */
.store-badge-preorder {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  background-color: var(--store-preorder);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25em 0.65em;
  border-radius: 2px;
  z-index: 1;
  pointer-events: none;
}


/* ── Out-of-stock image treatment ───────────────────────────── */
.store-img-oos {
  filter: var(--store-oos-filter);
  transition: filter 0.2s ease;
}

.store-card-oos .card-title {
  color: var(--brand-text-muted);
}

.store-card-oos .store-price {
  color: var(--brand-text-muted);
}


/* ── Product card price ─────────────────────────────────────── */
.store-price {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: #f0ece4;
  margin-bottom: 0.4rem;
}


/* ── Subsection availability heading strip ──────────────────── */
.store-subsection-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  margin-top: 0.25rem;
}

.store-avail-badge {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.3em 0.8em;
  border-radius: 2px;
}

.store-avail-badge--in-stock {
  background-color: var(--store-in-stock-bg);
  color: var(--store-in-stock);
  border: 1px solid rgba(45, 138, 78, 0.3);
}

.store-avail-badge--preorder {
  background-color: var(--store-preorder-bg);
  color: var(--store-preorder);
  border: 1px solid rgba(160, 120, 0, 0.3);
}

.store-avail-badge--oos {
  background-color: rgba(136, 136, 128, 0.1);
  color: var(--brand-text-muted);
  border: 1px solid rgba(136, 136, 128, 0.25);
}


/* ── Pre-order button ───────────────────────────────────────── */
/* Bootstrap btn-warning looks wrong on dark themes (yellow bg, dark text).
   This class matches the amber --store-preorder token with white text. */
.btn.store-btn-preorder {
  background-color: var(--store-preorder);
  border-color: var(--store-preorder);
  color: #fff;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.btn.store-btn-preorder:hover,
.btn.store-btn-preorder:focus {
  background-color: #8a6800;
  border-color: #8a6800;
  color: #fff;
}

.btn.store-btn-preorder:disabled {
  opacity: 0.6;
  pointer-events: none;
}


/* ── Section loading spinner wrapper ────────────────────────── */
.store-loading {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 200px;
}


/* ── Cart overlay (full-screen dark scrim) ──────────────────── */
.store-cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: var(--store-overlay-z);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.store-cart-overlay.is-open {
  opacity: 1;
  visibility: visible;
}


/* ── Cart drawer ────────────────────────────────────────────── */
.store-cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--store-cart-width);
  height: 100vh;
  background-color: var(--store-cart-bg);
  border-left: 1px solid var(--store-cart-border);
  z-index: var(--store-cart-z);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.store-cart-drawer.is-open {
  transform: translateX(0);
}

@media (max-width: 575.98px) {
  .store-cart-drawer {
    width: 100%;
  }
}


/* ── Cart drawer regions ────────────────────────────────────── */
.store-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--store-cart-border);
  flex-shrink: 0;
}

.store-cart-header h2 {
  font-family: var(--font-ui);
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #f0ece4;
  margin: 0;
}

.store-cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1.25rem;
}

.store-cart-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--store-cart-border);
  flex-shrink: 0;
}


/* ── Cart empty state ───────────────────────────────────────── */
.store-cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: var(--brand-text-muted);
  font-family: var(--font-ui);
  font-size: 0.875rem;
  text-align: center;
  gap: 0.625rem;
}


/* ── Cart line items ────────────────────────────────────────── */
.store-cart-line {
  display: flex;
  gap: 0.875rem;
  padding: 0.875rem 0;
  border-bottom: 1px solid var(--store-cart-border);
  align-items: flex-start;
}

.store-cart-line:last-child {
  border-bottom: none;
}

.store-cart-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 2px;
  flex-shrink: 0;
  background-color: var(--brand-surface);
}

.store-cart-line-info {
  flex: 1;
  min-width: 0;
}

.store-cart-line-title {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  color: #d4d0c8;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.store-cart-line-price {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  color: var(--brand-text-muted);
  margin-bottom: 0.375rem;
}


/* ── Quantity stepper ───────────────────────────────────────── */
.store-qty-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.store-qty-btn {
  background: none;
  border: 1px solid var(--store-cart-border);
  color: #c8c4bc;
  width: 24px;
  height: 24px;
  border-radius: 2px;
  font-size: 0.9375rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.store-qty-btn:hover {
  border-color: var(--brand-accent);
  color: var(--brand-accent);
}

.store-qty-val {
  font-family: var(--font-ui);
  font-size: 0.875rem;
  min-width: 1.5rem;
  text-align: center;
  color: #d4d0c8;
}


/* ── Cart subtotal row ──────────────────────────────────────── */
.store-cart-subtotal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.store-cart-subtotal-label {
  font-family: var(--font-ui);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--brand-text-muted);
}

.store-cart-subtotal-amount {
  font-family: var(--font-ui);
  font-size: 1.0625rem;
  font-weight: 600;
  color: #f0ece4;
}


/* ── Cart toggle — navbar nav item ──────────────────────────── */
/* Injected by ShopifyStore.init() as the last item in .navbar-nav */
.store-cart-nav-item {
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
}

.store-cart-toggle {
  background-color: var(--brand-accent);
  border: 1px solid var(--brand-accent);
  color: #000;
  border-radius: var(--brand-card-radius, 4px);
  padding: 0.5rem 0.875rem;
  font-family: var(--font-ui);
  font-size: 0.875rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.store-cart-toggle:hover {
  background-color: var(--brand-accent-hover);
  border-color: var(--brand-accent-hover);
  color: #000;
}

/* Item-count badge inside the cart toggle */
.store-badge {
  background-color: rgba(255, 255, 255, 0.25);
  border-radius: 50px;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.1em 0.5em;
  min-width: 1.35em;
  text-align: center;
  display: none;
}

.store-badge.has-items {
  display: inline-block;
}


/* ── Product detail modal ───────────────────────────────────── */
.store-modal-content {
  background-color: var(--store-cart-bg);
  border-color: var(--store-cart-border);
  color: #d4d0c8;
}

.store-modal-header {
  border-bottom-color: var(--store-cart-border);
}

.store-modal-header .modal-title {
  font-family: var(--font-ui);
  font-size: 1rem;
  font-weight: 600;
  color: #f0ece4;
}

.store-modal-body {
  padding: 1.5rem;
}
