/* Add custom CSS styles below */

/* CLS fix - mobile only */
@media (max-width: 767px) {
  /* top header bar: reserve final height */
  .top-navbar { min-height: 52px; }

  /* breadcrumbs: always one line, long product name ends with ... */
  nav.breadcrumbs salla-breadcrumb { display: block; min-height: 20px; }
  nav.breadcrumbs .s-breadcrumb-wrapper { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; }
  nav.breadcrumbs .s-breadcrumb-item:last-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

  /* product gallery: fixed height = square image */
  salla-slider.details-slider {
    display: block;
    height: calc(100vw - 20px);
    overflow: hidden;
  }
  /* + thumbnails row when the package has more than one image */
  salla-slider.details-slider:has([slot="thumbs"]),
  salla-slider.details-slider:has(.s-slider-thumbs) {
    height: calc(100vw - 20px + 80px);
  }
  /* 300 interview questions guide: portrait 4:5 image */
  #details-slider-285536537 { height: calc((100vw - 20px) * 1.25); }
}

/* CLS fix - homepage products sections - mobile only */
@media (max-width: 767px) {
  body.index salla-products-list[data-testid="store-home-fixed-products-list"] { display: block; }
  /* "باقات التقديم على الوظائف" - 1 row of 2 cards */
  body.index salla-products-list[data-testid="store-home-fixed-products-list"][source="selected"] {
    min-height: min(calc(50vw - 15px + 181px), 361px);
  }
  /* "باقات السيرة الذاتية وحسابات linkedin" - 3 rows (5 packages) */
  body.index salla-products-list[data-testid="store-home-fixed-products-list"][source="categories"] {
    min-height: min(calc(150vw - 45px + 562px), 1142px);
  }
}

/* CLS fix - product card images + logo - mobile only */
@media (max-width: 767px) {
  /* logo: fixed size so it doesn't jump when it loads */
  .navbar-brand img { width: 48px; height: 48px; object-fit: contain; }
  /* product cards: square image box reserved before the image loads */
  custom-salla-product-card .s-product-card-image { aspect-ratio: 1 / 1; }
  custom-salla-product-card .s-product-card-image img { width: 100%; height: 100%; object-fit: cover; }
}

/* CLS fix - product gallery while images / slider script are still loading - mobile only */
@media (max-width: 767px) {
  /* image area keeps its final size even before the images arrive */
  salla-slider.details-slider .s-slider-container { height: calc(100vw - 20px); }
  #details-slider-285536537 .s-slider-container { height: calc((100vw - 20px) * 1.25); }
  /* before the slider script runs: show only the first image, hide the rest + thumbnails */
  salla-slider.details-slider:not(.hydrated) [slot="items"] > :not(:first-child),
  salla-slider.details-slider:not(.hydrated) [slot="thumbs"] { display: none; }
}

/* CLS fix - homepage wide banner: reserve its real 2:1 size before the image loads - mobile only */
@media (max-width: 767px) {
  .s-block--fixed-banner .banner--fixed img { width: 100%; height: auto; aspect-ratio: 2 / 1; object-fit: cover; }
}

/* CLS fix - announcement bar: reserve its space and skip the slide-down animation - mobile only */
@media (max-width: 767px) {
  salla-advertisement:not(.hydrated) { display: block; min-height: 46px; }
  salla-advertisement.s-advertisement-animate-in { animation: none !important; height: auto; opacity: 1; }
}