/* =============================================================================
   DICKMAGNETS.COM - Responsive Stylesheet
   Mobile-first breakpoints and adaptive layouts
   ============================================================================= */

/* =============================================================================
   BASE MOBILE (default - applies to all sizes, overridden upward)
   ============================================================================= */

/* Product grid: single column on smallest screens */
.dm-product-grid {
  grid-template-columns: 1fr;
}

/* Category cards: single column on mobile */
.dm-category-cards {
  grid-template-columns: 1fr;
}

/* Header: show hamburger, hide nav */
.dm-menu-toggle {
  display: flex;
}

/* Hide desktop nav by default on mobile */
.dm-nav {
  display: none;
}

/* Single product: stack columns */
.dm-single-product-inner {
  grid-template-columns: 1fr;
}

/* Hero: more padding on mobile */
.dm-hero {
  padding-top: calc(var(--dm-header-height) + 40px);
  min-height: auto;
  padding-bottom: 80px;
}

/* Container padding reduction */
.dm-container {
  padding: 0 16px;
}

/* Section padding reduction */
.dm-section {
  padding: 40px 0;
}

/* Footer */
.dm-footer {
  margin-top: 40px;
  padding: 32px 0 16px;
}

.dm-footer-tagline {
  font-size: 1.5rem;
  margin-bottom: 20px;
}

.dm-footer-links {
  gap: 16px;
}

/* Header inner gap reduction */
.dm-header-inner {
  gap: 16px;
  padding: 0 16px;
}

/* Category card body on mobile */
.dm-category-card-name {
  font-size: 1.5rem;
}

/* STL viewer height on mobile */
.dm-stl-viewer {
  min-height: 160px;
}

/* Hide gallery sticky on mobile */
.dm-single-gallery {
  position: static;
}

/* =============================================================================
   MOBILE NAVIGATION OVERLAY
   Triggered by body.dm-nav-open class (added by JS on hamburger click)
   ============================================================================= */
body.dm-nav-open .dm-nav {
  display: flex;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: var(--dm-header-bg);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: var(--dm-header-height);
  animation: dm-fadeIn 0.25s ease;
}

body.dm-nav-open .dm-nav-list {
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 32px;
}

body.dm-nav-open .dm-nav-list > li {
  width: 100%;
  text-align: center;
}

body.dm-nav-open .dm-nav-list > li > a,
body.dm-nav-open .dm-nav-list > li > button {
  font-size: 1.5rem;
  font-family: var(--dm-font-heading);
  letter-spacing: 0.08em;
  padding: 14px 24px;
  width: 100%;
  justify-content: center;
  border-radius: var(--dm-radius);
}

body.dm-nav-open .dm-nav-list > li > a:hover,
body.dm-nav-open .dm-nav-list > li > button:hover {
  background: rgba(255, 0, 110, 0.2);
  color: var(--dm-pink);
}

/* Keep dropdowns hidden in mobile nav - JS handles tap-to-expand */
body.dm-nav-open .dm-has-dropdown .dm-dropdown {
  display: none;
  position: static;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--dm-radius);
  box-shadow: none;
  margin-top: 4px;
  animation: dm-fadeIn 0.2s ease;
}

body.dm-nav-open .dm-has-dropdown.dm-dropdown-open .dm-dropdown {
  display: block;
}

body.dm-nav-open .dm-has-dropdown .dm-dropdown a {
  font-size: 1.2rem;
  padding: 12px 24px;
  text-align: center;
}

/* Prevent body scroll when mobile nav is open */
body.dm-nav-open {
  overflow: hidden;
}

/* Close button inside mobile menu (positioned at top right) */
body.dm-nav-open .dm-menu-toggle {
  position: fixed;
  top: calc((var(--dm-header-height) - 40px) / 2);
  right: 16px;
  z-index: 1001;
}

/* =============================================================================
   SMALL MOBILE ( < 380px )
   ============================================================================= */
@media (max-width: 380px) {
  .dm-hero-title {
    font-size: clamp(2.2rem, 10vw, 3rem);
    text-shadow: 2px 2px 0 var(--dm-pink);
  }

  .dm-hero-cta {
    font-size: 1.2rem;
    padding: 14px 32px;
  }

  .dm-logo {
    font-size: 22px;
    letter-spacing: 1px;
  }

  .dm-product-card {
    border-radius: var(--dm-radius);
  }

  .dm-404-number {
    font-size: 8rem;
  }
}

/* =============================================================================
   MOBILE ( <= 640px )
   ============================================================================= */
@media (max-width: 640px) {
  /* Product grid stays 1 column */
  .dm-product-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Category cards stay 1 column */
  .dm-category-cards {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  /* Hero adjustments */
  .dm-hero {
    padding-top: calc(var(--dm-header-height) + 32px);
    min-height: 90vh;
  }

  .dm-hero-content {
    padding: 24px 16px 60px;
  }

  .dm-hero-subtitle {
    margin-bottom: 28px;
  }

  .dm-hero-cta {
    width: 100%;
    max-width: 320px;
    box-sizing: border-box;
  }

  /* Ticker font size */
  .dm-ticker {
    font-size: 12px;
  }

  /* Section title */
  .dm-section-title {
    font-size: 1.8rem;
  }

  /* Single product gallery on mobile */
  .dm-single-gallery-thumbs img {
    width: 52px;
    height: 52px;
  }

  /* Single product add to cart */
  .dm-single-add-to-cart {
    flex-direction: column;
  }

  .dm-single-add-to-cart .dm-btn-cart {
    width: 100%;
  }

  /* Product purchase row on small screens */
  .dm-product-purchase {
    flex-direction: column;
    gap: 8px;
  }

  .dm-btn-cart {
    width: 100%;
  }

  /* Footer nav */
  .dm-footer-nav {
    gap: 8px 16px;
  }

  .dm-footer-nav a {
    font-size: 13px;
  }

  /* Filter bar */
  .dm-filter-bar {
    gap: 8px;
  }

  .dm-filter-select {
    font-size: 13px;
    padding: 6px 32px 6px 12px;
  }

  /* Cart totals */
  .cart_totals {
    margin-left: 0;
    max-width: 100%;
  }

  /* Back to top position */
  .dm-back-top {
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    font-size: 18px;
  }

  /* Logo: abbreviate slightly */
  .dm-logo {
    font-size: 20px;
    letter-spacing: 1px;
  }

  /* Header actions: reduce gap */
  .dm-header-actions {
    gap: 6px;
  }

  .dm-cart-link span:not(.dm-cart-count) {
    display: none; /* hide "Cart" text, show only icon + count */
  }

  /* 404 */
  .dm-404-number {
    text-shadow: 4px 4px 0 var(--dm-yellow);
  }

  /* Page content */
  .dm-page-content {
    padding: 40px 16px;
  }

  /* WooCommerce checkout */
  .woocommerce .col2-set {
    grid-template-columns: 1fr;
  }

  /* Media tabs: smaller */
  .dm-media-tabs {
    top: 6px;
    right: 6px;
    gap: 3px;
  }

  .dm-tab-btn {
    font-size: 10px;
    padding: 3px 8px;
  }
}

/* =============================================================================
   TABLET ( 641px - 1024px )
   ============================================================================= */
@media (min-width: 641px) {
  /* Nav visible on tablet+ */
  .dm-nav {
    display: flex;
  }

  /* Hide hamburger on tablet+ */
  .dm-menu-toggle {
    display: none;
  }

  /* 2-column product grid */
  .dm-product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Category cards: 3 columns maintained */
  .dm-category-cards {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Hero: full height restored */
  .dm-hero {
    min-height: 100vh;
    padding-top: var(--dm-header-height);
  }

  /* Container padding restored */
  .dm-container {
    padding: 0 24px;
  }

  /* Section padding */
  .dm-section {
    padding: 56px 0;
  }

  /* Footer */
  .dm-footer {
    margin-top: 64px;
  }

  /* Header gap */
  .dm-header-inner {
    gap: 24px;
    padding: 0 24px;
  }

  /* Single product: 2 column on tablet */
  .dm-single-product-inner {
    grid-template-columns: 1fr 1fr;
  }

  /* Product purchase row */
  .dm-product-purchase {
    flex-direction: row;
  }

  /* Cart link text visible */
  .dm-cart-link span {
    display: inline;
  }
}

/* =============================================================================
   TABLET - WIDE ( 768px - 1024px )
   ============================================================================= */
@media (min-width: 768px) and (max-width: 1024px) {
  /* Slightly reduce nav font */
  .dm-nav-list > li > a,
  .dm-nav-list > li > button {
    font-size: 13px;
    padding: 8px 12px;
  }

  /* Logo size */
  .dm-logo {
    font-size: 24px;
  }

  /* Category card name */
  .dm-category-card-name {
    font-size: 1.8rem;
  }

  /* Single product gallery sticky */
  .dm-single-gallery {
    position: sticky;
    top: calc(var(--dm-header-height) + 24px);
  }
}

/* =============================================================================
   DESKTOP ( 1025px+ )
   ============================================================================= */
@media (min-width: 1025px) {
  /* 3-column product grid on desktop */
  .dm-product-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  /* Section padding full */
  .dm-section {
    padding: 64px 0;
  }

  /* Header inner gap full */
  .dm-header-inner {
    gap: 32px;
  }

  /* Logo full size */
  .dm-logo {
    font-size: 28px;
  }

  /* Single product gallery sticky */
  .dm-single-gallery {
    position: sticky;
    top: calc(var(--dm-header-height) + 24px);
  }

  /* Footer */
  .dm-footer {
    margin-top: 80px;
    padding: 48px 0 24px;
  }

  /* Category card name */
  .dm-category-card-name {
    font-size: 2rem;
  }
}

/* =============================================================================
   LARGE DESKTOP ( 1280px+ )
   ============================================================================= */
@media (min-width: 1280px) {
  /* 4-column product grid on large screens */
  .dm-product-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  /* Wider container padding */
  .dm-container {
    padding: 0 32px;
  }

  /* Hero title max size */
  .dm-hero-title {
    font-size: 7rem;
  }

  /* Single product more spacious */
  .dm-single-product-inner {
    gap: 64px;
  }
}

/* =============================================================================
   EXTRA LARGE ( 1600px+ )
   ============================================================================= */
@media (min-width: 1600px) {
  .dm-product-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 28px;
  }

  .dm-container {
    padding: 0 48px;
  }
}

/* =============================================================================
   NAVIGATION RESPONSIVE REFINEMENTS
   ============================================================================= */

/* Tablet: condensed nav */
@media (min-width: 641px) and (max-width: 900px) {
  .dm-nav-list > li > a,
  .dm-nav-list > li > button {
    font-size: 12px;
    padding: 7px 10px;
    letter-spacing: 0.03em;
  }

  .dm-header-inner {
    gap: 12px;
  }

  .dm-logo {
    font-size: 20px;
    letter-spacing: 1px;
  }
}

/* =============================================================================
   PRINT STYLES
   ============================================================================= */
@media print {
  .dm-header,
  .dm-ticker,
  .dm-hero,
  .dm-footer,
  .dm-back-top,
  .dm-filter-bar,
  .dm-btn-cart,
  .dm-carousel-btn,
  .dm-media-tabs,
  .dm-menu-toggle {
    display: none !important;
  }

  .dm-main {
    padding-top: 0;
  }

  .dm-product-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .dm-product-card {
    box-shadow: none;
    border: 1px solid #ccc;
    break-inside: avoid;
  }

  body {
    background: white;
    color: black;
  }
}

/* =============================================================================
   HIGH DPI / RETINA
   ============================================================================= */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
  /* Ensure borders stay crisp */
  .dm-product-card,
  .dm-category-card {
    border-width: calc(var(--dm-border-width) * 1px);
  }
}

/* =============================================================================
   LANDSCAPE MOBILE
   ============================================================================= */
@media (max-width: 896px) and (orientation: landscape) {
  .dm-hero {
    min-height: auto;
    padding-top: calc(var(--dm-header-height) + 20px);
    padding-bottom: 60px;
  }

  .dm-hero-title {
    font-size: clamp(2rem, 6vw, 4rem);
    margin-bottom: 12px;
  }

  .dm-hero-subtitle {
    font-size: 1rem;
    margin-bottom: 20px;
  }
}

/* =============================================================================
   HOVER-CAPABLE DEVICES ONLY
   (Avoids sticky hover states on touch devices)
   ============================================================================= */
@media (hover: hover) and (pointer: fine) {
  .dm-product-card:hover {
    transform: translateY(-6px);
  }

  .dm-category-card:hover {
    transform: translateY(-4px);
  }

  .dm-btn-cart:hover {
    transform: translate(-2px, -2px);
  }

  .dm-btn-primary:hover {
    transform: translate(-2px, -2px);
  }

  .dm-hero-cta:hover {
    transform: translate(-2px, -2px);
  }
}

/* On touch devices, remove hover transforms */
@media (hover: none) {
  .dm-product-card:hover,
  .dm-category-card:hover {
    transform: none;
  }

  .dm-btn-cart:hover,
  .dm-btn-primary:hover,
  .dm-hero-cta:hover {
    transform: none;
  }
}
