/*
 * Darius mobile photo & layout polish v1.7.8
 * Corrects small/over-compressed mobile imagery from earlier overrides.
 * Uses the approved source photographs; does not invent product/model images.
 */

@media screen and (max-width: 760px) {
  /* Six-family grid: preserve full product artwork at a readable size. */
  html body .category-grid.family-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    align-items: stretch !important;
    gap: 12px !important;
  }
  html body .category-grid.family-grid .category-card.family-card {
    display: flex !important;
    flex-direction: column !important;
    min-width: 0 !important;
    padding: 13px 12px 14px !important;
    gap: 7px !important;
    overflow: hidden !important;
    border-radius: 9px !important;
  }
  html body .category-grid.family-grid .category-card.family-card > img.family-photo {
    display: block !important;
    width: 100% !important;
    height: clamp(112px, 31vw, 138px) !important;
    min-height: 112px !important;
    max-height: 138px !important;
    margin: 5px 0 7px !important;
    padding: 7px !important;
    object-fit: contain !important;
    object-position: center center !important;
    box-sizing: border-box !important;
    background: #f5f7f8 !important;
    border: 1px solid #e5e9ec !important;
    border-radius: 7px !important;
  }
  html body .category-grid.family-grid .category-card.family-card h3 {
    margin: 0 0 3px !important;
    font-size: 14px !important;
    line-height: 1.28 !important;
    overflow-wrap: anywhere !important;
  }
  html body .category-grid.family-grid .category-card.family-card p {
    margin: 0 0 5px !important;
    font-size: 11.5px !important;
    line-height: 1.52 !important;
    -webkit-line-clamp: 4 !important;
  }
  html body .category-grid.family-grid .category-card.family-card .number {
    font-size: 8px !important;
    letter-spacing: .09em !important;
  }

  /* Product list cards: substantial thumbnails without squeezing the copy. */
  html body .darius-product-listing-card {
    display: grid !important;
    grid-template-columns: 92px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 10px 12px !important;
    min-height: 0 !important;
    padding: 12px !important;
    border-radius: 9px !important;
  }
  html body .darius-product-listing-card .darius-product-card-image-wrap {
    display: flex !important;
    flex: 0 0 92px !important;
    align-items: center !important;
    justify-content: center !important;
    width: 92px !important;
    height: 92px !important;
    min-width: 92px !important;
    min-height: 92px !important;
    max-width: 92px !important;
    max-height: 92px !important;
    overflow: hidden !important;
    border: 1px solid #e2e7eb !important;
    border-radius: 7px !important;
    background: #f7f8f9 !important;
  }
  html body .darius-product-listing-card .darius-product-listing-image {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    max-height: 100% !important;
    padding: 5px !important;
    object-fit: contain !important;
    object-position: center center !important;
    box-sizing: border-box !important;
    background: #fff !important;
  }
  html body .darius-product-listing-card .darius-product-photo-placeholder {
    width: 92px !important;
    height: 92px !important;
    min-width: 92px !important;
    min-height: 92px !important;
    padding: 6px !important;
  }
  html body .darius-product-listing-card .darius-product-listing-copy {
    min-width: 0 !important;
  }
  html body .darius-product-listing-card .darius-product-listing-copy h3 {
    margin: 4px 0 5px !important;
    font-size: 14px !important;
    line-height: 1.3 !important;
    overflow-wrap: anywhere !important;
  }
  html body .darius-product-listing-card .darius-product-listing-copy p {
    margin: 0 !important;
    font-size: 11.5px !important;
    line-height: 1.5 !important;
    -webkit-line-clamp: 3 !important;
  }
  html body .darius-product-listing-card .darius-product-listing-actions {
    grid-column: 1 / -1 !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 10px !important;
    padding-top: 2px !important;
  }
  html body .darius-product-listing-card .darius-representative-image-tag {
    left: 4px !important;
    right: 4px !important;
    bottom: 4px !important;
    padding: 4px 3px !important;
    font-size: 7px !important;
    line-height: 1.15 !important;
  }

  /* Product-group tiles: keep equipment and pack shots clearly visible. */
  html body .catalogue-group-cards .darius-group-photo-wrap {
    height: 138px !important;
    min-height: 138px !important;
    margin: 10px 0 14px !important;
  }
  html body .catalogue-group-cards .darius-group-photo-wrap img {
    width: 100% !important;
    height: 100% !important;
    padding: 8px !important;
    object-fit: contain !important;
    object-position: center !important;
  }

  /* Bestseller carousel: a larger image panel ahead of the product copy. */
  html body .darius-bestsellers-section .bestseller-slide {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    min-height: 0 !important;
    gap: 0 !important;
  }
  html body .darius-bestsellers-section .bestseller-image-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 196px !important;
    min-height: 196px !important;
    max-height: 196px !important;
    padding: 10px !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
    border-radius: 8px 8px 0 0 !important;
    background: #f7f8f9 !important;
  }
  html body .darius-bestsellers-section .bestseller-image-wrap .slide-photo,
  html body .darius-bestsellers-section .bestseller-image-wrap .darius-bestseller-photo-placeholder {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    height: 176px !important;
    min-height: 176px !important;
    max-height: 176px !important;
    padding: 8px !important;
    object-fit: contain !important;
    object-position: center !important;
    box-sizing: border-box !important;
    background: #fff !important;
    border-radius: 6px !important;
  }
  html body .darius-bestsellers-section .bestseller-image-wrap .darius-representative-image-tag {
    left: 12px !important;
    right: 12px !important;
    bottom: 12px !important;
    padding: 5px 7px !important;
    font-size: 8px !important;
  }
  html body .darius-bestsellers-section .bestseller-copy {
    padding: 18px 16px 20px !important;
  }

  /* Individual product image: no 180px thumbnail cap or clipped wrapper. */
  html body .darius-product-refresh .product-detail-image {
    max-height: none !important;
    overflow: visible !important;
    margin-bottom: 16px !important;
  }
  html body .darius-product-refresh .product-detail-image .product-large-image {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: 320px !important;
    padding: 10px !important;
    object-fit: contain !important;
    object-position: center !important;
    box-sizing: border-box !important;
    border: 1px solid #e3e8ec !important;
    border-radius: 8px !important;
    background: #fff !important;
  }
  html body .darius-product-refresh .product-detail-image .darius-product-detail-photo-placeholder {
    width: 100% !important;
    min-height: 220px !important;
    max-height: 320px !important;
  }

  /* Mobile-first photo/text composition: photo strip above the page title.
     Avoids squeezing a wide 16:9/2:1 image behind text in a tall phone banner. */
  html body .darius-page-banner {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    height: auto !important;
  }
  html body .darius-page-banner-visual {
    position: relative !important;
    inset: auto !important;
    order: 0 !important;
    display: block !important;
    width: 100% !important;
    height: clamp(156px, 46vw, 192px) !important;
    min-height: clamp(156px, 46vw, 192px) !important;
    max-height: 192px !important;
    overflow: hidden !important;
    z-index: 0 !important;
  }
  html body .darius-page-banner-photo {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center 45% !important;
  }
  /* Catalogue archive banners often use square equipment/pack-shot artwork.
     Keep these complete on phones instead of cropping away the product. */
  html body.tax-darius_product_family .darius-page-banner-visual,
  html body.tax-darius_product_group .darius-page-banner-visual {
    background: #f4f6f8 !important;
  }
  html body.tax-darius_product_family .darius-page-banner-photo,
  html body.tax-darius_product_group .darius-page-banner-photo {
    object-fit: contain !important;
    object-position: center center !important;
    padding: 8px !important;
    box-sizing: border-box !important;
  }
  html body .darius-page-banner-visual:before {
    background: linear-gradient(180deg, rgba(8,20,31,.05), rgba(8,20,31,.16)) !important;
  }
  html body .darius-page-banner-copy {
    position: relative !important;
    order: 1 !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 22px 5vw 27px !important;
    background: #10263b !important;
  }
  html body .darius-page-banner .darius-banner-breadcrumb {
    margin-bottom: 13px !important;
    font-size: 10px !important;
  }
  html body .darius-page-banner h1 {
    max-width: 100% !important;
    font-size: clamp(28px, 7.4vw, 36px) !important;
    line-height: 1.12 !important;
    letter-spacing: -.03em !important;
  }
  html body .darius-page-banner-copy > p {
    max-width: 100% !important;
    font-size: 13px !important;
    line-height: 1.62 !important;
  }
  html body .darius-page-banner-product {
    right: 4% !important;
    bottom: 12px !important;
    width: min(30%, 142px) !important;
    height: 76% !important;
    padding: 5px !important;
  }
}

@media screen and (max-width: 680px) {
  /* Homepage hero: give each photo its own calm horizontal frame, then show copy. */
  html body .darius-home-hero-stage {
    min-height: 0 !important;
    height: auto !important;
  }
  html body .darius-home-hero-slide {
    position: absolute !important;
    inset: 0 !important;
    display: none !important;
    flex-direction: column !important;
    align-items: stretch !important;
    min-height: 0 !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    transition: none !important;
  }
  html body .darius-home-hero-slide.active {
    position: relative !important;
    inset: auto !important;
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
  html body .darius-home-hero-image {
    position: relative !important;
    inset: auto !important;
    display: block !important;
    flex: 0 0 clamp(158px, 47vw, 188px) !important;
    width: 100% !important;
    height: clamp(158px, 47vw, 188px) !important;
    min-height: clamp(158px, 47vw, 188px) !important;
    max-height: 188px !important;
    object-fit: cover !important;
    object-position: center 46% !important;
  }
  html body .darius-home-hero-overlay {
    display: none !important;
  }
  html body .darius-home-hero-inner {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 23px 5vw 82px !important;
    box-sizing: border-box !important;
    background: #0b1a29 !important;
  }
  html body .darius-home-hero-copy {
    width: 100% !important;
    max-width: 100% !important;
  }
  html body .darius-home-hero h1,
  html body .darius-home-hero h2 {
    max-width: 100% !important;
    margin-bottom: 12px !important;
    font-size: clamp(30px, 8vw, 38px) !important;
    line-height: 1.1 !important;
  }
  html body .darius-home-kicker {
    gap: 8px !important;
    margin-bottom: 12px !important;
    font-size: 8.5px !important;
    line-height: 1.45 !important;
    letter-spacing: .12em !important;
  }
  html body .darius-home-hero-copy > p {
    max-width: 100% !important;
    font-size: 13px !important;
    line-height: 1.62 !important;
  }
  html body .darius-home-hero-features {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px 10px !important;
    margin: 16px 0 17px !important;
  }
  html body .darius-home-hero-features strong {
    font-size: 9px !important;
  }
  html body .darius-home-hero-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    margin-top: 17px !important;
  }
  html body .darius-home-hero-actions .darius-refresh-button {
    width: 100% !important;
    min-height: 44px !important;
    padding: 0 9px !important;
    gap: 6px !important;
    font-size: 10px !important;
    text-align: center !important;
  }
  html body .darius-home-hero-controls {
    right: 5vw !important;
    left: 5vw !important;
    bottom: 10px !important;
    justify-content: space-between !important;
    gap: 8px !important;
    padding: 6px 7px !important;
  }
  html body .darius-home-hero-controls .darius-hero-control {
    min-height: 28px !important;
    padding: 0 8px !important;
    font-size: 9px !important;
  }
}

@media screen and (max-width: 390px) {
  html body .category-grid.family-grid .category-card.family-card > img.family-photo {
    height: 112px !important;
    min-height: 112px !important;
  }
  html body .darius-product-listing-card {
    grid-template-columns: 84px minmax(0, 1fr) !important;
    gap: 9px 10px !important;
    padding: 10px !important;
  }
  html body .darius-product-listing-card .darius-product-card-image-wrap,
  html body .darius-product-listing-card .darius-product-photo-placeholder {
    flex-basis: 84px !important;
    width: 84px !important;
    height: 84px !important;
    min-width: 84px !important;
    min-height: 84px !important;
    max-width: 84px !important;
    max-height: 84px !important;
  }
  html body .darius-product-listing-card .darius-product-listing-copy h3 {
    font-size: 13px !important;
  }
  html body .darius-product-listing-card .darius-product-listing-copy p {
    font-size: 11px !important;
    -webkit-line-clamp: 2 !important;
  }
  html body .darius-bestsellers-section .bestseller-image-wrap {
    height: 180px !important;
    min-height: 180px !important;
    max-height: 180px !important;
  }
  html body .darius-bestsellers-section .bestseller-image-wrap .slide-photo,
  html body .darius-bestsellers-section .bestseller-image-wrap .darius-bestseller-photo-placeholder {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .darius-home-hero-slide { transition: none !important; }
}
