/* ==========================================================================
   Reviews — cards, slider and product-card ratings
   --------------------------------------------------------------------------
   Used by: product page (#reviews), collection page (#catTestimonials),
   product grid cards (.cat-product-rating).
   Markup: template-parts/reviews/card.php + slider.php, woocommerce/category-reviews.php.
   JS: assets/js/bfp-shop.js (initReviews).

   TO RESTYLE: change the tokens below. Every rule in this file reads them, so
   colours, fonts, sizes, spacing and the arrow / dot look change everywhere.
   A single page can override them too, e.g. `#catTestimonials { --rv-card-bg: #FBF7F1; }`.
   ========================================================================== */

/* ---------- 0. Tokens ---------- */
:root {
	/* card */
	--rv-card-bg: #fff;
	--rv-card-border: var(--line, #E7DCCB);
	--rv-card-radius: 22px;
	--rv-card-pad: 28px;
	--rv-card-shadow: 0 1px 2px rgba(31, 42, 64, .04);
	--rv-card-shadow-hover: 0 2px 4px rgba(31, 42, 64, .04), 0 12px 24px -12px rgba(31, 42, 64, .18);
	--rv-card-border-hover: var(--kraft-light, #E8DBC9);
	--rv-card-lift: -3px;
	--rv-shadow-room: 14px;          /* space kept around cards so the hover shadow is never cut off */

	/* text */
	--rv-text-font: var(--serif, Georgia, serif);
	--rv-text-size: 1.08rem;
	--rv-text-color: var(--ink, #1F2A40);
	--rv-quote-mark: var(--kraft-light, #E8DBC9);
	--rv-muted: var(--muted, #5D6472);

	/* stars */
	--rv-star: #E2A33B;
	--rv-star-size: 15px;

	/* reviewer */
	--rv-name-font: var(--head, Arial, sans-serif);
	--rv-name-color: var(--ink, #1F2A40);
	--rv-avatar-size: 46px;
	--rv-avatar-bg: var(--ink, #1F2A40);
	--rv-avatar-alt-bg: var(--kraft, #9A6B40);
	--rv-avatar-color: #fff;
	--rv-accent: var(--kraft, #9A6B40);
	--rv-link: var(--kraft-text, #7A5636);
	--rv-link-hover: var(--ink, #1F2A40);
	--rv-ok: var(--ok, #2F7D5B);

	/* slider */
	--rv-gap: 24px;
	--rv-arrow-size: 50px;
	--rv-arrow-gap: 18px;            /* space between arrow and cards */
	--rv-arrow-bg: #fff;
	--rv-arrow-color: var(--ink, #1F2A40);
	--rv-arrow-border: var(--line, #E7DCCB);
	--rv-arrow-hover-bg: var(--ink, #1F2A40);
	--rv-arrow-hover-color: #fff;
	--rv-dot: var(--line, #E7DCCB);
	--rv-dot-active: var(--kraft, #9A6B40);
	--rv-dots-space: 28px;           /* space above the dots */

	/* product grid card rating */
	--rv-card-rating-star: var(--rv-star);
	--rv-card-rating-size: 13px;
}

/* ---------- 1. Slider: arrows outside the cards, dots centred below ---------- */
.bcp-rv-slider { position: relative; }
.bcp-rv-slider__stage { position: relative; }
.bcp-rv-slider.has-nav .bcp-rv-slider__stage { padding-inline: calc(var(--rv-arrow-size) + var(--rv-arrow-gap)); }

/* Room for the card lift + hover shadow inside Swiper's overflow:hidden.
   The negative margin keeps the cards aligned with the content edge. */
.bcp-rv-slider__swiper { padding: 10px var(--rv-shadow-room) 28px; margin: -10px calc(-1 * var(--rv-shadow-room)) -28px; }
.bcp-rv-slider__swiper .swiper-wrapper { margin: 0; padding: 0; list-style: none; }
.bcp-rv-slider__swiper .swiper-slide { height: auto; }

/* Card width = one column of a 3-column grid (col-4). Swiper overrides this with its own
   inline width once it runs; with a single review it never runs, so the card keeps this width. */
.bcp-rv-slider .swiper-wrapper { gap: 0; }
.bcp-rv-slider .swiper-slide { width: calc((100% - 2 * var(--rv-gap)) / 3); }
.bcp-rv-slider:not(.is-ready) .swiper-wrapper { display: flex; gap: var(--rv-gap); }

.bcp-rv-slider__arrow {
	position: absolute; top: 50%; z-index: 2;
	display: grid; place-items: center;
	width: var(--rv-arrow-size); height: var(--rv-arrow-size); margin-top: calc(var(--rv-arrow-size) / -2); padding: 0;
	border: 1px solid var(--rv-arrow-border); border-radius: 50%;
	background: var(--rv-arrow-bg); color: var(--rv-arrow-color);
	font-size: 16px; line-height: 1; cursor: pointer;
	box-shadow: 0 6px 18px -10px rgba(31, 42, 64, .35);
	transition: background .2s, color .2s, border-color .2s, opacity .2s;
}
.bcp-rv-slider__arrow--prev { left: 0; }
.bcp-rv-slider__arrow--next { right: 0; }
.bcp-rv-slider__arrow:hover,
.bcp-rv-slider__arrow:focus-visible { background: var(--rv-arrow-hover-bg); border-color: var(--rv-arrow-hover-bg); color: var(--rv-arrow-hover-color); }
.bcp-rv-slider__arrow:focus-visible { outline: 3px solid var(--rv-accent); outline-offset: 3px; }
.bcp-rv-slider__arrow.is-disabled { opacity: .35; cursor: default; pointer-events: none; }
.bcp-rv-slider__arrow.is-locked { display: none; }

.bcp-rv-slider__dots { display: flex; justify-content: center; align-items: center; gap: 4px; margin-top: var(--rv-dots-space); }
.bcp-rv-slider__dots.is-locked { display: none; }
.bcp-rv-slider__dots .swiper-pagination-bullet {
	position: relative; width: 9px; height: 9px; margin: 0 !important;
	border-radius: 99px; background: var(--rv-dot); opacity: 1;
	transition: width .3s, background .3s;
}
/* Bigger tap target than the visible dot */
.bcp-rv-slider__dots .swiper-pagination-bullet::after { content: ""; position: absolute; inset: -10px -4px; }
.bcp-rv-slider__dots .swiper-pagination-bullet-active { width: 28px; background: var(--rv-dot-active); }

/* ---------- 2. Card (same layout as the home page reviews) ---------- */
.bcp-rv-card {
	position: relative; isolation: isolate;
	display: flex; flex-direction: column; gap: 16px; height: 100%;
	padding: var(--rv-card-pad);
	background: var(--rv-card-bg); border: 1px solid var(--rv-card-border); border-radius: var(--rv-card-radius);
	box-shadow: var(--rv-card-shadow);
	transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-color .35s ease;
}
.bcp-rv-card:hover { transform: translateY(var(--rv-card-lift)); box-shadow: var(--rv-card-shadow-hover); border-color: var(--rv-card-border-hover); }
/* Top row: stars left, quote mark right (own row, never over the text) */
.bcp-rv-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 26px; margin-bottom: -6px; }
.bcp-rv-card__mark { margin-left: auto; height: 26px; font-family: var(--rv-text-font); font-size: 4.2rem; line-height: .8; color: var(--rv-quote-mark); pointer-events: none; }

.bcp-rv-card__stars { margin: 0; padding-top: 4px; line-height: 1; }
.bcp-rv-card .bcp-stars { display: inline-flex; gap: 3px; color: var(--rv-star); font-size: var(--rv-star-size); }

.bcp-rv-card__text { flex: 1; margin: 0; padding: 0; border: 0; font-family: var(--rv-text-font); font-size: var(--rv-text-size); line-height: 1.55; color: var(--rv-text-color); }
.bcp-rv-card__text p { margin: 0 0 .6em; font: inherit; color: inherit; }
.bcp-rv-card__text p:last-child { margin-bottom: 0; }

.bcp-rv-card__by { display: flex; align-items: center; gap: 12px; padding-top: 16px; border-top: 1px dashed var(--rv-card-border); }
.bcp-rv-card__avatar {
	display: grid; place-items: center; flex: 0 0 auto;
	width: var(--rv-avatar-size); height: var(--rv-avatar-size); border-radius: 50%;
	background: var(--rv-avatar-bg); color: var(--rv-avatar-color);
	font-family: var(--rv-name-font); font-weight: 800; font-size: 14px; letter-spacing: .02em;
}
.bcp-rv-card__avatar--alt { background: var(--rv-avatar-alt-bg); }
.bcp-rv-card__who { display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 14px; line-height: 1.4; color: var(--rv-muted); }
.bcp-rv-card__name { display: inline-flex; align-items: center; gap: 6px; font-style: normal; font-family: var(--rv-name-font); font-weight: 700; font-size: 15.5px; color: var(--rv-name-color); }
.bcp-rv-card__verified { color: var(--rv-ok); font-size: 13px; }
.bcp-rv-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 8px; font-size: 13px; }
.bcp-rv-card__focus i { color: var(--rv-accent); }
.bcp-rv-card__focus + time::before { content: "·"; margin-right: 8px; }
a.bcp-rv-card__product { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 13px; font-weight: 600; color: var(--rv-link); text-decoration: none; }
a.bcp-rv-card__product:hover { color: var(--rv-link-hover); text-decoration: underline; }

/* ---------- 3. Product page section ---------- */
.pd-rv .pd-rv-list { margin-top: 32px; }
.pd-rv-write { max-width: 760px; margin: 40px auto 0; }
.pd-rv-new + .pd-rv-write { margin-top: 24px; }
.pd-rv-write[hidden] { display: none; }
.pd-rv-form__opt { font-weight: 400; color: var(--rv-muted); }

/* ---------- 4. Collection page section ---------- */
.cat-testimonials .cat-testi-head { margin-bottom: 28px; }

/* ---------- 5. Product grid card: stars + count ---------- */
a.cat-product-rating { display: inline-flex; align-items: center; gap: 6px; margin: 2px 0 8px; font-size: var(--rv-card-rating-size); line-height: 1; color: var(--rv-muted); text-decoration: none; }
a.cat-product-rating:hover { color: var(--rv-link); }
.cat-product-rating .bcp-stars { display: inline-flex; gap: 2px; color: var(--rv-card-rating-star); font-size: var(--rv-card-rating-size); }
.cat-product-rating__avg { font-weight: 700; color: var(--rv-name-color); }
.cat-product-rating .hn-sr { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- 6. Responsive ---------- */
@media (max-width: 1199.98px) {
	.bcp-rv-slider .swiper-slide { width: calc((100% - var(--rv-gap)) / 2); }
}
@media (max-width: 767.98px) {
	:root { --rv-card-pad: 22px; --rv-arrow-size: 42px; --rv-arrow-gap: 10px; --rv-text-size: 1rem; }
	.bcp-rv-slider .swiper-slide { width: 100%; }
}
/* Phones: swipe + dots, no arrows, cards use the full width */
@media (max-width: 575.98px) {
	.bcp-rv-slider.has-nav .bcp-rv-slider__stage { padding-inline: 0; }
	.bcp-rv-slider__arrow { display: none; }
}
@media (prefers-reduced-motion: reduce) {
	.bcp-rv-card, .bcp-rv-slider__arrow, .bcp-rv-slider__dots .swiper-pagination-bullet { transition: none; }
	.bcp-rv-card:hover { transform: none; }
}
