/* ===========================
   GOOGLE REVIEWS SLIDER — Premium Edition
   Quiet luxury aesthetic. Embeddable on any landing page.
   Inherits host CSS variables, provides refined defaults.
   =========================== */

/* --- Animation Keyframes --- */
@keyframes gr-fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes gr-scaleIn {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: scale(1); }
}

@keyframes gr-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gr-pulseGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 162, 0, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(232, 162, 0, 0.08); }
}

/* --- Widget Root --- */
.gr-widget {
  width: 100%;
  --gr-gold: var(--star-color, #D4940A);
  --gr-gold-light: rgba(212, 148, 10, 0.10);
  --gr-gold-medium: rgba(212, 148, 10, 0.22);
  --gr-surface: var(--bg-surface, #ffffff);
  --gr-text-primary: var(--text-dark, #111111);
  --gr-text-secondary: var(--text-medium, #555555);
  --gr-text-tertiary: var(--text-light, #888888);
  --gr-border: var(--neutral-200, #eaeaea);
  --gr-border-hover: var(--neutral-300, #d0d0d0);
  --gr-accent: var(--gr-accent, #004563);
  --gr-radius: var(--border-radius-lg, 14px);
  --gr-card-gap: 20px;
}

/* --- Score Header --- */
.gr-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.625rem;
  margin-bottom: 2.5rem;
  text-align: center;
  animation: gr-fadeUp 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gr-header__google-logo {
  width: 72px;
  height: auto;
  opacity: 0.9;
  transition: opacity 0.3s ease;
}

.gr-header__google-logo:hover {
  opacity: 1;
}

.gr-header__score {
  display: flex;
  align-items: baseline;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.gr-header__number {
  font-size: clamp(2.2rem, 2.5vw + 1rem, 3rem);
  font-weight: 800;
  color: var(--gr-text-primary);
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.gr-header__scale {
  font-size: 0.38em;
  font-weight: 400;
  color: var(--gr-text-tertiary);
  letter-spacing: 0.02em;
}

.gr-header__stars {
  display: flex;
  gap: 0.2rem;
  font-size: 1.35rem;
}

.gr-header__stars .gr-star {
  color: var(--gr-gold);
  filter: drop-shadow(0 1px 2px rgba(212, 148, 10, 0.3));
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.gr-header:hover .gr-header__stars .gr-star {
  animation: gr-pulseGlow 2s ease-in-out infinite;
}

.gr-header__meta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.gr-header__count {
  font-size: 0.85rem;
  color: var(--gr-text-tertiary);
  font-weight: 500;
  letter-spacing: 0.01em;
}

/* --- Verified Badge (Header) --- */
.gr-header__verified {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #4285F4;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: opacity 0.2s;
}

.gr-header__verified:hover {
  opacity: 1;
}

.gr-header__verified .gr-verified-icon {
  width: 14px;
  height: 14px;
}

.gr-header__link {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--gr-text-tertiary);
  font-size: 0.78rem;
  font-weight: 400;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.25s ease, letter-spacing 0.25s ease;
  opacity: 0.7;
}

.gr-header__link:hover {
  color: var(--gr-accent);
  letter-spacing: 0.03em;
  opacity: 1;
}

/* --- Slider --- */
.gr-slider {
  position: relative;
}

.gr-slider__track {
  display: flex;
  gap: var(--gr-card-gap);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 4px 12px;
  margin: -8px -4px;
}

.gr-slider__track::-webkit-scrollbar {
  display: none;
}

/* --- Review Card --- */
.gr-card {
  flex: 0 0 calc(33.333% - var(--gr-card-gap) * 2 / 3);
  scroll-snap-align: start;
  display: flex;
  flex-direction: column;
  min-height: 290px;
  background: var(--gr-surface);
  padding: 1.75rem;
  border-radius: var(--gr-radius);
  border: 1px solid var(--gr-border);
  position: relative;
  overflow: hidden;
  transition:
    transform 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 0.35s cubic-bezier(0.22, 1, 0.36, 1),
    border-color 0.35s ease;
  animation: gr-scaleIn 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* Stagger card entrance animations */
.gr-card:nth-child(1) { animation-delay: 0.05s; }
.gr-card:nth-child(2) { animation-delay: 0.12s; }
.gr-card:nth-child(3) { animation-delay: 0.19s; }
.gr-card:nth-child(4) { animation-delay: 0.26s; }
.gr-card:nth-child(5) { animation-delay: 0.33s; }

.gr-card:hover {
  transform: translateY(-3px);
  border-color: var(--gr-gold);
  border-width: 2px;
  padding: calc(1.75rem - 1px);
  box-shadow:
    0 8px 30px -8px rgba(0, 0, 0, 0.08),
    0 2px 8px -2px rgba(0, 0, 0, 0.04);
}

/* --- Stars in Card --- */
.gr-card__stars {
  display: flex;
  gap: 0.125rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  color: var(--gr-gold);
}

.gr-card__stars .gr-star {
  filter: drop-shadow(0 0.5px 1px rgba(212, 148, 10, 0.25));
}

/* --- Review Text --- */
.gr-card__text {
  font-size: 0.9rem;
  color: var(--gr-text-secondary);
  line-height: 1.75;
  margin-bottom: 0.875rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  letter-spacing: 0.005em;
}

.gr-card__text.gr-card__text--expanded {
  -webkit-line-clamp: unset;
}

/* --- Highlighted Trust Phrases --- */
.gr-card__text mark {
  background: linear-gradient(
    120deg,
    rgba(212, 148, 10, 0.0) 0%,
    var(--gr-gold-medium) 8%,
    var(--gr-gold-medium) 92%,
    rgba(212, 148, 10, 0.0) 100%
  );
  color: inherit;
  font-weight: 600;
  padding: 2px 5px;
  margin: 0 -2px;
  border-radius: 4px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  transition: background 0.3s ease;
}

.gr-card:hover .gr-card__text mark {
  background: linear-gradient(
    120deg,
    rgba(212, 148, 10, 0.0) 0%,
    rgba(212, 148, 10, 0.30) 8%,
    rgba(212, 148, 10, 0.30) 92%,
    rgba(212, 148, 10, 0.0) 100%
  );
}

/* --- Read More Button --- */
.gr-card__more {
  background: none;
  border: none;
  color: var(--gr-accent);
  font-weight: 600;
  cursor: pointer;
  padding: 0;
  margin-top: 0.125rem;
  margin-bottom: 0.625rem;
  font-size: 0.82rem;
  display: inline-block;
  text-align: right;
  width: 100%;
  font-family: inherit;
  letter-spacing: 0.02em;
  transition: opacity 0.2s;
  opacity: 0.8;
}

.gr-card__more:hover {
  opacity: 1;
}

/* --- Card Footer --- */
.gr-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 0.875rem;
  border-top: 1px solid var(--gr-border);
  transition: border-color 0.3s ease;
}

.gr-card:hover .gr-card__footer {
  border-color: var(--gr-border-hover);
}

.gr-card__author {
  display: inline-flex;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gr-text-primary);
  letter-spacing: 0.005em;
}

.gr-card__author .gr-verified-icon {
  width: 13px;
  height: 13px;
  margin-left: 0.35rem;
  vertical-align: -1px;
  opacity: 0.85;
}

.gr-card__date {
  font-size: 0.76rem;
  color: var(--gr-text-tertiary);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* --- Controls --- */
.gr-slider__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
  animation: gr-fadeUp 0.6s 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.gr-slider__arrow {
  background: var(--gr-surface);
  border: 1px solid var(--gr-border);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--gr-text-secondary);
  transition:
    all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
}

.gr-slider__arrow:hover {
  border-color: var(--gr-accent);
  color: var(--gr-accent);
  transform: scale(1.06);
  box-shadow: 0 2px 8px -2px rgba(0, 0, 0, 0.08);
}

.gr-slider__arrow:active {
  transform: scale(0.96);
}

.gr-slider__dots {
  display: flex;
  gap: 0.375rem;
  align-items: center;
}

.gr-slider__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gr-border);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.gr-slider__dot:hover {
  background: var(--gr-border-hover);
  transform: scale(1.3);
}

.gr-slider__dot--active {
  width: 22px;
  height: 6px;
  border-radius: 3px;
  background: var(--gr-accent);
}

/* --- Footer --- */
.gr-footer {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.25rem;
  font-size: 0.7rem;
  color: var(--gr-text-tertiary);
  letter-spacing: 0.03em;
  opacity: 0.5;
  transition: opacity 0.3s;
}

.gr-widget:hover .gr-footer {
  opacity: 0.7;
}

/* --- Responsive --- */
@media (max-width: 991px) {
  .gr-card {
    flex: 0 0 calc(50% - var(--gr-card-gap) / 2);
    min-height: 270px;
    padding: 1.5rem;
  }

  .gr-header {
    margin-bottom: 2rem;
  }
}

@media (max-width: 600px) {
  .gr-card {
    flex: 0 0 88%;
    min-height: auto;
    padding: 1.375rem;
  }

  .gr-header__number {
    font-size: 2rem;
  }

  .gr-header {
    margin-bottom: 1.5rem;
  }

  .gr-slider__controls {
    margin-top: 1.5rem;
  }

  .gr-card__text {
    -webkit-line-clamp: 7;
  }
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .gr-card,
  .gr-header,
  .gr-slider__controls {
    animation: none;
  }

  .gr-card:hover {
    transform: none;
  }

  .gr-card::before {
    transition: opacity 0.15s;
  }

  .gr-header:hover .gr-header__stars .gr-star {
    animation: none;
  }
}
