/* ============================================================================
   reviews.css  -  Customer reviews: display, summary and the review form
   ----------------------------------------------------------------------------
   Loaded via injectCSS on the pages that actually show reviews:
     tecdoc.part.number.cfm / part.number.cfm / gfb.part.number.cfm  (display)
     reviews.cfm                                                    (display)
     review.cfm                                                     (the form)

   Built on css/foundations.css tokens rather than ported from SuperPro's
   brand-2025.css -- that file is not reachable from this workspace, and
   rebuilding on --oct-* means the block inherits Octane's scale and palette
   instead of arriving as a second opinion about what a card looks like.

   THE STAR RATING INPUT -- read before restyling
   ----------------------------------------------
   review.cfm renders the five radios in DOM order 5,4,3,2,1 (input, label,
   input, label...) and this file flips the row back with row-reverse. That
   ordering is load-bearing: `input:checked ~ label` can only reach siblings
   AFTER the checked input, so 5-to-1 markup is what lets checking star 3
   light stars 3, 2 and 1. Re-order the markup ascending and the highlighting
   silently stops working.

   The radios are hidden with opacity, NOT display:none -- a display:none
   input cannot be focused, which would take the keyboard and the screen
   reader down with it. They stay in the tab order and :focus-visible draws
   a real ring on the label standing in for them.
============================================================================ */

/* Screen-reader-only text. Defined here because the site's only copies live
   in css/font-awesome.css and the probite stylesheets, none of which are in
   the core bundle -- the rating announcements would otherwise be visible. */
.reviews-block .sr-only,
.review-card .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================================================
   SHARED STARS
============================================================================ */
.reviews-stars {
    display: inline-flex;
    gap: 2px;
    line-height: 1;
    /* The glyphs are decorative (aria-hidden); the number beside them is the
       accessible version. */
}
.reviews-star {
    color: var(--oct-line);
    font-size: 1.125rem;
}
.reviews-star.is-on { color: var(--oct-accent); }

/* ============================================================================
   REVIEW LIST  (includes/reviews.display.cfm)
============================================================================ */
.reviews-block {
    text-align: left;
    margin: var(--oct-space-7) 0;
}

.reviews-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: var(--oct-space-2) var(--oct-space-5);
    padding-bottom: var(--oct-space-3);
    border-bottom: 2px solid var(--oct-line-soft);
    margin-bottom: var(--oct-space-5);
}

/* The heading is an <h2>, and the global base sets h2 to 300% -- three times
   the size of the surrounding page. Pin it to the token scale here rather
   than leaving the block to inherit a heading bigger than the h1 above it. */
.reviews-block h2 {
    display: block;
    width: auto;
    margin: 0;
    font-size: var(--oct-h2);
    font-weight: 700;
    line-height: 1.2;
    color: var(--oct-ink);
    text-align: left;
}

.reviews-summary-score {
    display: flex;
    align-items: center;
    gap: var(--oct-space-2);
}
.reviews-summary-score .reviews-star { font-size: 1.375rem; }

.reviews-score-text {
    font-size: var(--oct-text-base);
    color: var(--oct-ink-soft);
}
.reviews-score-text strong {
    font-size: var(--oct-text-lg);
    color: var(--oct-ink);
}
.reviews-count { color: var(--oct-ink-mute); }

.reviews-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.review {
    padding: var(--oct-space-5) 0;
    border-bottom: 1px solid var(--oct-line-soft);
}
.review:first-child { padding-top: 0; }
.review:last-child  { border-bottom: 0; }

.review-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oct-space-2) var(--oct-space-3);
    margin-bottom: var(--oct-space-2);
}
.review-title {
    font-size: var(--oct-text-md);
    font-weight: 700;
    color: var(--oct-ink);
}

.review-body {
    /* Capped like .oct-prose: a review running the full width of a 1632px
       container is not readable, and these are the words people came for. */
    max-width: var(--oct-measure);
    margin: 0 0 var(--oct-space-3);
    font-size: var(--oct-text-base);
    line-height: 1.6;
    color: var(--oct-ink);
}

.review-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--oct-space-1) var(--oct-space-4);
    margin: 0;
    font-size: var(--oct-text-sm);
    color: var(--oct-ink-mute);
}
.review-author { font-weight: 600; color: var(--oct-ink-soft); }

.review-verified {
    color: var(--oct-green);
    font-weight: 600;
}
.review-verified::before {
    content: "\2713";     /* check mark */
    margin-right: 4px;
}

.review-vehicle {
    /* The single most useful thing in a parts review, so it gets to look
       like a fact rather than another grey timestamp. */
    background: var(--oct-surface-alt);
    border: 1px solid var(--oct-line);
    border-radius: var(--oct-radius-pill);
    padding: 3px 12px;
    color: var(--oct-ink-soft);
}

.review-response {
    max-width: var(--oct-measure);
    margin: var(--oct-space-3) 0 0;
    padding: var(--oct-space-3) var(--oct-space-4);
    background: var(--oct-surface-alt);
    border-left: 3px solid var(--oct-accent);
    border-radius: 0 var(--oct-radius-sm) var(--oct-radius-sm) 0;
}
.review-response-label {
    display: block;
    font-size: var(--oct-text-xs);
    text-transform: uppercase;
    letter-spacing: .04em;
    font-weight: 700;
    color: var(--oct-ink-faint);
    margin-bottom: var(--oct-space-1);
}
.review-response p {
    margin: 0;
    font-size: var(--oct-text-sm);
    line-height: 1.6;
    color: var(--oct-ink-soft);
}

@media (max-width: 640px) {
    .reviews-block h2 { font-size: 1.35rem; }
    .reviews-summary  { gap: var(--oct-space-2); }
}

/* ============================================================================
   SITE REVIEWS PAGE  (reviews.cfm)
============================================================================ */
.reviews-page-intro {
    max-width: var(--oct-measure);
    font-size: var(--oct-text-md);
    line-height: 1.6;
    color: var(--oct-ink-soft);
    margin: 0 0 var(--oct-space-5);
}
.reviews-page-note {
    max-width: var(--oct-measure);
    margin: var(--oct-space-7) 0 0;
    padding-top: var(--oct-space-4);
    border-top: 1px solid var(--oct-line);
    font-size: var(--oct-text-sm);
    color: var(--oct-ink-mute);
}

/* ============================================================================
   THE REVIEW FORM  (review.cfm)
============================================================================ */
.review-intro,
.review-thanks {
    max-width: var(--oct-measure);
    font-size: var(--oct-text-md);
    line-height: 1.6;
    color: var(--oct-ink-soft);
    margin: 0 0 var(--oct-space-5);
}

.review-error {
    max-width: var(--oct-measure);
    margin: 0 0 var(--oct-space-5);
    padding: var(--oct-space-3) var(--oct-space-4);
    border: 1px solid var(--oct-accent);
    border-left-width: 3px;
    border-radius: var(--oct-radius-sm);
    background: #fff5f2;
    color: var(--oct-ink);
    font-size: var(--oct-text-base);
}

/* ---- one CARD per part -----------------------------------------------------
   Each card is its own <form> with its own send button, and it leads with the
   photograph: that, not "SPF1485-20K", is what tells somebody which of the
   four things in the box they are being asked about. */
.review-sent {
    max-width: var(--oct-measure);
    margin: 0 0 var(--oct-space-5);
    padding: var(--oct-space-3) var(--oct-space-4);
    border: 1px solid var(--oct-green);
    border-left-width: 3px;
    border-radius: var(--oct-radius-sm);
    background: var(--oct-green-soft);
    color: var(--oct-ink);
    font-size: var(--oct-text-base);
}
.review-sent__tick { font-weight: 700; margin-right: var(--oct-space-1); }

.review-progress {
    margin: 0 0 var(--oct-space-3);
    font-size: var(--oct-text-sm);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--oct-ink-faint);
}

.review-cards {
    display: grid;
    gap: var(--oct-space-5);
    max-width: 680px;
    margin-bottom: var(--oct-space-5);
}

.review-card {
    box-sizing: border-box;
    max-width: 680px;
    margin: 0;
    padding: var(--oct-space-5);
    border: 1px solid var(--oct-line);
    border-radius: var(--oct-radius);
    background: var(--oct-surface);
}
.review-card--site { background: var(--oct-surface-alt); }
/* A card that has been sent stays on the page - seeing "reviewed" against the
   part is the confirmation - but stops competing for attention with the ones
   still to do. */
.review-card--done {
    border-color: #cfe3d0;
    background: var(--oct-green-soft);
}

.review-card__head {
    display: flex;
    align-items: center;
    gap: var(--oct-space-4);
    padding-bottom: var(--oct-space-4);
    border-bottom: 1px solid var(--oct-line-soft);
}
.review-card__photo {
    flex: 0 0 96px;
    width: 96px;
    height: 96px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--oct-line);
    border-radius: var(--oct-radius-sm);
    background: var(--oct-surface);
}
.review-card__photo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}
.review-card__ident { min-width: 0; }
.review-card__part {
    display: block;
    font-size: var(--oct-text-md);
    font-weight: 700;
    color: var(--oct-ink);
    word-break: break-word;
}
.review-card__desc {
    display: block;
    margin-top: 2px;
    font-size: var(--oct-text-base);
    color: var(--oct-ink-mute);
}
.review-card__sitehead {
    margin: 0 0 var(--oct-space-1);
    font-size: var(--oct-h3);
    font-weight: 700;
    color: var(--oct-ink);
}

.review-card__field { margin-top: var(--oct-space-3); }
.review-card__ratinglabel {
    display: block;
    font-size: var(--oct-text-base);
    font-weight: 600;
    color: var(--oct-ink);
}

.review-card label {
    display: block;
    margin: var(--oct-space-4) 0 var(--oct-space-1);
    font-size: var(--oct-text-base);
    font-weight: 600;
    color: var(--oct-ink);
}
.review-card input[type="text"],
.review-card textarea {
    /* 18px to match the site's input scale -- 16px is also the floor below
       which iOS Safari zooms the viewport on focus. */
    width: 100%;
    box-sizing: border-box;
    font: inherit;
    font-size: 1.125rem;
    padding: 11px 12px;
    border: 1px solid var(--oct-line);
    border-radius: var(--oct-radius-sm);
    background: var(--oct-surface);
    color: var(--oct-ink);
}
.review-card input[type="text"]:focus,
.review-card textarea:focus {
    outline: 2px solid var(--oct-accent);
    outline-offset: 1px;
    border-color: var(--oct-accent);
}
.review-card textarea { line-height: 1.5; resize: vertical; }

/* Name and send button on one line: the name is prefilled from the order and
   is almost never edited, so it should not read as another question. */
.review-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: var(--oct-space-3);
    margin-top: var(--oct-space-5);
    padding-top: var(--oct-space-4);
    border-top: 1px solid var(--oct-line-soft);
}
.review-card__name { flex: 1 1 220px; min-width: 0; }
.review-card__name label {
    margin: 0 0 var(--oct-space-1);
    font-size: var(--oct-text-sm);
    font-weight: 400;
    color: var(--oct-ink-mute);
}
.review-card__foot .oct-btn { flex: 0 0 auto; }

.review-card__done {
    margin: var(--oct-space-3) 0 0;
    font-weight: 600;
    color: var(--oct-green);
}
.review-card__tick { margin-right: var(--oct-space-1); }

@media (max-width: 480px) {
    .review-card { padding: var(--oct-space-4); }
    .review-card__photo { flex-basis: 72px; width: 72px; height: 72px; }
    .review-card__foot .oct-btn { width: 100%; }
}

.review-optional {
    font-weight: 400;
    font-size: var(--oct-text-sm);
    color: var(--oct-ink-mute);
}
p.review-optional { margin: 0 0 var(--oct-space-3); }

/* ---- the radio star rating -------------------------------------------------
   See the note at the top of this file: markup is 5->1, the row is flipped
   back here, and the sibling combinators depend on both. */
.review-rating {
    display: inline-flex;
    flex-direction: row-reverse;
    justify-content: flex-end;
    gap: 4px;
    margin-top: var(--oct-space-2);
}

.review-rating input[type="radio"] {
    /* Hidden but focusable -- never display:none here. */
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.review-rating label {
    /* Overrides the block label rule above: these sit in a row. */
    display: inline-block;
    margin: 0;
    padding: 2px;
    /* 44px of touch target, per star, without a 44px glyph. */
    min-width: 40px;
    line-height: 40px;
    text-align: center;
    cursor: pointer;
    color: var(--oct-line);
    font-size: 2rem;
    border-radius: var(--oct-radius-sm);
    transition: color .12s ease;
}
.review-rating label::before { content: "\2605"; }   /* solid star */

/* Checked: the star itself, and every LOWER star (later in the DOM). */
.review-rating input[type="radio"]:checked + label,
.review-rating input[type="radio"]:checked ~ label {
    color: var(--oct-accent);
}

/* Hover preview. Same direction of travel: a hovered label and the labels
   after it, which row-reverse puts to its left. */
.review-rating:hover label:hover,
.review-rating:hover label:hover ~ label {
    color: var(--oct-accent-dark);
}
/* While hovering anywhere in the row, drop the committed highlight so the
   preview is not competing with it. */
.review-rating:hover input[type="radio"]:checked + label,
.review-rating:hover input[type="radio"]:checked ~ label {
    color: var(--oct-line);
}

.review-rating input[type="radio"]:focus-visible + label {
    outline: 2px solid var(--oct-ink);
    outline-offset: 1px;
}

.review-optout {
    max-width: var(--oct-measure);
    margin-top: var(--oct-space-6);
    font-size: var(--oct-text-sm);
    color: var(--oct-ink-mute);
}
