/**
 * Aha Orbit Testimonials — Grid Layout CSS.
 *
 * Loaded ONLY when the Grid layout is active.
 * Orbit layout styles are in orbit-testimonials.css.
 * Carousel layout styles are in carousel-testimonials.css.
 *
 * @package Aha_Orbit_Testimonials
 * @since   1.1.0
 */

/* ── CSS custom property defaults (overridable via per-orbit meta) ──────── */
.ot-layout-grid {
    --ot-text-primary: #1e293b;
    --ot-text-secondary: #64748b;
    --ot-accent-color: #3b82f6;
    --ot-card-bg: #ffffff;
    --ot-name-color: var(--ot-accent-color);
    --ot-role-color: var(--ot-text-secondary);
    --ot-quote-color: var(--ot-text-secondary);
    --ot-grid-cols: 3;

    display: grid;
    grid-template-columns: repeat(var(--ot-grid-cols), 1fr);
    gap: 1.5rem;
    width: 100%;
    box-sizing: border-box;
}

.ot-layout-grid *,
.ot-layout-grid *::before,
.ot-layout-grid *::after {
    box-sizing: border-box;
}

/* ── Card ───────────────────────────────────────────────────────────────── */
.ot-grid-card {
    background: var(--ot-card-bg);
    border-radius: 16px;
    padding: 1.75rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    color: var(--ot-text-primary);
    animation: ot-grid-fade-in 0.5s ease both;
}

.ot-grid-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.10);
}

@keyframes ot-grid-fade-in {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Stagger fade-in per card */
.ot-grid-card:nth-child(1) {
    animation-delay: 0.05s !important;
}

.ot-grid-card:nth-child(2) {
    animation-delay: 0.10s !important;
}

.ot-grid-card:nth-child(3) {
    animation-delay: 0.15s !important;
}

.ot-grid-card:nth-child(4) {
    animation-delay: 0.20s !important;
}

.ot-grid-card:nth-child(5) {
    animation-delay: 0.25s !important;
}

.ot-grid-card:nth-child(6) {
    animation-delay: 0.30s !important;
}

.ot-grid-card:nth-child(7) {
    animation-delay: 0.35s !important;
}

.ot-grid-card:nth-child(8) {
    animation-delay: 0.40s !important;
}

.ot-grid-card:nth-child(9) {
    animation-delay: 0.45s !important;
}

.ot-grid-card:nth-child(n+10) {
    animation-delay: 0.50s !important;
}

/* ── Card header: avatar + meta ─────────────────────────────────────────── */
.ot-grid-card__header {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.ot-grid-avatar-wrap {
    position: relative;
    flex-shrink: 0;
    width: 60px;
    height: 60px;
}

.ot-layout-grid .ot-grid-card img.ot-grid-avatar-img,
.ot-grid-avatar-img {
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    object-fit: cover !important;
    display: block !important;
    border: 3px solid var(--ot-card-bg) !important;
    max-width: none !important;
}

.ot-grid-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4776e6, #8e54e9);
    /* fallback */
    border: 3px solid var(--ot-card-bg) !important;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    text-transform: uppercase;
    user-select: none;
}

/* Cycling gradients per card */
.ot-layout-grid .ot-grid-card:nth-child(6n+1) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #4776e6, #8e54e9);
}

.ot-layout-grid .ot-grid-card:nth-child(6n+2) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #0ba360, #3cba92);
}

.ot-layout-grid .ot-grid-card:nth-child(6n+3) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #f7971e, #ffd200);
}

.ot-layout-grid .ot-grid-card:nth-child(6n+4) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #f953c6, #b91d73);
}

.ot-layout-grid .ot-grid-card:nth-child(6n+5) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #1a85ff, #00c6fb);
}

.ot-layout-grid .ot-grid-card:nth-child(6n+6) .ot-grid-avatar-initials {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
}

/* Social badge sizing inside grid avatar */
.ot-grid-avatar-wrap .ot-social-badge {
    width: 22px;
    height: 22px;
}

.ot-grid-avatar-wrap .ot-social-badge svg {
    width: 14px;
    height: 14px;
}

/* ── Card meta (name / role / logo) ────────────────────────────────────── */
.ot-grid-card__meta {
    flex: 1;
    min-width: 0;
}

.ot-grid-card__name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--ot-name-color);
    margin: 0 0 0.15rem;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ot-grid-card__role {
    font-size: 0.85rem;
    color: var(--ot-role-color);
    margin: 0;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ot-layout-grid .ot-grid-card img.ot-grid-card__logo,
.ot-grid-card__logo {
    display: block !important;
    max-height: 22px !important;
    width: auto !important;
    max-width: 90px !important;
    margin-top: 0.4rem !important;
    object-fit: contain !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

/* ── Card body (quote icon + stars + text) ──────────────────────────────── */
.ot-grid-card__body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ot-grid-card__body .ot-quote-icon {
    color: var(--ot-quote-color);
    opacity: 0.2;
    display: flex;
    margin-bottom: 0.25rem;
}

.ot-grid-card__body .ot-star-rating {
    display: flex;
    gap: 3px;
    margin: 0;
}

.ot-grid-card__text {
    font-size: 0.95rem;
    color: var(--ot-text-primary);
    line-height: 1.7;
    margin: 0;
    font-style: italic;
    font-weight: 500;
}

/* ── Stars (shared tokens, scoped to grid) ──────────────────────────────── */
.ot-layout-grid .ot-star {
    font-size: 1.3rem;
    color: #d1d5db;
    user-select: none;
}

.ot-layout-grid .ot-star--filled {
    color: #f59e0b;
}

.ot-layout-grid .ot-star--half {
    position: relative;
    display: inline-block;
    color: #d1d5db;
}

.ot-layout-grid .ot-star--half::after {
    content: "\2605";
    position: absolute;
    left: 0;
    top: 0;
    width: 50%;
    overflow: hidden;
    color: #f59e0b;
}

/* ── Social badges (shared, scoped to grid) ─────────────────────────────── */
.ot-layout-grid .ot-social-badge-link {
    display: block;
    text-decoration: none;
}

.ot-layout-grid .ot-social-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #555;
    color: #fff;
    border: 2px solid #fff;
    z-index: 3;
    transition: transform 0.2s ease;
}

.ot-layout-grid .ot-social-badge-link:hover .ot-social-badge {
    transform: scale(1.15);
}

.ot-layout-grid .ot-social-badge--facebook {
    background: #1877f2;
}

.ot-layout-grid .ot-social-badge--instagram {
    background: radial-gradient(circle at 30% 110%, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

.ot-layout-grid .ot-social-badge--linkedin {
    background: #0a66c2;
}

.ot-layout-grid .ot-social-badge--twitter {
    background: #000;
}

.ot-layout-grid .ot-social-badge--youtube {
    background: #ff0000;
}

.ot-layout-grid .ot-social-badge--tiktok {
    background: #010101;
}

.ot-layout-grid .ot-social-badge--google {
    background: #fff;
}

.ot-layout-grid .ot-social-badge--trustpilot {
    background: #00b67a;
}

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
    .ot-layout-grid {
        grid-template-columns: repeat(min(var(--ot-grid-cols), 2), 1fr);
    }
}

@media (max-width: 600px) {
    .ot-layout-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Resilience: force transitions even if theme resets them ────────────── */
.ot-layout-grid .ot-grid-card {
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
    transition-duration: 0.25s, 0.25s !important;
    transition-delay: 0s !important;
    animation-duration: 0.5s !important;
}