/* Techstack Section - Using PROVEN Working Approach */

/* Main Container */
.techstack .section-content {
    width: calc(100% - var(--section-title-width) - var(--section-gap));
    overflow: hidden;
}

/* Subsections */
.tech-subsection {
    margin-bottom: 3rem;
}

.tech-subsection:last-child {
    margin-bottom: 0;
}

.tech-subsection-title {
    font-size: 1.4rem;
    color: var(--accent-color);
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

/* WORKING Carousel - Back to proven method */
.tech-carousel {
    display: flex;
    flex-direction: column;
    gap: 15px;
    /* WORKING mask - don't change this */
    -webkit-mask: -webkit-linear-gradient(90deg, transparent 0%, white 10%, white 90%, transparent 100%);
    mask: linear-gradient(90deg, transparent 0%, white 10%, white 90%, transparent 100%);
}

.tech-row {
    overflow: hidden;
    white-space: nowrap;
    position: relative;
}

.tech-row-content {
    display: inline-flex;
    gap: 15px;
    will-change: transform;
}

/* WORKING ANIMATIONS - Keep the proven method */

/* Programming Languages (Subsection 1) - Normal Speed */
.tech-subsection:nth-child(1) .tech-row-1 .tech-row-content {
    animation: scrollRight 40s linear infinite;
}

.tech-subsection:nth-child(1) .tech-row-2 .tech-row-content {
    animation: scrollLeft 45s linear infinite;
}

/* Software & Tools (Subsection 2) - MUCH SLOWER */
.tech-subsection:nth-child(2) .tech-row-1 .tech-row-content {
    animation: scrollRight 80s linear infinite; /* Much slower */
}

.tech-subsection:nth-child(2) .tech-row-2 .tech-row-content {
    animation: scrollLeft 90s linear infinite; /* Much slower */
}

.tech-subsection:nth-child(2) .tech-row-3 .tech-row-content {
    animation: scrollRight 85s linear infinite; /* Much slower */
}

/* PROVEN WORKING Keyframes - Don't change these */
@keyframes scrollRight {
    0% {
        transform: translate3d(0%, 0, 0);
    }
    100% {
        transform: translate3d(-50%, 0, 0);
    }
}

@keyframes scrollLeft {
    0% {
        transform: translate3d(-50%, 0, 0);
    }
    100% {
        transform: translate3d(0%, 0, 0);
    }
}

/* Tech Items - WORKING version */
.tech-item {
    display: inline-block;
    padding: 8px 16px;
    font-size: 0.95rem;
    color: #555;
    background-color: #f5f5f5;
    border-radius: 50px;
    white-space: nowrap;
    opacity: 0.9;
    flex-shrink: 0;
}

.tech-item:hover {
    transform: translateY(-2px);
    opacity: 1;
    transition: all 0.2s ease;
}

/* Operating Systems Grid */
.os-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1.5rem;
    justify-items: center;
    margin-top: 1rem;
}

.os-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    background-color: var(--card-bg-color);
    border-radius: var(--border-radius);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    width: 120px;
    height: 120px;
    text-align: center;
}

.os-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.05);
}

.os-icon {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
}

.os-icon i {
    font-size: 40px !important;
    line-height: 1;
    display: block;
}

.os-icon svg {
    width: 40px !important;
    height: 40px !important;
    display: block;
}

.os-icon img {
    width: 40px !important;
    height: 40px !important;
    object-fit: contain;
}

.os-item span {
    font-size: 0.85rem;
    color: var(--primary-color);
    font-weight: 500;
    line-height: 1.2;
    margin-top: auto;
}

a.os-item {
    text-decoration: none;
    color: inherit;
}

/* Rainbow Apple Logo for iPadOS */
.rainbow-apple {
    background: linear-gradient(
            to bottom,
            #61bb46 0%,     /* Green */
            #fdb827 17%,    /* Yellow */
            #f5821f 33%,    /* Orange */
            #e03a3e 50%,    /* Red */
            #963d97 67%,    /* Purple */
            #009ddc 83%,    /* Blue */
            #61bb46 100%    /* Green */
    ) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    -webkit-text-fill-color: transparent !important;
    color: transparent !important;
}

/* Fallback for older browsers */
@supports not (-webkit-background-clip: text) {
    .rainbow-apple {
        background: none !important;
        color: #61bb46 !important;
        -webkit-text-fill-color: initial !important;
    }
}

/* RESPONSIVE STYLES */
@media (max-width: 1024px) {
    .techstack .section-content {
        width: calc(100% - var(--section-title-width) - 2rem);
    }

    /* Adjust speeds for tablets */
    .tech-subsection:nth-child(1) .tech-row-1 .tech-row-content {
        animation-duration: 45s;
    }

    .tech-subsection:nth-child(1) .tech-row-2 .tech-row-content {
        animation-duration: 50s;
    }

    .tech-subsection:nth-child(2) .tech-row-1 .tech-row-content {
        animation-duration: 85s;
    }

    .tech-subsection:nth-child(2) .tech-row-2 .tech-row-content {
        animation-duration: 95s;
    }

    .tech-subsection:nth-child(2) .tech-row-3 .tech-row-content {
        animation-duration: 90s;
    }
}

@media (max-width: 768px) {
    .techstack .section-content {
        width: 100%;
    }

    .tech-carousel {
        gap: 12px;
    }

    .tech-row-content {
        gap: 12px;
    }

    .tech-item {
        padding: 6px 12px;
        font-size: 0.9rem;
    }

    /* Mobile speeds */
    .tech-subsection:nth-child(1) .tech-row-1 .tech-row-content {
        animation-duration: 50s;
    }

    .tech-subsection:nth-child(1) .tech-row-2 .tech-row-content {
        animation-duration: 55s;
    }

    .tech-subsection:nth-child(2) .tech-row-1 .tech-row-content {
        animation-duration: 90s;
    }

    .tech-subsection:nth-child(2) .tech-row-2 .tech-row-content {
        animation-duration: 100s;
    }

    .tech-subsection:nth-child(2) .tech-row-3 .tech-row-content {
        animation-duration: 95s;
    }

    .os-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }

    .os-item {
        width: 100px;
        height: 100px;
        padding: 1rem 0.5rem;
    }

    .os-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 6px;
    }

    .os-icon i {
        font-size: 32px !important;
    }

    .os-icon svg,
    .os-icon img {
        width: 32px !important;
        height: 32px !important;
    }

    .os-item span {
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .tech-carousel {
        gap: 10px;
    }

    .tech-row-content {
        gap: 10px;
    }

    .tech-item {
        padding: 5px 10px;
        font-size: 0.85rem;
    }

    .tech-subsection-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    .os-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .os-item {
        width: 90px;
        height: 90px;
    }

    .os-icon {
        width: 28px;
        height: 28px;
    }

    .os-icon i {
        font-size: 28px !important;
    }

    .os-icon svg,
    .os-icon img {
        width: 28px !important;
        height: 28px !important;
    }
}