
/* The legacy display:block !important override defeated [hidden] on carousel
   slides, keeping every campaign layered and painted at once. */
body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide[hidden] {
  display: none !important;
}

/*
 * Fixes for the supplied 320px screenshot: an actual single-line header,
 * native-ratio campaign images, and reduced GPU work on mobile.
 * Loaded after all legacy homepage and mobile stylesheet overrides.
 */
@media (max-width: 992px) {
  body[data-bsg-page="home"]:not(.admin-page) .header .container.header-top-row {
    display: grid !important;
    grid-template-columns: 40px minmax(0, 1fr) 38px auto !important;
    grid-template-rows: 54px !important;
    grid-template-areas: "toggle logo search actions" !important;
    gap: 5px !important;
    width: 100% !important;
    height: 54px !important;
    min-height: 54px !important;
    padding: 0 9px !important;
    direction: rtl !important;
    align-items: center !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .header-primary {
    display: contents !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .nav-toggle {
    display: grid !important;
    grid-area: toggle !important;
    place-items: center !important;
    width: 38px !important;
    min-width: 38px !important;
    height: 38px !important;
    margin: 0 !important;
    justify-self: center !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .logo {
    grid-area: logo !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-self: start !important;
    margin: 0 !important;
    gap: 5px !important;
    font-size: clamp(.72rem, 3.2vw, 1rem) !important;
    overflow: hidden !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .logo-img {
    max-width: 38px !important;
    max-height: 32px !important;
    flex-shrink: 0 !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .logo-site-name {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    font-size: inherit !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .header-navbar {
    display: none !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header #headerSearch,
  body[data-bsg-page="home"]:not(.admin-page) .header #headerSearch.is-inline,
  body[data-bsg-page="home"]:not(.admin-page) .header #headerSearch.is-inline.is-open {
    display: flex !important;
    grid-area: search !important;
    width: 38px !important;
    min-width: 38px !important;
    max-width: 38px !important;
    height: 38px !important;
    align-items: center !important;
    justify-self: center !important;
    margin: 0 !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .actions {
    grid-area: actions !important;
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    min-width: 0 !important;
    max-width: 100% !important;
    gap: 4px !important;
    justify-self: end !important;
    margin: 0 !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .actions :is(.register-btn,.theme-toggle,.bell-wrap,.wishlist-action,.exit-nav-btn) {
    display: none !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header .actions > :is(a,button),
  body[data-bsg-page="home"]:not(.admin-page) .header .actions [data-cart-drawer-open] {
    min-width: 34px !important;
    width: 34px !important;
    height: 34px !important;
    border-radius: 12px !important;
  }

  body[data-bsg-page="home"]:not(.admin-page) .header,
  body[data-bsg-page="home"]:not(.admin-page) .pc-hero-image-only {
    overflow: hidden !important;
    border-radius: 20px !important;
    border-top-left-radius: 20px !important;
    border-top-right-radius: 20px !important;
    border-bottom-left-radius: 20px !important;
    border-bottom-right-radius: 20px !important;
  }

  /* Hardware accelerators: don't decode a second blurred full-frame image. */
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide img.hero-banner-ambient {
    display: none !important;
  }
  body[data-bsg-page="home"] .pc-trust-section::after {
    animation: none !important;
    opacity: 0 !important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only::after {
    animation-duration: 25s !important;
  }
}

@media (max-width: 760px) {
  /* Display the exact desktop artwork in a landscape banner on mobile.
     Match the 1920x680 default artwork ratio so embedded text is not cropped. */
  body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__grid {
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    aspect-ratio: 1920 / 680 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture,
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img,
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img[src*="tech-hero-20261106/"],
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img[src*="-v3.webp"] {
    width: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    transform: none !important;
    filter: none !important;
    padding: 0 !important;
  }

  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-controls {
    left: 12px !important;
    right: auto !important;
    bottom: 10px !important;
    transform: none !important;
  }

  body[data-bsg-page="home"] .pc-hero-image-only {
    margin-top: 12px !important;
  }

  /* Non-visible homepage sections skip layout/paint until the user scrolls. */
  body[data-bsg-page="home"] :is(.product-rail-section,.special-products,.new-products-section,.best-sellers-section) {
    content-visibility: auto;
    contain-intrinsic-size: auto 460px;
  }
}

@media (max-width: 370px) {
  body[data-bsg-page="home"]:not(.admin-page) .header .container.header-top-row {
    grid-template-columns: 38px minmax(0, 1fr) 36px auto !important;
    gap: 3px !important;
    padding-inline: 7px !important;
  }
  body[data-bsg-page="home"]:not(.admin-page) .header .actions {
    gap: 2px !important;
  }
  body[data-bsg-page="home"]:not(.admin-page) .header .actions > :is(a,button) {
    min-width: 32px !important;
    width: 32px !important;
  }
}
@media (prefers-reduced-motion: reduce) {
  body[data-bsg-page="home"] .pc-hero-image-only::after {
    animation: none !important;
  }
}

/* Reduce touch-device paint and motion across every public page, not only home. */
@media (max-width: 992px) {
  [data-aos] {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
    pointer-events: auto !important;
  }
  .grid-overlay { animation: none !important; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  [data-aos] { opacity: 1 !important; transform: none !important; filter: none !important; transition: none !important; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/*
 * Touch-device thermal/performance profile.
 * Keep the visual hierarchy and translucent surfaces, but remove continuous
 * full-viewport compositing, large-radius blur layers and decorative motion.
 */
@media (max-width: 992px) {
  :root { --glass: none !important; }
  html { scroll-behavior: auto !important; }

  /* The two fixed 140px-blurred ambient orbs animated on every route. */
  body:not(.admin-page)::before,
  body:not(.admin-page)::after {
    animation: none !important;
    filter: none !important;
    transform: none !important;
    will-change: auto !important;
  }

  /* Site-custom backgrounds scroll with content and never blur the viewport. */
  body.has-site-bg::before {
    background-attachment: scroll !important;
    will-change: auto !important;
    filter: none !important;
  }
  body.has-site-bg::after {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    filter: none !important;
  }

  /* Retain translucent surfaces without repeatedly compositing live blur. */
  body:not(.admin-page) :is(
    .header,
    .header .nav-dropdown,
    .header .nav-mega,
    .header .header-search-panel,
    .header .bell-panel,
    .mobile-bottom-bar,
    .profile-nav,
    .bell-panel,
    .wishlist-btn,
    .product-badge,
    .hero-banner-controls,
    .pc-trust-section,
    .builder-drawer-panel,
    .modal-overlay,
    .offer-banner
  ) {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  body.dark:not(.admin-page) .header {
    background-color: rgba(8, 10, 17, .94) !important;
  }
  body:not(.dark):not(.admin-page) .header {
    background-color: rgba(250, 252, 255, .96) !important;
  }
  body.dark:not(.admin-page) .mobile-bottom-bar {
    background-color: rgba(9, 13, 24, .94) !important;
  }
  body:not(.dark):not(.admin-page) .mobile-bottom-bar {
    background-color: rgba(248, 250, 255, .96) !important;
  }
  body.dark[data-bsg-page="home"] .pc-trust-section {
    background-color: rgba(13, 18, 28, .94) !important;
  }
  body:not(.dark)[data-bsg-page="home"] .pc-trust-section {
    background-color: rgba(244, 247, 252, .96) !important;
  }

  /* Remove decorative infinite animations; keep functional loading spinners. */
  body:not(.admin-page) .cart-count-badge,
  body:not(.admin-page) .offer-banner::before,
  body:not(.admin-page) .offer-banner::after,
  body:not(.admin-page) .hero-art-ring,
  body:not(.admin-page) .hero-art-ring-2,
  body:not(.admin-page) .hero-art-ring-3,
  body:not(.admin-page) .hero-art-core,
  body:not(.admin-page) .hero-art-chip,
  body:not(.admin-page) .builder-status-icon i,
  body:not(.admin-page) .error-404-icon,
  body:not(.admin-page) .maintenance-icon,
  body:not(.admin-page) .pc-hero-image-only::after,
  body:not(.admin-page) .pc-trust-section::after {
    animation: none !important;
  }

  body:not(.admin-page) .offer-banner::before,
  body:not(.admin-page) .offer-banner::after,
  body:not(.admin-page) .hero-glow,
  body[data-bsg-page="home"] .pc-home-hero__visual-glow {
    filter: none !important;
  }

  body:not(.admin-page) .lazy-skeleton {
    animation: none !important;
    background-position: center !important;
  }

  /* Avoid decoding and blurring an extra full-resolution image on mobile. */
  body[data-bsg-page="home"] .pc-hero-image-only
  .hero-banner-slide img.hero-banner-ambient {
    display: none !important;
    filter: none !important;
  }

  body[data-bsg-page="home"] .pc-hero-image-only::after,
  body[data-bsg-page="home"] .pc-trust-section::after {
    display: none !important;
    animation: none !important;
  }
}


/* Mobile storefront: scrollable category stories and portrait campaign card. */
.ts-mobile-category-stories { display:none; }
@media (max-width:760px) {
  body[data-bsg-page="home"] .ts-mobile-category-stories {
    display:block; width:100%; margin:22px 0 18px; overflow:hidden;
  }
  body[data-bsg-page="home"] .ts-mobile-category-stories__track {
    display:flex; gap:14px; overflow-x:auto; padding:4px 18px 12px;
    scroll-snap-type:x proximity; scrollbar-width:none; direction:rtl;
  }
  body[data-bsg-page="home"] .ts-mobile-category-stories__track::-webkit-scrollbar {display:none;}
  body[data-bsg-page="home"] .ts-mobile-category-story {
    flex:0 0 76px; display:flex; flex-direction:column; align-items:center;
    gap:9px; color:inherit; text-decoration:none; scroll-snap-align:start;
    font-size:12px; font-weight:700; text-align:center;
  }
  body[data-bsg-page="home"] .ts-mobile-category-story__circle {
    width:72px; height:72px; border-radius:50%; display:grid; place-items:center;
    border:2px solid #ff783f; background:linear-gradient(145deg,#1d292a,#0a1012);
    box-shadow:0 0 0 3px rgba(255,120,63,.12); color:#ff965e; font-size:27px;
  }
  body[data-bsg-page="home"] .ts-mobile-category-story__name {
    display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2;
    overflow:hidden; line-height:1.5;
  }
  body[data-bsg-page="home"]:not(.admin-page) .pc-hero-image-only {
    width:100%!important; max-width:none!important; margin:8px 0 0!important;
    padding:0!important; border:0!important; border-radius:0!important;
    box-shadow:none!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__grid {
    aspect-ratio: 1920 / 979.2 !important; height:auto!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture,
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img {
    width:100%!important; height:100%!important; object-fit:cover!important;
    object-position:center!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-controls {
    bottom:16px!important; left:16px!important;
  }
}

/* Keep campaign images intact: never letterbox a landscape asset in a portrait slot. */
@media (max-width:760px) {
 body[data-bsg-page="home"] .ts-mobile-category-story__circle {overflow:hidden;}
 body[data-bsg-page="home"] .ts-mobile-category-story__circle img {
   display:block;width:100%;height:100%;object-fit:cover;border-radius:50%;
 }
 body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__grid {
   /* 20% taller than the previous 1920:816 mobile hero. */
   aspect-ratio:1920 / 979.2!important;height:auto!important;
 }
 body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture,
 body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img {
   object-fit:cover!important;object-position:center!important;
 }
}

/* Final mobile hero geometry: full-bleed, no lateral gutters or shadow. */
@media (max-width: 760px) {
  body[data-bsg-page="home"]:not(.admin-page) .pc-hero-image-only {
    left:0!important;right:0!important;transform:none!important;
    width:100%!important;max-width:none!important;
    margin-inline:0!important;padding-inline:0!important;
    border:0!important;border-radius:20px!important;box-shadow:none!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__grid,
  body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__slider {
    width:100%!important;max-width:none!important;margin-inline:0!important;
    padding-inline:0!important;border-radius:20px!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide,
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture,
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img {
    border-radius:20px!important;box-shadow:none!important;
  }
  body[data-bsg-page="home"] .pc-hero-image-only .hero-banner-slide picture img {
    object-fit:cover!important;object-position:center!important;filter:none!important;
  }
}

/*
 * Dynamic campaign image height.
 * Reference height is the frame that existed before this change.
 * Uploaded image ratio determines the preferred height; clamp prevents extremes.
 * Desktop maximum is 100% of the reference height; mobile/tablet retain 110%.
 */
body[data-bsg-page="home"] .pc-hero-image-only {
  --ts-hero-reference-height: clamp(518.4px, 37.44vw, 619.2px);
  --ts-hero-min-height: calc(var(--ts-hero-reference-height) * 0.6);
  --ts-hero-max-height: var(--ts-hero-reference-height);
}
@media (max-width: 992px) {
  body[data-bsg-page="home"] .pc-hero-image-only {
    --ts-hero-reference-height: clamp(324px, 50.4vw, 444px);
    --ts-hero-max-height: calc(var(--ts-hero-reference-height) * 1.1);
  }
}
@media (max-width: 760px) {
  body[data-bsg-page="home"] .pc-hero-image-only {
    /* Current mobile reference: 979.2 / 1920 = 51% of viewport width. */
    --ts-hero-reference-height: 51vw;
  }
}
body[data-bsg-page="home"] .pc-hero-image-only .pc-home-hero__grid {
  aspect-ratio: auto !important;
  height: clamp(
    var(--ts-hero-min-height),
    var(--ts-hero-natural-height, var(--ts-hero-reference-height)),
    var(--ts-hero-max-height)
  ) !important;
  min-height: 0 !important;
}
