/* ============================================
   RESPONSIVE.CSS — RESTOCK CLUB
   Mobile-first breakpoints: 640, 768, 1024, 1280
   Sharp edges, gap 2px gallery style
   ============================================ */

/* ===== MOBILE UTILITIES ===== */

.desktop-only {
  display: none;
}

.mobile-only {
  display: block;
}


/* ===== MOBILE: < 640px ===== */

@media (max-width: 639px) {
  .toast-container {
    left: var(--space-sm);
    right: var(--space-sm);
    max-width: none;
  }

  .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }
}

/* ===== MOBILE HEADER FIX: icons don't overlap logo ===== */
@media (max-width: 1023px) {
  .header__right {
    margin-right: -8px;
    gap: 0;
  }

  .header__action {
    width: 34px;
    height: 34px;
  }

  .header__action svg {
    width: 20px;
    height: 20px;
  }
}


/* ===== SM: 640px ===== */

@media (min-width: 640px) {

  /* Trust bar: 2 -> 4 columns */
  .trust__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Collection grid: 2 col stays, wider gap */
  .collection-grid {
    gap: var(--gap);
  }

  /* Blog grid: 2 col */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Newsletter: inline form */
  .newsletter__form {
    flex-direction: row;
    max-width: 420px;
    margin: 0 auto;
  }

  .newsletter__form .input {
    text-align: left;
  }

  /* Footer: 2 col */
  .footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Advantages: 2 col */
  .advantages__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Stats: 4 col */
  .stats__grid {
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-xl);
  }

  /* Toast position */
  .toast-container {
    max-width: 380px;
  }
}


/* ===== MD: 768px ===== */

@media (min-width: 768px) {

  /* Collections: 2 col layout */
  .collections__grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .collections__grid .card-collection {
    aspect-ratio: 16/9;
  }

  /* Featured: 3 col */
  .featured__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Product page: 2 col */
  .product__inner {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2xl);
    align-items: start;
  }

  .product__gallery {
    position: sticky;
    top: 100px;
  }

  /* Product related: 3 col */
  .product__related-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hide mobile sticky CTA on tablet+ */
  .section-sticky-cta {
    display: none;
  }

  /* Footer: 3 col */
  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .footer__bottom {
    flex-direction: row;
    justify-content: space-between;
  }

  /* Carousel items wider */
  .models__track .card-product {
    flex: 0 0 260px;
  }

  /* Blog grid stays 2 col */
  .blog-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Newsletter form inline */
  .newsletter__form {
    flex-direction: row;
  }

  .newsletter__form .input {
    text-align: left;
  }
}


/* ===== LG: 1024px ===== */

@media (min-width: 1024px) {

  /* Show desktop nav, hide burger */
  .header__burger {
    display: none;
  }

  .header__center {
    display: flex;
  }

  /* Header: logo left, nav center, actions right */
  .header__inner {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: var(--space-lg);
  }

  .header__left {
    display: none;
  }

  .header__logo {
    position: static;
    transform: none;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
    max-width: none;
    overflow: visible;
  }

  .header__logo-img {
    height: 55px;
  }

  .header__inner > .header__center {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
  }

  .header__right {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    flex: none;
  }

  .desktop-only {
    display: block;
  }

  .mobile-only {
    display: none;
  }

  /* Grids bump up */
  .grid-2-lg { grid-template-columns: repeat(2, 1fr); }
  .grid-3-lg { grid-template-columns: repeat(3, 1fr); }
  .grid-4-lg { grid-template-columns: repeat(4, 1fr); }

  /* Collection grid: 3 col */
  .collection-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Featured: 4 col */
  .featured__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Collections: 3 equal columns */
  .collections__grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .collections__grid .card-collection {
    aspect-ratio: 16/9;
  }

  /* Advantages: 4 col */
  .advantages__grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Blog grid: 3 col */
  .blog-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Footer: 4 col */
  .footer__grid {
    grid-template-columns: 1.5fr 1fr 1fr 1fr;
  }

  /* Product page gallery sticky */
  .product__gallery {
    top: 90px;
  }

  /* Product related: 4 col */
  .product__related-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Section spacing larger */
  section {
    padding-block: var(--space-3xl);
  }

  /* Carousel items */
  .models__track .card-product {
    flex: 0 0 300px;
  }
}


/* ===== XL: 1280px ===== */

@media (min-width: 1280px) {

  /* Max width containers */
  .container {
    padding-inline: var(--space-lg);
  }

  /* Collection grid: 4 col */
  .collection-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Featured products larger gap */
  .featured__grid {
    gap: var(--gap);
  }

  /* Gallery thumbs bigger */
  .product__gallery-thumb {
    width: 80px;
    height: 100px;
  }

  /* Carousel items bigger */
  .models__track .card-product {
    flex: 0 0 320px;
  }
}


/* ===== PRODUCT PAGE MOBILE FIX ===== */
/* Optimized for iPhone (375px) and similar */

@media (max-width: 767px) {
  .page-product .product__inner {
    gap: var(--space-md);
    padding-top: 0;
  }

  .page-product .product__title {
    font-size: var(--font-size-lg);
    line-height: 1.2;
  }

  .page-product .product__price-current {
    font-size: var(--font-size-xl);
  }

  .page-product .product__price-save {
    font-size: 10px;
    padding: 3px 8px;
  }

  /* Gallery full bleed on mobile */
  .page-product .product__gallery {
    margin-inline: calc(-1 * var(--space-sm));
    width: calc(100% + 2 * var(--space-sm));
  }

  .page-product .product__gallery-thumbs {
    justify-content: center;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .page-product .product__gallery-thumbs::-webkit-scrollbar { display: none; }

  .page-product .product__gallery-thumb {
    width: 60px;
    height: 75px;
    flex-shrink: 0;
  }

  /* Add to cart full width */
  .product__add {
    flex-direction: column;
  }

  .product__add .btn {
    width: 100%;
    text-align: center;
    justify-content: center;
  }

  /* Trust badges compact */
  .page-product .product__trust {
    padding: var(--space-sm);
    gap: var(--space-xs);
  }

  .page-product .product__trust-item {
    font-size: var(--font-size-xs);
  }

  /* Tabs/accordion compact */
  .page-product .product__tabs {
    margin-top: var(--space-md);
  }

  .page-product .accordion__trigger {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
  }

  .page-product .accordion__content-inner {
    padding: 0 var(--space-md) var(--space-md);
  }

  /* Related products tighter */
  .page-product .product__related {
    padding-top: var(--space-xl);
    margin-top: var(--space-xl);
  }

  .page-product .product__related-title {
    font-size: var(--font-size-lg);
    margin-bottom: var(--space-md);
  }

  .page-product .product__related-grid {
    gap: var(--space-sm);
  }

  /* Sticky CTA proper mobile layout */
  .section-sticky-cta {
    padding: var(--space-sm) var(--space-md);
    gap: var(--space-sm);
  }

  .sticky-cta__price {
    min-width: 0;
  }

  /* Toast container above sticky CTA */
  .toast-container {
    bottom: 80px;
  }

  /* Review cards horizontal scroll */
  .review__card {
    flex: 0 0 85vw;
  }
}

@media (min-width: 768px) {
  .product__add {
    flex-direction: row;
  }
}


/* ===== HOVER MEDIA QUERY ===== */
/* Only show hover effects on devices that support hover */

@media (hover: hover) and (pointer: fine) {
  .card-product__cta {
    transform: translateY(100%);
  }

  .card-product:hover .card-product__cta {
    transform: translateY(0);
  }
}

/* Touch devices: always show CTA */
@media (hover: none) {
  .card-product__cta {
    transform: translateY(0);
    position: relative;
    background: none;
    padding: var(--space-xs) var(--space-md) var(--space-sm);
  }
}


/* ===== PRINT ===== */

@media print {
  body::after {
    display: none;
  }

  .scroll-progress,
  .section-announcement,
  .section-sticky-cta,
  .toast-container,
  .popup,
  .lightbox,
  .search-modal,
  .overlay,
  .drawer,
  .mobile-menu {
    display: none;
  }

  .section-header {
    position: static;
  }

  .card-product:hover {
    transform: none;
  }
}


/* ===== SIZE TABLE WRAPPER ===== */
.size-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.size-table-wrap::-webkit-scrollbar {
  height: 4px;
}

.size-table-wrap::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* ===== SIZE TABLE ===== */
.size-table {
  width: 100%;
  border-collapse: collapse;
  margin: var(--space-md) 0;
  font-size: var(--font-size-sm);
}

.size-table th,
.size-table td {
  padding: 10px 14px;
  text-align: center;
  border: 1px solid var(--border);
}

.size-table th {
  background: var(--bg-alt);
  font-weight: 600;
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
}

.size-table td {
  color: var(--text-secondary);
}

.size-table tr:hover td {
  background: var(--bg-alt);
}

/* ===== COLLECTIONS INDEX ===== */
.collections-index-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap);
}

@media (min-width: 768px) {
  .collections-index-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .collections-index-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
