/*
 * The reviews band of the home page (resources/views/common/reviews/_home_band.blade.php, public/js/home-reviews.js,
 * App\Support\Reviews\HomeReviews).
 *
 * A native scroll-snap carousel, no library: one card at 86% of the width on a phone so the next one peeks out, two from
 * 768px, three from 992px. The cards share one height and the renter's block sticks to the bottom of each.
 * Readable without JavaScript: the clamp, the arrows and the two toggles only exist once the script has put .hr-js on the
 * band.
 *
 * Colours, type, radii, spacing and shadows come from the site's tokens (style.css); translucent lines are built from a
 * token with color-mix.
 */

.hr-band {
    --hr-gap: var(--r2e-space-4);
    --hr-gutter: calc(var(--bs-gutter-x, 1.5rem) * 0.5);
    --hr-on-dark: var(--r2e-secondary-100);
    --hr-line: color-mix(in srgb, white 40%, transparent);
    font-family: "Poppins", sans-serif;
}
.hr-band [hidden] { display: none !important; }
.hr-band button { font-family: inherit; }

/* Header: eyebrow and title on the left, the marketplace note on the right. */
.hr-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--r2e-space-4) var(--r2e-space-8);
    margin-bottom: var(--r2e-space-6);
}
.hr-summary {
    display: flex;
    align-items: center;
    gap: var(--r2e-space-3);
    color: white;
}
.hr-average {
    font-weight: 700;
    font-size: var(--r2e-text-4xl);
    line-height: 1;
    letter-spacing: var(--r2e-tracking-tight);
}
.hr-summary-side {
    display: flex;
    flex-direction: column;
    /* Not stretched: the filled stars are a percentage of the row, which must be exactly as wide as its five stars. */
    align-items: flex-start;
    gap: var(--r2e-space-1);
}
/* The empty stars of the header, visible on the dark band (the shared default is a light grey made for a white page). */
.hr-star-empty { color: color-mix(in srgb, white 40%, transparent); }
.hr-count {
    font-size: var(--r2e-text-sm);
    color: var(--hr-on-dark);
}

/* The track bleeds to the screen edge on a phone and keeps the container's alignment: same gutter as padding.
   Positioned so it clips the absolute .visually-hidden text of the off-screen cards: without it those spans
   escape the scroller and widen the whole page on a phone. */
.hr-track {
    position: relative;
    display: flex;
    gap: var(--hr-gap);
    margin: 0 calc(var(--hr-gutter) * -1);
    padding: var(--r2e-space-2) var(--hr-gutter) var(--r2e-space-4);
    list-style: none;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--hr-gutter);
    scrollbar-width: none;
}
.hr-track::-webkit-scrollbar { display: none; }

.hr-card {
    flex: 0 0 86%;
    display: flex;
    min-width: 0;
    scroll-snap-align: start;
}
@media (min-width: 768px) {
    .hr-card { flex-basis: calc((100% - var(--hr-gap)) / 2); }
}
@media (min-width: 992px) {
    .hr-card { flex-basis: calc((100% - 2 * var(--hr-gap)) / 3); }
}

.hr-article {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: var(--r2e-space-6);
    background: var(--bs-white);
    color: var(--r2e-ink);
    border-radius: var(--r2e-radius-lg);
    box-shadow: var(--r2e-shadow-sm);
}

.hr-rating {
    display: flex;
    align-items: center;
    gap: var(--r2e-space-2);
    margin-bottom: var(--r2e-space-3);
}
.hr-mark {
    font-weight: 700;
    font-size: var(--r2e-text-lg);
    line-height: 1;
}
.hr-verified {
    display: inline-flex;
    align-items: center;
    gap: var(--r2e-space-1);
    margin-left: auto;
    font-size: var(--r2e-text-xs);
    white-space: nowrap;
    color: var(--bs-success);
}

.hr-text {
    margin: 0;
    font-size: var(--r2e-text-base);
    line-height: var(--r2e-leading-body);
    overflow-wrap: anywhere;
}
/* Six lines, then "Read more": only once the script can offer it. */
.hr-js .hr-text {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 6;
    line-clamp: 6;
    overflow: hidden;
}
.hr-js .hr-article.is-open .hr-text {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    overflow: visible;
}

/* Buttons that read as links: the whole band is made of them, none of them is a call to action. */
.hr-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--bs-primary);
    font-size: var(--r2e-text-sm);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 0.2em;
    cursor: pointer;
}
.hr-link:hover { text-decoration-thickness: 2px; }
.hr-translated .hr-link { white-space: nowrap; }
/* "Read more" and the translation note share a line when the card is wide enough, and wrap when it is not. */
.hr-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    column-gap: var(--r2e-space-4);
}
.hr-more { margin-top: var(--r2e-space-3); }

.hr-translated {
    margin: var(--r2e-space-3) 0 0;
    font-size: var(--r2e-text-sm);
    color: var(--r2e-ink-muted);
}

/* The name and the renter sit at the foot of every card, level from one card to the next: the gap, if any, is above the name. */
.hr-author {
    margin-top: auto;
    padding-top: var(--r2e-space-4);
}
.hr-name {
    margin: 0;
    font-size: var(--r2e-text-base);
    font-weight: 700;
    line-height: var(--r2e-leading-snug);
}
.hr-flag {
    display: inline-block;
    height: auto;
    vertical-align: baseline;
    border-radius: var(--r2e-radius-xs);
}
.hr-name .hr-flag { margin-left: var(--r2e-space-1); }
.hr-date {
    font-size: var(--r2e-text-sm);
    font-weight: 400;
    color: var(--r2e-ink-secondary);
}
.hr-vehicle {
    margin: var(--r2e-space-1) 0 0;
    font-size: var(--r2e-text-sm);
    color: var(--r2e-ink-secondary);
}

/* The renter: the whole block is the link to its page. */
.hr-lessor {
    display: flex;
    align-items: center;
    gap: var(--r2e-space-3);
    margin-top: var(--r2e-space-4);
    padding-top: var(--r2e-space-4);
    border-top: 1px solid var(--bs-border-color);
    color: inherit;
    text-decoration: none;
}
.hr-lessor-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}
.hr-lessor-name {
    font-size: var(--r2e-text-base);
    font-weight: 700;
    line-height: var(--r2e-leading-snug);
}
.hr-lessor-role {
    font-size: var(--r2e-text-xs);
    color: var(--r2e-ink-secondary);
}
.hr-lessor-arrow {
    flex: 0 0 auto;
    color: var(--bs-primary);
    transition: transform 0.2s ease-in-out;
}
.hr-lessor:hover .hr-lessor-name { text-decoration: underline; }
.hr-lessor:hover .hr-lessor-arrow { transform: translateX(var(--r2e-space-1)); }
.hr-lessor:focus-visible,
.hr-link:focus-visible,
.hr-arrow:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 3px;
}

/* Band footer: the arrows, centred under the track (from 768px, once the script is there). */
.hr-foot {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--r2e-space-4);
}
.hr-arrows {
    display: none;
    gap: var(--r2e-space-2);
}
@media (min-width: 768px) {
    .hr-js .hr-arrows { display: flex; }
}
.hr-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--r2e-tap-target);
    height: var(--r2e-tap-target);
    padding: 0;
    border: 1px solid var(--hr-line);
    border-radius: var(--r2e-radius-pill);
    background: transparent;
    color: white;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}
.hr-arrow:hover:not(:disabled) { background: color-mix(in srgb, white 14%, transparent); }
.hr-arrow:disabled { opacity: 0.4; cursor: default; }
.hr-band .hr-arrow:focus-visible { outline-color: white; }

@media (prefers-reduced-motion: reduce) {
    .hr-lessor-arrow,
    .hr-arrow { transition: none; }
    .hr-lessor:hover .hr-lessor-arrow { transform: none; }
}
