/* ───────────────────────────────────────────────
 * GBP Testimonial Carousel — block stylesheet.
 *
 * Loaded on the frontend AND inside the editor canvas (via add_editor_style)
 * so what editors see matches the live site. Editor-only tweaks are scoped
 * under .gbp-tcc-editor at the bottom of the file.
 * ─────────────────────────────────────────────── */

.gbp-testimonial-cards-carousel {
    position: relative;
    overflow: visible;
    padding: 0 60px;
    box-sizing: border-box;
}

.gbp-tcc-viewport {
    overflow: hidden;
    padding: 10px 0;
}

.gbp-tcc-track {
    display: flex;
    transition: transform 0.4s ease;
}

/* ── Card ── */
.gbp-testimonial-card {
    position: relative;
    flex-shrink: 0;
    padding: 36px 32px 28px;
    border-radius: 8px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 320px;
    overflow: hidden;
}

.gbp-tc-icon {
    position: absolute;
    top: 16px;
    left: 24px;
    line-height: 0;
    pointer-events: none;
}

/* ── Background video ── */
/* The card already provides position: relative + overflow: hidden, so the
   video sits absolute-filled inside the rounded corners. Overlay is a
   solid-colour layer painted on top of the video; quote/author/icon get
   their own z-indexes via the .gbp-tc-has-video selectors below so they
   always render above both video and overlay. */
.gbp-tc-video-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.gbp-tc-video-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.gbp-tc-has-video .gbp-tc-icon,
.gbp-tc-has-video .gbp-tc-text,
.gbp-tc-has-video .gbp-tc-author {
    position: relative;
    z-index: 2;
}

.gbp-tc-icon-svg {
    width: 72px;
    height: 72px;
    display: block;
}

.gbp-tc-text {
    position: relative;
    font-size: 18px;
    line-height: 1.45;
    font-weight: 600;
    margin: 80px 0 24px;
    z-index: 1;
}

.gbp-tc-text:empty::before {
    content: attr(data-rich-text-placeholder);
    opacity: 0.5;
}

.gbp-tc-author {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: auto;
}

.gbp-tc-avatar img {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
}

.gbp-tc-author-info {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
}

.gbp-tc-name {
    font-weight: 700;
    font-size: 15px;
}

.gbp-tc-position {
    font-size: 13px;
    opacity: 0.85;
}

/* ── Navigation Arrows ── */
.gbp-tcc-nav-prev,
.gbp-tcc-nav-next {
    position: absolute;
    top: 50%;
    transform: translateY( -50% );
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #1a1a1a;
    color: #ffffff;
    border: none;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: opacity 0.2s ease;
}

.gbp-tcc-nav-prev { left: 8px; }
.gbp-tcc-nav-next { right: 8px; }

.gbp-tcc-nav-prev:hover,
.gbp-tcc-nav-next:hover {
    opacity: 0.85;
}

.gbp-tcc-nav-prev svg,
.gbp-tcc-nav-next svg {
    fill: currentColor;
}

/* ── Offset Width ──
 * Mirrors the gbp-offset-* widths defined for .wp-block-image in style.css,
 * scoped to the carousel so the panel from gbp-image-offset-width.js makes
 * the carousel extend beyond the content text area. position:relative is
 * already set on the carousel above, so left/transform reflow correctly
 * around the absolute-positioned nav buttons. */
.gbp-testimonial-cards-carousel[class*="gbp-offset-"] {
    max-width: none;
    left: 50%;
    transform: translateX(-50%);
}

.gbp-testimonial-cards-carousel.gbp-offset-slight { width: min(calc(100% + 50px), 100vw); }
.gbp-testimonial-cards-carousel.gbp-offset-medium { width: min(calc(100% + 150px), 100vw); }
.gbp-testimonial-cards-carousel.gbp-offset-large  { width: min(calc(100% + 250px), 100vw); }
.gbp-testimonial-cards-carousel.gbp-offset-xlarge { width: min(calc(100% + 400px), 100vw); }
.gbp-testimonial-cards-carousel.gbp-offset-full   { width: 100vw; }

/* Tablet & mobile gutters — see the matching block in style.css for the
 * full rationale. Clamps the rendered width to viewport-minus-20 so the
 * carousel outer box never kisses the screen edges below 1024px. */
@media (max-width: 1024px) {
    .gbp-testimonial-cards-carousel[class*="gbp-offset-"] {
        max-width: calc(100vw - 20px);
    }
}

/* ── Responsive ── */
@media ( max-width: 1024px ) {
    .gbp-testimonial-cards-carousel { padding: 0 50px; }
}

@media ( max-width: 600px ) {
    .gbp-testimonial-cards-carousel { padding: 0 40px; }
    .gbp-testimonial-card { min-height: 260px; padding: 28px 24px 22px; }
    .gbp-tc-icon-svg { width: 56px; height: 56px; }
    .gbp-tc-text { font-size: 16px; margin-top: 64px; }
}

/* ───────────────────────────────────────────────
 * Editor-only adjustments. The Gutenberg edit view shows cards in a static
 * horizontal row (no JS carousel) so editors can see/reorder all cards at
 * once. .gbp-tcc-editor is added by the parent block's edit() wrapper.
 * ─────────────────────────────────────────────── */
.gbp-tcc-editor {
    padding: 0;
}

.gbp-tcc-editor .gbp-tcc-editor-hint {
    font-size: 12px;
    color: #757575;
    margin-bottom: 8px;
    font-style: italic;
}

.gbp-tcc-editor-track {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    overflow-x: auto;
    padding: 8px 4px 16px;
}

.gbp-tcc-editor-track > .block-editor-inner-blocks,
.gbp-tcc-editor-track > .block-editor-block-list__layout {
    display: flex;
    flex-wrap: nowrap;
    gap: 16px;
    width: 100%;
}

.gbp-tcc-editor .gbp-testimonial-card,
.gbp-tcc-editor .block-editor-block-list__block.gbp-testimonial-card {
    flex: 0 0 280px;
    max-width: 280px;
    min-height: 300px;
}
