* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0d0d0d;
    --text: #e0e0e0;
    --text-muted: #777;
    --text-dim: #444;
    --link: #e0e0e0;
    --line: #2a2a2a;
    --dot-active: #e0e0e0;
    --dot-inactive: #444;
}

[data-theme="light"] {
    --bg: #fafafa;
    --text: #1a1a1a;
    --text-muted: #888;
    --text-dim: #ccc;
    --link: #1a1a1a;
    --line: #ddd;
    --dot-active: #1a1a1a;
    --dot-inactive: #bbb;
}

html {
    font-size: 16px;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    padding: 60px 24px 24px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

h1 {
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 4px;
}

.subtitle a {
    color: var(--text-muted);
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.subtitle a:hover {
    color: var(--text);
}

/* Theme Toggle */

.theme-toggle {
    background: none;
    border: 1px solid var(--text-dim);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.8rem;
    padding: 4px 14px;
    cursor: pointer;
    border-radius: 3px;
    transition: color 0.2s, border-color 0.2s;
    white-space: nowrap;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

/* Bio */

.bio {
    margin-top: 44px;
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.7;
    min-height: 3.4em;
}

.bio .typewriter {
    display: inline;
}

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

@keyframes blink {
    50% { opacity: 0; }
}

/* Timeline */

.timeline {
    margin-top: 44px;
    position: relative;
    padding-left: 56px;
}

.timeline-age {
    position: absolute;
    left: -56px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    color: var(--text-dim);
    width: 18px;
    text-align: right;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 28px;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: var(--line);
}

.timeline-item {
    position: relative;
    margin-bottom: 16px;
    padding: 8px 12px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.timeline-item:hover {
    border-color: var(--line);
}

.timeline-item:not(.active):hover .timeline-left a {
    color: var(--text);
}

.timeline-item:not(.active):hover .role {
    color: var(--text);
}

.timeline-item:not(.active):hover .meta {
    color: var(--text-muted);
}

.timeline-item:last-child {
    margin-bottom: 0;
}

.dot {
    position: absolute;
    left: -34px;
    top: 50%;
    transform: translateY(-50%);
    width: 13px;
    height: 13px;
    border-radius: 50%;
    border: 1.5px solid var(--dot-inactive);
    background: transparent;
    z-index: 1;
    box-shadow: 0 0 0 4px var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dot::after {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--dot-inactive);
}

.timeline-item.active .dot {
    border-color: var(--dot-active);
}

.timeline-item.active .dot::after {
    background: var(--dot-active);
    animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.timeline-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.timeline-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.timeline-left a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 0.95rem;
    transition: color 0.2s;
}

.timeline-item:not(.active) .timeline-left a {
    color: var(--text-muted);
}

.timeline-left a:hover {
    color: var(--text);
}

.meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.role {
    color: var(--text-muted);
    font-size: 0.9rem;
    white-space: nowrap;
}

/* Info Section */

.info {
    margin-top: 44px;
}

.info-row {
    display: flex;
    gap: 40px;
    margin-bottom: 20px;
    align-items: baseline;
}

.info-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.06em;
    min-width: 140px;
    text-transform: uppercase;
    line-height: 1.5;
}

.info-value {
    font-size: 1.05rem;
    color: var(--text);
}

/* Footer */

footer {
    margin-top: 56px;
    padding-top: 0;
    display: flex;
    gap: 28px;
}

footer a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.2s;
    position: relative;
}

footer a::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--text);
    transition: width 0.3s ease;
}

footer a:hover {
    color: var(--text);
}

footer a:hover::after {
    width: 100%;
}

/* Projects */

.projects {
    margin-top: 36px;
}

.projects:first-of-type {
    margin-top: 36px;
}

/* Projects Toggle */

.projects-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0;
    transition: color 0.2s;
}

.projects-toggle:hover {
    color: var(--text);
}

.toggle-arrow {
    font-size: 0.8rem;
    transition: transform 0.3s ease;
    display: inline-block;
}

.projects-toggle.open .toggle-arrow {
    transform: rotate(180deg);
}

/* Projects List (collapsible) */

.projects-list {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease, opacity 0.4s ease;
    opacity: 0;
}

.projects-list.open {
    grid-template-rows: 1fr;
    opacity: 1;
}

.projects-inner {
    overflow: hidden;
}

.projects-inner .project:first-child {
    margin-top: 28px;
}

.project {
    margin-bottom: 28px;
    padding: 16px 20px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: border-color 0.3s;
}

.project:last-of-type {
    margin-bottom: 0;
}

.project:hover {
    border-color: var(--line);
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.project-header a {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 3px;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.project-header a:hover {
    color: var(--text);
}

.project-link {
    font-size: 0.75rem;
    color: var(--text-dim);
    text-decoration: none;
    border: 1px solid var(--line);
    padding: 1px 8px;
    border-radius: 3px;
    transition: color 0.2s, border-color 0.2s;
}

.project-link:hover {
    color: var(--text);
    border-color: var(--text-muted);
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-top: 6px;
    line-height: 1.5;
}

.tags {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.tags span {
    font-size: 0.7rem;
    color: var(--text-muted);
    border: 1px solid var(--line);
    padding: 2px 10px;
    border-radius: 3px;
    transition: border-color 0.2s, color 0.2s;
}


/* Fade-in Animations */

.fade-in {
    opacity: 0;
    transform: translateY(12px);
    animation: fadeInUp 0.6s ease forwards;
}

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

header.fade-in { animation-delay: 0s; }
.bio.fade-in { animation-delay: 0.1s; }
.timeline.fade-in { animation-delay: 0.2s; }
.projects.fade-in { animation-delay: 0.3s; }
.info.fade-in { animation-delay: 0.35s; }
footer.fade-in { animation-delay: 0.4s; }

/* Responsive */

@media (max-width: 520px) {
    .container {
        padding: 48px 20px;
    }

    .bio {
        margin-top: 48px;
    }

    .timeline {
        margin-top: 48px;
    }

    .timeline-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 2px;
    }

    .info {
        margin-top: 48px;
    }

    .info-row {
        flex-direction: column;
        gap: 4px;
    }

    .info-label {
        min-width: auto;
    }

    .projects {
        margin-top: 48px;
    }

    footer {
        flex-wrap: wrap;
        gap: 20px;
        padding-top: 64px;
    }
}
