/**
 * Google reviews badge and pop-up.
 *
 * Deliberately not in the house style. This is Google's content shown the way
 * Google shows it: white card, round corners, system sans, Google's own star
 * yellow. Every class starts igr- and the plugin safelists that prefix with
 * WP Rocket, because most of the rules below describe states that are not in
 * the page when it loads.
 */

.igr-badge,
.igr-dialog {
  --igr-ink: #111111;
  --igr-ink-2: rgba(17, 17, 17, 0.7);
  --igr-line: rgba(17, 17, 17, 0.12);
  --igr-blue: #006dff;
  --igr-star: #fcbf02;
  --igr-star-off: #dadce0;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: var(--igr-ink);
  -webkit-font-smoothing: antialiased;
}

.igr-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---- stars ---- */

.igr-stars {
  position: relative;
  display: inline-block;
  flex: none;
  width: 90px;
  height: 18px;
  color: var(--igr-star-off);
  vertical-align: middle;
}

.igr-stars svg {
  display: block;
  width: 90px;
  height: 18px;
  fill: currentColor;
}

.igr-stars-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  overflow: hidden;
  color: var(--igr-star);
}

.igr-g { display: block; flex: none; width: 28px; height: 28px; }
.igr-g-large { width: 36px; height: 36px; }
.igr-g-small { width: 18px; height: 18px; margin-left: auto; }

/* ---- badge ---- */

.igr-badge {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08), 0 6px 24px rgba(0, 0, 0, 0.16);
  animation: igr-rise 0.3s ease-out both;
}

.igr-badge[hidden] { display: none; }

.igr-badge-open {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 34px 12px 16px;
  font: inherit;
  color: inherit;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}

.igr-badge-body { display: flex; flex-direction: column; gap: 2px; }
.igr-badge-row { display: flex; align-items: center; gap: 6px; }
.igr-badge-rating { font-size: 18px; font-weight: 700; line-height: 1; }
.igr-badge-count { font-size: 12px; color: var(--igr-ink-2); }

.igr-badge-close,
.igr-close {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  color: var(--igr-ink-2);
  background: none;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
}

.igr-badge-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
}

.igr-badge-close svg { width: 9px; height: 9px; }

.igr-badge-close:hover,
.igr-close:hover { color: var(--igr-ink); background: rgba(17, 17, 17, 0.06); }

.igr-badge-open:focus-visible,
.igr-badge-close:focus-visible,
.igr-close:focus-visible,
.igr-more:focus-visible,
.igr-write:focus-visible,
.igr-summary-count:focus-visible {
  outline: 2px solid var(--igr-blue);
  outline-offset: 2px;
}

@keyframes igr-rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---- pop-up ---- */

.igr-lock { overflow: hidden; }

.igr-dialog {
  width: min(720px, calc(100vw - 32px));
  max-width: none;
  max-height: min(820px, calc(100vh - 32px));
  max-height: min(820px, calc(100dvh - 32px));
  margin: auto;
  padding: 0;
  overflow: hidden;
  background: #fff;
  border: 0;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.3);
}

.igr-dialog[open] { display: flex; }
.igr-dialog::backdrop { background: rgba(17, 17, 17, 0.6); }

.igr-panel {
  display: flex;
  flex-direction: column;
  width: 100%;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 24px 28px 28px;
}

.igr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.igr-dialog p { margin: 0; max-width: none; font-family: inherit; color: inherit; }

.igr-dialog .igr-title { font-size: 22px; font-weight: 700; line-height: 1.25; }

.igr-close { flex: none; width: 36px; height: 36px; margin-right: -8px; }
.igr-close svg { width: 13px; height: 13px; }

.igr-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 20px;
  background: #f5f6f7;
  border-radius: 12px;
}

.igr-summary-rating { display: flex; align-items: center; gap: 14px; }
.igr-dialog .igr-summary-name { font-size: 15px; font-weight: 700; }
.igr-summary-line { display: flex; align-items: center; gap: 6px; }
.igr-summary-score { font-size: 18px; font-weight: 700; }

.igr-dialog a.igr-summary-count {
  font-size: 13px;
  color: var(--igr-ink-2);
  text-decoration: none;
  border: 0;
}

.igr-dialog a.igr-summary-count:hover { color: var(--igr-ink); text-decoration: underline; }

.igr-dialog a.igr-write {
  display: inline-block;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  color: #fff;
  text-decoration: none;
  white-space: nowrap;
  background: var(--igr-blue);
  border: 0;
  border-radius: 24px;
}

.igr-dialog a.igr-write:hover { color: #fff; background: #0058cf; }

.igr-list {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.igr-review { margin: 0; padding: 20px 0; border-bottom: 1px solid var(--igr-line); }
.igr-review:last-child { padding-bottom: 0; border-bottom: 0; }

.igr-review-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }

.igr-avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.igr-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  line-height: 1;
  color: #fff;
}

.igr-review-who { min-width: 0; }
.igr-dialog .igr-name { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.igr-dialog .igr-date { font-size: 12px; color: var(--igr-ink-2); }

.igr-text {
  display: -webkit-box;
  margin-top: 8px;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  line-clamp: 3;
}

.igr-text.igr-open {
  display: block;
  overflow: visible;
  -webkit-line-clamp: unset;
  line-clamp: unset;
}

.igr-text.igr-open p + p { margin-top: 0.75em; }

.igr-more {
  margin: 6px 0 0;
  padding: 0;
  font: inherit;
  font-size: 14px;
  color: var(--igr-ink-2);
  background: none;
  border: 0;
  cursor: pointer;
}

.igr-more[hidden] { display: none; }
.igr-more:hover { color: var(--igr-ink); text-decoration: underline; }

@media (max-width: 575px) {
  .igr-badge { left: 12px; bottom: 12px; }
  .igr-badge-open { padding: 10px 30px 10px 12px; gap: 10px; }

  .igr-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 12px;
  }

  .igr-panel { padding: 18px 16px 20px; }
  .igr-dialog .igr-title { font-size: 19px; }
  .igr-summary { padding: 14px; }
  .igr-dialog a.igr-write { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  .igr-badge { animation: none; }
}

@media print {
  .igr-badge { display: none; }
}
