/* ==========================================================================
   Visit Maramures | Review V2 | E2.6.C5.23.5.8

   OWNERSHIP
   - Shared public review presentation: summary, list, avatar, rating, form.
   - Typography, colors, spacing primitives: existing Design System V2.
   - Event layout, Hero, Visual Menu: event.css / Frontend Layout.
   - Numeric / Load More pagination: components.pagination + global style.css.
   - Legacy .review-* selectors: intentionally untouched (Accommodations).

   Activate only on a page that renders a Review V2 component.
   Requires Review V2 markup (following Blade integration step).
   ========================================================================== */

.review-v2 {
    --review-v2-brand: var(--frontend-design-color-brand, #174936);
    --review-v2-brand-hover: var(--frontend-design-color-brand-dark, #0d3327);
    --review-v2-ink: var(--frontend-design-color-text, #1c2520);
    --review-v2-muted: var(--frontend-design-color-text-muted, #667069);
    --review-v2-border: var(--frontend-design-color-border, #ded8cc);
    --review-v2-surface: var(--frontend-design-color-surface, #fff);
    --review-v2-surface-soft: var(--frontend-design-color-background, #f7f4ed);
    --review-v2-gold: var(--frontend-design-color-accent, #b88a3b);

    box-sizing: border-box;
    min-width: 0;
    width: 100%;
    container-type: inline-size;
    color: var(--review-v2-ink);
    font-family: var(--type-font-body, var(--frontend-design-font-body, "Manrope", Arial, sans-serif));
    font-size: var(--type-body-size, var(--frontend-design-body-font-size, 1rem));
    line-height: var(--type-body-line-height, var(--frontend-design-body-line-height, 1.65));
}

.review-v2 *,
.review-v2 *::before,
.review-v2 *::after {
    box-sizing: border-box;
}

/* Sticky-header offset for fragment navigation (including pagination). */
.review-v2[id] {
    scroll-margin-top: 112px;
}

.review-v2__heading {
    display: flex;
    justify-content: space-between;
    align-items: end;
    flex-wrap: wrap;
    gap: 12px 22px;
    min-width: 0;
    margin-bottom: 19px;
}

.review-v2__heading-copy {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    grid-template-rows: auto auto;
    column-gap: clamp(12px, 1.5cqi, 18px);
    row-gap: 8px;
    align-items: end;
    flex: 1 1 300px;
    min-width: 0;
}

.review-v2__heading-icon {
    display: inline-flex;
    grid-column: 1;
    grid-row: 1;
    align-self: end;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0;
    border: 1px solid var(--review-v2-border);
    border-radius: 12px;
    background: var(--frontend-design-color-surface-muted, #f1ece2);
    color: var(--editorial-eyebrow-color, #8e4a3a);
    font-size: 18px;
    line-height: 1;
}

.review-v2__title {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    margin: 0;
    color: var(--color-text, #192923);
    font-family: var(--type-font-heading, var(--frontend-design-font-heading, "Source Serif 4", Georgia, serif));
    font-size: var(--type-h3-desktop-size, 1.75rem);
    font-weight: var(--type-h2-weight, 700);
    line-height: var(--type-h2-line-height, 1.2);
    letter-spacing: var(--type-h3-letter-spacing, normal);
    text-wrap: balance;
    overflow-wrap: break-word;
}

.review-v2__lead {
    grid-column: 2;
    grid-row: 2;
    max-width: 68ch;
    margin: 0;
    color: var(--color-text-muted, #495951);
    font-family: var(--type-font-body, var(--frontend-design-font-body, "Manrope", Arial, sans-serif));
    font-size: var(--type-body-size, 1rem);
    font-weight: var(--type-body-weight, 400);
    line-height: var(--type-body-line-height, 1.7);
}

.review-v2__jump {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    max-width: 100%;
    padding: 9px 16px;
    border: 1px solid var(--review-v2-border);
    border-radius: var(--frontend-design-radius-pill, 999px);
    background: var(--review-v2-surface);
    color: var(--review-v2-brand);
    font: inherit;
    font-size: var(--frontend-design-button-font-size, 14px);
    font-weight: var(--frontend-design-button-font-weight, 700);
    line-height: 1.25;
    text-decoration: none;
    text-align: center;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease;
}

.review-v2__jump:hover {
    color: #fff;
    background: var(--review-v2-brand-hover);
    border-color: var(--review-v2-brand-hover);
    text-decoration: none;
}

/* Summary: compact editorial bar, never a second sidebar. */
.review-v2__summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 22px;
    min-width: 0;
    margin-bottom: 17px;
    padding: clamp(15px, 2.5cqi, 21px);
    border: 1px solid var(--review-v2-border);
    border-radius: 14px;
    background: linear-gradient(105deg,
        var(--review-v2-surface) 0%,
        var(--frontend-design-color-background, #f7f4ed) 100%);
    box-shadow: 0 5px 16px rgba(19, 42, 34, .035);
}

.review-v2__summary-score {
    display: flex;
    align-items: baseline;
    flex: 0 0 auto;
    gap: 5px;
    margin: 0;
    padding-right: clamp(15px, 2.5cqi, 24px);
    border-right: 1px solid var(--review-v2-border);
    color: var(--frontend-design-color-heading, #132a22);
    font-variant-numeric: tabular-nums;
}

.review-v2__summary-score strong {
    font-family: var(--type-font-heading, var(--frontend-design-font-heading, "Source Serif 4", Georgia, serif));
    font-size: clamp(2rem, 4cqi, 2.6rem);
    font-weight: 700;
    line-height: 1.05;
}

.review-v2__summary-scale {
    color: var(--review-v2-muted);
    font-size: .94rem;
}

.review-v2__summary-meta {
    flex: 1 1 190px;
    min-width: 0;
}

.review-v2__summary-stars,
.review-v2__stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: var(--review-v2-gold);
    letter-spacing: .025em;
    line-height: 1;
    white-space: nowrap;
}

.review-v2__summary-stars { margin: 0 0 6px; font-size: 1.08rem; }
.review-v2__stars { font-size: .94rem; }
.review-v2__star--empty { color: var(--review-v2-border); }

.review-v2__summary-count {
    display: block;
    margin: 0;
    font-size: .93rem;
    font-weight: 700;
    line-height: 1.45;
    color: var(--review-v2-ink);
}

.review-v2__summary-note {
    display: block;
    margin: 4px 0 0;
    color: var(--review-v2-muted);
    font-size: .81rem;
    line-height: 1.55;
}

/* Accessible list; never display numeric markers for reviews. */
.review-v2__list {
    display: grid;
    gap: 12px;
    min-width: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.review-v2__list-item { min-width: 0; margin: 0; padding: 0; list-style: none; }

.review-v2__card {
    min-width: 0;
    padding: clamp(16px, 2.4cqi, 21px);
    border: 1px solid var(--review-v2-border);
    border-radius: 13px;
    background: var(--review-v2-surface);
    box-shadow: 0 5px 14px rgba(19, 42, 34, .055);
}

.review-v2__card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 18px;
    border: none;
}

.review-v2__identity {
    display: flex;
    align-items: center;
    flex: 1 1 170px;
    gap: 12px;
    min-width: 0;
}

.review-v2__avatar {
    --review-v2-avatar-color: var(--review-v2-brand);
    --review-v2-avatar-bg: color-mix(in srgb, var(--review-v2-brand) 12%, white);

    display: inline-grid;
    place-items: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 1px solid color-mix(in srgb, var(--review-v2-avatar-color) 22%, transparent);
    border-radius: 50%;
    background: var(--review-v2-avatar-bg);
    color: var(--review-v2-avatar-color);
    font-family: var(--type-font-body, var(--frontend-design-font-body, "Manrope", Arial, sans-serif));
    font-size: 1rem;
    font-weight: 800;
    line-height: 1;
    text-transform: uppercase;
    user-select: none;
}

/* Tone is selected deterministically by the shared presenter; no email hashing. */
.review-v2__avatar[data-tone="1"] {
    --review-v2-avatar-color: var(--frontend-design-color-accent, #b88a3b);
}
.review-v2__avatar[data-tone="2"] {
    --review-v2-avatar-color: var(--editorial-eyebrow-color, #8e4a3a);
}
.review-v2__avatar[data-tone="3"] {
    --review-v2-avatar-color: var(--frontend-design-color-heading, #132a22);
}
.review-v2__avatar[data-tone="4"] {
    --review-v2-avatar-color: var(--frontend-design-color-text-muted, #667069);
}

.review-v2__identity-copy { min-width: 0; }
.review-v2__author {
    display: block;
    color: var(--frontend-design-color-heading, #132a22);
    font-size: .94rem;
    font-weight: 700;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.review-v2__date {
    display: block;
    margin-top: 3px;
    color: var(--review-v2-muted);
    font-size: .8rem;
    line-height: 1.45;
    font-variant-numeric: tabular-nums;
}

.review-v2__rating {
    display: inline-flex;
    align-items: center;
    flex: 0 0 auto;
    gap: 8px;
    min-height: 30px;
    padding: 5px 10px;
    border: 1px solid var(--review-v2-border);
    border-radius: var(--frontend-design-radius-pill, 999px);
    background: var(--review-v2-surface-soft);
    color: var(--review-v2-ink);
    font-size: .81rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.review-v2__comment {
    margin: 13px 0 0;
    padding-top: 11px;
    border-top: 1px solid color-mix(in srgb, var(--review-v2-border) 62%, transparent);
    color: var(--review-v2-ink);
    font-size: .92rem;
    line-height: 1.75;
    white-space: pre-line;
    overflow-wrap: anywhere;
}

.review-v2__comment--empty { color: var(--review-v2-muted); font-style: italic; }

/* The global .pagination and .pagination-item rules own every pager style. */

/* Review form: same design tokens and control geometry as Catalog V2. */
.review-v2__form-shell {
    min-width: 0;
    padding: clamp(18px, 2.8cqi, 27px);
    border: 1px solid var(--review-v2-border);
    border-radius: 16px;
    background: var(--review-v2-surface);
    box-shadow: 0 9px 28px rgba(23, 32, 25, .045);
}

.review-v2__form-shell > .review-v2__heading { margin-bottom: 21px; padding-bottom: 15px; border-bottom: 1px solid var(--review-v2-border); }
.review-v2__form { display: grid; gap: 20px; min-width: 0; margin: 0; }

.review-v2__form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.review-v2__field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.review-v2__field--full { grid-column: 1 / -1; }

.review-v2__label,
.review-v2__rating-field legend {
    display: block;
    margin: 0;
    padding: 0;
    color: var(--review-v2-ink);
    font: inherit;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.45;
}

.review-v2__required { color: var(--review-v2-brand); }

.review-v2__field > :is(input, textarea) {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 46px;
    padding: 11px 13px;
    border: 1px solid color-mix(in srgb, var(--review-v2-ink) 23%, transparent);
    border-radius: var(--frontend-design-radius-sm, 10px);
    background: #fbfaf7;
    color: var(--review-v2-ink);
    font: inherit;
    font-size: .88rem;
    line-height: 1.5;
    transition: border-color 160ms ease, background-color 160ms ease;
}

.review-v2__field > textarea {
    min-height: 126px;
    resize: vertical;
}

.review-v2__field > :is(input, textarea)::placeholder { color: var(--review-v2-muted); opacity: 1; }
.review-v2__field > :is(input, textarea):hover { border-color: color-mix(in srgb, var(--review-v2-ink) 42%, transparent); }
.review-v2__field > :is(input, textarea)[aria-invalid="true"] { border-color: #aa433b; }

.review-v2 :is(input, textarea, button, a):focus-visible {
    outline: 3px solid var(--review-v2-gold);
    outline-offset: 3px;
}

.review-v2__help {
    margin: 0;
    color: var(--review-v2-muted);
    font-size: .79rem;
    line-height: 1.55;
}

.review-v2__rating-field {
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.review-v2__rating-field legend { margin-bottom: 10px; }
.review-v2__rating-options { display: flex; flex-wrap: wrap; gap: 8px; }

.review-v2__rating-choice {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border: 1px solid var(--review-v2-border);
    border-radius: var(--frontend-design-radius-sm, 10px);
    background: var(--review-v2-surface-soft);
    color: var(--review-v2-gold);
    cursor: pointer;
    transition: border-color 160ms ease, background-color 160ms ease;
}

/* Native radio selection is cumulative: checking 3 highlights labels 1, 2, 3.
   :has(> input:checked) matches the chosen label; the sibling variant
   matches every label preceding it, with no JavaScript dependency. */
.review-v2__rating-choice:has(> input:checked),
.review-v2__rating-choice:has(~ .review-v2__rating-choice > input:checked),
.review-v2__rating-choice:hover,
.review-v2__rating-choice:has(~ .review-v2__rating-choice:hover) {
    border-color: var(--review-v2-gold);
    background: color-mix(in srgb, var(--review-v2-gold) 12%, white);
}

.review-v2__rating-choice > input {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: pointer;
}

.review-v2__rating-choice:focus-within {
    outline: 3px solid var(--review-v2-gold);
    outline-offset: 3px;
}

.review-v2__rating-choice-star {
    color: transparent;
    -webkit-text-stroke: 1px var(--review-v2-gold);
    font-size: 1.4rem;
    line-height: 1;
    pointer-events: none;
}

.review-v2__rating-choice:has(> input:checked) .review-v2__rating-choice-star,
.review-v2__rating-choice:has(~ .review-v2__rating-choice > input:checked) .review-v2__rating-choice-star,
.review-v2__rating-choice:hover .review-v2__rating-choice-star,
.review-v2__rating-choice:has(~ .review-v2__rating-choice:hover) .review-v2__rating-choice-star {
    color: var(--review-v2-gold);
    -webkit-text-stroke: 0;
}

/* Fallback: selected vs unselected remains distinct without text stroke. */
@supports not (-webkit-text-stroke: 1px #000) {
    .review-v2__rating-choice-star { color: var(--review-v2-muted); }

    .review-v2__rating-choice:has(> input:checked) .review-v2__rating-choice-star,
    .review-v2__rating-choice:has(~ .review-v2__rating-choice > input:checked) .review-v2__rating-choice-star,
    .review-v2__rating-choice:hover .review-v2__rating-choice-star,
    .review-v2__rating-choice:has(~ .review-v2__rating-choice:hover) .review-v2__rating-choice-star {
        color: var(--review-v2-gold);
    }
}

.review-v2__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

.review-v2__security { min-width: 0; }
.review-v2__security .cf-turnstile { max-width: 100%; }

.review-v2__submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: fit-content;
    max-width: 100%;
    min-height: 46px;
    padding: 10px 19px;
    border: 1px solid var(--review-v2-brand);
    border-radius: var(--frontend-design-radius-sm, 10px);
    background: var(--review-v2-brand);
    color: #fff;
    font-family: var(--frontend-design-button-font-family, "Manrope", Arial, sans-serif);
    font-size: var(--frontend-design-button-font-size, 14px);
    font-weight: var(--frontend-design-button-font-weight, 700);
    line-height: 1.25;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 160ms ease, border-color 160ms ease;
}

.review-v2__submit:hover { background: var(--review-v2-brand-hover); border-color: var(--review-v2-brand-hover); }
.review-v2__submit:disabled { opacity: .55; cursor: not-allowed; }

.review-v2__status {
    margin: 0;
    padding: 13px 15px;
    border: 1px solid var(--review-v2-border);
    border-radius: var(--frontend-design-radius-sm, 10px);
    background: var(--review-v2-surface-soft);
    color: var(--review-v2-ink);
    font-size: .87rem;
    line-height: 1.6;
}

.review-v2__status--success {
    border-color: color-mix(in srgb, var(--review-v2-brand) 35%, transparent);
    background: color-mix(in srgb, var(--review-v2-brand) 8%, white);
}

.review-v2__status--error {
    border-color: #b25b53;
    background: #fff3f1;
}

.review-v2__error {
    margin: 0;
    color: #963b35;
    font-size: .81rem;
    line-height: 1.5;
}

/* Components can be used in narrow columns inside other page layouts. */
/* Same heading typography breakpoint contract as Event Catalog (820/520).
   Other Review layout breakpoints remain independent to prevent regressions. */
@container (max-width: 820px) {
    .review-v2__title { font-size: var(--type-h3-tablet-size, var(--type-h3-desktop-size, 1.5rem)); }
}

@container (max-width: 640px) {
    .review-v2__heading { align-items: flex-start; }
}

@container (max-width: 520px) {
    .review-v2__title { font-size: var(--type-h3-mobile-size, 1.35rem); }
}

@container (max-width: 480px) {
    .review-v2__form-grid { grid-template-columns: minmax(0, 1fr); }
    .review-v2__heading { gap: 12px; }
    .review-v2__heading-copy { grid-template-columns: 36px minmax(0, 1fr); }
    .review-v2__heading-icon { width: 36px; height: 36px; font-size: 16px; }
    .review-v2__summary-score { padding-right: 15px; }
    .review-v2__jump { width: 100%; }
    .review-v2__summary { gap: 12px 18px; }
    .review-v2__card-head { gap: 12px; }
    .review-v2__rating { margin-inline-start: 58px; }
    .review-v2__submit { width: 100%; }
}

@container (max-width: 340px) {
    .review-v2__rating { margin-inline-start: 0; }
    .review-v2__summary-score { padding-right: 0; border-right: 0; }
    .review-v2__rating-options { gap: 6px; }
    .review-v2__rating-choice { flex-basis: 42px; width: 42px; height: 42px; }
}

@supports not (container-type: inline-size) {
    @media (max-width: 767px) {
        .review-v2__form-grid { grid-template-columns: minmax(0, 1fr); }
        .review-v2__title { font-size: var(--type-h3-mobile-size, 1.35rem); }
        .review-v2__jump { width: 100%; }
        .review-v2__submit { width: 100%; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .review-v2 :is(a, button, input, textarea),
    .review-v2__rating-choice { transition: none; }
}
