/*
 * Single product page — reviews, gallery, lightbox, sticky CTA
 * Extracted from cw-theme.css (Phase 1 Stage A split, 2026-07-02).
 * Loads on top of cw-theme.css (dependency: cw-theme-style).
 */

/* ==========================================================================
   Reviews — Sequence 4 (WP Social Ninja display via FluentCart hooks)
   ========================================================================== */

.cw-reviews-section {
  padding: 3rem 0;
}

.cw-reviews-section:empty,
.cw-reviews-section > .cw-container:empty,
.cw-reviews-section:not(:has(.cw-reviews, .wpsr-fluent-cart-reviews-section, [id^="wpsr-fluent-cart"], .wpsr-review-form)) {
  display: none;
  padding: 0;
}

#cw-reviews:target {
  outline: none;
}

/* Pull the WPSN-injected single-product star rating into the page rhythm */
.cw-shop-product__purchase-card .wpsr-fluent-cart-single-rating {
  margin: 0.625rem 0 0;
}

/* ==========================================================================
   Custom on-brand product reviews section (inc/cw-product-reviews.php)
   ========================================================================== */

.cw-reviews {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Shared star row: amber fill clipped to --cw-stars-fill over a neutral base */
.cw-stars {
  position: relative;
  display: inline-block;
  font-size: 1.05rem;
  line-height: 1;
  letter-spacing: 2px;
  white-space: nowrap;
  font-family: Arial, sans-serif; /* consistent star glyph metrics */
}

.cw-stars::before {
  content: "\2605\2605\2605\2605\2605";
  color: var(--cw-fog-dark);
}

.cw-stars__fill {
  position: absolute;
  top: 0;
  left: 0;
  width: var(--cw-stars-fill, 0%);
  overflow: hidden;
}

.cw-stars__fill::before {
  content: "\2605\2605\2605\2605\2605";
  color: #e8a13a;
}

/* Compact inline rating link below the purchase CTA */
.cw-compact-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--cw-text-muted, #6b7280);
  text-decoration: none;
  margin-top: 0.5rem;
}

.cw-compact-rating:hover,
.cw-compact-rating:focus-visible {
  color: var(--cw-clay, #e07a5f);
  text-decoration: underline;
}

.cw-compact-rating .cw-stars {
  font-size: 0.9rem;
  letter-spacing: 1px;
}

.cw-compact-rating__score {
  font-weight: 600;
  color: var(--cw-text, #1a1a1a);
}

/* Header: heading + score on the left, action on the right */
.cw-reviews__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--cw-border);
}

.cw-reviews__heading {
  margin: 0 0 0.4rem;
  font-size: 1.5rem;
}

.cw-reviews__score {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.cw-reviews__avg {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--cw-ink);
}

.cw-reviews__count {
  color: var(--cw-quiet);
  font-size: 0.95rem;
}

.cw-reviews__empty-note {
  margin: 0;
  color: var(--cw-quiet);
}

/* Review action / prompt — right-aligned beside the score on desktop */
.cw-reviews__action,
.cw-reviews__prompt {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  text-align: right;
}

.cw-reviews__prompt-text {
  margin: 0;
  max-width: 34ch;
  color: var(--cw-quiet);
  font-size: 0.95rem;
}

/* Review list */
.cw-reviews__list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.cw-reviews__card {
  background: var(--cw-white);
  border: 1px solid var(--cw-border);
  border-radius: var(--cw-radius-card);
  box-shadow: var(--cw-shadow-card);
  padding: 1.5rem;
}

.cw-reviews__card-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}

.cw-reviews__avatar {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--cw-teal-tint);
  color: var(--cw-teal-dark);
  font-weight: 700;
  font-size: 0.95rem;
  text-transform: uppercase;
}

.cw-reviews__meta {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.cw-reviews__name {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-weight: 600;
  color: var(--cw-ink);
}

.cw-reviews__badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.55rem;
  border-radius: 999px;
  background: var(--cw-teal-tint);
  color: var(--cw-teal-dark);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.cw-reviews__date {
  color: var(--cw-quiet);
  font-size: 0.85rem;
}

.cw-reviews__title {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.cw-reviews__body {
  margin: 0;
  color: var(--cw-ink-light);
  line-height: 1.6;
}

.cw-reviews__empty {
  margin: 0;
  color: var(--cw-quiet);
}

@media (max-width: 700px) {
  .cw-reviews__list {
    grid-template-columns: minmax(0, 1fr);
  }

  .cw-reviews__header {
    align-items: flex-start;
  }

  .cw-reviews__action,
  .cw-reviews__prompt {
    align-items: flex-start;
    text-align: left;
  }

  .cw-reviews__prompt-text {
    max-width: none;
  }
}

/* ==========================================================================
   On-brand restyle of the WP Social Ninja native review form
   (rendered via [wpsr_review_form css_class="cw-review-form-scope"])
   ========================================================================== */

.cw-reviews__form {
  width: 100%;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px dashed var(--cw-border);
}

.cw-reviews__form[hidden] {
  display: none;
}

.cw-review-form-scope {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 640px;
}

.cw-review-form-scope .wpsr-review-form-title {
  margin: 0;
  font-size: 1.2rem;
}

.cw-review-form-scope .wpsr-review-form-subtitle {
  margin: 0;
  color: var(--cw-quiet);
}

.cw-review-form-scope .wpsr-review-form-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.cw-review-form-scope .wpsr-review-form-field label {
  font-weight: 600;
  color: var(--cw-ink);
  font-size: 0.95rem;
}

.cw-review-form-scope input[type="text"],
.cw-review-form-scope input[type="email"],
.cw-review-form-scope input[type="url"],
.cw-review-form-scope textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--cw-border);
  border-radius: 10px;
  background: var(--cw-white);
  color: var(--cw-ink);
  font: inherit;
}

.cw-review-form-scope textarea {
  min-height: 120px;
  resize: vertical;
}

.cw-review-form-scope input:focus,
.cw-review-form-scope textarea:focus {
  outline: none;
  border-color: var(--cw-teal);
  box-shadow: 0 0 0 3px var(--cw-teal-tint);
}

.cw-review-form-scope .wpsr-rating-input {
  display: inline-flex;
  gap: 0.25rem;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--cw-fog-dark);
}

.cw-review-form-scope .wpsr-rating-icon {
  cursor: pointer;
  color: var(--cw-fog-dark);
  transition: color 0.12s ease;
}

.cw-review-form-scope .wpsr-rating-icon:hover,
.cw-review-form-scope .wpsr-rating-icon.is-active,
.cw-review-form-scope .wpsr-rating-icon[aria-checked="true"],
.cw-review-form-scope .wpsr-rating-icon.wpsr-active,
.cw-review-form-scope .wpsr-rating-icon.selected {
  color: #e8a13a;
}

.cw-review-form-scope .wpsr-required {
  color: var(--cw-clay);
}

/* Submit button → brand clay pill (matches .cw-button-primary) */
.cw-review-form-scope .wpsr-review-form-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 9999px;
  background: var(--cw-clay);
  color: var(--cw-white);
  font-weight: 600;
  padding: 0.7rem 1.6rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.cw-review-form-scope .wpsr-review-form-btn:hover {
  background: var(--cw-clay-dark);
}

.cw-review-form-scope .wpsr-review-form-btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.cw-review-form-scope .wpsr-review-form-messages {
  font-size: 0.95rem;
}

.cw-review-form-scope .wpsr-review-form-login-required {
  color: var(--cw-quiet);
}

/* ==========================================================================
   Shop refactor — Sequence 2
   Etsy-style gallery + lightbox + mobile sticky CTA + content polish
   ========================================================================== */

/* ---- Button reset for all Sequence 2 buttons ---------------------------
   The Kadence parent applies a global `button { padding:.4em 1em;
   font-size:1.125rem; line-height:1.6; border-radius:3px; }` rule that
   distorts our fixed-size circular controls (40×40, 44×44, 48×48). Reset
   appearance, padding, margin, border, font + force border-box so explicit
   width/height land as intended. Per-button rules below set the actual
   visual treatment. */

.cw-gallery__nav,
.cw-gallery__thumb,
.cw-gallery__dot,
.cw-gallery-lightbox__close,
.cw-gallery-lightbox__nav,
.cw-sticky-cta__button {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  box-sizing: border-box;
  padding: 0;
  margin: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  border-radius: 0;
  text-decoration: none;
  cursor: pointer;
  line-height: 1;
  flex-shrink: 0;
}

/* ---- Etsy-style gallery ------------------------------------------------- */

.cw-gallery {
  position: relative;
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
}

.cw-gallery.is-single-image,
.cw-gallery:not(.has-multi-image) {
  grid-template-columns: minmax(0, 1fr);
}

.cw-gallery__thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.cw-gallery__thumb {
  display: block;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  background: var(--cw-fog);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.15s ease, transform 0.15s ease;
  flex-shrink: 0;
}

.cw-gallery__thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cw-gallery__thumb:hover {
  border-color: var(--cw-teal);
}

.cw-gallery__thumb.is-active {
  border-color: var(--cw-teal);
  transform: scale(1.03);
}

.cw-gallery__thumb:focus-visible {
  outline: 2px solid var(--cw-teal);
  outline-offset: 2px;
}

.cw-gallery__hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 380px;
  border-radius: 16px;
  background: var(--cw-shop-card-bg);
  padding: 32px;
  overflow: hidden;
  cursor: zoom-in;
}

.cw-gallery__hero:focus-visible {
  outline: 2px solid var(--cw-teal);
  outline-offset: 2px;
}

.cw-gallery__image {
  display: block;
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.cw-gallery__nav {
  position: absolute;
  top: 50%;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #fff;
  color: var(--cw-ink);
  box-shadow: 0 2px 8px rgba(45, 45, 53, 0.15);
  opacity: 0;
  /* Combined transform: vertical centering + idle scale. Hover bumps scale. */
  transform: translateY(-50%) scale(1);
  transition: opacity 0.18s ease, transform 0.18s ease, background 0.18s ease;
  z-index: 2;
}

.cw-gallery__nav svg {
  width: 16px;
  height: 16px;
  display: block;
}

.cw-gallery__hero:hover .cw-gallery__nav,
.cw-gallery__nav:focus-visible {
  opacity: 1;
}

.cw-gallery__nav:hover {
  background: var(--cw-mist);
  transform: translateY(-50%) scale(1.06);
}

.cw-gallery__nav:focus-visible {
  outline: 2px solid var(--cw-teal);
  outline-offset: 2px;
}

.cw-gallery__nav--prev {
  left: 12px;
}

.cw-gallery__nav--next {
  right: 12px;
}

.cw-gallery__counter {
  position: absolute;
  top: 14px;
  right: 14px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(26, 28, 32, 0.72);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
  z-index: 2;
}

.cw-gallery__hero .cw-shop-shell__type-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  z-index: 2;
}

.cw-gallery__dots {
  display: none;
}

/* Mobile: thumbs hidden, dots shown */
@media (max-width: 1023px) {
  .cw-gallery {
    grid-template-columns: minmax(0, 1fr);
  }

  .cw-gallery__thumbs {
    display: none;
  }

  .cw-gallery__nav {
    opacity: 1;
  }

  .cw-gallery__dots {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin-top: 12px;
  }

  /* 24×24 hit area for tap target compliance; 8px visual dot drawn with
     ::before so the button itself stays large enough to tap reliably. */
  .cw-gallery__dot {
    position: relative;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: transparent;
  }

  .cw-gallery__dot::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(26, 28, 32, 0.25);
    transition: background 0.15s ease, transform 0.15s ease;
  }

  .cw-gallery__dot.is-active::before {
    background: var(--cw-teal);
    transform: scale(1.25);
  }

  .cw-gallery__dot:focus-visible {
    outline: 2px solid var(--cw-teal);
    outline-offset: 2px;
  }
}

/* ---- Lightbox ----------------------------------------------------------- */

.cw-gallery-lightbox[hidden] {
  display: none !important;
}

.cw-gallery-lightbox {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 17, 22, 0.94);
  padding: 32px;
}

.cw-gallery-lightbox__image {
  display: block;
  max-width: 92vw;
  max-height: 88vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: transparent;
}

.cw-gallery-lightbox__close,
.cw-gallery-lightbox__nav {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--cw-clay);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
  transition: background 0.15s ease, transform 0.15s ease;
}

.cw-gallery-lightbox__close svg,
.cw-gallery-lightbox__nav svg {
  display: block;
}

.cw-gallery-lightbox__close {
  top: 24px;
  right: 24px;
  width: 44px;
  height: 44px;
}

.cw-gallery-lightbox__close svg {
  width: 18px;
  height: 18px;
}

.cw-gallery-lightbox__nav {
  top: 50%;
  /* Combined transform: vertical centering + idle scale; hover bumps scale. */
  transform: translateY(-50%) scale(1);
  width: 48px;
  height: 48px;
}

.cw-gallery-lightbox__nav svg {
  width: 20px;
  height: 20px;
}

.cw-gallery-lightbox__nav--prev {
  left: 24px;
}

.cw-gallery-lightbox__nav--next {
  right: 24px;
}

.cw-gallery-lightbox__close:hover {
  background: var(--cw-clay-dark);
  transform: scale(1.06);
}

.cw-gallery-lightbox__nav:hover {
  background: var(--cw-clay-dark);
  transform: translateY(-50%) scale(1.06);
}

.cw-gallery-lightbox__close:focus-visible,
.cw-gallery-lightbox__nav:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.cw-gallery-lightbox__counter {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.2;
}


/* ---- Social proof ------------------------------------------------------ */

.cw-social-proof {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--cw-teal-tint);
  color: var(--cw-teal-dark);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

/* ---- Quick details strip ----------------------------------------------- */

.cw-shop-product__quick-details {
  padding: 28px 0;
  background: var(--cw-white);
  border-top: 1px solid var(--cw-border);
  border-bottom: 1px solid var(--cw-border);
}

.cw-quick-details {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px 44px;
}

.cw-quick-detail {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  line-height: 1.4;
}

.cw-quick-detail__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--cw-fog);
  font-size: 18px;
  flex-shrink: 0;
}

.cw-quick-detail__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cw-quick-detail__label {
  color: var(--cw-quiet);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cw-quick-detail__value {
  color: var(--cw-ink);
  font-size: 14px;
  font-weight: 600;
}

@media (max-width: 767px) {
  .cw-quick-details {
    gap: 16px 20px;
    justify-content: flex-start;
  }
  .cw-quick-detail {
    flex: 1 1 calc(50% - 20px);
  }
  .cw-quick-detail__icon {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
}

/* ---- Materials section ------------------------------------------------- */

.cw-shop-product__materials-card .cw-shop-product__materials-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 24px;
}

.cw-shop-product__materials-card .cw-shop-product__materials-list li {
  position: relative;
  padding-left: 22px;
  color: var(--cw-ink);
  font-size: 14px;
  line-height: 1.6;
}

.cw-shop-product__materials-card .cw-shop-product__materials-list li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cw-clay);
}

@media (max-width: 640px) {
  .cw-shop-product__materials-card .cw-shop-product__materials-list {
    grid-template-columns: 1fr;
  }
}

/* ---- About the maker --------------------------------------------------- */

.cw-about-maker {
  padding: 48px 0 72px;
  background: var(--cw-white);
}

/* ---- Mobile sticky CTA ------------------------------------------------- */

.cw-sticky-cta[hidden] {
  display: none !important;
}

.cw-sticky-cta {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--cw-white);
  border-top: 1px solid var(--cw-border);
  box-shadow: 0 -4px 16px rgba(45, 45, 53, 0.08);
  transform: translateY(110%);
  transition: transform 0.2s ease;
}

.cw-sticky-cta.is-visible {
  transform: translateY(0);
}

.cw-sticky-cta__label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 auto;
}

.cw-sticky-cta__title {
  color: var(--cw-ink);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cw-sticky-cta__price {
  color: var(--cw-ink-light);
  font-size: 12px;
  font-weight: 500;
}

.cw-sticky-cta__member {
  color: var(--cw-teal-dark);
  font-size: 13px;
  font-weight: 600;
}

.cw-sticky-cta__action {
  flex: 0 0 auto;
}

.cw-sticky-cta__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 999px;
  background: var(--cw-clay);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}

.cw-sticky-cta__button:hover {
  background: var(--cw-clay-dark);
  color: #fff;
}

.cw-sticky-cta__button.cw-cta--download {
  background: var(--cw-teal);
}

.cw-sticky-cta__button.cw-cta--download:hover {
  background: var(--cw-teal-dark);
}

/* Sticky bar is mobile-only. Hide entirely above the breakpoint so it never
   competes with the in-flow purchase card. */
@media (min-width: 768px) {
  .cw-sticky-cta {
    display: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cw-sticky-cta {
    transition: none;
  }
}

