/* =============================================================
   Spartan Agency — Site Reviews plugin skin

   Re-themes the free Site Reviews plugin (GeminiLabs) to the
   Spartan token set. Loaded only when the plugin is active
   (conditional enqueue in functions.php). Every selector is
   scoped to `.glsr` / `.glsr-*` (the plugin's default wrapper
   prefix), so removing this file cleanly reverts to the plugin's
   stock look without leaking overrides.

   Palette rules (2026 rebrand): gold is the accent, charcoal the
   ink; plum is reserved for hyperlinks and only reaches this file
   through the global --link token. Titles, borders and star
   strokes therefore use --text / --charcoal-2, never --plum.

   Contrast targets (verified against docs/A11Y-AUDIT.md § 1.4.3):
     • Body text  --text-muted on --surface-elevated : ≥ 7 : 1
     • Star fill  --accent (gold) on white is 2.27:1, below the
       WCAG 1.4.11 3:1 non-text threshold, so every star carries a
       --charcoal-2 stroke that supplies the contrast.
   ============================================================= */

/* ---------- Review card / list ---------- */
.glsr,
.glsr-default {
  font-family: var(--font-body);
  color: var(--text);
}

.glsr-review,
.glsr-default .glsr-review {
  background: var(--surface-elevated);
  border-radius: var(--r-card);
  box-shadow: var(--elev-2);
  padding: var(--s-5);
  margin-block: var(--s-4);
  transition:
    box-shadow var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.glsr-review:hover,
.glsr-review:focus-within {
  box-shadow: var(--elev-3);
  transform: translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .glsr-review:hover,
  .glsr-review:focus-within {
    transform: none;
    box-shadow: var(--elev-2);
  }
}

.glsr-review-title,
.glsr-review .glsr-review-title {
  font-family: var(--font-display);
  font-size: var(--fs-h3);
  line-height: var(--lh-h3);
  color: var(--text);
  margin-bottom: var(--s-2);
}

.glsr-review-content,
.glsr-review .glsr-review-content {
  font-family: var(--font-prose);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  color: var(--text-muted);
}

.glsr-review-author,
.glsr-review .glsr-review-author {
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--text);
  margin-top: var(--s-3);
}

.glsr-review-date,
.glsr-review .glsr-review-date {
  font-family: var(--font-mono);
  font-size: var(--fs-small);
  color: var(--text-muted);
  letter-spacing: var(--tracking-mono);
}

/* ---------- Star widget (both listing + summary) ----------
   The plugin outputs each star as an inline SVG inside a
   .glsr-star element. Force gold fill + charcoal stroke so the
   star is legible against every surface AND passes WCAG 1.4.11
   3:1 non-text contrast (via the stroke, since gold alone would
   fail on white). */
.glsr-star,
.glsr-review .glsr-star {
  color: var(--accent);              /* SVG fill inherits from color */
}

.glsr-star svg,
.glsr-review .glsr-star svg {
  fill: var(--accent);
  stroke: var(--charcoal-2);
  stroke-width: 1.5;
  width: 20px;
  height: 20px;
}

.glsr-star--empty svg {
  fill: transparent;
  stroke: var(--charcoal-2);
}

/* ---------- Aggregate summary bar ---------- */
.glsr-summary {
  background: var(--surface-elevated);
  border-radius: var(--r-card);
  box-shadow: var(--elev-1);
  border-top: 3px solid var(--brand-primary);
  padding: var(--s-4) var(--s-5);
  margin-block: var(--s-5);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  align-items: center;
  justify-content: space-between;
}

.glsr-summary-rating {
  font-family: var(--font-display);
  font-size: var(--fs-h1);
  color: var(--text);
}

/* Percentage bars in the summary breakdown: gold fill on a soft rule. */
.glsr-summary .glsr-bar-background {
  background: var(--rule-soft);
  border-radius: var(--r-pill);
}

.glsr-summary .glsr-bar-background-percent {
  background: var(--brand-primary);
  border-radius: var(--r-pill);
}

/* Plugin's own "no reviews yet" fallback line */
.glsr-fallback,
.glsr .glsr-fallback {
  margin: var(--s-4) 0;
  padding: var(--s-4) var(--s-5);
  background: var(--bone);
  border-left: 3px solid var(--brand-primary);
  border-radius: 0 var(--r-md) var(--r-md) 0;
  color: var(--text-muted);
}

.glsr-summary-count {
  font-family: var(--font-body);
  color: var(--text-muted);
}

/* ---------- Submission form ---------- */
.glsr-form,
.glsr-default form,
form.glsr-form {
  background: var(--surface-elevated);
  border-radius: var(--r-card);
  box-shadow: var(--elev-1);
  padding: var(--s-6);
  margin-block: var(--s-6);
}

.glsr-form .glsr-field,
.glsr-form fieldset {
  margin-bottom: var(--s-4);
  border: 0;
  padding: 0;
}

.glsr-form label,
.glsr-form legend {
  display: block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--fs-body);
  color: var(--text);
  margin-bottom: var(--s-2);
}

.glsr-form input[type="text"],
.glsr-form input[type="email"],
.glsr-form input[type="url"],
.glsr-form input[type="tel"],
.glsr-form textarea,
.glsr-form select {
  width: 100%;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.4;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--ink-muted);
  border-radius: var(--r-input);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.glsr-form input:hover:not(:focus),
.glsr-form textarea:hover:not(:focus),
.glsr-form select:hover:not(:focus) {
  border-color: var(--charcoal-2);
}

.glsr-form input:focus,
.glsr-form textarea:focus,
.glsr-form select:focus {
  border-color: var(--charcoal-2);
  /* :focus-visible outline is provided by the theme's global rule
     in base.css — no duplicate box-shadow needed here. */
}

.glsr-form input[aria-invalid="true"],
.glsr-form textarea[aria-invalid="true"] {
  border-color: var(--danger);
}

.glsr-form .glsr-field-description {
  font-size: var(--fs-small);
  color: var(--text-muted);
  margin-top: var(--s-1);
}

/* Interactive star input on the submit form */
.glsr-star-rating {
  display: inline-flex;
  gap: 4px;
}

.glsr-star-rating .glsr-star-rating-star {
  cursor: pointer;
  color: var(--accent);
  transition: transform var(--dur-fast) var(--ease-out);
}

.glsr-star-rating .glsr-star-rating-star:hover,
.glsr-star-rating .glsr-star-rating-star:focus-visible {
  transform: scale(1.15);
}

@media (prefers-reduced-motion: reduce) {
  .glsr-star-rating .glsr-star-rating-star:hover,
  .glsr-star-rating .glsr-star-rating-star:focus-visible {
    transform: none;
  }
}

/* Submit button — matches the theme's gold pill CTA (.tx-btn--gold) */
.glsr-form button[type="submit"],
.glsr-form input[type="submit"],
.glsr-button-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  padding: 12px 30px;
  font-family: var(--font-body);
  font-size: var(--fs-btn);
  font-weight: 600;
  line-height: 22px;
  letter-spacing: var(--tracking-nav);
  border-radius: var(--r-pill);
  border: 1.5px solid var(--brand-primary);
  background: var(--brand-primary);
  color: var(--brand-primary-ink);
  cursor: pointer;
  min-width: 160px;
  transition:
    background-color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out),
    box-shadow var(--dur-fast) var(--ease-out);
}

.glsr-form button[type="submit"]:hover,
.glsr-form button[type="submit"]:focus-visible,
.glsr-form input[type="submit"]:hover,
.glsr-form input[type="submit"]:focus-visible,
.glsr-button-submit:hover,
.glsr-button-submit:focus-visible {
  background: var(--brand-primary-hover);
  border-color: var(--brand-primary-hover);
  color: var(--brand-primary-ink);
  box-shadow: var(--elev-1);
  transform: translateY(-1px);
}

@media (prefers-reduced-motion: reduce) {
  .glsr-form button[type="submit"]:hover,
  .glsr-form input[type="submit"]:hover,
  .glsr-button-submit:hover {
    transform: none;
    box-shadow: none;
  }
}

/* Form-level status messages (WCAG 4.1.3 status messages) */
.glsr-form-message--success,
.glsr-notice--success {
  color: var(--success);
  padding: var(--s-3);
  border-left: 3px solid var(--success);
  background: rgba(20, 107, 58, 0.06);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

.glsr-form-message--error,
.glsr-notice--error {
  color: var(--danger);
  padding: var(--s-3);
  border-left: 3px solid var(--danger);
  background: rgba(183, 28, 28, 0.06);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .glsr-review {
    padding: var(--s-4);
  }
  .glsr-summary {
    padding: var(--s-3) var(--s-4);
  }
  .glsr-form {
    padding: var(--s-4);
  }
}
