/*
 * RECOMMENDED PAIRING
 * ------------------------------------------------------------------
 * Lifted from the Sacred page so every product page shows the same
 * section. On Sacred these rules still live inline in Sacred.html and
 * are scoped to body.sacred-page; here the same rules are de-scoped to
 * .ca-pairing so any page can use them.
 *
 * Desktop/tablet: a three-up grid.
 * Phones (<=699px): the jars become a swipeable coverflow with one
 * caption row and stretching dots, built by assets/scripts/ca-pairing.js.
 */

.ca-pairing {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  box-sizing: border-box;
  padding: 0 64px 120px;
  background: #fff;
  font-family: Montserrat, 'Helvetica Neue', Arial, sans-serif;
  color: #231f20;
}
.ca-pairing .sacred-details-heading_subtitle {
  margin-top: .75rem;
  font-family: Montserrat, 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  color: #2b2a28;
}
.ca-pairing__grid {
  max-width: 1080px;
  margin: 72px auto 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
}
.ca-pairing__media { display: block; aspect-ratio: 1 / 1; }
.ca-pairing__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 400ms cubic-bezier(.4, 0, 0, 1);
}
.ca-pairing__item:hover .ca-pairing__media img { transform: translateY(-6px); }
/* Kasumi's crop has an off-white backdrop; multiply melts it into the page */
.ca-pairing__media img.-blend { mix-blend-mode: multiply; }
.ca-pairing__info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(35, 31, 32, .35);
}
.ca-pairing__name { margin: 0; font-size: 14px; font-weight: 500; line-height: 1.4; }
.ca-pairing__notes { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: #66625f; }
.ca-pairing__shop {
  flex: none;
  font-size: 12px;
  font-weight: 500;
  color: #231f20;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.ca-pairing__shop:hover { text-decoration-thickness: 2px; }

/* ---------- Motion ---------- */

/* Heading fades up once, when scrolled into view (script adds .is-in).
   Applies at every width; the phone block below repeats it harmlessly. */
html.has-js .ca-pairing .ca-fadeup {
  opacity: 0; transform: translateY(26px);
  transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
}
html.has-js .ca-pairing .ca-fadeup.-late { transition-delay: .16s; }
html.has-js .ca-pairing .ca-fadeup.is-in { opacity: 1; transform: none; }

/* Desktop/tablet: the three jars slide up in sequence as the section
   arrives, instead of the grid just being there. Scoped to >=700px on
   purpose -- phones drive .ca-pairing__item with the coverflow's own
   translateX/scale, which a reveal transform would fight. */
@media (min-width: 700px) {
  html.has-js .ca-pairing__item {
    opacity: 0; transform: translateY(30px);
    transition: opacity .85s cubic-bezier(.2,.7,.2,1), transform .85s cubic-bezier(.2,.7,.2,1);
  }
  html.has-js .ca-pairing__item:nth-child(2) { transition-delay: .13s; }
  html.has-js .ca-pairing__item:nth-child(3) { transition-delay: .26s; }
  html.has-js .ca-pairing__item.is-in { opacity: 1; transform: none; }

  /* a little more life on hover than the old 6px nudge */
  .ca-pairing__item:hover .ca-pairing__media img { transform: translateY(-10px) scale(1.03); }
}

/* The phone-only pieces are built by the script and stay hidden until then */
.ca-pairing .ca-m-only,
.ca-pairing .ca-sdots { display: none; }

@media (max-width: 749px) {
  .ca-pairing { padding: 0 20px 72px; }
  .ca-pairing .sacred-details-heading_title { font-size: 11.5vw; }
  .ca-pairing__grid { grid-template-columns: 1fr; gap: 48px; max-width: 360px; margin-top: 40px; }
}

/* ---------- Phones: swipeable coverflow ---------- */
@media (max-width: 699px) {
  /* Heading fades up once, when scrolled into view (script adds .is-in) */
  html.has-js .ca-pairing .ca-fadeup {
    opacity: 0; transform: translateY(26px);
    transition: opacity .9s cubic-bezier(.2,.7,.2,1), transform .9s cubic-bezier(.2,.7,.2,1);
  }
  html.has-js .ca-pairing .ca-fadeup.-late { transition-delay: .16s; }
  html.has-js .ca-pairing .ca-fadeup.is-in { opacity: 1; transform: none; }

  /* Stretching dots */
  .ca-pairing .ca-sdots {
    display: flex; justify-content: center; align-items: center;
    gap: 8px; margin: 0; padding: 0; list-style: none;
  }
  .ca-pairing .ca-sdots li { display: flex; }
  .ca-pairing .ca-sdots button {
    width: 6px; height: 6px; padding: 0; border: 0; border-radius: 999px;
    background: #c9c7cb; cursor: pointer;
    transition: width .4s cubic-bezier(.2,.7,.2,1), background-color .4s;
  }
  .ca-pairing .ca-sdots button[aria-current="true"] { width: 26px; background: #231f20; }
  .ca-pairing .ca-sdots button:focus-visible { outline: 1px solid #231f20; outline-offset: 2px; }

  .ca-pairing { padding: 40px 0 64px; }
  .ca-pairing .sacred-details-heading { padding: 0 20px; text-align: left; }
  .ca-pairing .sacred-details-heading_title { font-size: 52px; line-height: 1; letter-spacing: -0.045em; }
  .ca-pairing .ca-ph { display: inline-block; }
  .ca-pairing .ca-ph.-two { text-transform: lowercase; }
  .ca-pairing .sacred-details-heading_subtitle { margin-top: 8px; font-size: 12px; color: #66625f; text-align: left; }

  .ca-pairing__grid {
    display: block; position: relative; height: 310px; max-width: none;
    margin: 24px 0 0; overflow: hidden;
    touch-action: pan-y; user-select: none; -webkit-user-select: none;
  }
  .ca-pairing__grid img, .ca-pairing__grid a { -webkit-user-drag: none; }
  .ca-pairing__item {
    position: absolute; left: 50%; top: 0; width: 220px; height: 100%; margin-left: -110px;
    display: flex; align-items: center; justify-content: center;
    transform: translateX(calc(var(--ca-k, 0) * 190px)) scale(var(--ca-s, 1));
    opacity: var(--ca-o, 1);
    transition: transform .7s cubic-bezier(.2,.7,.2,1), opacity .7s cubic-bezier(.2,.7,.2,1);
  }
  .ca-pairing__media { width: 100%; height: 100%; aspect-ratio: auto; display: flex; align-items: center; justify-content: center; }
  .ca-pairing__media img { width: auto; height: auto; max-width: 220px; max-height: 260px; }
  .ca-pairing__item:hover .ca-pairing__media img { transform: none; }
  .ca-pairing__info { display: none; }

  /* .ca-m-only is hidden by default above, so this needs to out-weigh it */
  .ca-pairing .ca-pairing__mrow.ca-m-only {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin: 0 20px; padding-top: 18px;
    border-top: 1px solid #231f20;
    transition: opacity .45s cubic-bezier(.2,.7,.2,1), transform .45s cubic-bezier(.2,.7,.2,1);
  }
  /* set instantly, then released, so the row slides up into its new text */
  .ca-pairing__mrow.is-swap { opacity: 0; transform: translateY(10px); transition: none; }
  .ca-pairing__mname { margin: 0; font-size: 16px; font-weight: 500; color: #231f20; }
  .ca-pairing__mnotes { margin: 4px 0 0; font-size: 13px; color: #66625f; }
  .ca-pairing__mshop { font-size: 13px; font-weight: 500; color: #231f20; text-decoration: underline; text-underline-offset: 4px; }
  .ca-pairing .ca-sdots { margin-top: 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .ca-pairing__media img,
  .ca-pairing__item,
  .ca-pairing__mrow { transition: none !important; }
  .ca-pairing__mrow.is-swap { opacity: 1 !important; transform: none !important; }
  /* >=700px only: on phones .ca-pairing__item's transform IS the coverflow */
  @media (min-width: 700px) {
    html.has-js .ca-pairing__item { opacity: 1 !important; transform: none !important; }
  }
  html.has-js .ca-pairing .ca-fadeup {
    opacity: 1 !important; transform: none !important; transition: none !important;
  }
  .ca-pairing .ca-sdots button { transition: none !important; }
}
