/* Corrupt Vanity mobile layout repair — keep product cards inside the viewport */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  max-width: 100%;
}

@media (max-width: 700px) {
  html, body {
    width: 100%;
    overflow-x: hidden;
  }

  body.dd-home main,
  body.dd-home .dd-shop,
  body.dd-home .dd-grid,
  body.dd-shop-page main,
  body.dd-shop-page .shop-shell,
  body.dd-shop-page .product-grid {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.dd-home .dd-shop {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  body.dd-home .dd-grid.cv-home-four-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    align-items: start;
    gap: 14px 12px !important;
  }

  body.dd-home .dd-grid.cv-home-four-grid > .dd-product {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  body.dd-home .dd-product-photo {
    width: 100%;
    max-width: 100%;
    aspect-ratio: 4 / 5;
    overflow: hidden;
  }

  body.dd-home .dd-product-photo img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: contain;
  }

  /* Keep long product names from pushing prices or cards off-screen. */
  body.dd-home .dd-product-meta {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content;
    align-items: start;
    column-gap: 7px;
    width: 100%;
    min-width: 0;
    padding: 10px 1px 20px !important;
    font-size: 9px !important;
    line-height: 1.25;
  }

  body.dd-home .dd-product-meta span {
    display: block;
    min-width: 0;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
    line-height: 1.25;
  }

  body.dd-home .dd-product-meta strong {
    display: block;
    min-width: 0;
    white-space: nowrap;
    font-size: 9px !important;
    line-height: 1.25;
    text-align: right;
  }

  body.dd-shop-page .shop-shell {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  body.dd-shop-page .product-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-flow: row;
    align-items: start;
    gap: 14px 10px !important;
  }

  body.dd-shop-page .product-grid > .product-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
  }

  body.dd-shop-page .product-card .cv-product-detail-link,
  body.dd-shop-page .product-card .photo {
    display: block;
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  body.dd-shop-page .product-card .photo {
    aspect-ratio: 4 / 5 !important;
    overflow: hidden !important;
  }

  body.dd-shop-page .product-card .photo img {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: 100% !important;
    object-fit: contain !important;
  }

  body.dd-shop-page .product-card .product-meta {
    width: 100%;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  body.dd-shop-page .product-card .product-name {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    line-height: 1.25;
  }
}


/* FINAL NOV 25 FIX: force four product cards across on mobile.
   This override is intentionally last so earlier two-column mobile rules cannot win. */
@media (max-width: 700px) {
  html body.dd-home .dd-shop .dd-grid.cv-home-four-grid,
  html body.dd-shop-page .shop-shell .product-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    grid-auto-flow: row !important;
    gap: 12px 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }
  html body.dd-home .dd-shop .dd-grid.cv-home-four-grid > .dd-product,
  html body.dd-shop-page .shop-shell .product-grid > .product-card {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
  html body.dd-home .dd-shop .dd-product-photo,
  html body.dd-shop-page .shop-shell .product-card .photo {
    display: grid !important;
    place-items: center !important;
    width: 100% !important;
    aspect-ratio: 4 / 5 !important;
    overflow: hidden !important;
  }
  html body.dd-home .dd-shop .dd-product-photo img,
  html body.dd-shop-page .shop-shell .product-card .photo img {
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
  }
  html body.dd-home .dd-shop .dd-product-meta {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) max-content !important;
    gap: 3px !important;
    padding: 6px 1px 14px !important;
    font-size: 7px !important;
    line-height: 1.15 !important;
  }
  html body.dd-home .dd-shop .dd-product-meta span {
    min-width: 0 !important;
    font-size: 7px !important;
    overflow-wrap: anywhere !important;
  }
  html body.dd-home .dd-shop .dd-product-meta strong {
    font-size: 7px !important;
    white-space: nowrap !important;
  }
  html body.dd-shop-page .shop-shell .product-card .product-meta {
    display: block !important;
    min-width: 0 !important;
    padding: 6px 1px 12px !important;
    font-size: 7px !important;
    overflow-wrap: anywhere !important;
  }
  html body.dd-shop-page .shop-shell .product-card .product-name,
  html body.dd-shop-page .shop-shell .product-card .price {
    font-size: 7px !important;
    line-height: 1.15 !important;
    overflow-wrap: anywhere !important;
  }
}
