/* ============================================
   TAJELINE — Global Smoothness Layer
   Smooth scrolling, transitions, lazy images,
   page load animations, touch feedback
   ============================================ */

/* --- Smooth scroll everywhere --- */
html {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* --- GPU-accelerated transitions on interactive elements --- */
a, button, input, select, textarea,
.wrapper, .product-card, .engine-link, .tj-nav-link,
.sidebar, .navbar, .action, .secondtext {
    -webkit-tap-highlight-color: transparent;
}

/* --- Page load fade-in --- */
@keyframes tj-fadeUp {
    from { opacity: 0; transform: translateY(18px); }
    to   { opacity: 1; transform: translateY(0); }
}

body {
    animation: tj-fadeUp 0.4s ease-out;
}

/* --- Staggered card reveals on scroll --- */
.wrapper, .product-card {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.45s ease, transform 0.45s ease;
}

.wrapper.tj-visible, .product-card.tj-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Image lazy-load fade --- */
img {
    transition: opacity 0.35s ease;
}
img[loading="lazy"] {
    opacity: 0;
}
img[loading="lazy"].tj-loaded,
img[loading="lazy"][complete] {
    opacity: 1;
}

/* --- Smoother hover on cards --- */
.wrapper {
    transition: transform 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94),
                box-shadow 0.3s ease;
}
.wrapper:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.12);
}

/* --- Navbar smooth slide --- */
.navbar {
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
    will-change: transform;
}
.navbar.tj-scrolled {
    /* background & shadow handled in style.css */
}

/* --- Sidebar smooth open/close --- */
.sidebar {
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

/* --- Smooth bottom nav --- */
.tj-nav-bar {
    transition: transform 0.3s ease;
}

/* --- Button / link press feedback --- */
button:active, .action:active, a:active {
    transform: scale(0.97);
    transition: transform 0.1s ease;
}

/* --- Section headings fade-in --- */
.nine, .showroom-header, section > h1, section > h2 {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity 0.5s ease, transform 0.5s ease;
}
.nine.tj-visible, .showroom-header.tj-visible,
section > h1.tj-visible, section > h2.tj-visible {
    opacity: 1;
    transform: translateY(0);
}

/* --- Smoother scrollbar (webkit) --- */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(0,0,0,0.3);
}

/* --- Horizontal scroll containers (second nav, categories) --- */
.second, .overflow-x-auto {
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.second::-webkit-scrollbar, .overflow-x-auto::-webkit-scrollbar {
    display: none;
}

/* --- Focus ring for accessibility --- */
*:focus-visible {
    outline: 2px solid rgba(0,0,0,0.3);
    outline-offset: 2px;
    border-radius: 2px;
}

/* --- Reduce motion for users who prefer it --- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
