/* ===== Gallery action bar (View in 3D + Start Engine) ===== */
.gallery-actions {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 18px;
    flex-wrap: wrap;
}

.gallery-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    padding: 11px 22px;
    font-family: var(--font-body);
    font-size: 0.8125rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
    background: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    z-index: 1;
    transition: color var(--transition-base), border-color var(--transition-base), transform var(--transition-fast);
}

.gallery-action::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 0;
    background: linear-gradient(90deg, #3b82f6, #60a5fa);
    z-index: -1;
    transition: width 0.4s ease;
}

.gallery-action:hover:not(:disabled) {
    color: #fff;
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.gallery-action:hover:not(:disabled)::before { width: 100%; }

.gallery-action:disabled {
    opacity: 0.45;
    cursor: default;
}

.gallery-action svg {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* --- loading state on the 3D button --- */
.gallery-action.is-loading {
    opacity: 0.7;
    cursor: wait;
}

/* --- engine button: warm ignition accent while running --- */
.engine-btn.is-running {
    color: #fff;
    border-color: #f59e0b;
    box-shadow: 0 0 18px rgba(245, 158, 11, 0.28);
}

.engine-btn.is-running::before {
    width: 100%;
    background: linear-gradient(90deg, #b45309, #f59e0b);
}

/* --- little equaliser that animates only while the audio plays --- */
.engine-bars {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 13px;
}

.engine-bars i {
    display: block;
    width: 2px;
    height: 4px;
    background: currentColor;
    border-radius: 1px;
    transition: height var(--transition-base);
}

.engine-btn.is-running .engine-bars i {
    animation: engineBar 0.6s ease-in-out infinite;
}

.engine-btn.is-running .engine-bars i:nth-child(2) { animation-delay: 0.15s; }
.engine-btn.is-running .engine-bars i:nth-child(3) { animation-delay: 0.3s; }
.engine-btn.is-running .engine-bars i:nth-child(4) { animation-delay: 0.45s; }

@keyframes engineBar {
    0%, 100% { height: 4px; }
    50%      { height: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    .engine-btn.is-running .engine-bars i { animation: none; height: 9px; }
    .gallery-action::before { transition: none; }
}

@media (max-width: 640px) {
    .gallery-actions { gap: 10px; }
    .gallery-action {
        padding: 10px 16px;
        font-size: 0.75rem;
        letter-spacing: 0.04em;
    }
}

/* ===== Shared 3D canvas mount (works on any car page) ===== */
.car3d {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: auto;
    z-index: 2;
}

.car3d canvas { width: 100%; height: 100%; display: block; }

.gallery-container.is3d .car3d { opacity: 1; }
.gallery-container.is3d .gallery-img { opacity: 0 !important; pointer-events: none; }

.gallery-container.no3d .car3d,
.gallery-container.no3d .car3d-loading { display: none; }

.car3d-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-size: 0.75rem;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--text-muted);
    z-index: 3;
    pointer-events: none;
    animation: car3dPulse 1.6s ease infinite;
}

.gallery-container.is3d .car3d-loading { display: none; }

@keyframes car3dPulse { 0%,100%{opacity:.35} 50%{opacity:.9} }
