/*
 * Single ritual page.
 *
 * ⚠️ MOBILE FIRST — every base rule is the phone layout and the only media
 * queries are `min-width`.
 *
 * ⚠️ SCOPED UNDER `.rp` and prefixed `rp-*`. The design's own classes (`.pdp`,
 * `.buy`, `.gal`, `.step`, `.works`, `.acc`, `.buybar`) are far too generic for
 * a WooCommerce install to adopt safely.
 *
 * Palette and type come from brand.css. The per-ritual accent arrives as
 * `--rp-accent` on the wrapper.
 */

/* The breadcrumb wrapper matches the shared container — see brand.css. */
.rp-crumbs {
  width: 100%;
  max-width: 77.5rem;
  margin-inline: auto;
  padding-inline: clamp(12px, 4vw, 40px);
}

.rp {
  background: var(--xg-cream);
  color: var(--xg-green);
  font-family: var(--xg-sans);
  --rp-accent: var(--xg-accent-ink);
}

.rp :where(h1, h2, h3) { font-family: var(--xg-serif); font-weight: 400; text-wrap: balance; }
.rp :where(ul, ol) { list-style: none; margin: 0; padding: 0; }
.rp :where(a) { color: inherit; }
.rp a { text-decoration: none; }

.rp a:focus-visible,
.rp button:focus-visible,
.rp summary:focus-visible {
  outline: 2px solid var(--xg-accent-ink);
  outline-offset: 2px;
}

.rp-kicker {
  display: block;
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--rp-ink, var(--xg-accent-ink));
}

/* "If this is not quite yours" — the design's related-section heading. */
.rp-h2 { font-size: clamp(1.625rem, 7vw, 2.5rem); line-height: 1.05; margin: .375rem 0 1.125rem; }

/*
 * ⚠️ THE HOW-TO HEADING IS BIGGER AND DELIBERATELY WRAPS.
 *
 * The design sets it at up to 44px with `max-width: 22ch`, so "Four steps,
 * about ninety seconds." breaks after "ninety" and lands as two lines. Mine ran
 * to 34px on one line, which read as a subheading rather than the opening
 * statement of the section.
 *
 * The measure is what forces the break — not a manual line break, so a
 * three-step ritual with a shorter heading simply stays on one line.
 */
.rp-howto .rp-h2 {
  font-size: clamp(1.75rem, 7.5vw, 2.75rem);
  line-height: 1.04;
  margin: .5rem 0 .375rem;
  /* 24ch, not the design's 22 — Instrument Serif renders a touch wider here, and
     22 broke the line a word early ("Four steps, about / ninety seconds."). The
     measure is set to produce the design's break, not to copy its number. */
  max-width: 24ch;
}

/* ── Top: gallery + buy ──────────────────────────────────────────────────── */

/* The trail sits just above; this only needs to clear it, not restate it. */
.rp-top {
  display: grid;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  max-width: 77.5rem;
  margin: 0 auto;
  padding-inline: clamp(12px, 4vw, 40px);
  padding-block: clamp(1rem, 3vw, 1.75rem) clamp(2rem, 5vw, 3.5rem);
}

/*
 * ⚠️ A SCROLL-SNAP STRIP, NOT A SCRIPTED CAROUSEL.
 *
 * Native swiping, native keyboard scrolling, and it works before any JavaScript
 * runs. The thumbnails are anchors to each slide's id, so they are functional
 * with scripting blocked entirely — no prev/next state to keep in sync.
 */
.rp-gal {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: var(--xg-cream-2);
}

.rp-gal__track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  overscroll-behavior-x: contain;
  /* The strip scrolls; the page must not move sideways with it. */
  scrollbar-width: none;
}

.rp-gal__track::-webkit-scrollbar { display: none; }

@media (prefers-reduced-motion: reduce) {
  .rp-gal__track { scroll-behavior: auto; }
}

.rp-gal__slide {
  flex: 0 0 100%;
  scroll-snap-align: start;
  /* 4:5 portrait. The strip is the ritual's main image and shows the same
     product photography as the PDP gallery, which is also 4:5 on a phone. */
  aspect-ratio: 4 / 5;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--rp-accent) 8%, var(--xg-cream-2));
}

@supports not (background: color-mix(in srgb, red 8%, blue)) {
  .rp-gal__slide { background: var(--xg-cream-2); }
}

/*
 * ⚠️ ABSOLUTELY POSITIONED, OR THE `aspect-ratio` ABOVE IS DECORATION.
 *
 * `.rp-gal__slide` is a flex item, so it keeps `min-height: auto`, and
 * `aspect-ratio` is only a PREFERRED size — an in-flow image with `height: 100%`
 * resolves against an indefinite height, falls back to its own intrinsic ratio,
 * and ends up SETTING the slide height instead of filling it. The declared ratio
 * then does nothing and slides vary with whatever was uploaded.
 *
 * `position: relative` was added to the slide above for this. The rule is only
 * safe because `.rp-gal__empty` — the no-image label — stays in flow and is
 * still centred by the slide's own flex alignment.
 *
 * @see `.x-bs__media img` in bestsellers.css, adaptation (10) in concerns.css,
 *      `.pdp-card__media img` in product.css — the same fault, four times now.
 */
.rp-gal__slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.rp-gal__empty {
  font-size: 11px;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--xg-ink-60);
}

.rp-gal__badge {
  position: absolute;
  top: 12px;
  z-index: 2;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .92);
  color: var(--xg-green);
}

/* ⚠️ HIDDEN UNTIL ritual.js SETS data-gal-js — see the note in the template.
   Without scripting "previous" has no meaning, so the control is not offered. */
.rp-gal__btn { display: none; }

.rp-gal[data-gal-js] .rp-gal__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 1px solid rgba(18, 48, 35, .12);
  background: rgba(247, 244, 238, .92);
  color: var(--xg-green);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

@supports (backdrop-filter: blur(8px)) or (-webkit-backdrop-filter: blur(8px)) {
  .rp-gal[data-gal-js] .rp-gal__btn {
    -webkit-backdrop-filter: blur(8px);
            backdrop-filter: blur(8px);
  }
}

.rp-gal[data-gal-js] .rp-gal__btn:hover { background: var(--xg-cream); }
.rp-gal[data-gal-js] .rp-gal__btn--prev { left: 12px; }
.rp-gal[data-gal-js] .rp-gal__btn--next { right: 12px; }

.rp-gal__dots {
  position: absolute;
  bottom: 14px;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 6px;
}

/* The active dot widens rather than only changing colour, so the position in
   the set is readable without relying on a colour difference alone. */
.rp-gal__dot {
  width: 10px;
  height: 6px;
  border-radius: 99px;
  background: rgba(18, 48, 35, .3);
  transition: width .3s ease, background .3s ease;
}

.rp-gal__dot.is-active { width: 26px; background: var(--xg-green); }

@media (prefers-reduced-motion: reduce) {
  .rp-gal__dot { transition: none; }
}

.rp-thumb.is-active { border: 2px solid var(--xg-green); }

.rp-gal__badge--left { left: 12px; }
.rp-gal__badge--right { right: 12px; background: var(--xg-green); color: var(--xg-cream-ink); }

.rp-thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
.rp-thumbs::-webkit-scrollbar { display: none; }

/*
 * ⚠️ FLEXIBLE AND CAPPED, NOT A FIXED 64px.
 *
 * The design gives each thumbnail `flex: 1 1 0` with `max-width: 78px`, so the
 * row spreads to the gallery's width on a wide column and shrinks evenly on a
 * narrow one. Fixed squares left a gap on the right and looked detached from
 * the gallery above them.
 */
.rp-thumb {
  flex: 1 1 0;
  max-width: 78px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(18, 48, 35, .12);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--xg-ink-60);
  text-align: center;
}

.rp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rp-thumb:hover { border-color: var(--rp-accent); }

/* ── Buy column ──────────────────────────────────────────────────────────── */

.rp-buy { display: flex; flex-direction: column; gap: 12px; }
.rp-buy__meta { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }

/* Ink, not the base — a light gold pill with white text fails contrast. */
.rp-tag {
  background: var(--rp-ink, var(--rp-accent));
  color: #fff;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
}

.rp-buy__sku { font-size: 12px; color: var(--xg-ink-60); }
.rp-buy__title { font-size: clamp(2rem, 9vw, 3rem); line-height: 1.04; margin: 0; }
/*
 * The tagline is the design's most distinctive piece of type — Instrument Serif
 * in italic, at the accent's readable weight. Set in the body sans it read as an
 * ordinary subtitle and the page lost its voice.
 */
.rp-buy__line {
  margin: 0;
  font-family: var(--xg-serif);
  font-style: italic;
  font-size: clamp(1.1875rem, 2.3vw, 1.5rem);
  line-height: 1.32;
  color: var(--rp-ink, var(--rp-accent));
  max-width: 26ch;
}
.rp-buy__blurb { margin: 0; font-size: .9375rem; line-height: 1.6; font-weight: 300; color: var(--xg-ink-72); max-width: 46ch; }

.rp-buy__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-top: 4px; }
/*
 * ⚠️ THE SIZE HAS TO REACH THE INNER SPAN.
 *
 * `wc_price()` wraps every amount in its own `.woocommerce-Price-amount`, which
 * carries a font-size from the theme's WooCommerce stylesheet. Sizing only the
 * `<b>` left the price rendering at body size — the largest number on the page
 * looked like a footnote.
 */
.rp-buy__price b,
.rp-buy__price b .woocommerce-Price-amount {
  font-size: clamp(1.75rem, 7.5vw, 2.375rem);
  font-weight: 500;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.rp-buy__price s,
.rp-buy__price s .woocommerce-Price-amount { font-size: 1rem; color: rgba(18, 48, 35, .45); }
.rp-buy__price > span { font-size: 13px; color: var(--xg-ink-60); }

/* A tinted panel, not a line of text — it is the reason to buy the set. */
.rp-buy__save {
  margin: 0;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--rp-wash, var(--xg-cream-2));
  color: var(--rp-ink, var(--rp-accent));
  font-size: 13.5px;
}

.rp-buy__save + .rp-steplist { margin-top: 2px; }

.rp-buy__oos {
  margin: 0;
  padding: 14px;
  border-radius: 999px;
  text-align: center;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: var(--xg-cream-2);
  color: var(--xg-ink-60);
}

.rp-buy__low { margin: 0; font-size: 12.5px; color: var(--rp-ink, var(--rp-accent)); }

.rp-buy__link {
  align-self: flex-start;
  font-size: 12.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--xg-green);
  border-bottom: 1px solid rgba(18, 48, 35, .3);
  padding-bottom: 2px;
}

/* ── Step list in the buy column ─────────────────────────────────────────── */

/*
 * ⚠️ NO CARD — THE DESIGN SETS THESE STRAIGHT ON THE PAGE.
 *
 * A white rounded panel around the four steps boxed them off from the price
 * above and the buttons below, so the buy column read as three separate blocks
 * instead of one continuous column. Hairlines do the separating.
 *
 * The last row keeps its rule: it is what closes the list off from the buttons.
 */
.rp-steplist { display: grid; gap: 9px; padding-top: 2px; }

.rp-steprow {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(18, 48, 35, .09);
}

/*
 * `--rp-item` is set per row from the product's own ink. It falls back to the
 * ritual accent so a product with no colour configured still renders correctly
 * rather than transparent.
 */
.rp-steprow__n,
.rp-step__n {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--rp-item, var(--rp-ink, var(--rp-accent)));
  color: #fff;
  font-size: 12.5px;
  font-weight: 500;
}

.rp-steprow__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rp-steprow__role { font-size: 9.5px; letter-spacing: .13em; text-transform: uppercase; color: var(--rp-item, var(--rp-accent)); }
.rp-steprow__name { font-size: 13.5px; font-weight: 500; line-height: 1.25; }
.rp-steprow__does { font-size: 11.5px; font-weight: 300; color: var(--xg-ink-60); }
.rp-steprow__price { flex: 0 0 auto; font-size: 12.5px; color: rgba(18, 48, 35, .5); white-space: nowrap; }

/* ── WooCommerce's own add-to-cart form ──────────────────────────────────── */

/*
 * ⚠️ STYLED, NOT REPLACED.
 *
 * The markup is WooCommerce's, because it carries the validation, stock checks
 * and filters every other add-to-cart on the site goes through — including
 * xl-bundles.php's guard that refuses a ritual whose components cannot make a
 * complete set. A hand-rolled form would look right and skip all of it.
 *
 * So the form keeps its own classes and just wears the brand instead.
 */
.rp form.cart {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 4px 0 0;
}

.rp form.cart .quantity {
  display: flex;
  align-items: center;
  min-height: 52px;
  border: 1px solid rgba(18, 48, 35, .2);
  border-radius: 999px;
  background: #fff;
  overflow: hidden;
}

.rp form.cart .quantity input::-webkit-outer-spin-button,
.rp form.cart .quantity input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/*
 * ⚠️ THE −/+ BUTTONS ARE ADDED BY ritual.js, NOT PRINTED BY PHP.
 *
 * WooCommerce renders a bare number input. Wrapping it server-side would mean
 * replacing WooCommerce's own quantity template, which other things read from.
 * The script injects two buttons around the existing input instead, so the form
 * WooCommerce posts is untouched — and without scripting the input is still a
 * perfectly usable number field.
 */
.rp form.cart .quantity button {
  width: 44px;
  min-height: 50px;
  border: 0;
  background: none;
  color: var(--xg-green);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
}

.rp form.cart .quantity button:hover { background: var(--xg-cream-2); }

.rp form.cart .quantity input {
  width: 44px;
  height: 50px;
  border: 0;
  /* Chrome's spinner duplicates the buttons either side of it. */
  -moz-appearance: textfield;
  appearance: textfield;
  background: none;
  text-align: center;
  font: inherit;
  font-size: 14px;
  color: var(--xg-green);
  font-variant-numeric: tabular-nums;
}

/*
 * ⚠️ THREE CLASSES AND TWO ELEMENTS, TO OUTRANK `.button.alt`.
 *
 * WooCommerce ships `.woocommerce button.button.alt` for the primary add-to-cart
 * button — a higher-specificity selector than `.rp .single_add_to_cart_button`,
 * so the plainer version lost and the button stayed WooCommerce's default black
 * while every other control on the page was brand green.
 *
 * Matching its weight is the fix. Escalating past it with !important would win
 * too, and would then have to be fought all over again by anything that needs to
 * change this button later.
 */
.rp form.cart button.single_add_to_cart_button {
  flex: 1 1 11.25rem;
  min-height: 52px;
  padding: 13px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--xg-green);
  color: var(--xg-cream-ink);
  font: inherit;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
  cursor: pointer;
}

.rp form.cart button.single_add_to_cart_button:hover { background: var(--xg-green-mid); color: var(--xg-cream-ink); }
.rp form.cart button.single_add_to_cart_button:disabled { opacity: .5; cursor: default; }

/* ── The promo line ──────────────────────────────────────────────────────── */

.rp-promo {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 13px 15px;
  border: 1px dashed var(--rp-accent);
  border-radius: 14px;
  background: var(--rp-wash, #fff);
  font-size: 13px;
  font-weight: 300;
  line-height: 1.4;
  color: var(--xg-ink-72);
}

/* The code and the sentence sit on one line where there is room, as designed. */
.rp-promo > span:last-child { flex: 1 1 12rem; }

.rp-promo__code {
  font-family: ui-monospace, Menlo, monospace;
  letter-spacing: .15em;
  font-size: 13px;
  white-space: nowrap;
  color: var(--rp-ink, var(--xg-accent-ink));
}

/* ── Facts ───────────────────────────────────────────────────────────────── */

/* Two up on a phone, as the design does — 130px is narrow enough to pair at
   320px and the labels are short. */
.rp-facts {
  display: grid;
  /* Three across wherever they fit — the design's row of three reads as a
     single reassurance strip rather than a stack of cards. */
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 7.5rem), 1fr));
  gap: 10px;
  margin-top: 4px;
}

.rp-facts li {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px;
  border: 0;
  border-radius: 14px;
  background: var(--xg-cream-2);
}

.rp-facts b { font-size: 13.5px; font-weight: 500; }
.rp-facts span { font-size: 12.5px; font-weight: 300; color: var(--xg-ink-60); }

/* ── How to use ──────────────────────────────────────────────────────────── */

/*
 * ⚠️ A PALE ACCENT BAND, NOT WHITE. It is what separates the routine from the
 * buy column above it, and it is tinted by the ritual so each set reads
 * differently. A white band made the whole page one flat sheet.
 */
.rp-howto {
  margin-top: clamp(2.25rem, 6vw, 4.5rem);
  padding-block: clamp(2rem, 5vw, 3.75rem);
  background: var(--rp-wash, var(--xg-cream-2));
}

.rp-howto__lede {
  margin: 0 0 1.375rem;
  max-width: 48ch;
  font-size: .9375rem;
  line-height: 1.65;
  font-weight: 300;
  color: var(--xg-ink-72);
}

.rp-flow { display: grid; gap: 10px; }

/*
 * ⚠️ CARDS WITH THE IMAGE ON TOP, NOT ROWS WITH A THUMBNAIL BESIDE.
 *
 * The first build used horizontal rows, which fits more on a phone but turns
 * the routine into a list. The design gives each step a card with a 4:3 plate
 * so the four read as four things you do — and the plate is where the
 * photography goes when it exists.
 */
.rp-step {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(18, 48, 35, .1);
  border-radius: 16px;
  background: #fff;
}

.rp-step__img {
  position: relative;
  aspect-ratio: 4 / 5;
  background: linear-gradient(160deg,
    color-mix(in srgb, var(--rp-plate, var(--rp-accent)) 10%, #fff),
    color-mix(in srgb, var(--rp-plate, var(--rp-accent)) 24%, #fff));
}

@supports not (background: color-mix(in srgb, red 10%, blue)) {
  .rp-step__img { background: var(--xg-cream-2); }
}

/*
 * ⚠️ ABSOLUTELY POSITIONED, OR THE `aspect-ratio` ABOVE IS DECORATION.
 *
 * In flow, `height: 100%` resolves against an indefinite height and the image
 * falls back to its own intrinsic ratio, so the photograph SIZES the plate
 * instead of filling it. Measured before this change: the plate declared 4/3 and
 * rendered 1.000 — a perfect square — at every width, because the old
 * `woocommerce_thumbnail` request returned a 300x300 square crop and that was
 * what the box inherited. Two bugs wearing each other as a disguise: the ratio
 * looked deliberate because the crop happened to be consistent.
 *
 * `.rp-step__img` is already `position: relative` — for `.rp-step__n` — so
 * taking the image out of flow costs nothing and makes 4/5 authoritative.
 *
 * @see `.x-bs__media img` in bestsellers.css, `.rp-gal__slide img` above,
 *      `.rr__media img` in routine-rail.css, adaptation (10) in concerns.css,
 *      `.pdp-card__media img` in product.css — the same fault, six times.
 */
.rp-step__img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Above the photograph, which is now absolutely positioned too — so this needs
   a stacking order rather than relying on being later in the document. */
.rp-step__n { position: absolute; z-index: 1; top: 8px; left: 8px; }

.rp-step__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.rp-step__role { font-size: 10px; letter-spacing: .13em; text-transform: uppercase; color: var(--rp-item, var(--rp-accent)); }
.rp-step__body h3 { margin: 0; font-family: var(--xg-sans); font-size: 15px; font-weight: 500; line-height: 1.25; }
.rp-step__body p { margin: 0; font-size: 13px; line-height: 1.5; font-weight: 300; color: var(--xg-ink-72); }
.rp-step__when { font-size: 11.5px; color: var(--xg-ink-60); margin-top: auto; padding-top: 8px; }

/* ── What it works on ────────────────────────────────────────────────────── */

.rp-works { padding-block: clamp(1.75rem, 5vw, 3rem); }
.rp-works__grid { display: grid; gap: 10px; margin-top: 1rem; }

.rp-works__card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 22px;
  border: 1px solid rgba(18, 48, 35, .08);
  border-radius: 18px;
  background: #fff;
}

/* Serif, and large — these are statements, not field labels. */
.rp-works__card h3 {
  margin: 0;
  font-family: var(--xg-serif);
  font-weight: 400;
  font-size: clamp(1.3125rem, 5vw, 1.625rem);
  line-height: 1.15;
}

.rp-works__card p { margin: 0; font-size: 14px; line-height: 1.6; font-weight: 300; color: var(--xg-ink-72); }

/* ── Accordions ──────────────────────────────────────────────────────────── */

/*
 * ⚠️ BORDERED ROWS, NOT ROUNDED CARDS.
 *
 * The design runs these as a plain list separated by hairlines, which reads as
 * "more detail if you want it" and stays out of the way. Cards gave three
 * closed panels the same visual weight as the sections that matter above them.
 */
.rp-accs {
  padding-block: clamp(2rem, 5vw, 3.75rem);
  display: block;
  border-top: 1px solid rgba(18, 48, 35, .14);
}

.rp-acc {
  border-bottom: 1px solid rgba(18, 48, 35, .14);
  background: none;
}

.rp-acc summary {
  padding: 18px 0;
  font-size: 15.5px;
  letter-spacing: .03em;
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

/* Safari draws its own triangle unless this pseudo-element is cleared. */
.rp-acc summary::-webkit-details-marker { display: none; }

.rp-acc summary::after {
  content: "+";
  font-size: 20px;
  line-height: 1;
  opacity: .45;
}

.rp-acc[open] summary::after { content: "\2013"; }

.rp-acc__body {
  padding: 0 0 19px;
  max-width: 78ch;
  font-size: 14px;
  line-height: 1.7;
  font-weight: 300;
  color: var(--xg-ink-72);
}
.rp-acc__body p { margin: 0 0 .5rem; }
.rp-acc__body p:last-child { margin-bottom: 0; }

.rp-box { display: grid; gap: 6px; margin-bottom: .75rem !important; }
.rp-box li { display: flex; justify-content: space-between; gap: 10px; font-size: 13.5px; }
.rp-box span { color: var(--xg-ink-60); white-space: nowrap; }

/* ── Backed by receipts ──────────────────────────────────────────────────── */

.rp-banner {
  position: relative;
  overflow: hidden;
  margin-top: clamp(2rem, 5vw, 4rem);
  /*
   * ⚠️ THE TEXTURE IS ALMOST FLAT, ON PURPOSE.
   *
   * It stands in until photography exists. At the original 8-point contrast the
   * diagonal stripes read as a deliberate pattern straight through the scrim,
   * which the design does not have — its placeholder is a plain light panel.
   * Two points apart is enough to stop the band looking like a flat colour
   * fill, without pretending to be a design element.
   */
  background: repeating-linear-gradient(135deg, #e6e0d3 0 14px, #e4ded1 14px 28px);
}

.rp-banner__scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, rgba(14, 42, 30, .92) 0%, rgba(18, 48, 35, .72) 52%, rgba(185, 143, 66, .34) 100%);
}

.rp-banner__body {
  position: relative;
  padding-block: clamp(2.5rem, 7vw, 5.25rem);
  color: var(--xg-cream-ink);
}

.rp-kicker--light { color: var(--rp-soft, var(--xg-accent-soft)); }

.rp-banner__head {
  margin: 12px 0;
  max-width: 20ch;
  font-size: clamp(1.875rem, 8.5vw, 3.25rem);
  line-height: 1.04;
}

.rp-banner__sub {
  margin: 0 0 1.375rem;
  max-width: 46ch;
  font-size: .96875rem;
  line-height: 1.65;
  font-weight: 300;
  color: rgba(244, 237, 223, .8);
}

/* ── Related ─────────────────────────────────────────────────────────────── */

.rp-related { padding-bottom: clamp(2rem, 6vw, 4rem); }
.rp-pick { display: grid; gap: 10px; }

/*
 * ⚠️ min-height, NOT JUST PADDING.
 *
 * The design gives these 165px so all four match whatever their concern label
 * wraps to, and so the price sits away from the name rather than under it.
 * Without it the cards collapsed to their content and read as a dense strip of
 * rows instead of four cards.
 */
.rp-pick__card {
  min-height: 165px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 9px;
  padding: 1rem;
  border: 1px solid rgba(18, 48, 35, .1);
  border-radius: 16px;
  background: #fff;
}

a.rp-pick__card:hover { border-color: var(--rp-accent); }

.rp-pick__concern {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--rp-accent);
}

.rp-pick__concern i { width: 9px; height: 9px; border-radius: 999px; background: var(--rp-accent); flex: 0 0 auto; }
.rp-pick__name { font-family: var(--xg-serif); font-size: 1.375rem; line-height: 1.12; }
.rp-pick__roles { font-size: 12.5px; font-weight: 300; line-height: 1.4; color: var(--xg-ink-60); }
.rp-pick__price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.rp-pick__price b { font-size: 1.03125rem; font-weight: 500; }
.rp-pick__price s { font-size: 12px; color: rgba(18, 48, 35, .45); }

.rp-pick__price em {
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--rp-accent);
  padding: 3px 8px;
  border-radius: 999px;
}

/* ── Sticky buy bar ──────────────────────────────────────────────────────── */

/*
 * ⚠️ THE BAR IS MOBILE-ONLY. On a desktop the buy column is beside the gallery
 * and stays in view; a bar there would cover content to repeat a button the
 * shopper can already see.
 */
.rp-bar {
  position: sticky;
  bottom: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(247, 244, 238, .96);
  border-top: 1px solid rgba(18, 48, 35, .12);
}

@supports (backdrop-filter: blur(12px)) or (-webkit-backdrop-filter: blur(12px)) {
  .rp-bar {
    -webkit-backdrop-filter: blur(12px);
            backdrop-filter: blur(12px);
  }
}

.rp-bar__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.rp-bar__name { font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-bar__price { font-size: 13.5px; display: flex; gap: 7px; align-items: baseline; }
.rp-bar__price s { font-size: 11.5px; color: rgba(18, 48, 35, .45); }
.rp-bar__form { margin: 0; flex: 0 0 auto; }

.rp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  letter-spacing: .05em;
  text-transform: uppercase;
  cursor: pointer;
}

.rp-btn--dark { background: var(--xg-green); color: var(--xg-cream-ink); }
.rp-btn--dark:hover { background: var(--xg-green-mid); color: var(--xg-cream-ink); }

/*
 * ⚠️ THE GRADIENT STAYS DARK END TO END. The design's README is explicit about
 * it: these buttons carry white labels, so a light gold stop would drop the
 * contrast below 4.5:1 and the label would wash out at the bright end.
 */
.rp-btn--accent {
  background: linear-gradient(135deg, var(--rp-ink, var(--xg-accent-ink)), var(--rp-deep, #4a4429));
  color: #fff;
  min-height: 52px;
  padding: 15px 28px;
  font-size: 13.5px;
  letter-spacing: .06em;
}

.rp-btn--accent:hover { filter: brightness(1.12); color: #fff; }

.rp-buynow { margin: 0; }
.rp-buynow .rp-btn--accent { width: 100%; }

/* ────────────────────────────────────────────────────────────────────────────
 * 640px
 * ──────────────────────────────────────────────────────────────────────────── */

@media (min-width: 40em) {
  .rp-works__grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
  .rp-pick { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13.75rem), 1fr)); }
  .rp-flow { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 43.75em) {
  /* The design switches the routine to four across at 700px. */
  .rp-flow { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* ────────────────────────────────────────────────────────────────────────────
 * 940px — gallery and buy column sit side by side
 * ──────────────────────────────────────────────────────────────────────────── */

@media (min-width: 58.75em) {
  /*
   * ⚠️ NEARLY EQUAL COLUMNS, NOT A NARROW SIDEBAR.
   *
   * A fixed 24rem buy column squeezed the price, the step list and the buttons
   * into a strip beside an oversized gallery. The design splits the row almost
   * down the middle — the buy column is the page, and the gallery is beside it.
   */
  .rp-top { grid-template-columns: 1.02fr .98fr; align-items: start; }
  .rp-buy { position: sticky; top: 96px; }
  /* See the note above the rule: redundant once the buy column is in view. */
  .rp-bar { display: none; }
}

/*
 * ⚠️ REVIEWS ON THE RITUAL PAGE, MATCHING THE SHARED CONTAINER.
 *
 * The design PDP has its own reviews block in xl-product-single.php, which
 * never runs here — `xyvira_is_design_pdp()` excludes every ritual. These rules
 * dress WooCommerce's own review list and form to this page's measure rather
 * than restyling them: the container width, the heading scale and the button
 * are all the ones the rest of the page already uses.
 */
.rp-reviews {
  width: 100%;
  max-width: 77.5rem;
  margin-inline: auto;
  padding-inline: clamp(12px, 4vw, 40px);
  padding-block: clamp(2rem, 5vw, 3.5rem);
}

.rp-reviews__title {
  font-family: var(--xg-serif, inherit);
  font-size: clamp(1.625rem, 7vw, 2.5rem);
  line-height: 1.05;
  margin: 0 0 1.125rem;
}

/* The form starts closed; the summary is the page's own dark button. */
.rp-reviews__form > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  list-style: none;
  margin-bottom: 1rem;
}

.rp-reviews__form > summary::-webkit-details-marker { display: none; }

/* WooCommerce's list and form, held to a readable measure on wide screens. */
.rp-reviews .commentlist,
.rp-reviews #review_form_wrapper { max-width: 46rem; }
.rp-reviews .commentlist { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.rp-reviews .comment_container { display: flex; gap: .875rem; padding-block: 1rem; }
.rp-reviews .comment-text { flex: 1; min-width: 0; }
.rp-reviews .woocommerce-review__author { font-weight: 500; }
.rp-reviews .woocommerce-review__published-date { color: var(--xg-ink-72, inherit); font-size: .875rem; }
