/* ============================================
   RELLA — PDP (Product Detail Page) Styles
   Depends on: tokens.css
   ============================================ */

/* ─── Base ─── */

.site-body {
  margin: 0;
  padding: 0;
  font-family: var(--ui-font);
  color: var(--ui-text);
  background: var(--ui-bg);
  line-height: var(--ui-leading-normal);
  -webkit-font-smoothing: antialiased;
}

.pdp-container {
  max-width: var(--ui-container-max);
  margin: 0 auto;
  padding: 0 var(--ui-container-padding);
}

.pdp-section-title {
  font-family: var(--ui-font-display);
  font-size: 1.75rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 var(--ui-space-xl);
  color: var(--ui-text);
}

/* ─── CTA Button ─── */

.pdp-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ui-space-sm);
  border: none;
  border-radius: 2px;
  font-family: var(--ui-font);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--ui-duration) var(--ui-ease),
              transform var(--ui-duration) var(--ui-ease);
  padding: var(--ui-space-md) var(--ui-space-xl);
}

.pdp-cta-btn--primary {
  background: #3d2b6b;
  color: var(--ui-white);
}

.pdp-cta-btn--primary:hover:not(:disabled) {
  background: #49337d;
  transform: translateY(-1px);
}

.pdp-cta-btn--primary:active:not(:disabled) {
  transform: translateY(0);
}

.pdp-cta-btn--primary:disabled {
  background: var(--ui-border);
  color: var(--ui-text-muted);
  cursor: not-allowed;
}

.pdp-cta-btn--secondary {
  background: var(--ui-surface);
  color: var(--ui-primary-500);
  border: 2px solid var(--ui-primary-200);
}

.pdp-cta-btn--secondary:hover {
  background: var(--ui-primary-50);
}

/* ─── Stars ─── */

.pdp-stars {
  color: var(--ui-star);
  font-size: 1.1rem;
  letter-spacing: 1px;
}

.pdp-star--half {
  opacity: 0.5;
}

.pdp-star--empty {
  opacity: 0.2;
}

/* ============================================
   1. HERO
   ============================================ */

.pdp-hero {
  padding: calc(var(--ui-space-xl) / 2) 0 var(--ui-space-2xl);
}

.pdp-hero__inner {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ui-space-3xl);
  align-items: start;
}

/* Gallery */

.pdp-gallery {
  position: sticky;
  top: var(--ui-space-lg);
  width: 100%;
  min-width: 0;
}

.pdp-gallery__main {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  overflow: hidden;
  background: var(--ui-ivory-100);
  isolation: isolate;
}

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

.pdp-gallery__main--slide-next img {
  animation: pdpGallerySlideNext 240ms var(--ui-ease);
}

.pdp-gallery__main--slide-prev img {
  animation: pdpGallerySlidePrev 240ms var(--ui-ease);
}

.pdp-gallery__nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ui-text);
  cursor: pointer;
  transform: translateY(-50%);
  transition:
    color var(--ui-duration) var(--ui-ease),
    opacity var(--ui-duration) var(--ui-ease);
}

.pdp-gallery__nav:hover {
  color: var(--ui-primary-600);
}

.pdp-gallery__nav:focus-visible {
  outline: 2px solid var(--ui-primary-400);
  outline-offset: 2px;
}

.pdp-gallery__nav svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 1px 2px rgba(255, 255, 255, 0.72));
}

.pdp-gallery__nav--prev {
  left: 14px;
}

.pdp-gallery__nav--next {
  right: 14px;
}

.pdp-gallery__thumbs {
  display: flex;
  gap: var(--ui-space-sm);
  margin-top: var(--ui-space-md);
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.pdp-gallery__thumbs::-webkit-scrollbar {
  display: none;
}

.pdp-gallery__thumb {
  width: 72px;
  height: 72px;
  border: 2px solid transparent;
  border-radius: var(--ui-radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--ui-ivory-100);
  padding: 0;
  transition: border-color var(--ui-duration) var(--ui-ease);
}

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

.pdp-gallery__thumb--active,
.pdp-gallery__thumb:hover {
  border-color: var(--ui-primary-400);
}

@keyframes pdpGallerySlideNext {
  from {
    opacity: 0.64;
    transform: translateX(18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes pdpGallerySlidePrev {
  from {
    opacity: 0.64;
    transform: translateX(-18px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Hero Info */

.pdp-hero__title {
  font-family: var(--ui-font-display);
  font-size: 2.25rem;
  font-weight: 800;
  line-height: var(--ui-leading-tight);
  color: #2d2542;
  margin: 0 0 var(--ui-space-sm);
}

.pdp-hero__title-mobile-break {
  display: none;
}

.pdp-hero__subtitle {
  font-size: 1.1rem;
  color: var(--ui-text-muted);
  margin: 0 0 var(--ui-space-lg);
  white-space: pre-line;
}

.pdp-hero__rating {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  margin-bottom: var(--ui-space-lg);
}

.pdp-hero__rating-avg {
  font-weight: 700;
  font-size: 1rem;
}

.pdp-hero__rating-count {
  color: var(--ui-text-muted);
  font-size: 0.9rem;
}

.pdp-hero__desc {
  margin: 0 0 var(--ui-space-lg);
  color: var(--ui-text);
  line-height: var(--ui-leading-normal);
}

.pdp-hero__bullets {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--ui-space-xl);
}

.pdp-hero__bullet {
  position: relative;
  padding-left: var(--ui-space-lg);
  margin-bottom: var(--ui-space-sm);
  line-height: 1.5;
}

.pdp-hero__bullet::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--ui-success);
  font-weight: 700;
}

/* Price */

.pdp-hero__price {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  margin-bottom: var(--ui-space-lg);
  flex-wrap: wrap;
}

.pdp-hero__price-compare {
  text-decoration: line-through;
  color: var(--ui-text-muted);
  font-size: 1rem;
}

.pdp-hero__price-badge {
  background: var(--ui-error);
  color: var(--ui-white);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--ui-radius-full);
}

.pdp-hero__price-current {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--ui-text);
}

/* Language selector */

.pdp-hero__lang {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  margin-bottom: var(--ui-space-xl);
}

.pdp-hero__lang-label {
  font-size: 0.9rem;
  color: var(--ui-text-muted);
}

.pdp-hero__lang-value {
  padding: var(--ui-space-xs) var(--ui-space-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: 0.9rem;
  line-height: 1.4;
}

.pdp-hero__lang select {
  font-family: var(--ui-font);
  font-size: 0.9rem;
  padding: var(--ui-space-xs) var(--ui-space-md);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-sm);
  background: var(--ui-surface);
  cursor: pointer;
}

/* Hero CTA */

.pdp-hero__info .pdp-cta-btn {
  width: 100%;
  padding: var(--ui-space-md) var(--ui-space-xl);
  font-size: 1.15rem;
}

/* ============================================
   2. TESTIMONIAL BANNER
   ============================================ */

.pdp-testimonial {
  background: #F7F3FB;
  padding: var(--ui-space-3xl) 0;
  text-align: center;
  color: var(--ui-text);
}

.pdp-testimonial__quote {
  font-size: 1.35rem;
  font-style: italic;
  line-height: 1.6;
  margin: 0 auto var(--ui-space-lg);
  max-width: 720px;
  border: none;
  padding: 0;
}

.pdp-testimonial__author {
  font-style: normal;
  font-size: 1rem;
  opacity: 0.85;
}

/* ============================================
   3. ILLUSTRATOR
   ============================================ */

.pdp-story {
  padding: var(--ui-space-4xl) var(--ui-container-padding);
  background: var(--ui-white);
}

.pdp-story__layout {
  width: 100%;
  max-width: var(--ui-container-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.pdp-story__row {
  display: grid;
  grid-template-columns: minmax(280px, 38%) minmax(0, 1fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: center;
  padding: 16px;
  background: transparent;
  border-radius: 8px;
}

.pdp-story__row--reverse {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 38%);
}

.pdp-story__row--reverse .pdp-story__media {
  grid-column: 2;
  grid-row: 1;
}

.pdp-story__row--reverse .pdp-story__copy {
  grid-column: 1;
  grid-row: 1;
}

.pdp-story__copy {
  max-width: 640px;
  padding: clamp(28px, 4vw, 54px);
  align-self: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pdp-story__copy--bg {
  width: 100%;
  max-width: none;
  min-height: clamp(340px, 28vw, 430px);
  background-color: var(--ui-white);
  background-image: var(--pdp-copy-bg, none);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 100% 100%;
  border-radius: 6px;
}


.pdp-story__title {
  font-family: var(--ui-font-display);
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: 700;
  color: var(--ui-text);
  margin: 0 0 16px;
}

.pdp-story__body {
  margin: 0;
  color: var(--ui-text-muted);
  font-size: 1.125rem;
  line-height: 1.7;
}

.pdp-story__name {
  font-weight: 700;
  font-size: 0.94rem;
  color: var(--ui-primary-600);
  margin: 0 0 8px;
}

.pdp-story__media {
  margin: 0;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--ui-ivory-100);
  overflow: hidden;
  border-radius: 6px;
}

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

/* ============================================
   5. REVIEWS
   ============================================ */

.pdp-reviews {
  padding: var(--ui-space-4xl) 0;
}

.pdp-reviews__list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--ui-space-lg);
}

.pdp-reviews__state {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--ui-text-muted);
  text-align: center;
}

.pdp-review-card {
  background: var(--ui-surface);
  border-radius: var(--ui-radius-md);
  padding: var(--ui-space-lg);
  box-shadow: var(--ui-shadow-sm);
}

.pdp-review-card__header {
  display: flex;
  align-items: center;
  gap: var(--ui-space-sm);
  margin-bottom: var(--ui-space-sm);
}

.pdp-review-card__verified {
  font-size: 0.75rem;
  background: var(--ui-success);
  color: var(--ui-white);
  padding: 2px 8px;
  border-radius: var(--ui-radius-full);
  font-weight: 600;
}

.pdp-review-card__photo {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  margin-bottom: var(--ui-space-md);
  border-radius: 3px;
  object-fit: cover;
}

.pdp-review-card__title {
  margin: 0 0 6px;
  color: var(--ui-text);
  font-size: 1rem;
  line-height: 1.45;
}

.pdp-review-card__text {
  margin: 0 0 var(--ui-space-sm);
  line-height: 1.5;
}

.pdp-review-card__meta {
  font-size: 0.85rem;
  color: var(--ui-text-muted);
  margin: 0;
}

/* ============================================
   6. FAQ ACCORDION
   ============================================ */

.pdp-faq {
  padding: var(--ui-space-4xl) 0;
  background: var(--ui-ivory-100);
}

.pdp-faq__item {
  background: var(--ui-surface);
  border-radius: var(--ui-radius-md);
  margin-bottom: var(--ui-space-sm);
  box-shadow: var(--ui-shadow-sm);
  overflow: hidden;
}

.pdp-faq__question {
  padding: var(--ui-space-lg);
  font-weight: 600;
  font-size: 1.05rem;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.pdp-faq__question::-webkit-details-marker {
  display: none;
}

.pdp-faq__question::after {
  content: "+";
  font-size: 1.4rem;
  font-weight: 300;
  color: var(--ui-primary-400);
  transition: transform var(--ui-duration) var(--ui-ease);
  flex-shrink: 0;
  margin-left: var(--ui-space-md);
}

.pdp-faq__item[open] .pdp-faq__question::after {
  content: "−";
}

.pdp-faq__answer {
  padding: 0 var(--ui-space-lg) var(--ui-space-lg);
  margin: 0;
  color: var(--ui-text-muted);
  line-height: 1.6;
}

/* ============================================
   STATE SCREENS
   ============================================ */

.pdp-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  text-align: center;
  padding: var(--ui-space-2xl);
}

.pdp-state--loading p {
  margin-top: var(--ui-space-lg);
  color: var(--ui-text-muted);
}

.pdp-state--error h2 {
  margin: var(--ui-space-md) 0 var(--ui-space-sm);
}

.pdp-state--error p {
  color: var(--ui-text-muted);
  margin: 0 0 var(--ui-space-xl);
}

.pdp-state__icon {
  font-size: 3rem;
}

/* Spinner */

.pdp-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--ui-border);
  border-top-color: var(--ui-primary-500);
  border-radius: 50%;
  animation: pdp-spin 0.8s linear infinite;
}

@keyframes pdp-spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   STICKY CTA (Mobile)
   ============================================ */

.pdp-sticky-cta {
  display: none;
}

/* ============================================
   RESPONSIVE
   ============================================ */

/* Tablet */
@media (max-width: 1023px) {
  .pdp-hero__inner {
    grid-template-columns: 1fr;
    gap: var(--ui-space-xl);
  }

  .pdp-gallery {
    position: static;
    max-width: 560px;
    margin: 0 auto;
  }

  .pdp-reviews__list {
    grid-template-columns: 1fr;
  }

  .pdp-story__layout {
    width: 100%;
  }

  .pdp-story__row,
  .pdp-story__row--reverse {
    grid-template-columns: minmax(220px, 38%) minmax(0, 1fr);
    gap: var(--ui-space-lg);
  }

  .pdp-story__row--reverse .pdp-story__media,
  .pdp-story__row--reverse .pdp-story__copy {
    grid-column: auto;
    grid-row: auto;
  }
}

/* Mobile */
@media (max-width: 767px) {
  .pdp-hero {
    padding: calc(var(--ui-space-xl) / 2) 0 var(--ui-space-lg);
  }

  .pdp-story {
    padding-right: var(--ui-space-md);
    padding-left: var(--ui-space-md);
  }

  .pdp-hero__title {
    font-size: 1.65rem;
  }

  .pdp-hero__title-mobile-break {
    display: initial;
  }

  .pdp-hero__subtitle {
    font-size: 1rem;
  }

  .pdp-section-title {
    font-size: 1.4rem;
  }

  .pdp-gallery__thumb {
    flex: 0 0 auto;
    width: 56px;
    height: 56px;
  }

  .pdp-gallery__nav {
    width: 38px;
    height: 38px;
  }

  .pdp-gallery__nav--prev {
    left: 10px;
  }

  .pdp-gallery__nav--next {
    right: 10px;
  }

  .pdp-story__layout {
    gap: var(--ui-space-md);
  }

  .pdp-story__row,
  .pdp-story__row--reverse {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .pdp-story__copy {
    padding: clamp(24px, 7vw, 36px);
  }

  .pdp-story__copy--bg {
    min-height: 320px;
    background-size: cover;
  }

  .pdp-story__media {
    border-radius: 6px;
  }

  .pdp-story__title {
    font-size: 1.5rem;
  }

  .pdp-story__body {
    font-size: 1rem;
  }

  .pdp-testimonial__quote {
    font-size: 1.1rem;
  }

  /* Hide hero CTA, show sticky CTA */
  .pdp-hero__info .pdp-cta-btn {
    display: none;
  }

  .pdp-sticky-cta {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ui-surface);
    padding: var(--ui-space-md) var(--ui-container-padding);
    padding-bottom: calc(var(--ui-space-md) + env(safe-area-inset-bottom, 0px));
    box-shadow: var(--ui-shadow-top-sm);
    z-index: 100;
  }

  .pdp-sticky-cta .pdp-cta-btn {
    width: 100%;
    font-size: 1.05rem;
  }

  .pdp-reviews {
    padding: var(--ui-space-2xl) 0;
  }

  .pdp-testimonial,
  .pdp-story,
  .pdp-faq {
    padding: var(--ui-space-2xl) 0;
  }

  /* Prevent fixed CTA from covering bottom content */
  .site-body {
    padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  }
}
