/**
 * PDP reviews — theme overrides (loads after Acme_ProductReviews module CSS).
 * Opal UI (navy Write, bordered score, stars) stays global on every PDP.
 *
 * Spacing contract:
 *  - KEEP whitespace above the grey divider (.acme-pdp flex gap)
 *  - Title sits close under the section divider
 *  - Write / Sort sit at the top of the feed (right column) — never in the
 *    whitespace/gap between summary and feed; no grey bar above Write
 */
body.acme-pdp-page .acme-pdp__reviews-wrap {
    width: 100%;
    max-width: none;
    margin-inline: auto;
    /* Do NOT cancel .acme-pdp gap — whitespace above the grey line is required */
    margin-block-start: 0 !important;
    padding-block-start: 0 !important;
}

html body.acme-pdp-page .acme-reviews,
html body.catalog-product-view .acme-reviews {
    --acme-reviews-primary: #0f2d52;
    --acme-reviews-text: #374151;
    --acme-reviews-border: #e5e7eb;
    --acme-reviews-bg: #ffffff;
    --acme-reviews-muted: #f7f7f7;
    --acme-reviews-verified: #0f766e;
    --acme-reviews-pending: #b45309;
    --acme-reviews-unverified: #4b5563;
    --acme-reviews-star: #ca8a04;
    --acme-reviews-font: Montserrat, Inter, ui-sans-serif, system-ui, sans-serif;

    border-top: 1px solid #e5e7eb;
    margin-block: 0 1.5rem !important;
    /* Short breath under the divider before the title — not a large empty band */
    padding-block: 0.75rem 0 !important;
    padding-inline: 0 !important;
}

html body.acme-pdp-page .acme-reviews__title,
html body.catalog-product-view .acme-reviews__title {
    margin-block-start: 0 !important;
    padding-block-start: 0 !important;
}

/* Match details / similar: mobile L/R pad on wrap — never pad above the divider */
@media (max-width: 743px) {
    body.acme-pdp-page .acme-pdp__reviews-wrap {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
        padding-inline: 1rem !important;
        padding-block-start: 0 !important;
        padding-block-end: 1rem !important;
        box-sizing: border-box;
    }
}

body.acme-pdp-page .acme-pdp__details-wrap {
    margin-bottom: 0 !important;
}

/* Solid button (beats module defaults for PDP brand colors) */
body.acme-pdp-page .acme-reviews__write-link {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.5rem 1.25rem;
    border: 2px solid #0f2d52;
    border-radius: 0.25rem;
    background: #0f2d52;
    color: #fff;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    text-transform: uppercase;
    cursor: pointer;
    margin-right: auto;
}
body.acme-pdp-page .acme-reviews__write-link:hover,
body.acme-pdp-page .acme-reviews__write-link:focus-visible {
    background: #0a5f8a;
    border-color: #0a5f8a;
    color: #fff;
    outline: none;
}

/* Title/subtitle in left rail — Write lives on the feed grey bar */
body.acme-pdp-page .acme-reviews__header {
    display: block !important;
    margin-bottom: 0.75rem !important;
}

body.acme-pdp-page .acme-reviews__header-text {
    width: 100%;
    max-width: min(100%, 42rem);
    min-width: 0;
}

body.acme-pdp-page .acme-reviews__rail {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    min-width: 0;
}

body.acme-pdp-page .acme-reviews__title {
    font-family: Montserrat, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: clamp(1.375rem, 2vw, 1.75rem);
    font-weight: 600;
    color: #0f2d52;
    letter-spacing: -0.02em;
    margin: 0 !important;
}

body.acme-pdp-page .acme-reviews__subtitle {
    font-family: Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1rem;
    color: #4b5563;
    max-width: 42rem;
    margin-top: 0.25rem;
    margin-bottom: 0 !important;
}

/* Score summary stays visible (no Alpine cloak); light panel, not an empty tall card */
body.acme-pdp-page .acme-reviews__score-card {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: none;
    background: #fff;
    padding: 1rem 1.15rem;
    min-height: 0;
    aspect-ratio: auto !important;
}

body.acme-pdp-page .acme-reviews__distribution,
body.acme-pdp-page .acme-reviews__dimensions {
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    padding: 0;
    min-height: 0;
}

body.acme-pdp-page .acme-reviews__item {
    border: 1px solid var(--acme-reviews-border);
    border-radius: 0.375rem;
    box-shadow: none;
    background: #fff;
    padding: 1rem 1.15rem;
    min-height: 0;
}

body.acme-pdp-page .acme-reviews__summary {
    gap: 1rem;
}

body.acme-pdp-page .acme-reviews__average-value {
    color: #0f2d52;
    white-space: nowrap;
}

/* Single-line score ("5.0 / 5") — no separate /5 above the stars */
body.acme-pdp-page .acme-reviews__average {
    display: block;
    margin: 0;
    line-height: 1.1;
}

body.acme-pdp-page .acme-reviews__average-of {
    display: none !important;
}

/* Score is the number only — no "/ 5" suffix */

body.acme-pdp-page .acme-reviews__stars {
    margin-top: 0.5rem;
    letter-spacing: 0.14em;
    line-height: 1;
}

body.acme-pdp-page .acme-reviews__star {
    font-size: 1.75rem !important;
}

/*
 * Shell: score | feed. Write/Sort are the first row of the feed (on the grey bar).
 */
html body.acme-pdp-page .acme-reviews__shell,
html body.catalog-product-view .acme-reviews__shell {
    align-items: start !important;
}

html body.acme-pdp-page .acme-reviews__toolbar,
html body.catalog-product-view .acme-reviews__toolbar {
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.75rem 1rem;
    order: 0 !important;
    width: 100% !important;
    margin: 0 0 0.75rem !important;
    padding: 0 !important;
    min-height: 0 !important;
    border: 0 !important;
}

html body.acme-pdp-page .acme-reviews__write-link,
html body.catalog-product-view .acme-reviews__write-link {
    margin-left: 0 !important;
    margin-right: 0 !important;
    margin-top: 0 !important;
    flex: 0 0 auto !important;
}

html body.acme-pdp-page .acme-reviews__toolbar-end,
html body.catalog-product-view .acme-reviews__toolbar-end {
    margin-left: auto !important;
}

html body.acme-pdp-page .acme-reviews__feed,
html body.catalog-product-view .acme-reviews__feed {
    margin-top: 0 !important;
    min-height: 0 !important;
    border-top: 0 !important;
    padding-top: 0 !important;
}

/* Desktop rail+feed from 900px — iPad Pro 13 + Surface Pro 10 match desktop */
@media (min-width: 900px) {
    /*
     * Desktop: left rail (title+score) | feed (Write + list).
     * Write at top of feed — not in the column gap; no grey bar above Write.
     */
    html body.acme-pdp-page .acme-reviews__shell,
    html body.catalog-product-view .acme-reviews__shell {
        display: grid !important;
        grid-template-columns: minmax(16rem, 22rem) minmax(0, 1fr) !important;
        column-gap: 2rem !important;
        row-gap: 0 !important;
        align-items: start !important;
    }

    html body.acme-pdp-page .acme-reviews__rail,
    html body.catalog-product-view .acme-reviews__rail {
        grid-column: 1 !important;
    }

    html body.acme-pdp-page .acme-reviews__feed,
    html body.catalog-product-view .acme-reviews__feed {
        grid-column: 2 !important;
        border-top: 0 !important;
        padding-top: 0 !important;
    }

    html body.acme-pdp-page .acme-reviews__toolbar,
    html body.catalog-product-view .acme-reviews__toolbar {
        margin-left: 0 !important;
        margin-bottom: 0.75rem !important;
    }
}

html body.acme-pdp-page .acme-reviews__list,
html body.catalog-product-view .acme-reviews__list {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Keep old __grid selectors harmless if any sheet still targets them */
html body.acme-pdp-page .acme-reviews__grid {
    display: contents;
}

body.acme-pdp-page .acme-reviews__dim-score {
    white-space: nowrap;
}

body.acme-pdp-page .acme-reviews__write .rating-summary {
    display: inline-flex;
    align-items: center;
    gap: 0.15rem;
}

body.acme-pdp-page .acme-reviews__write .rating-summary label {
    color: #ca8a04;
}

/* Empty-state + write form — same navy Opal chrome on every PDP */
body.acme-pdp-page .acme-reviews__empty {
    border: 1px dashed #d1d5db;
    border-radius: 0.375rem;
    background: #fafafa;
    color: #4b5563;
    padding: 1.25rem 1rem;
    text-align: center;
    font-size: 0.9375rem;
}

body.acme-pdp-page .acme-reviews__write {
    margin-top: 1rem;
    padding-top: 0;
    border-top: 0;
}

body.acme-pdp-page .acme-reviews__write #review-form {
    padding-block: 0.25rem 0;
}

body.acme-pdp-page .acme-reviews__write .card {
    border: 1px solid #e5e7eb;
    border-radius: 0.375rem;
    box-shadow: none;
    background: #fff;
    padding: 1rem 1.15rem 1.25rem;
}

body.acme-pdp-page .acme-reviews__write .card > .text-xl {
    font-family: Montserrat, Inter, ui-sans-serif, system-ui, sans-serif;
    font-size: 1.125rem;
    font-weight: 700;
    color: #0f2d52;
    margin: 0 0 0.5rem;
}

body.acme-pdp-page .acme-reviews__write .form-input,
body.acme-pdp-page .acme-reviews__write input[type="text"],
body.acme-pdp-page .acme-reviews__write input[type="email"],
body.acme-pdp-page .acme-reviews__write textarea {
    border: 1px solid #e5e7eb;
    border-radius: 0.25rem;
    background: #fff;
    color: #111827;
}

body.acme-pdp-page .acme-reviews__write .form-input:focus,
body.acme-pdp-page .acme-reviews__write input:focus,
body.acme-pdp-page .acme-reviews__write textarea:focus {
    outline: 2px solid rgba(15, 45, 82, 0.25);
    border-color: #0f2d52;
}

body.acme-pdp-page .acme-reviews__submit,
body.acme-pdp-page .acme-reviews__write button[type="submit"].acme-reviews__submit {
    appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.5rem 1.35rem;
    border: 2px solid #0f2d52 !important;
    border-radius: 0.25rem;
    background: #0f2d52 !important;
    color: #fff !important;
    font: inherit;
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
}

body.acme-pdp-page .acme-reviews__submit:hover,
body.acme-pdp-page .acme-reviews__submit:focus-visible,
body.acme-pdp-page .acme-reviews__write button[type="submit"].acme-reviews__submit:hover,
body.acme-pdp-page .acme-reviews__write button[type="submit"].acme-reviews__submit:focus-visible {
    background: #0a5f8a !important;
    border-color: #0a5f8a !important;
    color: #fff !important;
    outline: none;
}

body.acme-pdp-page .acme-reviews__status {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    line-height: 1.2;
    border-radius: 0.25rem;
    border: 1px solid transparent;
}

body.acme-pdp-page .acme-reviews__status--verified {
    border-color: var(--acme-reviews-verified);
    color: var(--acme-reviews-verified);
    background: rgba(15, 118, 110, 0.08);
}

body.acme-pdp-page .acme-reviews__status--pending {
    border-color: var(--acme-reviews-pending);
    color: var(--acme-reviews-pending);
    background: rgba(180, 83, 9, 0.08);
}

body.acme-pdp-page .acme-reviews__status--unverified {
    border-color: #9ca3af;
    color: var(--acme-reviews-unverified);
    background: rgba(107, 114, 128, 0.1);
}

body.acme-pdp-page .acme-reviews__dim-heading {
    display: none;
}

body.acme-pdp-page .acme-reviews__dim-list {
    gap: 0.55rem;
}

body.acme-pdp-page .acme-pdp__faq-wrap {
    width: 100%;
    max-width: none;
    margin-inline: auto;
    margin-block: 0 2rem;
}

body.acme-pdp-page .acme-pdp__faq-wrap .acme-faq {
    margin-top: 0;
}

/* Match details / reviews / similar: mobile L/R pad */
@media (max-width: 743px) {
    body.acme-pdp-page .acme-pdp__faq-wrap {
        width: 100%;
        max-width: 100%;
        margin-inline: 0;
        padding: 1rem !important;
        box-sizing: border-box;
    }
}

/* Description prose often leaves 2rem+ below — pull reviews up to the divider */
body.acme-pdp-page .acme-pdp__details-wrap {
    margin-bottom: 0;
}

body.acme-pdp-page .acme-pdp__details-wrap .acme-pdp-prose {
    margin-bottom: 0.5rem;
}

@media (min-width: 1024px) {
    html body.acme-pdp-page .acme-reviews__shell {
        column-gap: 2rem;
        row-gap: 0.5rem;
    }
}
