/*
 * Homepage final recovery layer.
 * Loaded after the canonical Shop card styles so the homepage can reuse the
 * exact same product component while presenting it as a responsive shelf.
 */
body.home .f4u-section--patterns > .f4u-container {
  width: min(94%, 110rem);
  max-width: 110rem;
}

body.home .f4u-section--patterns {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: var(--f4u-color-paper, #fffdfb);
}

body.home .f4u-section--patterns::after {
  position: absolute;
  z-index: 0;
  right: 0;
  bottom: 0;
  left: 0;
  height: clamp(3.5rem, 6vw, 5.5rem);
  background: linear-gradient(180deg, rgba(255,253,251,0), rgba(255,248,246,.88));
  content: '';
  pointer-events: none;
}

body.home .f4u-section--patterns > .f4u-container {
  position: relative;
  z-index: 1;
}

body.home .f4u-home-pattern-carousel {
  --f4u-home-shelf-gap: clamp(.65rem, 1vw, 1rem);
  position: relative;
}

body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid {
  display: flex !important;
  gap: var(--f4u-home-shelf-gap) !important;
  width: 100% !important;
  margin: 0 !important;
  padding: .2rem .1rem .75rem !important;
  overflow-x: auto !important;
  overscroll-behavior-inline: contain;
  scroll-behavior: smooth;
  scroll-padding-inline: .1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid::-webkit-scrollbar { display: none; }

body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
  flex: 0 0 calc((100% - (3 * var(--f4u-home-shelf-gap))) / 4) !important;
  min-width: 0 !important;
  background: #fff !important;
  background-image: none !important;
  scroll-snap-align: start;
}

body.home .f4u-section--patterns .f4u-product-card__media,
body.home .f4u-section--patterns .f4u-product-card .f4u-media--portrait {
  aspect-ratio: 2 / 3 !important;
}

body.home .f4u-home-pattern-carousel__control {
  position: absolute;
  z-index: 8;
  top: 40%;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  padding: .7rem;
  border: 1px solid rgba(44, 46, 52, .16);
  border-radius: 50%;
  background: rgba(255, 253, 251, .96);
  color: var(--f4u-color-ink, #17171a);
  box-shadow: 0 .45rem 1.25rem rgba(43, 34, 34, .12);
  transform: translateY(-50%);
}

body.home .f4u-home-pattern-carousel__control[hidden] { display: none !important; }
body.home .f4u-home-pattern-carousel__control:disabled { opacity: .35; cursor: default; }
body.home .f4u-home-pattern-carousel__control span,
body.home .f4u-home-pattern-carousel__control svg { display: block; width: 100%; height: 100%; }
body.home .f4u-home-pattern-carousel__control svg { fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1.7; }
body.home .f4u-home-pattern-carousel__control--previous { left: clamp(-1rem, -1.5vw, -.35rem); }
body.home .f4u-home-pattern-carousel__control--previous span { transform: rotate(180deg); }
body.home .f4u-home-pattern-carousel__control--next { right: clamp(-1rem, -1.5vw, -.35rem); }

@media (min-width: 1024px) and (max-width: 1439px) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex-basis: calc((100% - (2 * var(--f4u-home-shelf-gap))) / 3) !important;
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex-basis: calc((100% - var(--f4u-home-shelf-gap)) / 2) !important;
  }
}

@media (max-width: 767px) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex-basis: min(82vw, 20rem) !important;
  }
}

@media (max-width: 767px) {
  body.home .f4u-section--patterns > .f4u-container { width: min(calc(100% - 1.5rem), 110rem); }
  body.home .f4u-home-pattern-carousel__control { top: 38%; width: 2.5rem; height: 2.5rem; padding: .65rem; }
  body.home .f4u-home-pattern-carousel__control--previous { left: -.55rem; }
  body.home .f4u-home-pattern-carousel__control--next { right: -.55rem; }
}

@media (prefers-reduced-motion: reduce) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid { scroll-behavior: auto; }
}

/* v0.2.01 — ultrawide media rails.
 * Text keeps its existing readable measures. Only the image-led homepage
 * sections gain room on large displays; the shared Shop card itself is not
 * restyled here. */
@media (min-width: 1600px) {
  body.home .f4u-section--patterns > .f4u-container,
  body.home .f4u-section--collections > .f4u-container,
  body.home .f4u-community-grid,
  body.home .f4u-editorial-grid,
  body.home .f4u-reviews-grid,
  body.home .f4u-app-grid {
    width: min(calc(100% - clamp(6rem,8vw,14rem)),128rem) !important;
    max-width: 128rem;
    margin-inline: auto;
  }

  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid,
  body.home .f4u-section--collections .f4u-card-track--collections {
    width: 100% !important;
    max-width: none;
  }

  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex-basis: calc((100% - (4 * var(--f4u-home-shelf-gap))) / 5) !important;
  }
}

@media (min-width: 2400px) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex-basis: calc((100% - (5 * var(--f4u-home-shelf-gap))) / 6) !important;
  }
}

/* Scoped ultrawide correction for Block 02 only. Four real catalogue items
 * remain readable and centred; a fifth item creates horizontal overflow. */
@media (min-width: 1600px) {
  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid > .f4u-product-card {
    flex: 0 0 min(27rem, calc((100% - (3 * var(--f4u-home-shelf-gap))) / 4)) !important;
  }

  body.home .f4u-section--patterns .f4u-product-grid.f4u-home-product-grid:not(:has(> .f4u-product-card:nth-child(5))) {
    justify-content: center;
  }
}

body.home .f4u-home-cart-feedback {
  display: none;
  align-items: center;
  justify-content: center;
  gap: .8rem;
  min-height: 2.75rem;
  margin: .55rem auto 0;
  padding: .65rem 1rem;
  color: var(--f4u-color-text, #2f3640);
  font-size: .9rem;
  text-align: center;
}

body.home .f4u-home-cart-feedback.is-visible { display: flex; }
body.home .f4u-home-cart-feedback.is-error { color: var(--f4u-color-error, #9b3546); }
body.home .f4u-home-cart-feedback a {
  color: var(--f4u-color-accent, #d95f79);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: .16em;
}

body.home .f4u-section--patterns [data-f4u-purchase-action][aria-busy='true'] {
  cursor: wait;
  opacity: .72;
  pointer-events: auto;
}

body.home .f4u-section--patterns [data-f4u-favourite-toggle][data-busy='true'] {
  opacity: .72;
}

body.home .f4u-home-cart-fly {
  position: fixed;
  z-index: 9999;
  width: 3rem;
  height: 4.5rem;
  object-fit: cover;
  border-radius: .35rem;
  box-shadow: 0 .45rem 1.25rem rgba(43, 34, 34, .2);
  pointer-events: none;
  transition: left .55s ease, top .55s ease, width .55s ease, height .55s ease, opacity .55s ease;
}

@media (max-width: 767px) {
  body.home .f4u-home-cart-feedback { align-items: flex-start; flex-direction: column; gap: .25rem; text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  body.home .f4u-home-cart-fly { display: none !important; }
}
