/* ==========================================================================
   Page sections: tech stack, experience timeline, project cards, contact.
   Loaded after styles.css and relies on its tokens.
   ========================================================================== */

/* ---------- Tech stack ----------
   One row, equal columns. Everything inside scales with the row's width
   (container query units), so the row always fits and never overflows. */
.tech-grid {
    --tech-count: 9; /* overwritten from JS with the real item count */
    container-type: inline-size;
    display: grid;
    grid-template-columns: repeat(var(--tech-count), minmax(0, 1fr));
    gap: 1vw;
    gap: clamp(0.25rem, 1.2cqi, 1.25rem);
    width: 100%;
    margin-top: 2rem;
}

.tech-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(0.25rem, 1cqi, 0.9rem);
    min-width: 0;
    aspect-ratio: 1 / 1;
    padding: clamp(0.2rem, 0.6cqi, 0.6rem);
    border: 2px solid #f0f0f0;
    border-radius: var(--radius);
    background: #fff;
    text-align: center;
    overflow: hidden;
    transition: border-color 0.3s ease;
}

    .tech-item:hover {
        border-color: var(--red);
    }

    .tech-item i {
        font-size: 3vw;
        font-size: clamp(1rem, 3.6cqi, 2.75rem);
        line-height: 1;
        color: var(--text);
    }

    .tech-item img {
        width: 3vw;
        width: clamp(1rem, 3.6cqi, 2.75rem);
        height: auto;
        aspect-ratio: 1 / 1;
        object-fit: contain;
        filter: grayscale(100%) contrast(0%) brightness(0.2);
    }

    .tech-item h4 {
        max-width: 100%;
        font-size: 1.1vw;
        font-size: clamp(0.6rem, 1.15cqi, 0.95rem);
        font-weight: 600;
        line-height: 1.2;
        color: var(--text);
        overflow-wrap: break-word;
        hyphens: auto;
    }

/* Too narrow for readable labels: show icons only (names stay as tooltips). */
@container (max-width: 720px) {
    .tech-item h4 {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ---------- Experience timeline ---------- */
.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

    .timeline::before {
        content: '';
        position: absolute;
        top: 0;
        bottom: 0;
        left: 2rem;
        width: 2px;
        background: var(--red);
    }

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 5rem;
}

.timeline-date {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--red);
}

.timeline-content h3 {
    margin-bottom: 0.25rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--ink);
}

.timeline-content h4 {
    margin-bottom: 1rem;
    font-size: 1.1rem;
    color: var(--subtle);
}

.timeline-content .project-tech {
    margin-bottom: 1rem;
}

.timeline-content p {
    margin-bottom: 1rem;
    color: var(--muted);
}

.timeline-content ul {
    list-style: none;
}

.timeline-content li {
    position: relative;
    margin-bottom: 0.5rem;
    padding-left: 1.5rem;
    color: var(--muted);
}

    .timeline-content li::before {
        content: '▸';
        position: absolute;
        left: 0;
        color: var(--red);
        font-weight: bold;
    }

/* ---------- Projects ---------- */
.projects-loading {
    padding: 3rem;
    text-align: center;
    color: var(--subtle);
}

    .projects-loading p {
        margin-top: 1rem;
    }

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.subsection-label {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 3rem 0 1.5rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--faint);
}

    .subsection-label::after {
        content: '';
        flex: 1;
        height: 1px;
        background: #e5e5e5;
    }

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.project-card {
    overflow: hidden;
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

    .project-card:hover {
        transform: translateY(-4px);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    }

.project-image {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #333, #666);
    color: #fff;
    font-size: 3rem;
}

    .project-image img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.project-content {
    padding: 1.5rem;
}

.project-header {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

    .project-header h3 {
        font-size: 1.5rem;
        font-weight: 700;
        color: var(--ink);
    }

.gamejam-badge {
    flex-shrink: 0;
    padding: 0.1rem 0.45rem;
    border: 1px solid #ddd;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    color: #888;
}

.duration-tag {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    color: var(--faint);
}

.project-content p {
    margin-bottom: 1rem;
    color: var(--subtle);
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tech-tag {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    background: #f0f0f0;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
}

/* ---------- Contact ---------- */
.contact {
    background: var(--dark);
}

    .contact .section-title {
        color: #fff;
    }

.contact-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: #fff;
}

.contact-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 45px;
    height: 45px;
    border: 1px solid rgba(220, 38, 38, 0.3);
    border-radius: 8px;
    background: rgba(220, 38, 38, 0.1);
}

    .contact-icon i {
    }

.contact-info h4 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.contact-info p {
    font-size: 1.1rem;
    color: #e5e7eb;
    overflow-wrap: break-word;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
    .timeline::before {
        left: 1rem;
    }

    .timeline-item {
        padding-left: 3rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}
