/* ── Reset & Base ─────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a28;
    --green: #00ff88;
    --cyan: #00d4ff;
    --text: #e0e0e0;
    --text-dim: #888;
    --border: #1e1e2e;
    --border-glow: rgba(0, 255, 136, 0.3);
    --radius: 8px;
    --font: 'JetBrains Mono', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--green);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover {
    color: var(--cyan);
}

/* ── Canvas Background ───────────────────────────── */
#matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.scanline {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.03) 2px,
        rgba(0, 0, 0, 0.03) 4px
    );
}

main, .footer {
    position: relative;
    z-index: 2;
}

/* ── Buttons ─────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: var(--radius);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s;
    border: 1px solid transparent;
    text-decoration: none;
}

.btn-primary {
    background: var(--green);
    color: var(--bg);
    border-color: var(--green);
}

.btn-primary:hover {
    background: transparent;
    color: var(--green);
    box-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--cyan);
    border-color: var(--cyan);
}

.btn-outline:hover {
    background: var(--cyan);
    color: var(--bg);
    box-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
}

/* ── Hero ────────────────────────────────────────── */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    text-align: center;
}

.hero-content {
    max-width: 700px;
    animation: fadeInUp 0.8s ease-out;
}

.hero-avatar {
    border-radius: 50%;
    border: 3px solid var(--green);
    box-shadow: 0 0 25px rgba(0, 255, 136, 0.3);
    margin-bottom: 1.5rem;
    opacity: 0;
    animation: fadeInUp 0.8s ease-out 0.2s forwards;
}

.terminal-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.prompt-symbol {
    color: var(--green);
    font-size: 2rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(0, 255, 136, 0.5);
}

.typewriter {
    font-size: clamp(1.8rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.typewriter .typewriter-text {
    text-shadow: 0 0 20px rgba(0, 255, 136, 0.3);
}

.cursor {
    color: var(--green);
    animation: blink 1s step-end infinite;
    font-weight: 300;
}

.hero-sub {
    color: var(--text-dim);
    font-size: 1.05rem;
    margin-bottom: 2rem;
    font-weight: 300;
}

.hero-links {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Section Titles ──────────────────────────────── */
.section-title {
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 2.5rem;
    text-align: center;
    text-shadow: 0 0 15px rgba(0, 255, 136, 0.2);
}

.section-title .accent {
    color: var(--green);
}

/* ── Projects ────────────────────────────────────── */
.projects {
    padding: 5rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    animation: fadeInUp 0.5s ease-out both;
}

.project-card:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
    box-shadow: 0 0 30px rgba(0, 255, 136, 0.08);
    transform: translateY(-2px);
}

.project-card a {
    color: inherit;
}

.project-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 0.5rem;
    transition: color 0.2s;
}

.project-card:hover .project-name {
    color: var(--green);
}

.project-desc {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    flex: 1;
    line-height: 1.5;
}

.project-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    flex-wrap: wrap;
}

.project-lang {
    display: flex;
    align-items: center;
    gap: 5px;
}

.lang-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.project-stat {
    display: flex;
    align-items: center;
    gap: 3px;
}

.project-stat svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.project-time {
    margin-left: auto;
}

/* Loading / Error states */
.loading-state, .error-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem;
    color: var(--text-dim);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.error-state a {
    color: var(--green);
}

/* ── Activity ────────────────────────────────────── */
.activity {
    padding: 3rem 2rem 5rem;
    max-width: 800px;
    margin: 0 auto;
}

.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-day {
    margin-bottom: 1.5rem;
}

.activity-day-header {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.75rem;
    padding-left: 1.5rem;
    position: relative;
}

.activity-day-header::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--green);
    transform: translateY(-50%);
    box-shadow: 0 0 8px rgba(0, 255, 136, 0.4);
}

.activity-item {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.85rem 1.25rem;
    margin-bottom: 0.5rem;
    margin-left: 1.5rem;
    border-left: 3px solid var(--border);
    transition: border-color 0.2s;
    font-size: 0.85rem;
    line-height: 1.5;
    animation: fadeInUp 0.4s ease-out both;
}

.activity-item:hover {
    border-left-color: var(--green);
}

.activity-icon {
    margin-right: 0.5rem;
}

.activity-repo {
    color: var(--cyan);
    font-weight: 500;
}

.activity-repo:hover {
    color: var(--green);
}

.activity-detail {
    color: var(--text-dim);
}

.activity-time {
    color: #555;
    font-size: 0.75rem;
    float: right;
    margin-left: 1rem;
}

/* ── Contact ─────────────────────────────────────── */
.contact {
    padding: 5rem 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-dim);
    font-weight: 500;
}

.form-group input,
.form-group textarea {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 12px 16px;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green);
    box-shadow: 0 0 10px rgba(0, 255, 136, 0.15);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: #555;
}

.btn-submit {
    align-self: flex-start;
    margin-top: 0.5rem;
}

.form-status {
    font-size: 0.85rem;
    min-height: 1.5em;
}

.form-status.success {
    color: var(--green);
}

.form-status.error {
    color: #ff4444;
}

/* ── Footer ──────────────────────────────────────── */
.footer {
    border-top: 1px solid var(--border);
    padding: 2rem;
    margin-top: 3rem;
}

.footer-content {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-brand {
    color: var(--green);
    font-weight: 700;
    font-size: 1rem;
    text-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    font-size: 0.85rem;
}

.footer-links a {
    color: var(--text-dim);
}

.footer-links a:hover {
    color: var(--green);
}

/* ── Animations ──────────────────────────────────── */
@keyframes blink {
    50% { opacity: 0; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes glowPulse {
    0%, 100% { text-shadow: 0 0 10px rgba(0, 255, 136, 0.3); }
    50% { text-shadow: 0 0 25px rgba(0, 255, 136, 0.6); }
}

/* Staggered card animation */
.project-card:nth-child(1) { animation-delay: 0.05s; }
.project-card:nth-child(2) { animation-delay: 0.1s; }
.project-card:nth-child(3) { animation-delay: 0.15s; }
.project-card:nth-child(4) { animation-delay: 0.2s; }
.project-card:nth-child(5) { animation-delay: 0.25s; }
.project-card:nth-child(6) { animation-delay: 0.3s; }
.project-card:nth-child(7) { animation-delay: 0.35s; }
.project-card:nth-child(8) { animation-delay: 0.4s; }
.project-card:nth-child(9) { animation-delay: 0.45s; }

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }

    .hero {
        padding: 1.5rem;
    }

    .prompt-symbol {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }

    .terminal-prompt {
        flex-direction: column;
        gap: 4px;
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}

/* Reduce motion for accessibility / battery */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }

    #matrix-bg {
        display: none;
    }
}
