/* Top Marketing Reviews - professional location review grid */
.tmr-reviews-widget {
    --tmr-text: #172033;
    --tmr-muted: #667085;
    --tmr-line: #e6eaf0;
    --tmr-surface: #ffffff;
    --tmr-soft: #f7f9fc;
    --tmr-blue: #1a73e8;
    --tmr-blue-dark: #1558b0;
    --tmr-star: #fbbc04;
    --tmr-shadow: 0 14px 35px rgba(16, 24, 40, .08);

    width: 100%;
    max-width: 1180px;
    margin: 32px auto;
    padding: clamp(22px, 4vw, 38px);
    background: var(--tmr-surface);
    border: 1px solid var(--tmr-line);
    border-radius: 22px;
    box-shadow: var(--tmr-shadow);
    color: var(--tmr-text);
    font-family: inherit;
    box-sizing: border-box;
}

.tmr-reviews-widget *,
.tmr-reviews-widget *::before,
.tmr-reviews-widget *::after {
    box-sizing: border-box;
}

.tmr-widget-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 24px;
    margin-bottom: 26px;
    border-bottom: 1px solid var(--tmr-line);
}

.tmr-business-block {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.tmr-business-logo,
.tmr-google-badge {
    width: 62px;
    height: 62px;
    flex: 0 0 62px;
    border-radius: 16px;
    border: 1px solid var(--tmr-line);
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tmr-business-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.tmr-google-badge {
    color: #4285f4;
    font-size: 28px;
    font-weight: 800;
}

.tmr-business-copy {
    min-width: 0;
}

.tmr-eyebrow {
    display: block;
    margin-bottom: 4px;
    color: var(--tmr-muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.tmr-business-name {
    margin: 0 0 7px !important;
    color: var(--tmr-text) !important;
    font-size: clamp(20px, 2.2vw, 27px) !important;
    line-height: 1.2 !important;
    font-weight: 750 !important;
    text-transform: none !important;
}

.tmr-business-meta {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
    font-size: 14px;
}

.tmr-score {
    font-weight: 800;
    color: var(--tmr-text);
}

.tmr-stars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    line-height: 1;
}

.tmr-star {
    font-size: 18px;
    color: var(--tmr-star);
}

.tmr-star.is-empty {
    color: #d9dee7;
}

.tmr-total-reviews {
    color: var(--tmr-muted);
}

.tmr-google-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 17px;
    border-radius: 10px;
    background: var(--tmr-blue);
    color: #fff !important;
    text-decoration: none !important;
    font-size: 14px;
    font-weight: 700;
    white-space: nowrap;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}

.tmr-google-link:hover {
    background: var(--tmr-blue-dark);
    color: #fff !important;
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(26, 115, 232, .20);
}

.tmr-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.tmr-review-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 245px;
    padding: 22px;
    background: linear-gradient(180deg, #fff 0%, var(--tmr-soft) 100%);
    border: 1px solid var(--tmr-line);
    border-radius: 16px;
    transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.tmr-review-card:hover {
    border-color: #d4dbe6;
    box-shadow: 0 10px 24px rgba(16, 24, 40, .07);
    transform: translateY(-2px);
}

.tmr-review-card.is-hidden,
.tmr-review-card[hidden] {
    display: none !important;
}

.tmr-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 15px;
}

.tmr-reviewer {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.tmr-avatar {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    border-radius: 50%;
    object-fit: cover;
    background: #eef2f7;
}

.tmr-avatar-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #344054;
    font-weight: 800;
}

.tmr-reviewer-name {
    margin: 0 !important;
    color: var(--tmr-text) !important;
    font-size: 15px !important;
    line-height: 1.3 !important;
    font-weight: 750 !important;
    text-transform: none !important;
}

.tmr-review-date {
    margin-top: 3px;
    color: var(--tmr-muted);
    font-size: 12px;
}

.tmr-source-icon {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
}

.tmr-review-stars {
    margin-bottom: 14px;
}

.tmr-review-copy {
    position: relative;
    color: #344054;
    font-size: 14.5px;
    line-height: 1.7;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.tmr-review-copy.is-expanded {
    display: block;
    overflow: visible;
}

.tmr-read-more {
    align-self: flex-start;
    margin-top: 12px;
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--tmr-blue);
    font: inherit;
    font-size: 13px;
    font-weight: 750;
    cursor: pointer;
}

.tma-widget-container {
    display: flex;
    align-items: center;
    gap: 32px;
    width: 100%;
    font-family: Arial, Helvetica, sans-serif;
}


/* ==========================
   Left Company Section
========================== */

.tma-footer {
    width: 320px;
    flex-shrink: 0;
}

.tma-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.tma-footer .tma-profile-img img {
    width: 70px;
    height: 70px;
    object-fit: contain;
}

.tma-footer .tma-profile-details {
    display: flex;
    flex-direction: column;
}

.tma-footer .tma-name {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    margin-bottom: 10px;
}

/* Unfilled stars in the business header rating. */
.tma-star--empty {
    filter: grayscale(1);
    opacity: .3;
}

.tma-rating-value {
    margin-left: 6px;
    font-weight: 700;
    color: #333;
}

.tma-rating-text {
    margin-top: 10px;
    font-size: 16px;
    color: #333;
}


.tma-header-write-btn {
    display: inline-block;
    margin-top: 20px;
    padding: 10px 20px;
    border: 1px solid #bdbdbd;
    border-radius: 8px;
    color: #111;
    text-decoration: none;
    font-weight: 600;
    transition: .2s;
    line-height: 1;
}

.tma-header-write-btn:hover {
    background: #f5f5f5;
}

/* ==========================
   Swiper Review Slider
========================== */


.tma-reviews-container {
    flex: 1;
    width: calc(100% - 352px);
    overflow: hidden;
    position: relative;
}


.tma-reviews-container-wrapper {
    display: flex;
    align-items: stretch;
    margin: 20px 0px;
}

/* Important for Swiper */
.tmaSwiper .swiper-slide {
    height: auto;
    display: flex;
}


/* ==========================
   Review Card
========================== */


.tma-review-item {
    display: flex;
    width: 100%;
    height: 100%;
}


.tma-inner {
    background: #f7f7f7;
    border-radius: 18px;
    padding: 22px;
    box-sizing: border-box;
    width: 100%;
    min-height: 290px;
}

/* ==========================
   Review Header
========================== */


.tma-review-header {
    display: flex;
    align-items: center;
    margin-bottom: 18px;
}


/* Shown only when the remote avatar fails to load: Google rate-limits
   (HTTP 429) avatar requests that carry a Referer, so a fallback is needed. */
.tma-profile-img.tma-avatar-fallback::after {
    content: attr(data-initial);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #e8eaed;
    color: #5f6368;
    font-size: 16px;
    font-weight: 700;
    line-height: 1;
}

.tma-review-header .tma-profile-img img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.tma-review-header .tma-profile-details {
    margin-left: 14px;
    flex: 1;
    text-align: left;
}


.tma-review-header .tma-name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 3px;
}


.tma-date {
    color: #888;
    font-size: 11px;
}

.tma-business-name {
    color: var(--tmaw-text-muted, #888);
    display: block;
    font-size: 12px;
    line-height: 1.3;
    margin-top: 2px;
    text-decoration: none;
}

.tma-business-name[href]:hover {
    text-decoration: underline;
}


.tma-platform-icon {
    order: 3;
    margin-left: auto;
}


.tma-platform-icon img {
    width: 26px;
    height: 26px;
}



/* ==========================
   Review Content
========================== */

.tma-review-item .tma-stars {
    margin: 0 0 16px;
    color: #fbb900;
    font-size: 21px;
    letter-spacing: 2px;
    line-height: 1;
    display: flex;
    gap: 3px;
}

.tma-star {
    width: 20px;
    height: 20px;
}

.tma-review-content {
    font-size: 15px;
    line-height: 1.55;
    color: #222;
    height: 70px;
    transition: all .3s ease;
    overflow: hidden;
}

.tma-review-content.expanded {
    height: auto;
}

.tma-read-more {
    display: inline-block;
    margin-top: 12px;
    color: #1a73e8;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
}


/* ==========================
   Swiper Arrows
========================== */


.tma-reviews-container .swiper-button-prev,
.tma-reviews-container .swiper-button-next {
    width: 30px;
    height: 30px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 2px 10px rgb(0 0 0 / .15);

    &:hover {
        background-color: #4d4d4d;
    }
}

.tma-reviews-container .swiper-button-prev:hover::after,
.tma-reviews-container .swiper-button-next:hover::after {
    color: #fff;
}


.tma-reviews-container .swiper-button-prev::after,
.tma-reviews-container .swiper-button-next::after {
    font-size: 14px;
    color: #555;
    font-weight: 700;
}


.tma-reviews-container .swiper-button-prev {
    left: 5px;
}


.tma-reviews-container .swiper-button-next {
    right: 5px;
}



/* Hide old Trustindex controls */
.tma-controls,
.tma-controls-line {
    display: none !important;
}



/* ==========================
   Responsive
========================== */

@media (max-width: 800px) {

    .tmr-widget-head,
    .tmr-widget-footer {
        align-items: flex-start;
        flex-direction: column;
    }

    .tmr-grid {
        grid-template-columns: 1fr;
    }
}


/* The business panel is a fixed 320px column, so the reviews beside it get
   `100% - 352px`. Measured at 768px that left 384px for the grid, and the
   tablet column count then cut each card to 182px — a card too narrow to read.
   Stacking below 900px means the tablet column count always applies to a
   full-width container. */
@media (max-width: 899px) {
    .tma-widget-container {
        flex-direction: column;
    }

    .tma-footer {
        width: 100%;
    }

    .tma-reviews-container {
        width: 100%;
    }

    .tma-inner {
        min-height: auto;
    }
}

@media (max-width: 520px) {
    .tmr-reviews-widget {
        margin: 20px auto;
        padding: 18px;
        border-radius: 16px;
    }

    .tmr-business-block {
        align-items: flex-start;
    }

    .tmr-business-logo,
    .tmr-google-badge {
        width: 50px;
        height: 50px;
        flex-basis: 50px;
        border-radius: 12px;
    }

    .tmr-google-link {
        width: 100%;
    }

    .tmr-review-card {
        min-height: 0;
        padding: 18px;
    }
}

/* ==========================================================================
   Layouts
   Column counts arrive as custom properties from PHP, so one rule set covers
   every configuration.
   ========================================================================== */

.tma-widget-container {
    --tma-cols-desktop: 3;
    --tma-cols-tablet: 2;
    --tma-cols-mobile: 1;
    --tma-gap: 20px;
    --tma-row-gap: 20px;
}

/* ---- Grid ---- */
.tma-reviews-container.tma-grid {
    display: grid;
    grid-template-columns: repeat(var(--tma-cols-mobile), minmax(0, 1fr));
    /* Columns and rows space independently. The per-breakpoint variables are
       only emitted when the user set one, so var()'s fallback is what makes
       "inherit the desktop value" work without a second rule. */
    column-gap: var(--tma-gap-mobile, var(--tma-gap));
    row-gap: var(--tma-gap-mobile, var(--tma-row-gap));
    align-items: stretch;
}

.tma-grid .tma-review-item,
.tma-list .tma-review-item {
    height: 100%;
}

/* ---- Masonry ---- */
.tma-reviews-container.tma-masonry {
    column-count: var(--tma-cols-mobile);
    column-gap: var(--tma-gap-mobile, var(--tma-gap));
}

.tma-masonry-item {
    /* Stops a card being split across two columns. */
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    /* Column layout has no row-gap, so the vertical rhythm is a margin. */
    margin-bottom: var(--tma-gap-mobile, var(--tma-row-gap));
}

/* Masonry cards size to their content, so the read-more clamp is dropped. */
.tma-masonry .tma-review-content {
    height: auto;
}

.tma-masonry .tma-read-more {
    display: none;
}

/* ---- List ---- */
.tma-reviews-container.tma-list {
    display: flex;
    flex-direction: column;
    gap: var(--tma-gap-mobile, var(--tma-row-gap));
}

@media (min-width: 768px) {
    .tma-reviews-container.tma-grid {
        grid-template-columns: repeat(var(--tma-cols-tablet), minmax(0, 1fr));
        column-gap: var(--tma-gap-tablet, var(--tma-gap));
        row-gap: var(--tma-gap-tablet, var(--tma-row-gap));
    }

    .tma-reviews-container.tma-masonry {
        column-count: var(--tma-cols-tablet);
        column-gap: var(--tma-gap-tablet, var(--tma-gap));
    }

    .tma-masonry-item {
        margin-bottom: var(--tma-gap-tablet, var(--tma-row-gap));
    }

    .tma-reviews-container.tma-list,
    .tma-sidebar .tma-reviews-container.tma-sidebar-list {
        gap: var(--tma-gap-tablet, var(--tma-row-gap));
    }

    .tma-widget-container {
        font-size: var(--tmaw-font-size-tablet, var(--tmaw-font-size));
    }
}

@media (min-width: 1200px) {
    .tma-reviews-container.tma-grid {
        grid-template-columns: repeat(var(--tma-cols-desktop), minmax(0, 1fr));
        column-gap: var(--tma-gap);
        row-gap: var(--tma-row-gap);
    }

    .tma-reviews-container.tma-masonry {
        column-count: var(--tma-cols-desktop);
        column-gap: var(--tma-gap);
    }

    .tma-masonry-item {
        margin-bottom: var(--tma-row-gap);
    }

    .tma-reviews-container.tma-list,
    .tma-sidebar .tma-reviews-container.tma-sidebar-list {
        gap: var(--tma-row-gap);
    }

    .tma-widget-container {
        font-size: var(--tmaw-font-size);
    }
}

/* Pagination dots, only rendered when enabled. */
.tma-reviews-container .swiper-pagination {
    position: static;
    margin-top: 14px;
}

/* ==========================================================================
   Design tokens
   Light and Dark presets, overridable per widget by inline custom properties
   emitted from PHP. Every themeable value below reads a token, so a design
   change never needs a new stylesheet rule.
   ========================================================================== */

.tma-widget-container {
    --tmaw-bg: transparent;
    --tmaw-card-bg: #f7f7f7;
    --tmaw-text: #222;
    --tmaw-text-muted: #888;
    --tmaw-star: #fbb900;
    --tmaw-border: #e6eaf0;
    --tmaw-accent: #1a73e8;
    --tmaw-font-size: 15px;
    --tmaw-radius: 18px;
    --tmaw-card-padding: 22px;
    --tmaw-shadow: none;
}

.tma-widget-container.tma-style-dark {
    --tmaw-bg: #12161a;
    --tmaw-card-bg: #1d232a;
    --tmaw-text: #e8eaed;
    --tmaw-text-muted: #9aa4ad;
    --tmaw-star: #ffc043;
    --tmaw-border: #2b333b;
    --tmaw-accent: #7cb2ff;
}

/* ---- Shadow presets ---- */
.tma-shadow-small {
    --tmaw-shadow: 0 2px 8px rgba(16, 24, 40, .08);
}

.tma-shadow-medium {
    --tmaw-shadow: 0 6px 20px rgba(16, 24, 40, .12);
}

.tma-shadow-large {
    --tmaw-shadow: 0 14px 40px rgba(16, 24, 40, .18);
}

/* ---- Applying the tokens ---- */
.tma-widget-container {
    background: var(--tmaw-bg);
    color: var(--tmaw-text);
}

.tma-widget-container .tma-inner {
    background: var(--tmaw-card-bg);
    border-radius: var(--tmaw-radius);
    padding: var(--tmaw-card-padding);
    box-shadow: var(--tmaw-shadow);
    border: 1px solid var(--tmaw-border);
}

.tma-widget-container {
    /* Mobile first: the breakpoints above raise this to the tablet and
       desktop sizes when the user set them. */
    font-size: var(--tmaw-font-size-mobile, var(--tmaw-font-size));
}

.tma-widget-container .tma-review-content {
    color: var(--tmaw-text);
    font-size: inherit;
}

.tma-widget-container .tma-name,
.tma-widget-container .tma-rating-text,
.tma-widget-container .tma-rating-value {
    color: var(--tmaw-text);
}

.tma-widget-container .tma-date {
    color: var(--tmaw-text-muted);
}

.tma-widget-container .tma-read-more,
.tma-widget-container .tma-header-write-btn {
    color: var(--tmaw-accent);
}

.tma-widget-container .tma-header-write-btn {
    border-color: var(--tmaw-border);
}

/* ---- Stars ----
   Masked spans, not <img>, so the colour follows --tmaw-star. */
.tma-widget-container .tma-star {
    display: inline-block;
    width: 20px;
    height: 20px;
    background-color: var(--tmaw-star);
    -webkit-mask: var(--tmaw-star-icon) center / contain no-repeat;
    mask: var(--tmaw-star-icon) center / contain no-repeat;
}

.tma-widget-container .tma-star--empty {
    /* Same glyph, knocked back, so partial ratings read at a glance. */
    background-color: var(--tmaw-text-muted);
    opacity: .35;
    filter: none;
}

.tma-widget-container .tma-stars {
    display: inline-flex;
    gap: 3px;
    align-items: center;
}

.tma-rating-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

/* ==========================================================================
   Sidebar layout
   A panel pinned to one edge of the viewport, with its own scroll. Everything
   here reads the same design tokens as the inline layouts, so Light/Dark and
   the per-widget colour overrides apply unchanged.
   ========================================================================== */

.tma-sidebar-root {
    --tma-sidebar-width: 340px;
    position: relative;
    z-index: 9990;
}

/* Shared by both variants: a narrow vertical card. Only the positioning
   differs, and that lives on .tma-sidebar-floating / .tma-sidebar-inline. */
.tma-widget-container.tma-sidebar {
    display: flex;
    flex-direction: column;

    /* .tma-widget-container is a horizontal row by default: the business
       header sits 320px wide on the left and the reviews take the rest. The
       sidebar stacks instead, so the row-layout rules have to be undone here
       or the children are centred and sized for a full-width page. */
    align-items: stretch;
    gap: 14px;
    /* border-box so --tma-sidebar-width is the width the user actually gets,
       not the width before 36px of padding and 2px of border are added. */
    box-sizing: border-box;
    padding: 18px;
    background: var(--tmaw-card-bg);
    border: 1px solid var(--tmaw-border);
    border-radius: var(--tmaw-radius);
}

/* ---- Floating: pinned to the viewport ---- */
.tma-widget-container.tma-sidebar-floating {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: min(var(--tma-sidebar-width), calc(100vw - 24px));
    max-height: min(80vh, 720px);
    box-shadow: 0 14px 40px rgba(16, 24, 40, .18);
}

.tma-sidebar-floating.tma-sidebar-right {
    right: 16px;
}

.tma-sidebar-floating.tma-sidebar-left {
    left: 16px;
}

/* Non-sticky: scrolls away with the page instead of tracking the viewport. */
.tma-widget-container.tma-sidebar-static {
    position: absolute;
    top: 0;
    transform: none;
}

/* ---- Inline: sits in the page where the shortcode was placed ----
   A blog sidebar column is already narrow, so the width is a maximum rather
   than a fixed size and the panel never scrolls on its own. */
.tma-widget-container.tma-sidebar-inline {
    position: static;
    transform: none;
    width: 100%;
    max-width: var(--tma-sidebar-width);
    max-height: none;
}

.tma-sidebar-inline .tma-reviews-container.tma-sidebar-list {
    overflow: visible;
    max-height: none;
    padding-right: 0;
}

/* The header stays put; only the reviews scroll. */
.tma-sidebar .tma-reviews-container.tma-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: var(--tma-gap-mobile, var(--tma-row-gap, 14px));
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    min-height: 0;
    padding-right: 4px;

    /* Overrides .tma-reviews-container's width: calc(100% - 352px), which is
       negative inside a panel narrower than the 352px header column and
       collapses every card to zero width. */
    width: auto;
    flex: 1 1 auto;
    box-sizing: border-box;
}

/* The header is a fixed 320px column in the row layout; in the panel it is
   simply the full width. */
.tma-sidebar .tma-footer {
    width: auto;
    flex: 0 0 auto;
}

.tma-sidebar .tma-review-item {
    break-inside: auto;
}

/* Read more inside a narrow panel would reflow the whole column on every
   click, so the panel always shows the full comment. */
.tma-sidebar .tma-review-content {
    display: block;
}

.tma-sidebar .tma-read-more {
    display: none;
}

.tma-sidebar .tma-footer {
    flex: 0 0 auto;
}

/* ---- Close button ---- */
.tma-sidebar-close {
    position: absolute;
    top: 8px;
    right: 10px;
    z-index: 2;
    width: 30px;
    height: 30px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    cursor: pointer;
    color: var(--tmaw-text-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
}

.tma-sidebar-close:hover,
.tma-sidebar-close:focus-visible {
    color: var(--tmaw-text);
    background: var(--tmaw-border);
    outline: none;
}

/* Square, so the cross cannot be nudged off-centre by line-height or by the
   font's own glyph metrics. */
.tma-sidebar-close-icon {
    display: block;
    width: 14px;
    height: 14px;
}

/* Keeps the close control clear of the business name. */
.tma-sidebar .tma-footer .tma-profile-details {
    padding-right: 30px;
}

/* ---- Reopen tab ----
   Hidden while the panel is open, so closing never loses the widget. */
.tma-sidebar-reopen {
    position: fixed;
    top: 50%;
    z-index: 9989;
    display: none;
    align-items: center;
    gap: 6px;
    padding: 11px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: var(--tmaw-accent, #1a73e8);
    border: 0;
    /* Floats clear of the edge rather than sitting flush against it, so it
       reads as a button and does not collide with theme chrome or a scrollbar. */
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16, 24, 40, .18);
}

.tma-sidebar-reopen:hover {
    filter: brightness(1.08);
}

.tma-sidebar-reopen:focus-visible {
    outline: 2px solid var(--tmaw-accent, #1a73e8);
    outline-offset: 2px;
}

.tma-sidebar-root.is-closed .tma-sidebar-reopen {
    display: flex;
}

.tma-sidebar-root.is-closed .tma-widget-container.tma-sidebar {
    /* Kept in the DOM rather than removed, so reopening restores scroll
       position and needs no re-render. */
    visibility: hidden;
    pointer-events: none;
    opacity: 0;
}

.tma-sidebar-reopen-star {
    width: 14px;
    height: 14px;
    background-color: #fff;
    -webkit-mask: var(--tmaw-star-icon) center / contain no-repeat;
    mask: var(--tmaw-star-icon) center / contain no-repeat;
}

/* ---- Button placement ----
   Edge and alignment are independent, so the tab can sit anywhere around the
   viewport rather than only beside the panel. Defaults land on the right edge,
   vertically centred, which is where it used to be pinned. */
.tma-sidebar-reopen {
    top: auto;
    bottom: auto;
    left: auto;
    right: auto;
}

/* Vertical edges: the tab runs down the side. */
.tma-sidebar-btn-right .tma-sidebar-reopen {
    right: 14px;
}

.tma-sidebar-btn-left .tma-sidebar-reopen {
    left: 14px;
}

.tma-sidebar-btn-right.tma-sidebar-btn-start .tma-sidebar-reopen,
.tma-sidebar-btn-left.tma-sidebar-btn-start .tma-sidebar-reopen {
    top: 90px;
}

.tma-sidebar-btn-right.tma-sidebar-btn-center .tma-sidebar-reopen,
.tma-sidebar-btn-left.tma-sidebar-btn-center .tma-sidebar-reopen {
    top: 50%;
    transform: translateY(-50%);
}

.tma-sidebar-btn-right.tma-sidebar-btn-end .tma-sidebar-reopen,
.tma-sidebar-btn-left.tma-sidebar-btn-end .tma-sidebar-reopen {
    bottom: 24px;
}

/* Horizontal edges: the tab sits along the top or bottom. */
.tma-sidebar-btn-bottom .tma-sidebar-reopen {
    bottom: 14px;
}

.tma-sidebar-btn-top .tma-sidebar-reopen {
    top: 14px;
}

.tma-sidebar-btn-bottom.tma-sidebar-btn-start .tma-sidebar-reopen,
.tma-sidebar-btn-top.tma-sidebar-btn-start .tma-sidebar-reopen {
    left: 24px;
}

.tma-sidebar-btn-bottom.tma-sidebar-btn-center .tma-sidebar-reopen,
.tma-sidebar-btn-top.tma-sidebar-btn-center .tma-sidebar-reopen {
    left: 50%;
    transform: translateX(-50%);
}

.tma-sidebar-btn-bottom.tma-sidebar-btn-end .tma-sidebar-reopen,
.tma-sidebar-btn-top.tma-sidebar-btn-end .tma-sidebar-reopen {
    right: 24px;
}

/* ---- Animation ---- */
.tma-widget-container.tma-sidebar-anim-slide,
.tma-widget-container.tma-sidebar-anim-fade {
    transition: opacity .28s ease, transform .28s ease, visibility .28s;
}

/* Scoped to :not(.is-closed) on purpose. A CSS animation outranks normal
   declarations, and animation-fill-mode: both holds the "to" frame forever —
   so an unscoped entrance animation pins opacity: 1 and the closed state below
   can never hide the panel. Reopening replays the entrance, which is what you
   want anyway. */
/* No fill-mode. With "both" the animation's final frame keeps overriding
   opacity for good, which made the entrance load-bearing: if it failed to
   replay on reopen the panel stayed invisible. Without it the animation is
   purely decorative and the resting state always comes from the rules below. */
.tma-sidebar-root:not(.is-closed) .tma-sidebar-anim-slide.tma-sidebar-right {
    animation: tmaSidebarInRight .32s ease;
}

.tma-sidebar-root:not(.is-closed) .tma-sidebar-anim-slide.tma-sidebar-left {
    animation: tmaSidebarInLeft .32s ease;
}

.tma-sidebar-root:not(.is-closed) .tma-sidebar-anim-fade {
    animation: tmaSidebarFadeIn .32s ease;
}

.tma-sidebar-root.is-closed .tma-sidebar-anim-slide.tma-sidebar-right {
    transform: translate(24px, -50%);
}

.tma-sidebar-root.is-closed .tma-sidebar-anim-slide.tma-sidebar-left {
    transform: translate(-24px, -50%);
}

@keyframes tmaSidebarInRight {
    from {
        opacity: 0;
        transform: translate(32px, -50%);
    }

    to {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

@keyframes tmaSidebarInLeft {
    from {
        opacity: 0;
        transform: translate(-32px, -50%);
    }

    to {
        opacity: 1;
        transform: translate(0, -50%);
    }
}

@keyframes tmaSidebarFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Static panels are not centred, so they must not be shifted on the Y axis. */
.tma-sidebar-root:not(.is-closed) .tma-sidebar-static.tma-sidebar-anim-slide.tma-sidebar-right {
    animation-name: tmaSidebarInRightStatic;
}

.tma-sidebar-root:not(.is-closed) .tma-sidebar-static.tma-sidebar-anim-slide.tma-sidebar-left {
    animation-name: tmaSidebarInLeftStatic;
}

.tma-sidebar-root.is-closed .tma-sidebar-static.tma-sidebar-anim-slide.tma-sidebar-right {
    transform: translateX(24px);
}

.tma-sidebar-root.is-closed .tma-sidebar-static.tma-sidebar-anim-slide.tma-sidebar-left {
    transform: translateX(-24px);
}

@keyframes tmaSidebarInRightStatic {
    from {
        opacity: 0;
        transform: translateX(32px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes tmaSidebarInLeftStatic {
    from {
        opacity: 0;
        transform: translateX(-32px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .tma-widget-container.tma-sidebar-floating {
        animation: none;
        transition: none;
    }
}

/* On a phone a pinned side panel covers the content, so it becomes a sheet
   across the bottom of the screen instead. */
@media (max-width: 600px) {

    .tma-widget-container.tma-sidebar-floating,
    .tma-widget-container.tma-sidebar-static {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        width: auto;
        max-height: 62vh;
        transform: none;
        border-radius: var(--tmaw-radius) var(--tmaw-radius) 0 0;
        animation-name: tmaSidebarFadeIn;
    }

    .tma-sidebar-root.is-closed .tma-widget-container.tma-sidebar-floating {
        transform: none;
    }

    /* The tab keeps the edge and position it was configured with, at every
       screen size. It used to be forced to bottom-centre here on the theory
       that a bottom sheet wants a bottom tab — but the tab only ever shows
       while the sheet is closed, so there is nothing for it to collide with,
       and overriding it silently ignored the widget's own setting. */
}

/* ---- Business header: Google logo and Maps link (spec 14) ---- */
.tma-widget-container .tma-name {
    display: flex;
    align-items: center;
    gap: 7px;
    /* flex-wrap: wrap; */
}

.tma-header-google-logo {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
}

.tma-header-write-btn-container {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.tma-widget-container .tma-header-maps-link {
    color: var(--tmaw-accent);
    font-size: 13px;
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

.tma-widget-container .tma-header-maps-link:hover,
.tma-widget-container .tma-header-maps-link:focus-visible {
    border-bottom-color: currentColor;
}

/* Inside the sidebar the header is narrow, so the two links stack. */
.tma-sidebar .tma-header-write-btn-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

/* ---- Card width (spec 16) ----
   A maximum, not a fixed size. The variables are only emitted when the user
   set one, so the fallback keeps every layout filling its column as before. */
.tma-widget-container .tma-review-item {
    max-width: var(--tma-card-width-mobile, 100%);
    margin-inline: auto;
    width: 100%;
}

@media (min-width: 768px) {
    .tma-widget-container .tma-review-item {
        max-width: var(--tma-card-width-tablet, 100%);
    }
}

@media (min-width: 1200px) {
    .tma-widget-container .tma-review-item {
        max-width: var(--tma-card-width-desktop, 100%);
    }
}

/* ---- Per-card Google link (spec 11 / 12) ---- */
.tma-widget-container .tma-review-link {
    display: inline-block;
    margin-top: 10px;
    font-size: 13px;
    text-decoration: none;
    color: var(--tmaw-accent);
    border-bottom: 1px solid transparent;
}

.tma-widget-container .tma-review-link:hover,
.tma-widget-container .tma-review-link:focus-visible {
    border-bottom-color: currentColor;
}

/* ==========================================================================
   Theme-proofing for the sidebar controls

   A theme's button reset is usually written as `[type="button"], button {...}`.
   An attribute selector carries the same specificity as a class, and theme
   stylesheets load after plugin ones, so such a rule wins every tie against a
   single-class rule of ours. Measured on Hello Elementor: the close cross
   inherited the theme's 1px #c36 border and width:auto, and the reopen tab's
   `display: none` was overridden outright, so it sat on top of the panel while
   the panel was open.

   Scoping under .tma-sidebar-root takes these to two classes, which beats the
   attribute selector on specificity — no !important needed.
   ========================================================================== */

.tma-sidebar-root .tma-sidebar-close,
.tma-sidebar-root .tma-sidebar-reopen {
    box-sizing: border-box;
    width: auto;
    min-width: 0;
    min-height: 0;
    margin: 0;
    text-transform: none;
    text-decoration: none;
    letter-spacing: normal;
    -webkit-appearance: none;
    appearance: none;
}

.tma-sidebar-root .tma-sidebar-close {
    display: flex;
    width: 30px;
    height: 30px;
    padding: 0;
    color: var(--tmaw-text-muted);
    background: transparent;
    border: 0;
    border-radius: 50%;
}

.tma-sidebar-root .tma-sidebar-close:hover,
.tma-sidebar-root .tma-sidebar-close:focus-visible {
    color: var(--tmaw-text);
    background: var(--tmaw-border);
}

/* Hidden while the panel is open. The .is-closed rule above is three classes,
   so it still wins when the panel is closed. */
.tma-sidebar-root .tma-sidebar-reopen {
    display: none;
    padding: 11px 16px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: #fff;
    background: var(--tmaw-accent, #1a73e8);
    border: 0;
    border-radius: 8px;
}

/* Small screens: the panel is a full-width bottom sheet, so a tab floating
   over it is both redundant and in the way. Give the sheet room for the
   safe-area inset too, or the last card sits under the home indicator. */
@media (max-width: 600px) {

    .tma-sidebar-root .tma-widget-container.tma-sidebar-floating,
    .tma-sidebar-root .tma-widget-container.tma-sidebar-static {
        padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
    }

    /* Only tabs actually pinned to the bottom edge need to clear the home
       indicator. These selectors mirror the placement rules above so they
       match on specificity and add the inset without moving anything. */
    .tma-sidebar-btn-right.tma-sidebar-btn-end .tma-sidebar-reopen,
    .tma-sidebar-btn-left.tma-sidebar-btn-end .tma-sidebar-reopen {
        bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .tma-sidebar-btn-bottom .tma-sidebar-reopen {
        bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    }
}