/*
 * Home page
 * Product range section: category bar, sideways-scrolling product row, background.
 */

.home-products-scroll .hps-pin {
  background: #fbf1e3 url("../../images/home/products-section-bg.webp") center bottom / cover no-repeat;
}

.home-products-scroll.hps-static .hps-pin {
  background-attachment: scroll;
}

@media (max-width:640px) {
  .home-products-scroll .hps-pin {
    background-position: left bottom;
  }
}

/* Home products: pinned section; vertical scroll slides the product row sideways, then the page continues. */
.home-products-scroll {
  position: relative;
}

.hps-pin {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 640px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 104px 0 28px;
  overflow: hidden;
}

.hps-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.hps-viewall {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: 999px;
  background: #7F1D1D;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(127,29,29,.18);
  transition: background .2s ease, transform .2s ease;
  text-decoration: none;
}

.hps-viewall:hover {
  background: #991B1B;
  transform: translateY(-1px);
}

.hps-cats {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 20px auto 24px;
  padding: 6px;
  border-radius: 999px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(201,137,46,.3);
  box-shadow: 0 10px 26px rgba(74,44,17,.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.hps-cat {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 26px 9px 12px;
  border-radius: 999px;
  color: #4A2C11;
  text-decoration: none;
  white-space: nowrap;
  transition: background .3s ease, color .3s ease;
}

.hps-cat + .hps-cat::before {
  content: "";
  position: absolute;
  left: -1px;
  top: 22%;
  bottom: 22%;
  width: 1px;
  background: rgba(74,44,17,.18);
  transition: opacity .3s ease;
}

.hps-cat:hover::before,
.hps-cat:hover + .hps-cat::before,
.hps-cat:focus-visible::before,
.hps-cat:focus-visible + .hps-cat::before {
  opacity: 0;
}

.hps-cat-icon {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #FCEFC7;
  color: #7F1D1D;
  transition: background .3s ease, color .3s ease;
}

.hps-cat-icon svg {
  width: 22px !important;
  height: 22px !important;
}

.hps-cat-label {
  font-size: 14px;
  font-weight: 800;
}

.hps-cat:hover, .hps-cat:focus-visible {
  background: #7F1D1D;
  color: #fff;
}

.hps-cat:hover .hps-cat-icon, .hps-cat:focus-visible .hps-cat-icon {
  background: #F5C542;
  color: #7F1D1D;
}

.hps-viewport {
  overflow: hidden;
  margin: 0 -6px;
  padding: 6px 6px 14px;
}

.hps-track {
  --hps-gap: 24px;
  --hps-visible: 4;
  display: flex;
  gap: var(--hps-gap);
  will-change: transform;
}

.hps-track > .product-range-card {
  flex: 0 0 calc((100% - (var(--hps-visible) - 1) * var(--hps-gap)) / var(--hps-visible));
  background: #fff;
}

.hps-foot {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 10px;
}

.hps-progress {
  flex: 1;
  height: 3px;
  border-radius: 3px;
  background: rgba(74,44,17,.1);
  overflow: hidden;
}

.hps-progress span {
  display: block;
  height: 100%;
  width: 0;
  background: #7F1D1D;
  border-radius: 3px;
}

.hps-count {
  font-size: 13px;
  color: rgba(74,44,17,.6);
  font-variant-numeric: tabular-nums;
}

.hps-count b {
  color: #7F1D1D;
}

.hps-hint {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: #8b4a1e;
}

.hps-hint span {
  display: inline-block;
  animation: hpsNudge 1.6s ease-in-out infinite;
}

@keyframes hpsNudge {
  0%, 100% {
    transform: translateX(0);
  }
  50% {
    transform: translateX(5px);
  }
}

@media (max-width:1023px) {
  .hps-track {
    --hps-visible: 2.4;
  }
}

@media (max-width:640px) {
  .hps-track {
    --hps-visible: 1.25;
    --hps-gap: 16px;
  }
  .hps-pin {
    padding-top: 96px;
    min-height: 0;
  }
  .hps-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .hps-viewall {
    display: none;
  }
  .hps-cats {
    width: 100%;
    margin: 14px 0 16px;
    padding: 4px;
  }
  .hps-cat {
    flex: 1 1 0;
    min-width: 0;
    flex-direction: column;
    gap: 3px;
    padding: 7px 2px;
    white-space: normal;
    text-align: center;
  }
  .hps-cat-icon {
    flex: 0 0 auto;
    width: 28px;
    height: 28px;
  }
  .hps-cat-icon svg {
    width: 17px !important;
    height: 17px !important;
  }
  .hps-cat-label {
    font-size: 9.5px;
    line-height: 1.15;
  }
  .hps-hint {
    display: none;
  }
}

/* Fallback (short screens / reduced motion): no pinning; the row scrolls sideways natively. */
.home-products-scroll.hps-static {
  height: auto !important;
}

.home-products-scroll.hps-static .hps-pin {
  position: relative;
  height: auto;
  min-height: 0;
  padding: 72px 0 56px;
}

.home-products-scroll.hps-static .hps-viewport {
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.home-products-scroll.hps-static .hps-track > .product-range-card {
  scroll-snap-align: start;
}

.home-products-scroll.hps-static .hps-foot {
  display: none;
}

/* ===== Layout refresh to match reference ===== */
.hps-head {
  display: block;
}

.hps-head > div {
  max-width: 600px;
}

.hps-head span.text-xs {
  text-transform: uppercase;
  font-weight: 800;
  display: inline-flex !important;
  align-items: center;
  gap: 16px;
  color: #2E6B34 !important;
  font-size: 13px !important;
  letter-spacing: .22em !important;
}

.hps-head span.text-xs::after {
  content: "";
  width: 64px;
  height: 1.5px;
  background: #2E6B34;
  opacity: .7;
}

.hps-head h2 {
  font-size: clamp(38px,3.9vw,60px) !important;
  line-height: 1.04 !important;
  color: #5A2312 !important;
  margin-top: 10px !important;
  max-width: 560px;
}

.hps-head p {
  font-size: clamp(15px,1.25vw,19px) !important;
  line-height: 1.55 !important;
  color: rgba(74,44,17,.78) !important;
  max-width: 470px !important;
  margin-top: 12px !important;
}

.hps-cta-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 24px;
  margin: 16px 0 22px;
}

.hps-cta-row .hps-viewall {
  justify-self: start;
  margin-top: -6px;
}

.hps-cta-row .hps-cats {
  margin: 0;
}

/* product cards */
.hps-track > .product-range-card {
  position: relative;
  border-radius: 22px !important;
  border: 1px solid rgba(255,255,255,.9) !important;
  background: linear-gradient(180deg,#fff 0%,#fffdf9 100%) !important;
  box-shadow: 0 14px 34px rgba(74,44,17,.1) !important;
  overflow: hidden;
}

.hps-track > .product-range-card .product-range-image {
  aspect-ratio: 3 / 2 !important;
}

.hps-track > .product-range-card > div:last-child {
  position: relative;
  padding: 14px 64px 22px 24px !important;
}

.hps-track > .product-range-card h3 {
  color: #6B1F14 !important;
  font-size: 20px !important;
}

.hps-track > .product-range-card p {
  font-size: 14px !important;
}

.hps-track > .product-range-card > div:last-child::after {
  content: "\2192";
  position: absolute;
  right: 18px;
  bottom: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #FBE3E1;
  color: #7F1D1D;
  font-weight: 800;
  font-size: 16px;
  transition: background .25s ease, color .25s ease, transform .25s ease;
}

.hps-track > .product-range-card:hover > div:last-child::after {
  background: #7F1D1D;
  color: #fff;
  transform: translateX(2px);
}

.hps-track > .product-range-card::after {
  content: "";
  position: absolute;
  left: -10%;
  right: 35%;
  bottom: -34px;
  height: 58px;
  border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(ellipse at 30% 40%, rgba(181,214,170,.55), rgba(181,214,170,0) 70%);
}

.hps-track > .product-range-card:nth-child(3n+2)::after {
  background: radial-gradient(ellipse at 30% 40%, rgba(245,197,66,.35), rgba(245,197,66,0) 70%);
}

.hps-track > .product-range-card:nth-child(3n)::after {
  background: radial-gradient(ellipse at 30% 40%, rgba(232,160,160,.45), rgba(232,160,160,0) 70%);
}

.hps-foot {
  margin-top: 4px;
}

/* shorter screens */
@media (max-height:960px) and (min-width:641px) {
  .hps-pin {
    padding-top: 100px;
    justify-content: safe center;
  }
  .hps-head h2 {
    font-size: clamp(34px,3.4vw,52px) !important;
  }
  .hps-track > .product-range-card .product-range-image {
    aspect-ratio: 16 / 10 !important;
  }
}

@media (max-height:820px) and (min-width:641px) {
  .hps-head h2 {
    font-size: clamp(32px,3vw,44px) !important;
  }
  .hps-head p {
    margin-top: 6px !important;
  }
  .hps-cta-row {
    margin: 10px 0 14px;
  }
  .hps-track > .product-range-card .product-range-image {
    aspect-ratio: 16 / 9 !important;
  }
}

@media (max-width:1023px) {
  .hps-cta-row {
    grid-template-columns: 1fr;
    justify-items: center;
  }
  .hps-cta-row .hps-viewall {
    justify-self: start;
  }
  .hps-cta-spacer {
    display: none;
  }
}

@media (max-width:640px) {
  .hps-cta-row {
    margin: 10px 0 14px;
    gap: 0;
  }
  .hps-head h2 {
    font-size: 34px !important;
  }
  .hps-head span.text-xs {
    font-size: 10px !important;
  }
  .hps-head span.text-xs::after {
    width: 36px;
  }
  .hps-track > .product-range-card > div:last-child {
    padding: 12px 54px 18px 18px !important;
  }
  .hps-track > .product-range-card h3 {
    font-size: 17px !important;
  }
}

.hps-head h2 {
  max-width: 7.6em !important;
}

@media (max-width:640px) {
  .hps-head span.text-xs::after {
    display: none;
  }
}

/* category bar: one rounded bar, icon disc beside the name (reference style) */
.hps-cta-row .hps-cats {
  padding: 7px;
  gap: 0;
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(201,137,46,.28);
  box-shadow: 0 12px 30px rgba(74,44,17,.1);
}

.hps-cat-label {
  font-family: 'Playfair Display',Georgia,serif;
  font-size: 15px;
  font-weight: 700;
}

.hps-cat-icon {
  box-shadow: inset 0 0 0 1px rgba(201,137,46,.18);
}

@media (max-height:820px) and (min-width:641px) {
  .hps-cat {
    padding: 7px 22px 7px 10px;
  }
  .hps-cat-icon {
    flex-basis: 36px;
    height: 36px;
  }
}

@media (max-width:640px) {
  .hps-cat-label {
    font-family: inherit;
    font-size: 10px;
    line-height: 1.15;
  }
}

/* Phones (swipe row): every card is visible straight away, so the card peeking in from the right is never blank. */
.home-products-scroll.hps-static .hps-track > .product-range-card {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

@media (max-width:767px) {
  .home-products-scroll.hps-static .hps-pin {
    padding: 56px 0 44px;
  }
  .home-products-scroll.hps-static .hps-viewport {
    scrollbar-width: none;
  }
  .home-products-scroll.hps-static .hps-viewport::-webkit-scrollbar {
    display: none;
  }
}
