/* Shared small-screen guardrails. Loaded after each page's existing styles. */
*, *::before, *::after { box-sizing: border-box; }
html { max-width: 100%; }
body { min-width: 0; max-width: 100%; }
img, video, svg { max-width: 100%; }

@media (max-width: 760px) {
  /* Blend the food photo into the hero instead of stacking a large photo card. */
  .dglt-minimal.customer-home-page .hero { position: relative; isolation: isolate; }
  .dglt-minimal.customer-home-page .hero::before {
    content: "";
    display: block !important;
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background: url("../assets/manyfood.png") center 80% / min(108vw, 620px) auto no-repeat;
    opacity: .18;
  }
  .dglt-minimal.customer-home-page .hero-container { position: relative; z-index: 1; }
  .dglt-minimal.customer-home-page .hero-image-wrapper { display: none !important; }

  /* Avoid rigid child widths pushing forms or two-column panels off screen. */
  main, section, article, .container, .admin-main, .admin-content,
  .staff-main, .checkout-main, .order-main { min-width: 0; }
  input, select, textarea { max-width: 100%; }
  table { max-width: 100%; }
  .table-responsive, .table-wrap, .table-container { overflow-x: auto; -webkit-overflow-scrolling: touch; }
}

@media (max-width: 600px) {
  /* Two compact touch-friendly cards instead of five very tall rows. */
  .customer-home-page .category-grid {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }
  .customer-home-page .category-card {
    min-width: 0;
    min-height: 96px !important;
    padding: 10px 6px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 7px !important;
    text-align: center !important;
    border-radius: 14px !important;
    touch-action: manipulation;
  }
  .customer-home-page .category-icon {
    width: 38px !important;
    height: 38px !important;
    flex: none;
    font-size: 21px !important;
    border-radius: 12px !important;
  }
  .customer-home-page .category-name {
    font-size: 13px !important;
    line-height: 1.2 !important;
    overflow-wrap: anywhere;
  }
  /* The last card fills its row when there are five categories. */
  .customer-home-page .category-card:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}

@media (max-width: 360px) {
  .customer-home-page .category-grid { gap: 8px !important; }
  .customer-home-page .category-card { min-height: 88px !important; }
  .customer-home-page .category-icon { width: 34px !important; height: 34px !important; font-size: 19px !important; }
  .customer-home-page .category-name { font-size: 12px !important; }
}
