/* ============================================
   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 ──────────────────────────────────────────────── */
.dpug__header {
  max-width: 640px;
  margin: 0 auto var(--space-2xl);
  /* Default alignment — center. Per-section override via data-align. */
  text-align: center;
}

/* Alignment variants — shifts both the inner text-align and the block's
   horizontal position so "left" pulls the 640px column to the left edge
   instead of just left-aligning text inside a centered block. */
.dpug__header[data-align="left"] {
  margin: 0 0 var(--space-2xl);
  text-align: left;
}

.dpug__header[data-align="right"] {
  margin: 0 0 var(--space-2xl) auto;
  text-align: right;
}

.dpug__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;
}

.dpug__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;
}

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

/* Header button — sits below the subtext, above the product grid.
   inline-flex so the parent header's text-align (and data-align)
   naturally controls its horizontal position. */
.dpug__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  margin-top: var(--space-lg);
  padding: 14px var(--space-xl);
  border-radius: var(--radius-md, 6px);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  background: var(--clr-primary);
  color: var(--clr-text-inverse);
  border: 1px solid transparent;
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, color 0.3s ease;
  white-space: nowrap;
}

.dpug__btn:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

.dpug__btn--secondary {
  background: transparent;
  color: var(--clr-primary);
  border-color: var(--clr-primary);
}

.dpug__btn--secondary:hover {
  background: var(--clr-primary);
  color: var(--clr-text-inverse);
  opacity: 1;
}

/* Dark-section variant — inverse colors so the button stays visible
   on bg-accent-dark / bg-primary sections. */
.dpug.bg-accent-dark .dpug__btn,
.dpug.bg-primary .dpug__btn {
  background: var(--clr-text-inverse);
  color: var(--clr-primary);
}
.dpug.bg-accent-dark .dpug__btn--secondary,
.dpug.bg-primary .dpug__btn--secondary {
  background: transparent;
  color: var(--clr-text-inverse);
  border-color: var(--clr-text-inverse);
}
.dpug.bg-accent-dark .dpug__btn--secondary:hover,
.dpug.bg-primary .dpug__btn--secondary:hover {
  background: var(--clr-text-inverse);
  color: var(--clr-primary);
}

/* ============================================
   Product card grid — responsive across breakpoints.
     Mobile (< 600px): horizontal snap-scroll carousel, mirroring
       detailed-product-upsell so cards behave identically on phones.
     Tablet (600–1023px): 2-column responsive grid.
     Desktop (≥ 1024px): 4-column responsive grid.
   Tracks use minmax(0, 1fr) per gotchas §18.1 to prevent
   uppercase Barlow Condensed headings from blowing the grid wider
   than its container.
   ============================================ */
.dpug__grid {
  display: grid;
  grid-auto-flow: column;
  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);
  justify-content: safe center;
}

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

@media (min-width: 600px) {
  .dpug__grid {
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-lg);
    overflow-x: visible;
    scroll-snap-type: none;
    padding-bottom: 0;
    justify-content: initial;
  }
}

@media (min-width: 1024px) {
  .dpug__grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* 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. */
.dpug__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;
}

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

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

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

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

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

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

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

.dpug__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. */
.dpug__card-titlerow {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  margin: 0 0 var(--space-xs);
}

.dpug__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). */
.dpug__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;
}

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

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

.dpug__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. */
.dpug__card.bg-primary .dpug__star--empty path,
.dpug__card.bg-neutral-dark .dpug__star--empty path {
  fill: rgba(253, 252, 250, 0.25);
}
.dpug__card.bg-primary .dpug__card-rating-count,
.dpug__card.bg-neutral-dark .dpug__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. */
.dpug__card-link {
  color: inherit;
  text-decoration: none;
}

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

.dpug__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. */
.dpug__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;
}

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

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

.dpug__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);
}

.dpug__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;
}

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

.dpug__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). */
.dpug__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) {
  .dpug__card-add {
    padding: 11px 18px;
    font-size: 12px;
  }
}

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

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

.dpug__card-arrow {
  display: inline-flex;
  color: var(--clr-primary);
  text-decoration: none;
  transition: transform 0.2s ease;
  /* Make the arrow click-transparent so the Fluid SDK's `event.target` match
     on the button always wins — clicks on the arrow pass through to the
     <button> instead of landing on this <span> and being ignored. */
  pointer-events: none;
}

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

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