/**
 * Stitch Premium Organic Storefront - CSS Design System
 * Matches Google Stitch UI & DESIGN.md specifications
 * Optimized for Mobile 2-Column Responsive eCommerce Layouts
 */

:root {
  --stitch-primary: #002717;
  --stitch-primary-container: #173d2b;
  --stitch-secondary: #506532;
  --stitch-secondary-container: #cfe9a8;
  --stitch-tertiary: #2d1e00;
  --stitch-tertiary-container: #483200;
  --stitch-tertiary-fixed-dim: #e8c176;
  --stitch-gold: #C9A45C;
  --stitch-gold-dim: #be9a53;
  --stitch-gold-subtle: rgba(201, 164, 92, 0.28);
  --stitch-surface: #fbf9f2;
  --stitch-surface-subtle: #F0EBDD;
  --stitch-surface-container-low: #f5f4ed;
  --stitch-surface-container-lowest: #ffffff;
  --stitch-text-primary: #242824;
  --stitch-text-muted: #777D74;
  --stitch-font-headline: 'Playfair Display', Georgia, serif;
  --stitch-font-body: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Global Reset & Typography Baseline */
body, .editor-styles-wrapper {
  background-color: var(--stitch-surface);
  color: var(--stitch-text-primary);
  font-family: var(--stitch-font-body);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .wp-block-post-title, .stitch-heading-editorial {
  font-family: var(--stitch-font-headline);
  color: var(--stitch-primary);
  letter-spacing: -0.015em;
}

/* Primary Button Styling */
.stitch-btn-primary .wp-block-button__link,
.stitch-btn-primary a.button,
button.stitch-btn-primary {
  background-color: var(--stitch-primary) !important;
  color: #ffffff !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 700 !important;
  font-size: 14px !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  border-radius: 8px !important;
  padding: 14px 32px !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  box-shadow: 0 4px 14px rgba(0, 39, 23, 0.15) !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  border: none !important;
  text-decoration: none !important;
}

.stitch-btn-primary .wp-block-button__link:hover,
.stitch-btn-primary a.button:hover,
button.stitch-btn-primary:hover {
  background-color: var(--stitch-secondary) !important;
  box-shadow: 0 6px 20px rgba(80, 101, 50, 0.25) !important;
  transform: translateY(-1px) !important;
}

/* Secondary Button Styling */
.stitch-btn-secondary .wp-block-button__link,
.stitch-btn-secondary a.button {
  background-color: var(--stitch-surface-subtle) !important;
  color: var(--stitch-primary) !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 600 !important;
  font-size: 14px !important;
  border-radius: 8px !important;
  padding: 14px 28px !important;
  transition: all 0.2s ease !important;
  border: 1px solid rgba(23, 61, 43, 0.1) !important;
  text-decoration: none !important;
}

.stitch-btn-secondary .wp-block-button__link:hover,
.stitch-btn-secondary a.button:hover {
  background-color: #eae8e1 !important;
  color: var(--stitch-primary) !important;
}

/* Category Card Micro-Interactions */
.stitch-cat-card {
  transition: transform 0.35s ease, box-shadow 0.35s ease !important;
}
.stitch-cat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(23, 61, 43, 0.09) !important;
}
.stitch-cat-card img {
  transition: transform 0.5s ease-out !important;
}
.stitch-cat-card:hover img {
  transform: scale(1.05);
}

/* Product Card Micro-Interactions */
.stitch-product-card {
  transition: transform 0.3s ease, box-shadow 0.3s ease !important;
}
.stitch-product-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 32px rgba(23, 61, 43, 0.1) !important;
}
.stitch-product-card img {
  transition: transform 0.5s ease-out !important;
}
.stitch-product-card:hover img {
  transform: scale(1.04);
}

/* Star Rating Gold Accent */
.star-rating, .stitch-stars, .woocommerce .star-rating span {
  color: var(--stitch-gold-dim) !important;
}

/* Floating WhatsApp Support Button */
.stitch-whatsapp-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background-color: #25D366;
  color: #ffffff;
  border-radius: 9999px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--stitch-font-body);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(37, 211, 102, 0.35);
  z-index: 9999;
  transition: all 0.3s ease;
}

.stitch-whatsapp-float:hover {
  background-color: #20BA5A;
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(37, 211, 102, 0.45);
  color: #ffffff;
}

/* Floating Badge Hover */
.stitch-floating-badge {
  transition: transform 0.3s ease;
}
.stitch-floating-badge:hover {
  transform: translateY(-2px);
}

/* WooCommerce Enhancements */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
  color: var(--stitch-primary) !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 700 !important;
}

.woocommerce div.product .product_title {
  font-family: var(--stitch-font-headline) !important;
  color: var(--stitch-primary) !important;
}

.woocommerce #respond input#submit.alt,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt {
  background-color: var(--stitch-primary) !important;
  color: #ffffff !important;
  border-radius: 8px !important;
  font-family: var(--stitch-font-body) !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  padding: 14px 28px !important;
}

.woocommerce #respond input#submit.alt:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover {
  background-color: var(--stitch-secondary) !important;
}

/* =======================================================
   RESPONSIVE MOBILE ENGINE (Max-Width: 781px)
   Enforces 2-Column (Double) Layouts across All Sections
   ======================================================= */
@media (max-width: 781px) {

  /* 1. Category Grids: 2 Columns Side by Side */
  .stitch-category-grid,
  .stitch-category-grid-row2 {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
    margin-bottom: 12px !important;
  }
  .stitch-category-grid > .wp-block-column,
  .stitch-category-grid-row2 > .wp-block-column {
    flex-basis: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .stitch-cat-card {
    border-radius: 8px !important;
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }
  .stitch-cat-card > a {
    display: flex !important;
    flex-direction: column !important;
    height: 100% !important;
  }
  .stitch-cat-card > a > div:last-child {
    padding: 12px 10px !important;
    flex-grow: 1 !important;
  }
  .stitch-cat-card h3 {
    font-size: 15px !important;
    line-height: 1.25 !important;
    margin-bottom: 2px !important;
  }
  .stitch-cat-card p {
    font-size: 11px !important;
    line-height: 1.35 !important;
    margin-bottom: 8px !important;
  }
  .stitch-cat-card span {
    font-size: 10px !important;
    letter-spacing: 0.05em !important;
  }
  .stitch-cat-card span[style*="position:absolute"] {
    font-size: 9px !important;
    padding: 2px 6px !important;
    top: 8px !important;
    left: 8px !important;
  }

  /* 2. Best Sellers & WooCommerce Products: 2 Columns Side by Side */
  .stitch-product-grid-curated,
  ul.products {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }
  .stitch-product-grid-curated > .wp-block-column,
  ul.products li.product {
    flex-basis: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }
  .stitch-product-card {
    border-radius: 8px !important;
  }
  .stitch-product-card > div:first-child > div:last-child {
    padding: 12px 10px 8px 10px !important;
  }
  .stitch-product-card h3 {
    font-size: 14px !important;
    line-height: 1.3 !important;
    margin-bottom: 4px !important;
  }
  .stitch-product-card p {
    font-size: 11px !important;
    margin-bottom: 8px !important;
  }
  .stitch-product-card span[style*="font-size:22px"] {
    font-size: 16px !important;
  }
  .stitch-product-card span[style*="text-decoration:line-through"] {
    font-size: 11px !important;
    display: block !important;
    margin-left: 0 !important;
  }
  .stitch-product-card a[href*="add-to-cart"] {
    padding: 6px 12px !important;
    font-size: 12px !important;
    border-radius: 6px !important;
  }
  .stitch-product-card > div:last-child {
    padding: 0 10px 12px 10px !important;
  }

  /* 3. Trust Benefits Bar: 2x2 Grid on Mobile */
  .stitch-trust-benefits .wp-block-columns {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .stitch-trust-benefits .wp-block-column {
    flex-basis: 100% !important;
    width: 100% !important;
    padding: 14px 12px !important;
  }
  .stitch-trust-benefits h4 {
    font-size: 15px !important;
    margin-bottom: 4px !important;
  }
  .stitch-trust-benefits p {
    font-size: 11px !important;
    line-height: 1.4 !important;
  }

  /* 4. Why Choose Us (Clean Standard): 2x2 Grid on Mobile */
  .stitch-why-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .stitch-why-grid > .wp-block-column {
    flex-basis: 100% !important;
    width: 100% !important;
    padding: 16px 12px !important;
  }
  .stitch-why-grid h4 {
    font-size: 15px !important;
    margin-bottom: 4px !important;
  }
  .stitch-why-grid p {
    font-size: 11px !important;
    line-height: 1.4 !important;
  }

  /* 5. Instagram Gallery: 3 Columns Grid on Mobile */
  .stitch-instagram-grid {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }
  .stitch-instagram-grid > .wp-block-column {
    flex-basis: 100% !important;
    width: 100% !important;
    margin: 0 !important;
  }

  /* 6. Hero Section Typography & Spacing on Mobile */
  .stitch-hero-section {
    padding: 36px 16px !important;
  }
  .stitch-hero-section h1 {
    font-size: 32px !important;
    line-height: 1.2 !important;
    margin-bottom: 14px !important;
  }
  .stitch-hero-section p {
    font-size: 15px !important;
    line-height: 1.5 !important;
    margin-bottom: 20px !important;
  }
  .stitch-quick-stats {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding-top: 14px !important;
  }
  .stitch-quick-stats > .wp-block-column {
    flex-basis: 100% !important;
  }
  .stitch-floating-badge {
    margin-top: -30px !important;
    margin-left: 8px !important;
    margin-right: 8px !important;
    padding: 12px 14px !important;
  }
  .stitch-floating-badge p[style*="font-size:17px"] {
    font-size: 14px !important;
  }

  /* 7. Section Headings Scale Down on Mobile */
  .stitch-category-section h2,
  .stitch-bestsellers-section h2,
  .stitch-brand-story h2,
  .stitch-featured-banner h2,
  .stitch-why-choose h2,
  .stitch-testimonials h2,
  .stitch-instagram h2,
  .stitch-newsletter h2 {
    font-size: 26px !important;
    line-height: 1.25 !important;
    margin-bottom: 8px !important;
  }

  /* 8. Section Global Mobile Padding */
  .stitch-category-section,
  .stitch-bestsellers-section,
  .stitch-brand-story,
  .stitch-featured-banner,
  .stitch-why-choose,
  .stitch-testimonials,
  .stitch-instagram,
  .stitch-newsletter,
  .stitch-footer {
    padding: 40px 16px !important;
  }

  /* 9. Brand Story Column on Mobile */
  .stitch-brand-story .wp-block-column:last-child {
    padding-left: 0 !important;
    margin-top: 24px !important;
  }

  /* 10. Featured Collection Banner on Mobile */
  .stitch-featured-banner .wp-block-column:last-child {
    margin-top: 24px !important;
  }

  /* 11. Testimonials Stacked on Mobile */
  .stitch-testimonial-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 14px !important;
  }
  .stitch-testimonial-grid > .wp-block-column {
    padding: 20px 16px !important;
  }

  /* 12. Footer: 2 Columns on Mobile */
  .stitch-footer .wp-block-columns {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 24px 14px !important;
    margin-bottom: 28px !important;
  }
  .stitch-footer .wp-block-column:first-child {
    grid-column: span 2 !important;
  }

  /* 13. Floating WhatsApp compact circle on Mobile */
  .stitch-whatsapp-float {
    bottom: 16px !important;
    right: 16px !important;
    padding: 12px !important;
    border-radius: 50% !important;
  }
  .stitch-whatsapp-float .stitch-whatsapp-label {
    display: none !important;
  }
}
