/**
 * Grit storefront pages (TheSmithy#1056) — catalog, product, cart, success.
 *
 * Loads on top of grit-brand.css (extends website/grit/base.html), so it
 * inherits Merriweather, lowercase headers, the purple/blue palette, and the
 * glass utility classes. Mobile-first; warm and parent-facing with the same
 * kid-adjacent charm as the passport page.
 */

/* ---- Page canvas: soft lavender→mint wash so the glass cards read ---- */
.store-page {
  background: linear-gradient(180deg, #f7f3fc 0%, #f2f7fb 55%, #eef7f4 100%);
  min-height: calc(100vh - 64px);
  padding-bottom: 3rem;
}

/* ---- Hero band ---- */
.store-hero {
  background: linear-gradient(160deg, var(--color-purple) 0%, var(--color-blue) 100%);
  color: #fff;
  text-align: center;
  padding: clamp(2.25rem, 6vw, 4rem) 0 clamp(2.5rem, 6vw, 4.25rem);
  margin-bottom: 2rem;
}

.store-hero h1 {
  color: #fff;
  font-size: clamp(2rem, 5vw, var(--text-3xl));
  margin-bottom: 0.5rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.35);
}

.store-hero-lead {
  color: rgba(255, 255, 255, 0.92);
  font-size: 1.05rem;
  margin: 0 auto;
  max-width: 34rem;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Shipping disclosure — shown on the hero and the product page so cost is
   never first met in the cart (#6). On the hero it sits on the dark band,
   so it inherits the hero's light treatment. */
.store-hero .store-shipping-note {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  margin: 0.5rem auto 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---- Catalog grid ---- */
.store-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 1100px;
  margin: 0 auto;
}

@media (min-width: 576px) {
  .store-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 992px) {
  .store-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ---- Product card (glass) ---- */
.store-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(12px) saturate(150%);
  -webkit-backdrop-filter: blur(12px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(31, 38, 135, 0.1);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.store-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 14px 36px rgba(123, 68, 193, 0.18);
}

.store-card-media {
  position: relative;
  display: block;
  background: rgba(123, 68, 193, 0.08);
}

.store-card-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.store-card.is-coming-soon .store-card-media img {
  filter: saturate(0.75) brightness(1.02);
}

.store-card-placeholder {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 1 / 1;
  font-size: 3rem;
  color: var(--color-purple);
  background: linear-gradient(135deg, rgba(123, 68, 193, 0.12), rgba(30, 150, 252, 0.12));
}

/* coming-soon ribbon */
.store-ribbon {
  position: absolute;
  top: 0.9rem;
  left: -2.4rem;
  z-index: 1;
  transform: rotate(-35deg);
  width: 9.5rem;
  text-align: center;
  padding: 0.3rem 0;
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #1f1300;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  pointer-events: none;
}

.store-card-body {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  padding: 1.1rem 1.2rem 1.3rem;
}

.store-card-title {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
}

.store-card-title a {
  color: var(--slate-darkest);
  text-decoration: none;
}

.store-card-title a:hover {
  color: var(--color-purple);
}

.store-card-blurb {
  flex: 1 1 auto;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--slate-medium);
  margin-bottom: 1rem;
}

.store-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* The add control is a <form> now (#4). It sits as a flex item in the card
   footer where a bare <button> used to, so it must not carry the UA's
   default form margin. */
.store-card-add-form {
  margin: 0;
}

.store-card-btn {
  padding: 8px 18px;
  font-size: 0.85rem;
  white-space: nowrap;
}

.store-card-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ---- Prices ---- */
.store-price {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: var(--slate-darkest);
  font-size: 1.05rem;
}

.store-compare-at {
  font-weight: 400;
  color: var(--slate-light);
  margin-right: 0.35rem;
  font-size: 0.9em;
}

.store-price-soon {
  font-size: 0.82rem;
  font-weight: 400;
  font-style: italic;
  color: #b45309;
}

/* ---- Shared: breadcrumb + notes + empty state ---- */
.store-breadcrumb {
  padding: 1.25rem 0 0.25rem;
}

.store-breadcrumb a {
  color: var(--color-purple);
  font-size: 0.9rem;
  text-decoration: none;
}

.store-breadcrumb a:hover {
  color: var(--color-blue);
  text-decoration: underline;
}

.store-catalog-note {
  text-align: center;
  font-size: 0.85rem;
  color: var(--slate-light);
  margin: 2.5rem auto 0;
}

.store-catalog-note a {
  color: var(--color-purple);
}

.store-empty {
  max-width: 480px;
  margin: 2rem auto;
  padding: 2.5rem 2rem;
  text-align: center;
}

.store-empty h2 {
  font-size: 1.4rem;
  color: var(--slate-darkest);
  margin-bottom: 0.6rem;
}

.store-empty p {
  color: var(--slate-medium);
  margin-bottom: 1.25rem;
}

/* ---- Product detail ---- */
.store-product {
  padding-bottom: 2rem;
}

.store-product-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1000px;
  margin: 1.25rem auto 0;
}

@media (min-width: 768px) {
  .store-product-grid {
    grid-template-columns: minmax(0, 420px) 1fr;
    align-items: start;
    gap: 3rem;
  }
}

.store-product-media {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 18px 48px -16px rgba(31, 38, 135, 0.35);
}

.store-product-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.store-product-media.is-coming-soon img {
  filter: saturate(0.75) brightness(1.02);
}

.store-product-detail h1 {
  font-size: clamp(1.7rem, 4vw, var(--text-2xl));
  color: var(--slate-darkest);
  margin-bottom: 0.5rem;
}

.store-product-blurb {
  font-size: 1.02rem;
  line-height: 1.65;
  color: var(--slate-medium);
  margin-bottom: 1rem;
}

.store-product-price {
  font-size: 1.5rem;
  margin-bottom: 0.35rem;
}

.store-shipping-note {
  color: var(--color-charcoal, #323031);
  opacity: 0.75;
  font-size: 0.9rem;
  margin-bottom: 1.1rem;
}

.store-buy-box {
  padding: 1.4rem 1.5rem;
  margin-bottom: 1.75rem;
}

.store-variant-select {
  width: 100%;
  max-width: 320px;
  margin-bottom: 1rem;
}

.store-buy-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.store-add-btn {
  flex: 1 1 auto;
  min-width: 10rem;
}

.store-buy-note {
  font-size: 0.78rem;
  color: var(--slate-light);
  margin: 0.9rem 0 0;
}

/* coming-soon box */
.store-soon-box {
  padding: 1.3rem 1.5rem;
  margin-bottom: 1.75rem;
  border-left: 4px solid #f59e0b;
}

.store-soon-line {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--slate-medium);
}

.store-soon-line strong {
  color: #b45309;
  text-transform: lowercase;
}

.store-soon-line a {
  color: var(--color-purple);
}

.store-product-description h2 {
  font-size: 1.2rem;
  color: var(--slate-darkest);
  margin-bottom: 0.5rem;
}

.store-product-description p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--slate-medium);
}

/* ---- Qty stepper ---- */
.store-qty {
  display: inline-flex;
  align-items: stretch;
  border: 1px solid rgba(123, 68, 193, 0.35);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.store-qty-btn {
  width: 2.25rem;
  border: none;
  background: rgba(123, 68, 193, 0.08);
  color: var(--color-purple);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--transition-fast);
}

.store-qty-btn:hover {
  background: rgba(123, 68, 193, 0.18);
}

.store-qty-input {
  width: 3rem;
  border: none;
  text-align: center;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.95rem;
  color: var(--slate-darkest);
  -moz-appearance: textfield;
  appearance: textfield;
}

.store-qty-input::-webkit-outer-spin-button,
.store-qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.store-qty-input:focus {
  outline: 2px solid rgba(123, 68, 193, 0.35);
  outline-offset: -2px;
}

/* ---- Cart page ---- */
.store-cart {
  padding-bottom: 2rem;
}

.store-cart h1 {
  font-size: clamp(1.8rem, 4vw, var(--text-2xl));
  color: var(--slate-darkest);
  margin: 0.75rem 0 1.5rem;
}

.store-cart-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.75rem;
  max-width: 1000px;
}

@media (min-width: 992px) {
  .store-cart-layout {
    grid-template-columns: 1fr minmax(280px, 340px);
    align-items: start;
  }
}

.store-cart-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

.store-cart-line {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 0.9rem 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 16px rgba(31, 38, 135, 0.08);
  padding: 1rem;
}

.store-cart-line + .store-cart-line {
  margin-top: 1rem;
}

@media (min-width: 576px) {
  .store-cart-line {
    grid-template-columns: 88px 1fr auto;
  }
}

.store-line-media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 10px;
}

.store-line-media .store-card-placeholder {
  border-radius: 10px;
  font-size: 1.6rem;
}

.store-line-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.store-line-title {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: var(--slate-darkest);
  text-decoration: none;
  font-size: 0.98rem;
  line-height: 1.35;
}

.store-line-title:hover {
  color: var(--color-purple);
}

.store-line-variant {
  font-size: 0.8rem;
  color: var(--slate-light);
}

.store-line-unit {
  font-size: 0.8rem;
  color: var(--slate-medium);
}

.store-line-controls {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  justify-content: space-between;
}

@media (min-width: 576px) {
  .store-line-controls {
    grid-column: auto;
    justify-content: flex-end;
  }
}

.store-line-total {
  font-family: 'Merriweather', Georgia, serif;
  font-weight: 700;
  color: var(--slate-darkest);
  min-width: 4.25rem;
  text-align: right;
}

.store-line-remove {
  border: none;
  background: transparent;
  color: var(--slate-light);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  border-radius: 8px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.store-line-remove:hover {
  color: var(--color-error);
  background: rgba(231, 76, 60, 0.08);
}

/* summary card */
.store-cart-summary {
  padding: 1.5rem 1.6rem;
}

.store-cart-summary h2 {
  font-size: 1.15rem;
  color: var(--slate-darkest);
  margin-bottom: 1rem;
}

.store-summary-rows {
  margin: 0 0 1.1rem;
}

.store-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.35rem 0;
}

.store-summary-row dt {
  font-weight: 300;
  color: var(--slate-medium);
  text-transform: lowercase;
}

.store-summary-row dd {
  margin: 0;
  font-weight: 700;
  color: var(--slate-darkest);
}

.store-summary-total {
  border-top: 1px solid rgba(50, 48, 49, 0.15);
  margin-top: 0.4rem;
  padding-top: 0.75rem;
}

.store-summary-total dd {
  font-size: 1.2rem;
}

.js-cart-shipping {
  color: var(--slate-darkest);
}

.store-checkout-form {
  margin: 0;
}

.store-checkout-btn {
  width: 100%;
}

/* ---- Success page ---- */
.store-success {
  padding: 2.5rem 0 1rem;
}

.store-success-card {
  max-width: 560px;
  margin: 0 auto;
  padding: 2.5rem 2rem;
  text-align: center;
}

.store-success-mark {
  display: inline-grid;
  place-items: center;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--color-purple) 0%, var(--color-blue) 100%);
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 1rem;
  box-shadow: 0 8px 20px rgba(123, 68, 193, 0.35);
}

.store-success-card h1 {
  font-size: clamp(1.8rem, 4vw, var(--text-2xl));
  color: var(--slate-darkest);
  margin-bottom: 0.75rem;
}

.store-success-lead {
  color: var(--slate-medium);
  line-height: 1.65;
  margin-bottom: 1.5rem;
}

.store-success-lead a {
  color: var(--color-purple);
}

.store-success-summary {
  text-align: left;
  background: rgba(255, 255, 255, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-md);
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}

.store-success-summary h2 {
  font-size: 1.05rem;
  color: var(--slate-darkest);
  margin-bottom: 0.75rem;
}

.store-success-items {
  list-style: none;
  margin: 0 0 0.9rem;
  padding: 0 0 0.75rem;
  border-bottom: 1px solid rgba(50, 48, 49, 0.12);
}

.store-success-items li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.3rem 0;
  font-size: 0.92rem;
  color: var(--slate-medium);
}

.store-success-item-price {
  font-weight: 700;
  color: var(--slate-darkest);
  white-space: nowrap;
}

.store-success-shipping {
  font-size: 0.88rem;
  color: var(--slate-medium);
  margin: 0.75rem 0 0;
}

.store-success-actions {
  display: flex;
  gap: 0.9rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ---- Add-to-cart toast ---- */
.store-toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  transform: translate(-50%, 1rem);
  z-index: var(--z-modal);
  background: rgba(50, 48, 49, 0.95);
  color: #fff;
  font-family: 'Merriweather', Georgia, serif;
  font-size: 0.9rem;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  border: 1px solid rgba(154, 213, 202, 0.5);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.store-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.store-toast .store-toast-check {
  color: var(--color-sage);
  margin-right: 0.4rem;
  font-weight: 700;
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  .store-card,
  .store-card:hover,
  .store-toast {
    transition: none;
    transform: none;
  }
}

/* Checkout-failure banner (cart.html ?error=checkout) */
.store-checkout-error {
    border-left: 4px solid #c0392b;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    border-radius: var(--brand-radius, 12px);
}
.store-checkout-error strong {
    display: block;
    margin-bottom: 0.25rem;
}

/* ---- Add-to-cart confirmation interstitial (#4) ----
   Replaces the auto-dismissing toast. Persistent by design: the shopper
   must be able to read what was added without racing a timer. */
.store-added {
  padding: 3rem 0 4rem;
}

.store-added-heading {
  text-align: center;
  margin-bottom: 1.75rem;
}

.store-added-check {
  color: var(--color-sage, #9AD5CA);
  margin-right: 0.4rem;
}

.store-added-panel {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.75rem;
}

.store-added-item {
  display: flex;
  align-items: center;
  gap: 1.1rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.store-added-media {
  border-radius: 8px;
  flex: 0 0 auto;
  height: auto;
  max-width: 120px;
}

.store-added-title {
  font-weight: 700;
  margin-bottom: 0.15rem;
}

.store-added-variant,
.store-added-price {
  margin-bottom: 0;
  opacity: 0.8;
}

.store-added-summary {
  margin: 1.25rem 0 0;
}

.store-added-summary > div {
  display: flex;
  justify-content: space-between;
  padding: 0.3rem 0;
}

.store-added-summary dt,
.store-added-summary dd {
  margin: 0;
}

.store-added-total {
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  margin-top: 0.4rem;
  padding-top: 0.6rem !important;
  font-weight: 700;
}

.store-added-threshold {
  font-size: 0.9rem;
  opacity: 0.75;
  margin: 0.5rem 0 0;
  text-align: right;
}

/* Stacked and full-width on mobile: these are the three exits, and adjacent
   controls need spacing as well as size — tight gaps make shoppers avoid the
   interaction rather than risk a mis-tap. */
.store-added-actions {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.6rem;
}

.store-added-actions .btn,
.store-added-checkout-form .btn {
  width: 100%;
}

.store-added-checkout-form {
  margin: 0;
}

.store-added-continue {
  text-align: center;
  padding: 0.5rem 0;
}

@media (min-width: 576px) {
  .store-added-actions {
    align-items: center;
    flex-direction: row;
  }

  .store-added-actions .btn,
  .store-added-checkout-form .btn {
    width: auto;
  }

  .store-added-continue {
    margin-left: auto;
  }
}
