/* =========================================================
RESET
========================================================= */

#stacy-category-showcase,
#stacy-category-showcase *{
  box-sizing:border-box;
}


/* =========================================================
SECTION
========================================================= */

#stacy-category-showcase{

  --stacy-cream:#f4f0eb;
  --stacy-sand:#d6c9bb;
  --stacy-taupe:#b29b83;
  --stacy-brown:#806854;
  --stacy-ink:#2c2524;
  --stacy-white:#f9f6f2;

  width:100%;
  max-width:100%;

  margin:0;

  padding:88px 0 96px;

  overflow:hidden;

  background:#f4f0eb;

  color:var(--stacy-ink);

  font-family:
    "Hanken Grotesk",
    Arial,
    sans-serif;
}


#stacy-category-showcase img,
#stacy-category-showcase svg{
  display:block;
}


/* =========================================================
CONTAINER
========================================================= */

.stacy-category-container{

  width:
    min(calc(100% - 48px),1440px);

  margin:
    0 auto;
}


/* =========================================================
HEADING
========================================================= */

.stacy-category-heading{

  width:
    min(760px,100%);

  margin:
    0 auto 44px;

  text-align:center;
}


/* OLD SUBTEXT CSS LEFT UNCHANGED */

.stacy-category-eyebrow{

  margin:
    0 0 12px;

  color:
    var(--stacy-brown);

  font-size:12px;

  font-weight:700;

  line-height:1.4;

  letter-spacing:.17em;

  text-transform:uppercase;
}


/* MAIN HEADING */

.stacy-category-heading h2{

  margin:0;

  color:
    var(--stacy-ink);

  font-family:
    "Castoro",
    Georgia,
    serif;

  font-size:
    clamp(34px,3.7vw,54px);

  font-weight:400;

  line-height:1.12;

  letter-spacing:-.035em;
}


.stacy-category-heading h2 em{

  color:
    var(--stacy-brown);

  font-weight:400;
}


/* OLD INTRO CSS LEFT UNCHANGED */

.stacy-category-intro{

  width:
    min(590px,100%);

  margin:
    16px auto 0;

  color:#6a5c54;

  font-size:16px;

  line-height:1.7;
}


/* =========================================================
CATEGORY GRID
========================================================= */

.stacy-category-grid{

  display:grid;

  grid-template-columns:
    repeat(5,minmax(0,1fr));

  gap:14px;
}


/* =========================================================
CATEGORY CARD
========================================================= */

.stacy-category-card{

  min-width:0;

  aspect-ratio:
    4 / 5.35;

  position:relative;

  isolation:isolate;

  overflow:hidden;

  border-radius:3px;

  background:
    var(--stacy-sand);

  color:#fff;

  text-decoration:none;
}


/* INNER BORDER */

.stacy-category-card::after{

  content:"";

  position:absolute;

  inset:10px;

  z-index:2;

  border:
    1px solid
    rgba(255,255,255,.24);

  pointer-events:none;

  transition:
    border-color .35s ease,
    inset .35s ease;
}


/* =========================================================
IMAGES
========================================================= */

.stacy-category-card img{

  width:100%;

  height:100%;

  object-fit:cover;

  object-position:center;

  transition:
    transform .7s cubic-bezier(.2,.65,.3,1),
    filter .45s ease;
}


/* IMAGE POSITIONING */

.stacy-category-card--protein img{

  object-position:
    58% center;
}


.stacy-category-card--bars img{

  object-position:
    56% center;
}


.stacy-category-card--muffins img{

  object-position:
    57% center;
}


.stacy-category-card--gluten img{

  object-position:
    58% center;
}


/* =========================================================
DARK IMAGE SHADE
========================================================= */

.stacy-category-shade{

  position:absolute;

  inset:0;

  z-index:1;

  background:
    linear-gradient(
      180deg,
      rgba(26,20,17,.02) 25%,
      rgba(26,20,17,.18) 56%,
      rgba(26,20,17,.82) 100%
    );

  transition:
    background .4s ease;
}


/* =========================================================
CARD CONTENT
========================================================= */

.stacy-category-content{

  position:absolute;

  right:24px;

  bottom:25px;

  left:24px;

  z-index:3;

  display:grid;

  grid-template-columns:
    minmax(0,1fr)
    42px;

  grid-template-areas:
    "name arrow";

  align-items:end;

  gap:
    4px 12px;
}


/* CATEGORY NAME */

.stacy-category-name{

  grid-area:name;

  font-family:
    "Castoro",
    Georgia,
    serif;

  font-size:
    clamp(20px,1.55vw,27px);

  font-weight:400;

  line-height:1.12;

  letter-spacing:-.025em;
}


/* =========================================================
ARROW
========================================================= */

.stacy-category-arrow{

  grid-area:arrow;

  width:42px;

  height:42px;

  display:grid;

  place-items:center;

  border:
    1px solid
    rgba(255,255,255,.66);

  border-radius:50%;

  background:
    rgba(255,255,255,.08);

  transition:
    color .3s ease,
    background-color .3s ease,
    transform .3s ease;
}


.stacy-category-arrow svg,
.stacy-category-mobile-note svg{

  width:18px;

  height:18px;

  fill:none;

  stroke:currentColor;

  stroke-width:1.7;

  stroke-linecap:round;

  stroke-linejoin:round;
}


/* =========================================================
HOVER IMAGE
========================================================= */

.stacy-category-card:hover img,
.stacy-category-card:focus-visible img{

  transform:
    scale(1.055);

  filter:
    saturate(1.06);
}


/* INNER BORDER HOVER */

.stacy-category-card:hover::after,
.stacy-category-card:focus-visible::after{

  inset:7px;

  border-color:
    rgba(255,255,255,.5);
}


/* ARROW HOVER */

.stacy-category-card:hover .stacy-category-arrow,
.stacy-category-card:focus-visible .stacy-category-arrow{

  color:
    var(--stacy-ink);

  background:#fff;

  transform:
    translateX(3px);
}


/* ACCESSIBILITY FOCUS */

.stacy-category-card:focus-visible{

  outline:
    3px solid
    var(--stacy-brown);

  outline-offset:4px;
}


/* =========================================================
MOBILE NOTE
========================================================= */

.stacy-category-mobile-note{
  display:none;
}


/* =========================================================
TABLET / SMALL LAPTOP
========================================================= */

@media(max-width:1120px){

  .stacy-category-grid{

    grid-template-columns:
      repeat(3,minmax(0,1fr));

    gap:18px;
  }


  .stacy-category-card{

    aspect-ratio:
      4 / 4.7;
  }


  .stacy-category-name{

    font-size:
      clamp(22px,2.6vw,30px);
  }

}


/* =========================================================
MOBILE
========================================================= */

@media(max-width:767px){

  #stacy-category-showcase{

    padding:
      68px
      0
      72px;
  }


  .stacy-category-container{

    width:100%;
  }


  .stacy-category-heading{

    width:
      calc(100% - 36px);

    margin-bottom:34px;
  }


  .stacy-category-heading h2{

    font-size:
      clamp(33px,10.2vw,43px);
  }


  .stacy-category-intro{

    font-size:15px;

    line-height:1.65;
  }


  /* =========================================================
  MOBILE — EXACTLY 2 CARDS VISIBLE
  ========================================================= */

  #stacy-category-showcase .stacy-category-grid{

    width:100% !important;

    display:flex !important;

    flex-wrap:nowrap !important;

    gap:12px !important;

    overflow-x:auto !important;

    overflow-y:hidden !important;

    scroll-snap-type:x mandatory !important;

    scroll-padding-left:16px !important;

    padding:
      0
      16px
      10px !important;

    -webkit-overflow-scrolling:touch;

    scrollbar-width:none;
  }


  #stacy-category-showcase .stacy-category-grid::-webkit-scrollbar{

    display:none;
  }


  #stacy-category-showcase .stacy-category-card{

    width:
      calc((100vw - 44px) / 2) !important;

    min-width:
      calc((100vw - 44px) / 2) !important;

    max-width:
      calc((100vw - 44px) / 2) !important;

    flex:
      0
      0
      calc((100vw - 44px) / 2) !important;

    aspect-ratio:
      4 / 5 !important;

    scroll-snap-align:start;

    scroll-snap-stop:always;
  }


  #stacy-category-showcase .stacy-category-content{

    right:12px;

    bottom:14px;

    left:12px;

    grid-template-columns:
      minmax(0,1fr)
      30px;

    gap:
      4px
      6px;
  }


  #stacy-category-showcase .stacy-category-name{

    font-size:
      clamp(15px,4.4vw,19px);

    line-height:1.08;
  }


  #stacy-category-showcase .stacy-category-arrow{

    width:30px;

    height:30px;
  }


  #stacy-category-showcase .stacy-category-arrow svg{

    width:14px;

    height:14px;
  }


  #stacy-category-showcase .stacy-category-card::after{

    inset:6px;
  }


  /* MOBILE SWIPE NOTE */

  .stacy-category-mobile-note{

    margin:
      16px
      16px
      0;

    display:flex;

    align-items:center;

    justify-content:center;

    gap:7px;

    color:
      var(--stacy-brown);

    font-size:12px;

    font-weight:700;

    letter-spacing:.1em;

    text-transform:uppercase;
  }


  .stacy-category-mobile-note svg{

    width:17px;

    height:17px;
  }

}

/* =========================================================
SMALL MOBILE
========================================================= */

@media(max-width:380px){

  #stacy-category-showcase .stacy-category-grid{

    gap:10px !important;

    padding-left:12px !important;

    padding-right:12px !important;

    scroll-padding-left:12px !important;
  }


  #stacy-category-showcase .stacy-category-card{

    width:
      calc((100vw - 34px) / 2) !important;

    min-width:
      calc((100vw - 34px) / 2) !important;

    max-width:
      calc((100vw - 34px) / 2) !important;

    flex:
      0
      0
      calc((100vw - 34px) / 2) !important;
  }


  #stacy-category-showcase .stacy-category-content{

    right:10px;

    bottom:11px;

    left:10px;

    grid-template-columns:
      minmax(0,1fr)
      28px;
  }


  #stacy-category-showcase .stacy-category-name{

    font-size:
      clamp(14px,4.2vw,17px);
  }


  #stacy-category-showcase .stacy-category-arrow{

    width:28px;

    height:28px;
  }

}

/* =========================================================
REDUCED MOTION
========================================================= */

@media(prefers-reduced-motion:reduce){

  .stacy-category-card img,
  .stacy-category-card::after,
  .stacy-category-arrow{

    transition:none;
  }


  .stacy-category-grid{

    scroll-behavior:auto;
  }

}

/* =========================================================
DYNAMIC CATEGORY SLIDER — 6+ CARDS
Keeps the original five-card desktop proportions.
========================================================= */

#stacy-category-showcase .stacy-category-grid.is-slider{
  display:flex;
  flex-wrap:nowrap;
  gap:14px;
  overflow-x:auto;
  overflow-y:hidden;
  scroll-snap-type:x mandatory;
  scroll-behavior:smooth;
  scrollbar-width:none;
  -webkit-overflow-scrolling:touch;
}

#stacy-category-showcase .stacy-category-grid.is-slider::-webkit-scrollbar{
  display:none;
}

#stacy-category-showcase .stacy-category-grid.is-slider .stacy-category-card{
  width:calc((100% - 56px) / 5);
  min-width:calc((100% - 56px) / 5);
  max-width:calc((100% - 56px) / 5);
  flex:0 0 calc((100% - 56px) / 5);
  scroll-snap-align:start;
  scroll-snap-stop:always;
}

.stacy-category-slider-controls{
  margin:22px 0 0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
}

.stacy-category-slider-button{
  width:42px;
  height:42px;
  padding:0;
  display:grid;
  place-items:center;
  border:1px solid rgba(128,104,84,.42);
  border-radius:50%;
  background:transparent;
  color:var(--stacy-brown);
  cursor:pointer;
  transition:background-color .2s ease,color .2s ease,border-color .2s ease,opacity .2s ease;
}

.stacy-category-slider-button svg{
  width:17px;
  height:17px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.stacy-category-slider-button:hover:not(:disabled),
.stacy-category-slider-button:focus-visible:not(:disabled){
  background:var(--stacy-brown);
  border-color:var(--stacy-brown);
  color:#fff;
}

.stacy-category-slider-button:disabled{
  opacity:.35;
  cursor:default;
}

@media(max-width:1120px) and (min-width:768px){
  #stacy-category-showcase .stacy-category-grid.is-slider{
    display:flex;
    grid-template-columns:none;
    gap:18px;
  }

  #stacy-category-showcase .stacy-category-grid.is-slider .stacy-category-card{
    width:calc((100% - 36px) / 3);
    min-width:calc((100% - 36px) / 3);
    max-width:calc((100% - 36px) / 3);
    flex:0 0 calc((100% - 36px) / 3);
  }
}

@media(max-width:767px){
  .stacy-category-slider-controls{
    display:none;
  }
}
