/*
 * ETG Traveler Reviews - front-end styles.
 * Author: M.Shamekh
 * ------------------------------------------------------------------
 * Replaces the Strong Testimonials look (etg-testimonials.css) and keeps
 * its identity: ONE visible surface per review (white card, 1px #e3e6ea
 * border, 14px radius, no shadow), ETG orange arrows (prev outline, next
 * filled) in their own 44px row ABOVE the cards with a 16px gap, the green
 * TripAdvisor owl badge, no outer panel. The theme font is inherited; no
 * font is loaded.
 *
 * SCOPE: everything lives under .etgr. Section 1 neutralises theme rules
 * (blockquote, p, a, button) so the Getaway theme cannot leak in.
 * RTL: logical properties only; nav chevrons flip with direction.
 * NO JS: the carousel is a scroll-snap row; the nav stays hidden until
 * etgr.js adds .etgr--ready.
 * Markup contract: PLAN.md, Appendix A.
 */

/* ---------- 1. Root, tokens, defensive resets ---------- */
.etgr {
    --etgr-accent: #e5690f;      /* ETG orange, tuned for 3:1 on white */
    --etgr-accent-d: #c9560a;    /* hover + focus ring */
    --etgr-link: #007c80;        /* ETG teal (as the old Read More), darkened for AA (5.0:1) */
    --etgr-link-h: #00676a;
    --etgr-ink: #173b6c;
    --etgr-text: #4e596a;
    --etgr-muted: #5b6575;
    --etgr-line: #e3e6ea;
    --etgr-line-h: #cdd3db;
    --etgr-gold: #ffb400;
    --etgr-gap: 20px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    row-gap: 16px;
    box-sizing: border-box;
    margin: 24px 0 32px;
    margin-bottom: 32px !important; /* WPBakery zeroes :last-child margins; keep room for the theme's More Reviews button */
    padding: 0;
    color: var(--etgr-text);
    font-family: inherit;
    font-size: 15px;
    line-height: 1.5;
    text-align: start;
    background: none;
    border: 0;
    box-shadow: none;
}
.etgr *, .etgr *::before, .etgr *::after { box-sizing: border-box; }
.etgr > * { grid-column: 1 / -1; min-width: 0; }
.etgr [hidden] { display: none !important; }
.etgr a { box-shadow: none; }
.etgr :focus-visible { outline: 2px solid var(--etgr-accent-d); outline-offset: 2px; }
.etgr ::selection { color: #fff; background: var(--etgr-accent-d); }
.etgr button {
    appearance: none; margin: 0; font: inherit; letter-spacing: normal;
    text-transform: none; text-shadow: none; box-shadow: none; cursor: pointer;
}
.etgr .etgr-card__quote {
    margin: 0 0 12px; padding: 0; background: none; border: 0; border-radius: 0;
    box-shadow: none; color: var(--etgr-text); font: inherit; font-style: normal;
    quotes: none; text-align: start;
}
.etgr .etgr-card__quote::before, .etgr .etgr-card__quote::after { content: none !important; }
.etgr .etgr-card__quote p {
    margin: 0 0 .75em; padding: 0; background: none; border: 0; color: inherit;
    font-size: 15px; font-style: normal; font-weight: 400; line-height: 1.7;
    text-align: start; text-indent: 0;
}
.etgr .etgr-card__quote p:last-child { margin-bottom: 0; }

/* ---------- 2. Summary + disclosure ---------- */
.etgr-summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.etgr .etgr-summary__score { color: var(--etgr-ink); font-size: 28px; font-weight: 700; line-height: 1; }
.etgr .etgr-summary .etgr-star { width: 20px; height: 20px; }
.etgr .etgr-summary__link {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px;
    color: var(--etgr-link); font-weight: 600; text-decoration: none;
}
.etgr .etgr-summary__link:hover { text-decoration: underline; }
.etgr .etgr-summary .etgr-source { width: 28px; height: 28px; }
.etgr .etgr-summary .etgr-source svg { width: 20px; height: 20px; }
.etgr > .etgr-disclosure {
    grid-column: 1; align-self: center; margin: 0; padding: 0;
    color: var(--etgr-muted); font-size: 13px; line-height: 1.4;
}

/* ---------- 3. Navigation: 44px row above the cards ---------- */
.etgr > .etgr-nav {
    display: none; grid-column: 2; justify-content: flex-end; align-items: center; gap: 10px;
}
.etgr--carousel.etgr--ready:not(.etgr--static) > .etgr-nav { display: flex; }
.etgr .etgr-nav__btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 44px; height: 44px; padding: 0; color: var(--etgr-accent-d); background: #fff;
    border: 1px solid var(--etgr-accent); border-radius: 50%; line-height: 1;
    transition: color 180ms ease, background-color 180ms ease, border-color 180ms ease;
}
.etgr .etgr-nav__btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.etgr .etgr-nav__btn--next { color: #fff; background: var(--etgr-accent); }
.etgr .etgr-nav__btn:hover { color: #fff; background: var(--etgr-accent-d); border-color: var(--etgr-accent-d); }
.etgr .etgr-nav__btn:active { background: var(--etgr-accent-d); }
[dir="rtl"] .etgr .etgr-nav__btn svg { transform: scaleX(-1); }
.etgr:dir(rtl) .etgr-nav__btn svg { transform: scaleX(-1); }

/* ---------- 4. Card: the only visible surface ---------- */
/* Fixed anatomy: head, quote (always exactly 4 lines tall), Read more, foot
   pinned to the bottom. Same structure everywhere = same height everywhere. */
.etgr .etgr-card {
    position: relative; isolation: isolate; display: flex; flex-direction: column;
    margin: 0; padding: 22px 22px 18px; color: var(--etgr-text); background: #fff;
    border: 1px solid var(--etgr-line); border-radius: 14px; box-shadow: none;
    transition: border-color 180ms ease;
}
.etgr .etgr-card:hover { border-color: var(--etgr-accent); }
.etgr .etgr-card__head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    min-height: 34px; margin: 0 0 14px; padding: 0;
}
.etgr .etgr-stars { display: inline-flex; align-items: center; gap: 1px; line-height: 0; }
.etgr .etgr-star { flex: none; width: 16px; height: 16px; fill: var(--etgr-gold); }

/* Quote: Read more follows the text directly. Only carousel cards (server excerpt + etgr-card--clamp)
   are clamped to 4 lines as a safety net; grid/masonry text is never hidden. */
.etgr .etgr-card__quote { margin: 0 0 2px; font-size: 15px; line-height: 1.65; }
.etgr--carousel .etgr-card--clamp .etgr-card__quote {
    display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.etgr .etgr-card__quote p { font-size: 1em; line-height: inherit; }

/* Read more: plain link to the full review, directly under the quote. */
.etgr .etgr-card__more {
    display: inline-flex; align-self: flex-start; align-items: center; min-height: 44px;
    margin: 0; padding: 0; color: var(--etgr-link); font-weight: 600;
    text-decoration: none; background: none; border: 0;
}
.etgr .etgr-card__more:hover { color: var(--etgr-link-h); text-decoration: underline; text-underline-offset: 3px; }

/* Foot: avatar + who + soft quote glyph, hairline divider, pinned to the card
   bottom. Meta is ONE line, so every footer has the same height. */
.etgr .etgr-card__foot {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0 12px;
    margin: auto 0 0; padding: 14px 0 0; border-top: 1px solid #eef0f3;
}
.etgr .etgr-card__foot::after {
    content: ""; width: 40px; height: 40px; pointer-events: none;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e5690f' fill-opacity='.22' d='M6 17h3l2-4V7H5v6h3zm8 0h3l2-4V7h-6v6h3z'/%3E%3C/svg%3E") center / contain no-repeat;
}
[dir="rtl"] .etgr .etgr-card__foot::after { transform: scaleX(-1); }
.etgr .etgr-card__avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
    color: #8f3f05; background: #fdebdc; border-radius: 50%; font-size: 16px; font-weight: 700; line-height: 1;
}
.etgr .etgr-card__who { display: flex; flex-direction: column; justify-content: center; gap: 1px; min-width: 0; min-height: 58px; } /* name + up to 2 meta lines: equal footers */
.etgr .etgr-card__name { overflow: hidden; color: var(--etgr-ink); font-size: 16px; font-weight: 700; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.etgr .etgr-card__meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; min-width: 0; max-height: 2.8em; overflow: hidden;
    color: var(--etgr-muted); font-size: 13px; line-height: 1.4; white-space: nowrap;
}
.etgr .etgr-card__meta > * { flex: none; }
.etgr .etgr-card__meta > .etgr-card__trip, .etgr .etgr-card__meta > .etgr-card__translated {
    flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis;
}
.etgr .etgr-card__translated { font-style: italic; }
.etgr .etgr-flag {
    display: inline-flex; flex: none; width: 20px; height: 15px; overflow: hidden;
    border-radius: 2px; box-shadow: 0 0 0 1px rgba(23, 59, 108, .14);
}
.etgr .etgr-flag svg { display: block; width: 100%; height: 100%; }
.etgr .etgr-flag--code {
    width: auto; min-width: 20px; padding: 0 3px; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; line-height: 15px; letter-spacing: .02em; color: var(--etgr-muted);
    background: #f3f5f8;
}

/* ---------- 5. Source badge (circle, 34px visual, 44px hit area) ---------- */
.etgr .etgr-source {
    position: relative; display: inline-flex; flex: none; align-items: center; justify-content: center;
    width: 34px; height: 34px; color: #000; background: #36d4a0; border-radius: 50%;
    text-decoration: none;
}
.etgr a.etgr-source::after { content: ""; position: absolute; inset: -5px; }
.etgr .etgr-source svg { width: 24px; height: 24px; fill: currentColor; } /* 1.0.2: owl glyph ~24px in the 34px badge, like the old logo */
.etgr .etgr-source--tripadvisor { background: #36d4a0; color: #000; }
.etgr .etgr-source--google { background: #fff; box-shadow: inset 0 0 0 1px var(--etgr-line); }
.etgr .etgr-source--facebook { background: #1877f2; color: #fff; }
.etgr .etgr-source--trustpilot { background: #00b67a; color: #fff; }
.etgr .etgr-source--direct { background: var(--etgr-ink); color: #fff; }

/* ---------- 6. Layouts ---------- */
/* Carousel: native scroll-snap row; etgr.js adds loop, nav, dots. */
.etgr--carousel .etgr-track {
    position: relative; display: flex; gap: var(--etgr-gap); overflow-x: auto; overflow-y: hidden;
    overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: none; /* hidden from first paint: etgr.js loads late (LiteSpeed delay), a visible bar flashed during load (1.0.3) */
    /* 1.0.2: card widths are fractional and the browser rounds scrollLeft, so a snapped card's 1px border
       could land on the clip edge and vanish. 1px of inline padding (and the same snap padding) keeps
       both outer borders inside the visible box; card widths still use 100% of the content box. */
    padding-inline: 1px; scroll-padding-inline: 1px;
}
.etgr--carousel .etgr-card { flex: 0 0 calc((100% - 2 * var(--etgr-gap)) / 3); scroll-snap-align: start; }
.etgr--carousel .etgr-track::-webkit-scrollbar { display: none; }
.etgr--static [data-etgr-clone] { display: none; }
.etgr .etgr-track:focus-visible { outline-offset: 4px; border-radius: 14px; }

/* Grid: equal-height cards in an auto-fill grid. */
.etgr--grid .etgr-track { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: var(--etgr-gap); }

/* Masonry: CSS columns, natural heights. */
.etgr--masonry .etgr-track { display: block; column-width: 300px; column-gap: var(--etgr-gap); }
.etgr--masonry .etgr-card { display: block; margin: 0 0 var(--etgr-gap); break-inside: avoid; }
.etgr--masonry .etgr-card__head { margin-bottom: 16px; }
.etgr--masonry .etgr-card__more { display: flex; }
.etgr--masonry .etgr-card__foot { margin-top: 8px; }

/* Dots: decorative, phones only, filled by etgr.js. */
.etgr .etgr-dots { display: none; }
@media (max-width: 699px) {
    .etgr--carousel.etgr--ready:not(.etgr--static) .etgr-dots { display: flex; justify-content: center; gap: 8px; }
}
.etgr .etgr-dots span {
    width: 8px; height: 8px; background: var(--etgr-line-h); border-radius: 4px;
    transition: width 220ms cubic-bezier(.16, 1, .3, 1), background-color 220ms ease;
}
.etgr .etgr-dots span.is-active { width: 22px; background: var(--etgr-accent); }

/* ---------- 7. Responsive ---------- */
@media (max-width: 1099px) {
    .etgr--carousel .etgr-card { flex-basis: calc((100% - var(--etgr-gap)) / 2); }
}
@media (max-width: 699px) {
    .etgr { margin-block-end: 24px; }
    .etgr--carousel .etgr-card { flex-basis: calc((100% - var(--etgr-gap)) / 1.1); }
    .etgr .etgr-card { padding: 20px 18px 16px; }
    .etgr > .etgr-disclosure { grid-column: 1 / -1; }
    .etgr > .etgr-nav { grid-column: 1 / -1; }
}

/* ---------- 8. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .etgr *, .etgr *::before, .etgr *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Phones: give the name and meta the glyph's width. */
@media (max-width: 600px) {
    .etgr .etgr-card__foot { grid-template-columns: auto minmax(0, 1fr); }
    .etgr .etgr-card__foot::after { display: none; }
}
