/* =============================================================================
   Google reviews — trust section of the zahn-direkt.de homepage
   (components/google-rezensionen.ejs). Rendered right after the trust strip
   (home/trust-strip), with which it forms one cream band.

   LAYOUT: a single column. The headline row with the link to the Google profile,
   then the quote slider — a scroll-snap strip of cards — with its arrow-and-dots
   bar underneath. There is no rating box: the trust strip above carries the 4,9.

   COLOURS AND TYPE come from THIS site, not from privadent.de: the
   --comparison-* variables of comparison-style.css and the system font. The
   cards, the slider and its controls follow the approved draft, only coloured
   like the house they stand in.

   NO .pa-site scoping: that is the privadent.de namespace and does not apply
   here. The `google-revs__*` classes are unambiguous on their own.

   NO ICON FONT: zahn-direkt does not load the Phosphor icons (they belong to
   the privadent block of head-with-css-tracking.ejs), so every glyph is inline
   SVG.

   SLIDER MECHANICS: native scroll snapping, no transform arithmetic. The cards
   sit in a horizontally scrollable strip and snap into place, so swiping on a
   phone and two-finger scrolling on a trackpad work without a line of
   JavaScript; arrows and dots are an extra. If the script fails, the section
   stays fully usable.
   ============================================================================= */

/* --- Flaeche --------------------------------------------------------------- */

/*
 * BOX-SIZING FOR THIS COMPONENT.
 *
 * On the homepage the rule is redundant: home-sections.css already sets
 * `border-box` on everything inside `.home-page`. It stays for any host that
 * renders the component outside `.home-page`, where the legacy sections still
 * compute with `content-box`. Without it, padding and border are added on top
 * of every width: the quote cards measured 351 instead of 305 px and the third
 * card stuck 134 px out of the strip on a page meant to fit three side by side.
 *
 * Deliberately scoped to this component, not global: the legacy sections have
 * always computed with `content-box`, and a site-wide switch would reach into
 * sections that are not ours.
 */
.google-revs-section,
.google-revs-section *,
.google-revs-section *::before,
.google-revs-section *::after {
    box-sizing: border-box;
}

/*
 * CREAM BAND FROM EDGE TO EDGE.
 *
 * The block sits directly in the full page width (.home-page of the homepage); the inner
 * frame `.google-revs-inner` constrains the content to the width of `.home-wrap`.
 */
.google-revs-section {
    /* Cream like the trust strip before it (home/trust-strip.css): both form ONE band, so no
       outer spacing at the top and little inner spacing — the strip carries spacing and rule. */
    background-color: var(--tp-cream, #f7f7f3);
    /* The block sits in the full page width (.home-page), so it needs no width or negative
       margins of its own; the inner frame below constrains the content. */
    width: auto;
    margin-left: 0;
    margin-right: 0;
    padding: 26px 0 56px;
    margin-top: 0;
    margin-bottom: 0;
    text-align: left;
}

/* The inner frame: the same content width as `.home-wrap` (home-sections.css: 1140 px + 2×24 px),
   so the cards line up under the trust strip instead of spreading across the full band. */
.google-revs-inner {
    max-width: 1188px;
    margin: 0 auto;
    padding: 0 24px;
}

/* The same breakpoint and side padding as `.home-wrap` (home-sections.css: 16 px from 820 px
   down), so the cards keep the gutter of the sections around them. */
@media (max-width: 820px) {
    .google-revs-inner {
        padding: 0 16px;
    }
}

/* Head row: headline and intro on the left, the Google link on the right (wraps below them on
   narrow screens). Typography like the section heads of the homepage (home-sections.css). */
.google-revs-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px 24px;
    margin-bottom: 24px;
}

.google-revs-headline {
    font-family: inherit;
    font-size: clamp(24px, 3vw, 30px);
    font-weight: 800;
    letter-spacing: -0.4px;
    line-height: 1.15;
    color: var(--tp-ink, #252721);
    text-align: left;
    margin: 0;
}

.google-revs-intro {
    font-size: 1rem;
    line-height: 1.5;
    color: var(--tp-ink-2, rgba(37, 39, 33, 0.78));
    text-align: left;
    margin: 6px 0 0;
}

/*
 * One column, two rows: the slider viewport with the quote cards on top, the arrows and dots
 * (.google-revs__nav) below it. There is no rating column: the trust strip above the block
 * carries the overall rating.
 */
.google-revs {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto;
    gap: 0;
    margin-top: 0;
    text-align: left;
}

/* The Google link in the head row. */
.google-revs__link {
    font-size: 14px;
    font-weight: 700;
    color: var(--tp-accent-hover, #0c7568);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.google-revs__link:hover {
    text-decoration: underline;
}

.google-revs__link svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

/* --- The slider ------------------------------------------------------------ */

.google-revs__viewport {
    grid-column: 1;
    grid-row: 1;
    min-width: 0; /* ohne dies sprengt der Streifen das Raster */
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    /* Platz fuer den Kartenschatten, sonst schneidet der Ueberlauf ihn ab.
       Dieselben Werte stehen als Aussenabstand an der Bewertungsbox, damit beide
       Spalten auf derselben Linie beginnen und enden. */
    padding: 6px 2px 14px;
    /* Rollbalken aus — gescrollt wird ueber Wischen, Pfeile und Punkte */
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.google-revs__viewport::-webkit-scrollbar {
    display: none;
}

/* --- Eine Karte --- */

.google-revs__card {
    scroll-snap-align: start;
    flex: 0 0 calc((100% - 32px) / 3);
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 22px 22px 18px;
    background: #ffffff;
    border: 1px solid var(--comparison-gray-200, #e5e7eb);
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* Kopfzeile der Karte, wie bei Google: Bild links, rechts daneben der Name und
   darunter die Zeitangabe. */
.google-revs__person {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
}

.google-revs__avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    border-radius: 50%;
    object-fit: cover;
    /* Googles Buchstabenkreise sind randlos; ein hauchduenner Ring trennt helle
       Bilder vom weissen Kartengrund. */
    border: 1px solid var(--comparison-gray-200, #e5e7eb);
    background: var(--comparison-gray-100, #f3f4f6);
}

.google-revs__person-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

/* Sterne und die Zahl daneben („5 von 5") in einer Zeile. */
.google-revs__card-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

.google-revs__card-stars {
    display: flex;
    gap: 2px;
}

.google-revs__card-rating {
    font-size: 13px;
    font-weight: 700;
    color: var(--comparison-gray-500, #6b7280);
    font-variant-numeric: tabular-nums;
}

.google-revs__card-star {
    width: 15px;
    height: 15px;
    fill: var(--comparison-yellow-400, #fbbf24);
}

/*
 * Der Zitattext. `white-space: pre-line` haelt die Absatzumbrueche, die in den
 * Originalen stehen — bei Vyacheslav R., Maryna F., Claudia G. und Friedrich B.
 * gehoeren sie zum Zitat (ausgezaehlt im Datenblock der Vorlage).
 *
 * Die Zeilenbegrenzung ist noetig, weil die 15 Originale zwischen 56 und 1041
 * Zeichen lang sind. Ohne sie bestimmt die laengste Rezension die Hoehe aller
 * Karten einer Seite. Wer mehr lesen will, klappt die Karte auf (siehe
 * .google-revs__more) — abgeschnitten wird nichts, nur eingeklappt.
 */
.google-revs__text {
    font-size: 15px;
    line-height: 1.62;
    color: var(--comparison-gray-600, #4b5563);
    white-space: pre-line;
    margin: 0;
    flex: 1 1 auto;
    display: -webkit-box;
    /* Four lines: the row stays low, short quotes no longer sit in a tall empty card; longer
       quotes end in an ellipsis and open through "Mehr lesen". */
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.google-revs__card.is-open .google-revs__text {
    -webkit-line-clamp: unset;
    display: block;
    overflow: visible;
}

.google-revs__more {
    align-self: flex-start;
    font-size: 13px;
    font-weight: 600;
    color: var(--comparison-primary-green, #24b2a5);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
}

.google-revs__more:hover {
    text-decoration: underline;
}

/* Name und Zeitangabe stehen seit dem Umbau auf das Google-Layout OBEN in der
   Kopfzeile, untereinander rechts neben dem Bild — nicht mehr als getrennte
   Zeile am Kartenfuss. */
.google-revs__author {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
    color: var(--comparison-primary-navy, #1a365d);
    /* Lange Namen kuerzen statt die Kopfzeile umbrechen zu lassen. */
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.google-revs__date {
    font-size: 12px;
    line-height: 1.3;
    color: var(--comparison-gray-400, #9ca3af);
}

/* --- Bedienung: Pfeile, Punkte, Zaehler ------------------------------------ */

/* Second row, under the card strip. */
.google-revs__nav {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-top: 6px;
}

.google-revs__arrow {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border-radius: 9999px;
    border: 1px solid var(--comparison-gray-300, #d1d5db);
    background: #ffffff;
    color: var(--comparison-gray-600, #4b5563);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.google-revs__arrow svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.google-revs__arrow:hover:not(:disabled) {
    border-color: var(--comparison-primary-green, #24b2a5);
    color: var(--comparison-primary-green, #24b2a5);
}

.google-revs__arrow:disabled {
    opacity: 0.32;
    cursor: default;
}

.google-revs__dots {
    display: flex;
    align-items: center;
    gap: 7px;
}

.google-revs__dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 9999px;
    background: var(--comparison-gray-300, #d1d5db);
    cursor: pointer;
    transition: background-color 0.25s ease, width 0.25s ease;
}

.google-revs__dot.is-active {
    background: var(--comparison-primary-green, #24b2a5);
    width: 22px;
}

/* Tritt bei vielen Seiten an die Stelle der Punktreihe (siehe PUNKTE_HOECHSTENS
   in google-rezensionen.ejs) — 15 Punkte nebeneinander kann niemand abzaehlen.
   Feste Ziffernbreite, damit die Leiste beim Blaettern nicht zuckt. */
.google-revs__counter {
    font-size: 14px;
    font-weight: 600;
    color: var(--comparison-gray-500, #6b7280);
    font-variant-numeric: tabular-nums;
    min-width: 62px;
    text-align: center;
}

/* Ohne JavaScript gibt es nichts zu bedienen — dann bleibt gewischt. */
.google-revs:not(.is-ready) .google-revs__nav {
    display: none;
}

/* --- Schmalere Fenster ----------------------------------------------------- */

@media (max-width: 1080px) {
    .google-revs__card {
        flex: 0 0 calc((100% - 16px) / 2);
    }
}

@media (max-width: 860px) {
    .google-revs-section {
        padding: 22px 0 44px;
        margin-top: 0;
    }

    .google-revs-intro {
        font-size: 0.9rem;
    }

    .google-revs-head {
        margin-bottom: 18px;
    }

    .google-revs__viewport {
        grid-column: 1;
        grid-row: 1;
        /*
         * Der Streifen bricht aus dem seitlichen Abstand des Inhalts aus und laeuft
         * bis an den Bildschirmrand. Der Innenabstand holt den Startpunkt der ersten
         * Karte wieder auf dieselbe Linie wie Ueberschrift und Text; nach rechts
         * bleibt er offen, damit die naechste Karte sichtbar hereinragt statt am
         * Rand abgeschnitten zu wirken.
         *
         * `scroll-padding-left` sorgt dafuer, dass eine eingerastete Karte an
         * dieser Linie stehenbleibt und nicht am nackten Rand klebt.
         */
        margin-left: -16px;
        margin-right: -16px;
        padding-left: 16px;
        padding-right: 16px;
        scroll-padding-left: 16px;
    }

    .google-revs__nav {
        grid-column: 1;
        grid-row: 2;
        margin-top: 10px;
    }

    /* Schmaler als der Streifen, damit die naechste Karte sichtbar hereinragt und
       zeigt, dass es weitergeht. Bei 390 px Bildschirm bleiben so rund 50 px der
       Folgekarte stehen — genug als Hinweis, zu wenig zum Mitlesen. */
    .google-revs__card {
        flex: 0 0 85%;
    }
}

/* Wer Bewegung reduziert haben moechte, bekommt keine weichen Spruenge. */
@media (prefers-reduced-motion: reduce) {
    .google-revs__viewport {
        scroll-behavior: auto;
    }
}
