/* ============================================
   MugShop — Responsive
   Breakpoints, touch targets, fluid sizing
   ============================================ */

/* ══════════════════════════════════════════════
   TOUCH TARGETS
   ══════════════════════════════════════════════ */

/* Ensure interactive elements have minimum touch target */
.btn,
.checkbox input,
.radio input,
.nav__link,
.nav__search-toggle,
.nav__cart,
.nav__hamburger,
.product-card__wishlist,
.product-card__quick-view .btn,
.quantity__btn,
.pagination__btn,
.category-pill,
.filter-sidebar__clear,
.products-toolbar__view-btn {
  min-height: 48px;
  min-width: 48px;
}

/* ══════════════════════════════════════════════
   FLUID FONT SIZING
   ══════════════════════════════════════════════ */

/* All major headings already use clamp() in variables.css.
   Additional fluid overrides for specific components: */

.product-card__name {
  font-size: clamp(0.875rem, 0.8rem + 0.3vw, 1rem);
}

.product-detail__title {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2.25rem);
}

.hero__stat-number {
  font-size: clamp(1.5rem, 1.2rem + 0.8vw, 2.25rem);
}

.cart-page__summary-title {
  font-size: clamp(1.1rem, 1rem + 0.3vw, 1.25rem);
}


/* ══════════════════════════════════════════════
   1200px — Large tablets / small desktops
   ══════════════════════════════════════════════ */

@media (max-width: 1200px) {
  .container {
    padding-inline: var(--space-5);
  }

  .product-detail {
    gap: var(--space-8);
  }

  .products-layout {
    grid-template-columns: 220px 1fr;
    gap: var(--space-6);
  }

  .cart-page__layout {
    grid-template-columns: 1fr 340px;
    gap: var(--space-6);
  }

  .hero__stats {
    gap: var(--space-8);
    padding: var(--space-5) var(--space-6);
  }

  .filter-sidebar {
    max-width: 220px;
  }
}


/* ══════════════════════════════════════════════
   992px — Tablets landscape
   ══════════════════════════════════════════════ */

@media (max-width: 992px) {
  .products-layout {
    grid-template-columns: 1fr;
  }

  .filter-sidebar {
    position: static;
    max-height: none;
    display: none;
  }

  .filter-sidebar.mobile-active {
    display: block;
    position: fixed;
    inset: 0;
    inset-inline-start: 0;
    z-index: var(--z-modal);
    max-width: 320px;
    border-radius: 0;
    overflow-y: auto;
  }

  .product-detail {
    grid-template-columns: 1fr;
    gap: var(--space-8);
  }

  .product-detail__gallery {
    position: static;
  }

  .cart-page__layout {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .cart-page__summary {
    position: static;
  }

  .hero__stats {
    gap: var(--space-6);
    flex-wrap: wrap;
    justify-content: center;
  }

  .hero__stat-divider {
    display: none;
  }

  .hero__title {
    font-size: clamp(2rem, 1.5rem + 2.5vw, 3.5rem);
  }
}


/* ══════════════════════════════════════════════
   768px — Tablets portrait / Mobile breakpoints
   ══════════════════════════════════════════════ */

@media (max-width: 768px) {
  /* ── Nav ───────────────────────────────────── */
  .nav__links {
    display: none;
  }

  .nav__hamburger {
    display: flex;
  }

  /* ── Hero ──────────────────────────────────── */
  .hero {
    min-height: calc(100vh - 40px);
  }

  .hero__title {
    font-size: clamp(1.75rem, 1.3rem + 2.5vw, 3rem);
  }

  .hero__subtitle {
    font-size: clamp(0.875rem, 0.8rem + 0.5vw, 1.125rem);
  }

  .hero__actions {
    flex-direction: column;
    gap: var(--space-3);
  }

  .hero__actions .btn {
    width: 100%;
    max-width: 280px;
  }

  .hero__stats {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-5);
  }

  .hero__stat-divider {
    display: none;
  }

  .hero::after {
    width: 300px;
    height: 300px;
  }

  .hero__orb--1 {
    width: 250px;
    height: 250px;
  }

  .hero__orb--2 {
    width: 200px;
    height: 200px;
  }

  /* ── Product Grid: 2 columns ───────────────── */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-4);
  }

  .product-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }

  .product-grid--2 {
    grid-template-columns: 1fr;
  }

  /* ── Product Card adjustments ──────────────── */
  .product-card__image-wrap {
    aspect-ratio: 1;
  }

  .product-card__body {
    padding: var(--space-3) var(--space-4);
  }

  .product-card__name {
    font-size: var(--font-size-sm);
  }

  .product-card__quick-view {
    display: none;
  }

  .product-card__wishlist {
    opacity: 1;
    transform: scale(1);
    width: 32px;
    height: 32px;
  }

  /* ── Cart sidebar: full width ──────────────── */
  .cart {
    width: 100%;
    inset-inline-start: 0 !important;
    inset-inline-end: 0 !important;
    transform: translateX(-100%) !important;
  }

  [dir="rtl"] .cart {
    transform: translateX(100%) !important;
  }

  /* ── Section spacing ───────────────────────── */
  .section {
    padding-block: var(--space-12);
  }

  .section--lg {
    padding-block: var(--space-16);
  }

  /* ── Footer: stack columns ─────────────────── */
  .footer__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }

  .footer__bottom {
    flex-direction: column;
    gap: var(--space-4);
    text-align: center;
  }

  .footer__social {
    justify-content: center;
  }

  /* ── Category pills: full width scroll ─────── */
  .category-pills {
    margin-inline: calc(-1 * var(--container-padding));
    padding-inline: var(--container-padding);
  }

  /* ── Products toolbar ──────────────────────── */
  .products-toolbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .products-toolbar__right {
    width: 100%;
    justify-content: space-between;
  }

  .products-toolbar__search .input {
    width: 100%;
  }

  .products-toolbar__search:focus-within .input {
    width: 100%;
  }

  /* ── Product detail ────────────────────────── */
  .product-detail__thumbnails {
    overflow-x: auto;
    scrollbar-width: none;
  }

  .product-detail__thumbnails::-webkit-scrollbar {
    display: none;
  }

  .product-detail__features {
    grid-template-columns: 1fr;
  }

  .product-detail__cart-row {
    flex-wrap: wrap;
  }

  .product-detail__cart-row .btn--primary {
    width: 100%;
  }

  /* ── Cart table (full page) ────────────────── */
  .cart-table__head {
    display: none;
  }

  .cart-table__row {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .cart-table__product {
    gap: var(--space-3);
  }

  /* ── Modal ─────────────────────────────────── */
  .modal-overlay {
    padding: var(--space-4);
    align-items: flex-end;
  }

  .modal {
    border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
    max-height: 90vh;
  }

  /* ── Breadcrumb: wrap ──────────────────────── */
  .breadcrumb {
    font-size: var(--font-size-xs);
  }

  /* ── Pagination ────────────────────────────── */
  .pagination__btn {
    min-width: 40px;
    height: 40px;
  }

  /* ── Related products carousel ─────────────── */
  .related-products__track .product-card {
    min-width: 220px;
    max-width: 220px;
  }

  /* ── Accordion ─────────────────────────────── */
  .accordion__trigger {
    padding: var(--space-3) var(--space-4);
  }

  .accordion__body {
    padding: 0 var(--space-4) var(--space-4);
  }
}


/* ══════════════════════════════════════════════
   576px — Mobile
   ══════════════════════════════════════════════ */

@media (max-width: 576px) {
  :root {
    --container-padding: var(--space-4);
  }

  /* ── Hero ──────────────────────────────────── */
  .hero__title {
    font-size: clamp(1.5rem, 1.2rem + 2vw, 2.5rem);
  }

  .hero__badge {
    font-size: 0.65rem;
    padding: var(--space-1) var(--space-3);
  }

  .hero__scroll {
    bottom: var(--space-4);
  }

  /* ── Product grid ──────────────────────────── */
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-3);
  }

  .product-card__body {
    padding: var(--space-2) var(--space-3);
  }

  .product-card__category {
    display: none;
  }

  .product-card__rating {
    margin-bottom: var(--space-2);
  }

  .product-card__action {
    padding-top: var(--space-2);
  }

  .product-card__action .btn {
    font-size: var(--font-size-xs);
    padding: 0.5em 1em;
  }

  /* ── Section spacing ───────────────────────── */
  .section {
    padding-block: var(--space-8);
  }

  .section--lg {
    padding-block: var(--space-12);
  }

  /* ── Product detail ────────────────────────── */
  .product-detail__main-image {
    border-radius: var(--radius-lg);
  }

  .product-detail__thumbs {
    gap: var(--space-2);
  }

  .product-detail__thumb {
    width: 60px;
    height: 60px;
  }

  .product-detail__title {
    font-size: clamp(1.25rem, 1rem + 0.8vw, 1.75rem);
  }

  .product-detail__options {
    gap: var(--space-4);
  }

  /* ── Price display ─────────────────────────── */
  .price__current {
    font-size: var(--font-size-lg);
  }

  .price__current--lg {
    font-size: var(--font-size-2xl);
  }

  /* ── Filter sidebar ────────────────────────── */
  .filter-sidebar.mobile-active {
    width: 85%;
    max-width: 320px;
  }

  /* ── Toast ─────────────────────────────────── */
  .toast-container {
    left: var(--space-4);
    right: var(--space-4);
    transform: none;
  }

  .toast {
    max-width: 100%;
  }

  /* ── Tabs ──────────────────────────────────── */
  .tabs__tab {
    padding: var(--space-3) var(--space-4);
    font-size: var(--font-size-xs);
  }

  /* ── Color swatches ────────────────────────── */
  .color-swatch__circle {
    width: 28px;
    height: 28px;
  }
}


/* ══════════════════════════════════════════════
   400px — Small mobile
   ══════════════════════════════════════════════ */

@media (max-width: 400px) {
  /* ── Product grid: forced single column or tight 2 ── */
  .product-grid {
    grid-template-columns: 1fr;
    gap: var(--space-3);
  }

  .product-card {
    flex-direction: row;
  }

  .product-card__image-wrap {
    width: 120px;
    min-height: 120px;
    aspect-ratio: auto;
  }

  .product-card__body {
    padding: var(--space-3);
  }

  /* ── Hero headline ─────────────────────────── */
  .hero__title {
    font-size: clamp(1.3rem, 1.1rem + 1.5vw, 2rem);
  }

  .hero__stat-number {
    font-size: clamp(1.25rem, 1rem + 0.6vw, 1.75rem);
  }

  /* ── Buttons: ensure touch targets ─────────── */
  .btn--sm {
    padding: 0.5em 1em;
    min-height: 44px;
  }

  /* ── Cart item compact ─────────────────────── */
  .cart__item-thumb {
    width: 64px;
    height: 64px;
  }

  .cart__item .quantity__btn {
    width: 32px;
    height: 32px;
  }

  /* ── Modal on mobile ───────────────────────── */
  .modal-overlay {
    padding: 0;
  }

  .modal {
    min-height: 100vh;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal__header {
    padding: var(--space-4) var(--space-5);
  }

  .modal__body {
    padding: var(--space-5);
  }

  /* ── Footer columns: single ────────────────── */
  .footer__grid {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  /* ── Related products ──────────────────────── */
  .related-products__track .product-card {
    min-width: 200px;
    max-width: 200px;
  }

  /* ── Cart page ─────────────────────────────── */
  .cart-page__layout {
    gap: var(--space-4);
  }

  .cart-page__summary {
    padding: var(--space-4);
  }

  .cart-page__coupon {
    flex-direction: column;
  }
}


/* ══════════════════════════════════════════════
   HIGH DPI / RETINA
   ══════════════════════════════════════════════ */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  .skeleton::after {
    background: linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 255, 255, 0.06) 50%,
      transparent 100%
    );
  }
}


/* ══════════════════════════════════════════════
   REDUCED MOTION
   ══════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .hero::after,
  .hero__orb--1,
  .hero__orb--2 {
    animation: none;
  }

  .hero__scroll-wheel {
    animation: none;
  }

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

  .card:hover {
    transform: none;
  }
}


/* ══════════════════════════════════════════════
   DARK MODE (already dark, but system-aware)
   ══════════════════════════════════════════════ */

@media (prefers-color-scheme: light) {
  /* Site is always dark — this is a no-op guard
     Prevents browser from auto-switching */
}
