/* =========================================================
   LAKE DISTRICT MORTGAGES — GOOGLE REVIEWS (shared component)
   Depends on Switzer + --color-* tokens in header.css.
   Everything is scoped to .ldm-rv and .ldm-rv-modal, so it
   works on any page without that page's stylesheet.
   Cards are built by reviews.js from the Google Places API.
   No slider library: the list scrolls natively with snap points.
========================================================= */

.ldm-rv {
    --rv-section: clamp(80px, 9vw, 130px);
    --rv-radius: 16px;
    --rv-forest: #142B20;
    --rv-green-text: var(--color-primary-dark, #0C602D);
    --rv-muted: #525F57;                              /* 6.7:1 on white */
    --rv-border: var(--color-border, #E4EAE5);

    padding: var(--rv-section) 0;
    scroll-margin-top: 120px;
    background: var(--color-white, #fff);
    color: var(--color-text, #354139);
    font-family: var(--font-primary, "Switzer", Arial, sans-serif);
    -webkit-font-smoothing: antialiased;
}

/* Stays hidden until the reviews have loaded */
.ldm-rv[hidden] { display: none !important; }

.ldm-rv *,
.ldm-rv *::before,
.ldm-rv *::after { box-sizing: border-box; }

/* Pastel sage band, matching the page tints */
.ldm-rv--tint {
    --rv-muted: #4B5850;                              /* 6.6:1 on the tint */
    --rv-border: #D3E6D8;
    position: relative;
    background: radial-gradient(55% 70% at 0% 0%, rgba(169, 230, 186, .30), transparent 70%), #EDF5EF;
}

.ldm-rv__container {
    width: min(100% - 48px, 1280px);
    margin-inline: auto;
}

/* Fades up when scrolled into view (reviews.js adds the classes) */
.ldm-rv.is-waiting .ldm-rv__container { opacity: 0; transform: translateY(26px); }

.ldm-rv.is-revealing .ldm-rv__container {
    transition: opacity 700ms cubic-bezier(.22, .61, .36, 1), transform 700ms cubic-bezier(.22, .61, .36, 1);
}

.ldm-rv-sr {
    position: absolute !important;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}


/* ---------- Heading ---------- */

.ldm-rv__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: clamp(32px, 7vw, 110px);
    margin-bottom: clamp(42px, 5vw, 64px);
}

.ldm-rv__head > div { flex: 1 1 58%; max-width: 720px; }

.ldm-rv__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--rv-green-text);
    font-size: 12px;
    font-weight: var(--font-weight-semibold, 600);
    letter-spacing: .12em;
    line-height: 1.5;
    text-transform: uppercase;
}

.ldm-rv__dot {
    display: inline-block;
    width: 7px;
    height: 7px;
    flex: 0 0 7px;
    border-radius: 50%;
    background: var(--color-primary, #11823B);
}

.ldm-rv__title {
    margin: 18px 0 0;
    color: var(--color-heading, #19251E);
    font-size: clamp(38px, 4.6vw, 60px);
    font-weight: var(--font-weight-semibold, 600);
    line-height: 1.08;
    letter-spacing: -.055em;
    text-wrap: balance;
}

.ldm-rv__stop {
    color: var(--color-primary, #11823B);
    letter-spacing: 0;
}

.ldm-rv__lead {
    flex: 1 1 42%;
    max-width: 480px;
    margin: 0;
    padding-bottom: 6px;
    color: var(--rv-muted);
    font-size: 17px;
    line-height: 1.75;
    text-wrap: pretty;
}


/* ---------- Slider ---------- */

/* Padding leaves room for the card hover shadow inside the scroll area */
.ldm-rv__list {
    display: flex;
    gap: 20px;
    margin: -6px -2px -26px;
    padding: 6px 2px 26px;
    overflow-x: auto;
    list-style: none;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 2px;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
}

.ldm-rv__list::-webkit-scrollbar { display: none; }

.ldm-rv__list:focus-visible {
    outline: 2px solid var(--color-primary, #11823B);
    outline-offset: 4px;
}

.ldm-rv__item {
    display: flex;
    flex: 0 0 calc((100% - 40px) / 3);
    min-width: 0;
    margin: 0;
    padding: 0;
    scroll-snap-align: start;
}


/* ---------- Review card ---------- */

.ldm-rv-card {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    min-height: 250px;
    padding: 28px 26px;
    border: 1px solid var(--rv-border);
    border-radius: var(--rv-radius);
    background: #fff;
    transition: border-color var(--transition-base, 250ms ease), transform var(--transition-base, 250ms ease), box-shadow var(--transition-base, 250ms ease);
}

/* Only cards with a "Read more" button are clickable */
.ldm-rv-card--expandable { cursor: pointer; }

.ldm-rv-card--expandable:hover {
    border-color: #BFD8C5;
    transform: translateY(-3px);
    box-shadow: 0 18px 36px -22px rgba(20, 43, 32, .3);
}

.ldm-rv-card--expandable:focus-within { outline: 2px solid var(--color-primary, #11823B); outline-offset: 4px; }


/* ---------- Card head (shared by the card and the modal) ---------- */

.ldm-rv-card__head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 20px;
}

.ldm-rv-card__avatar {
    display: block;
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    border-radius: 50%;
    object-fit: cover;
}

.ldm-rv-card__avatar--initial {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-light, #E9F5ED);
    color: var(--color-primary-dark, #0C602D);
    font-size: 18px;
    font-weight: var(--font-weight-semibold, 600);
}

.ldm-rv-card__author {
    display: flex;
    flex-direction: column;
    gap: 5px;
    min-width: 0;
}

.ldm-rv-card__name {
    overflow: hidden;
    color: var(--color-heading, #19251E);
    font-size: 16px;
    font-weight: var(--font-weight-semibold, 600);
    line-height: 1.3;
    letter-spacing: -.02em;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Sits above the card's click overlay */
.ldm-rv-card__name a {
    position: relative;
    z-index: 3;
    color: inherit;
    text-decoration: none;
}

.ldm-rv-card__name a:hover { color: var(--color-primary-dark, #0C602D); text-decoration: underline; text-underline-offset: 3px; }

.ldm-rv-card__stars {
    display: inline-flex;
    gap: 2px;
    color: var(--color-primary, #11823B);
}

/* !important: page stylesheets size and stroke every svg inside their wrapper */
.ldm-rv-card__stars svg {
    display: block;
    width: 15px !important;
    height: 15px !important;
    fill: currentColor !important;
    stroke: none !important;
}

.ldm-rv-card__stars svg.is-empty { color: #CBD8CF; }

.ldm-rv-card__source {
    align-self: flex-start;
    margin-left: auto;
    color: var(--rv-muted, #525F57);
    font-size: 12px;
    font-weight: var(--font-weight-semibold, 600);
    letter-spacing: .04em;
    line-height: 1.6;
}

.ldm-rv-card__text {
    margin: 0;
    color: var(--color-text, #354139);
    font-size: 15px;
    line-height: 1.7;
}

.ldm-rv .ldm-rv-card__more {
    align-self: flex-start;
    margin-top: auto;
    padding: 18px 0 0;
    border: 0;
    border-radius: 0;
    background: none;
    color: var(--rv-green-text);
    font-family: inherit;
    font-size: 14px;
    font-weight: var(--font-weight-semibold, 600);
    line-height: 1.4;
    cursor: pointer;
}

.ldm-rv .ldm-rv-card__more:hover,
.ldm-rv .ldm-rv-card__more:focus {
    background: none;
    color: var(--color-primary, #11823B);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Whole card opens the full review */
.ldm-rv-card__more::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
}

.ldm-rv .ldm-rv-card__more:focus-visible { outline: none; }


/* ---------- Arrows ---------- */

.ldm-rv__nav {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 32px;
}

/* Every review already fits on screen */
.ldm-rv.is-static .ldm-rv__nav { display: none; }

.ldm-rv .ldm-rv__arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0;
    border: 1px solid var(--rv-border);
    border-radius: 50%;
    background: #fff;
    color: var(--color-heading, #19251E);
    cursor: pointer;
    transition: background var(--transition-base, 250ms ease), border-color var(--transition-base, 250ms ease), color var(--transition-base, 250ms ease);
}

.ldm-rv__arrow svg { display: block; width: 20px !important; height: 20px !important; }

.ldm-rv .ldm-rv__arrow:hover,
.ldm-rv .ldm-rv__arrow:focus {
    border-color: var(--rv-forest);
    background: var(--rv-forest);
    color: #fff;
}

.ldm-rv .ldm-rv__arrow:focus-visible { outline: 2px solid var(--color-primary, #11823B); outline-offset: 4px; }

.ldm-rv .ldm-rv__arrow[aria-disabled="true"],
.ldm-rv .ldm-rv__arrow[aria-disabled="true"]:hover,
.ldm-rv .ldm-rv__arrow[aria-disabled="true"]:focus {
    border-color: var(--rv-border);
    background: #fff;
    color: var(--color-heading, #19251E);
    opacity: .4;
    cursor: default;
}


/* ---------- Review modal (matches the team modal) ---------- */

.ldm-rv-modal {
    box-sizing: border-box;
    width: min(620px, calc(100% - 32px));
    max-width: 620px;
    max-height: calc(100dvh - 32px);
    margin: auto;
    padding: clamp(28px, 5vw, 44px);
    overflow-x: hidden;
    overflow-y: auto;
    border: 1px solid var(--color-border, #E4EAE5);
    border-radius: 20px;
    background: #fff;
    color: var(--color-text, #354139);
    box-shadow: 0 25px 90px rgba(0, 0, 0, .12);
    font-family: var(--font-primary, "Switzer", Arial, sans-serif);
}

.ldm-rv-modal *,
.ldm-rv-modal *::before,
.ldm-rv-modal *::after { box-sizing: border-box; }

.ldm-rv-modal::backdrop {
    background: rgba(9, 24, 16, .65);
    backdrop-filter: blur(3px);
}

html:has(.ldm-rv-modal[open]) { overflow: hidden; }

.ldm-rv-modal .ldm-rv-modal__close {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--color-border, #E4EAE5);
    border-radius: 50%;
    background: #fff;
    color: var(--color-heading, #19251E);
    cursor: pointer;
    transition: background var(--transition-fast, 150ms ease), border-color var(--transition-fast, 150ms ease);
}

.ldm-rv-modal .ldm-rv-modal__close:hover,
.ldm-rv-modal .ldm-rv-modal__close:focus {
    border-color: #CCE2D1;
    background: var(--color-primary-light, #E9F5ED);
    color: var(--color-heading, #19251E);
}

.ldm-rv-modal__close svg { display: block; width: 20px !important; height: 20px !important; }

/* Room for the close button; the Google label is not needed here */
.ldm-rv-modal .ldm-rv-card__head { margin-bottom: 24px; padding-right: 48px; }
.ldm-rv-modal .ldm-rv-card__source { display: none; }
.ldm-rv-modal .ldm-rv-card__name { font-size: 20px; letter-spacing: -.03em; }

.ldm-rv-modal__text {
    margin: 0;
    padding-top: 24px;
    border-top: 1px solid var(--color-border, #E4EAE5);
    color: #525F57;
    font-size: 16px;
    line-height: 1.8;
    white-space: pre-line;
}

.ldm-rv-modal a:focus-visible,
.ldm-rv-modal button:focus-visible { outline: 2px solid var(--color-primary, #11823B); outline-offset: 4px; }

.ldm-rv-modal[open] { animation: ldm-rv-modal-in 280ms ease both; }
.ldm-rv-modal[open]::backdrop { animation: ldm-rv-backdrop-in 280ms ease both; }

@keyframes ldm-rv-modal-in {
    from { opacity: 0; transform: translateY(20px) scale(.98); }
    to   { opacity: 1; transform: none; }
}

@keyframes ldm-rv-backdrop-in { from { opacity: 0; } to { opacity: 1; } }


/* ---------- Responsive ---------- */

@media (max-width: 1024px) {
    .ldm-rv__head {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }

    .ldm-rv__head > div,
    .ldm-rv__lead { flex-basis: auto; max-width: 680px; padding-bottom: 0; }

    .ldm-rv__item { flex-basis: calc((100% - 20px) / 2); }
}

@media (max-width: 700px) {
    .ldm-rv { --rv-section: 72px; }

    .ldm-rv__container { width: min(100% - 36px, 1280px); }

    .ldm-rv__title { font-size: clamp(34px, 9vw, 46px); }
    .ldm-rv__lead { font-size: 16px; }

    /* One card with the next peeking in, to show it swipes */
    .ldm-rv__list { gap: 14px; }
    .ldm-rv__item { flex-basis: 86%; }
    .ldm-rv-card { min-height: 0; padding: 24px 22px; }

    .ldm-rv-modal { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 42px 24px 30px; border-radius: 16px; }
    .ldm-rv-modal__text { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
    .ldm-rv *,
    .ldm-rv *::before,
    .ldm-rv *::after,
    .ldm-rv-modal,
    .ldm-rv-modal::backdrop {
        transition: none !important;
        animation: none !important;
    }

    .ldm-rv.is-waiting .ldm-rv__container { opacity: 1; transform: none; }
}