/* ==========================================================================
   Tech Stack Scroller Styles
   ========================================================================== 
   
   Features:
   - Infinite horizontal auto-scrolling
   - Grayscale to color on hover
   - GPU-accelerated transforms
   - Responsive and accessible
   - 8px grid alignment
   
   ========================================================================== */

/* ==========================================================================
   SCROLLER CONTAINER
   ========================================================================== */

.tech-stack {
    padding: var(--space-16) 0;
    overflow: hidden;
    position: relative;
    background: transparent;
}

.tech-stack__header {
    text-align: center;
    margin-bottom: var(--space-8);
    padding: 0 var(--space-4);
}

.tech-stack__title {
    font-family: var(--font-mono);
    font-size: var(--text-sm);
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==========================================================================
   SCROLLER WRAPPER & TRACK
   ========================================================================== */

.tech-stack__wrapper {
    position: relative;
    overflow: hidden;
}

.tech-stack__track {
    display: flex;
    flex-direction: row;
    width: max-content;
    animation: tech-scroll 40s linear infinite;
    will-change: transform;
}

.tech-stack__track:hover {
    animation-play-state: paused;
}

@keyframes tech-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-50%);
    }
}

/* ==========================================================================
   LOGO ITEMS
   ========================================================================== */

.tech-stack__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-4) var(--space-6);
    min-width: 120px;
    flex-shrink: 0;
}

.tech-stack__logo {
    width: 48px;
    height: 48px;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.6;
    transition: 
        filter 0.3s ease,
        opacity 0.3s ease,
        transform 0.3s ease;
    will-change: filter, opacity, transform;
}

.tech-stack__item:hover .tech-stack__logo {
    filter: grayscale(0%);
    opacity: 1;
    transform: scale(1.1);
}

.tech-stack__name {
    font-family: var(--font-mono);
    font-size: var(--text-xs);
    color: var(--text-muted);
    text-align: center;
    opacity: 0;
    transform: translateY(-4px);
    transition: 
        opacity 0.2s ease,
        transform 0.2s ease;
}

.tech-stack__item:hover .tech-stack__name {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   GRADIENT MASKS (Fade edges)
   ========================================================================== */

.tech-stack__wrapper::before,
.tech-stack__wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    width: 100px;
    z-index: 2;
    pointer-events: none;
}

.tech-stack__wrapper::before {
    left: 0;
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.tech-stack__wrapper::after {
    right: 0;
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

/* Dark mode gradient masks */
[data-theme="dark"] .tech-stack__wrapper::before {
    background: linear-gradient(to right, var(--bg-secondary), transparent);
}

[data-theme="dark"] .tech-stack__wrapper::after {
    background: linear-gradient(to left, var(--bg-secondary), transparent);
}

/* Dark mode logo visibility - softer filter for better visibility */
[data-theme="dark"] .tech-stack__logo {
    filter: brightness(1.2) contrast(0.9);
    opacity: 0.85;
}

/* SVG logos that are solid colored need inversion */
[data-theme="dark"] .tech-stack__logo--invert {
    filter: brightness(0) invert(1);
}

/* Keep colored logos fully visible in dark mode */
[data-theme="dark"] .tech-stack__logo--color {
    filter: none;
    opacity: 1;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

@media (max-width: 768px) {
    .tech-stack {
        padding: var(--space-12) 0;
    }

    .tech-stack__item {
        padding: var(--space-3) var(--space-4);
        min-width: 96px;
    }

    .tech-stack__logo {
        width: 40px;
        height: 40px;
    }

    .tech-stack__wrapper::before,
    .tech-stack__wrapper::after {
        width: 60px;
    }
}

/* ==========================================================================
   REDUCED MOTION
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .tech-stack__track {
        animation: none;
    }

    .tech-stack__logo,
    .tech-stack__name {
        transition: none;
    }
}
