/* --- CORE STYLES --- */
:root {
    --bg-color: #121212;
    --card-bg: #1f1f1f;
    --text-main: #eeeeee;
    --text-muted: #a0a0a0;
    --accent: #ffffff;
    --border-color: #333333;
    --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

body {
    font-family: var(--font-stack);
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
    line-height: 1.5;
}

/* --- HEADER & TITLE --- */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;          
    width: 100%;
    max-width: 1350px;              
    margin: 0 auto 50px auto;       
    padding-bottom: 20px;           
    border-bottom: 1px solid var(--border-color);
}

.title-wrapper {
    display: flex;
    align-items: center;
}

.typewriter {
    display: inline-flex;
    align-items: center;
    font-size: 2.6rem;
    font-weight: 400;
    letter-spacing: -1.5px;
    color: var(--text-main);
    /* Set a fixed height so the layout doesn't jump while empty */
    min-height: 3rem; 
}

.cursor {
    font-size: 2.6rem;
    margin-left: 4px;
    color: var(--accent);
    /* 1.8s delay matches the 9 letters * 200ms JS typing speed */
    animation: blink 1.15s step-end 1.8s infinite;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 8px;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* --- GRID CONTAINER --- */
.project-container {
    width: 100%;
    max-width: 1350px;
    display: grid;
    /* auto-fill ensures cards stay left-aligned and don't stretch */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 32px;
}

/* --- PROJECT CARDS --- */
.project-card {
    aspect-ratio: 1 / 1;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 34px 30px;
    text-decoration: none;
    color: var(--text-main);
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.project-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 0px 30px rgba(255, 255, 255, 0.12);
}

.card-content {
    flex-grow: 1;
}

.card-icon {
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}

.project-card:hover .card-icon {
    transform: scale(1.08) translateY(-2px);
}

.card-text-main {
    font-size: 1.32rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.card-text-sub {
    color: var(--text-muted);
    font-size: 0.92rem;
    font-family: monospace;
    margin-bottom: 18px;
}

.card-description {
    color: var(--text-muted);
    font-size: 0.96rem;
    line-height: 1.5;
}

/* Arrow pinned bottom-right */
.card-arrow {
    position: absolute;
    bottom: 32px;
    right: 30px;
    font-size: 1.8rem;
    color: var(--border-color);
    transition: all 0.3s ease;
}

.project-card:hover .card-arrow {
    color: var(--accent);
    transform: translateX(8px);
}

/* --- RESPONSIVENESS --- */
@media (max-width: 900px) {
    .project-container {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 24px;
    }
    .project-card {
        padding: 28px 26px;
    }
}

@media (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }
    .subtitle {
        margin-bottom: 0;
    }
}

@media (max-width: 600px) {
    .project-container {
        grid-template-columns: 1fr;
        max-width: 380px;
    }
    .typewriter, .cursor {
        font-size: 2.2rem;
    }
}

/* --- FOOTER --- */
footer {
    margin-top: 80px;
    color: var(--text-muted);
    font-size: 0.85rem;
    text-align: center;
}