/* ============================================
   RITUAL-PRODUCT — Daily ritual steps + product card grid
   Built off revamp-ritual (top) + revamp-system (bottom).
   Defaults to bg-neutral-light (sage) with primary olive text.
   ============================================ */

/* ─── Header ──────────────────────────────────────────────── */
.rip__header {
  text-align: center;
  max-width: 640px;
  margin: 0 auto var(--space-2xl);
}

.rip__eyebrow {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--clr-primary);
  line-height: 1.4;
}

.rip__heading {
  margin: 0 0 var(--space-md);
  font-size: clamp(26px, 4vw + 0.5rem, 60px);
  font-weight: 600;
  line-height: 1.06;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--clr-primary);
  text-wrap: balance;
  overflow-wrap: break-word;
}

.rip__subtext {
  margin: 0;
  font-size: 15px;
  font-weight: 300;
  line-height: 1.7;
  color: var(--clr-primary);
  opacity: 0.75;
  text-wrap: pretty;
}

/* ─── Steps grid ─────────────────────────────────────────── */
.rip__steps {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-2xl);
  counter-reset: step-counter;
  margin-bottom: var(--space-3xl);
}

@media (min-width: 900px) {
  .rip__steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-2xl);
  }
}

.rip__step {
  counter-increment: step-counter;
  min-width: 0;
}

.rip__step-border {
  height: 1px;
  /* Primary-tinted hairline so the rule remains visible against
     bg-neutral-light (sage), bg-card-secondary (peach), and bg-accent-warm
     (cream). --clr-border-light matches the sage exactly and would vanish. */
  background: rgba(60, 66, 46, 0.18);
  margin-bottom: var(--space-lg);
}

.rip__step-counter {
  margin: 0 0 var(--space-md);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  /* Primary olive — gold is reserved for dark backgrounds only
     per design guide §4 critical rule. */
  color: var(--clr-primary);
  display: flex;
  align-items: center;
  gap: 0;
}

.rip__step-number::before {
  content: counter(step-counter, decimal-leading-zero);
}

.rip__step-sep {
  margin: 0 6px;
}

.rip__step-title {
  margin: 0 0 var(--space-md);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--clr-primary);
}

@media (min-width: 1024px) {
  .rip__step-title { font-size: 32px; }
}

.rip__step-body {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: 300;
  line-height: 1.7;
  color: var(--clr-primary);
  opacity: 0.75;
}

/* ============================================
   Product card carousel — horizontal scroller at every breakpoint.
   Adding more cards extends the scroll, never wraps to a new line.
   Uses scroll-snap-type: x proximity per design guide §18.8
   so future prev/next buttons can scrollTo() reliably.
   ============================================ */
.rip__grid {
  display: grid;
  grid-auto-flow: column;
  /* Mobile: ~78% of viewport so cards feel substantial.
     Tablet+: fixed 320px so 3–5 cards become visible at once
     and additional cards scroll into view. */
  grid-auto-columns: 78%;
  gap: var(--space-md);
  overflow-x: auto;
  scroll-snap-type: x proximity;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding-bottom: var(--space-sm);
  /* When fewer cards than fit, center them; otherwise start-aligned
     so the first card anchors on the left (gotchas §9). */
  justify-content: safe center;
}

.rip__grid::-webkit-scrollbar { display: none; }

@media (min-width: 600px) {
  .rip__grid {
    grid-auto-columns: 320px;
    gap: var(--space-lg);
  }
}

@media (min-width: 1024px) {
  /* Size cards so exactly four fit in the visible area, regardless of
     container width. Anything beyond the fourth scrolls horizontally. */
  .rip__grid {
    grid-auto-columns: calc((100% - 3 * var(--space-lg)) / 4);
  }
}

/* Product card — root is now an <article>; an inner stretched link
   makes the whole card clickable to the PDP, while Learn More +
   Add-to-Cart sit above with their own click handlers. */
.rip__card {
  scroll-snap-align: start;
  border: 1px solid var(--clr-border-light);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  position: relative;
}

.rip__card-image {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background: #f5f2ed;
}

.rip__card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.4s ease;
}

.rip__card-img--hover {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.rip__card.has-hover-image:hover .rip__card-img--primary {
  opacity: 0;
}

.rip__card.has-hover-image:hover .rip__card-img--hover {
  opacity: 1;
}

.rip__card-placeholder {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #f5f2ed 0%, #e8e2d8 100%);
}

.rip__card-body {
  padding: var(--space-md) var(--space-lg) 0;
  flex: 1;
}

.rip__card-tag {
  margin: 0 0 var(--space-sm);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--clr-primary);
  opacity: 0.65;
}

/* Title row — product name (left) + optional star rating (right) on
   the same line. Stars are top-aligned so they sit with the first line
   of multi-line product names. */
.rip__card-titlerow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: 0 0 var(--space-xs);
}

.rip__card-name {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: var(--font-size-xl);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--clr-primary);
}

/* Star rating — gold per design guide §4 (--clr-brand-accent). */
.rip__card-rating {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  /* Nudge the stars down slightly so they sit on the optical baseline
     of the uppercase title rather than the cap-height top edge. */
  padding-top: 2px;
}

.rip__card-stars {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  color: var(--clr-brand-accent);
}

.rip__star {
  display: block;
  flex-shrink: 0;
}

.rip__card-rating-count {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.04em;
  line-height: 1;
  color: var(--clr-text-muted, var(--clr-primary));
  opacity: 0.7;
}

/* Dark-card variant — empty stars get an inverse muted tone so they
   stay visible against the dark surface. */
.rip__card.bg-primary .rip__star--empty path,
.rip__card.bg-neutral-dark .rip__star--empty path {
  fill: rgba(253, 252, 250, 0.25);
}
.rip__card.bg-primary .rip__card-rating-count,
.rip__card.bg-neutral-dark .rip__card-rating-count {
  color: var(--clr-text-inverse, #FDFCFA);
  opacity: 0.7;
}

/* Stretched link — fills the whole card surface so any click outside
   Learn More / Add-to-Cart navigates to the PDP. */
.rip__card-link {
  color: inherit;
  text-decoration: none;
}

.rip__card-link::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
}

.rip__card-desc {
  margin: 0;
  font-size: 14px;
  font-weight: 300;
  line-height: 1.65;
  color: var(--clr-primary);
  opacity: 0.75;
}

/* Learn More — text link below description, sits above the
   stretched link via z-index so it gets its own click. */
.rip__card-learn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-top: var(--space-sm);
  padding-bottom: 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--clr-primary);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  position: relative;
  z-index: 2;
  transition: gap 0.25s ease, opacity 0.25s ease;
}

.rip__card-learn:hover {
  gap: 10px;
  opacity: 0.85;
}

.rip__card-learn:focus-visible {
  outline: 2px solid var(--clr-brand-accent);
  outline-offset: 3px;
}

.rip__card-footer {
  padding: var(--space-sm) var(--space-lg) var(--space-md);
  margin-top: var(--space-md);
  border-top: 1px solid var(--clr-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.rip__card-price {
  font-size: var(--font-size-lg);
  font-weight: 600;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--clr-primary);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}

.rip__card-price-prefix {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--clr-text-muted);
}

.rip__card-price-amount {
  font-size: var(--font-size-lg);
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* Add to Cart — outlined button per design guide §8.
   Real button hit area (12px+ padding) so clicks reliably land on
   the button, not the stretched link beneath. Sits at z-index: 3
   so it always beats the stretched link's ::before (z-index: 1). */
.rip__card-add {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: transparent;
  border: 1px solid var(--clr-primary);
  border-radius: var(--radius-md);
  color: var(--clr-primary);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
  position: relative;
  z-index: 3;
  transition: background-color 0.25s ease, color 0.25s ease;
}

@media (min-width: 768px) {
  .rip__card-add {
    padding: 11px 18px;
    font-size: 12px;
  }
}

.rip__card-add:hover {
  background: var(--clr-primary);
  color: var(--clr-text-inverse);
}

.rip__card-add:focus-visible {
  outline: 2px solid var(--clr-brand-accent);
  outline-offset: 3px;
}

.rip__card-arrow {
  display: inline-flex;
  color: var(--clr-primary);
  text-decoration: none;
  transition: transform 0.2s ease;
}

.rip__card:hover .rip__card-arrow {
  transform: translateX(4px);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .rip__card-img,
  .rip__card-arrow {
    transition: none;
  }
}
