/* ===== CSS Variables ===== */
:root {
    --bg: #131020;
    --bg-elevated: #1c1928;
    --text: #ccc8dc;
    --text-muted: #7a7490;
    --accent: #e8956d;
    --border: #28243a;
    --heading: #ede9ff;
    --nav-h: 60px;
    --transition: all 0.2s ease;
}

[data-theme="light"] {
    --bg: #f8f7fc;
    --bg-elevated: #eeeaf8;
    --text: #2e2a40;
    --text-muted: #7a7490;
    --accent: #b85c2a;
    --border: #d8d5e8;
    --heading: #1a1630;
}

/* Smooth theme transitions */
body, nav, section, hr, footer {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-h);
}

body {
    font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
    font-size: 16px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s ease;
}

img { max-width: 100%; height: auto; }

/* ===== Container ===== */
.container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ===== Navigation ===== */
.navbar {
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--nav-h);
    display: flex;
    align-items: center;
    background: var(--bg);
    border-bottom: 1px solid transparent;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

.navbar.scrolled {
    border-bottom-color: var(--border);
}

.nav-container {
    max-width: 680px;
    margin: 0 auto;
    padding: 0 24px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 700;
    font-size: 1rem;
    color: var(--heading);
    letter-spacing: -0.02em;
}
.nav-logo:hover { color: var(--accent); }

.nav-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 0;
}

.nav-link {
    color: var(--text-muted);
    font-size: 0.9rem;
    padding: 4px 10px;
    border-radius: 4px;
    transition: color 0.2s;
}
.nav-link:hover, .nav-link.active { color: var(--heading); }

/* Theme Toggle */
.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: var(--text-muted);
    transition: color 0.2s;
}
.theme-toggle:hover { color: var(--heading); }

.theme-toggle svg {
    width: 16px;
    height: 16px;
    position: absolute;
    transition: opacity 0.2s, transform 0.2s;
}

[data-theme="dark"] .theme-toggle .sun-icon,
[data-theme="light"] .theme-toggle .moon-icon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}
[data-theme="dark"] .theme-toggle .moon-icon,
[data-theme="light"] .theme-toggle .sun-icon {
    opacity: 0;
    transform: rotate(180deg) scale(0);
}

/* Mobile nav toggle */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}
.nav-toggle span {
    width: 20px;
    height: 2px;
    background: var(--text-muted);
    transition: all 0.2s;
    display: block;
}

/* ===== Hero ===== */
.hero {
    padding: 56px 0 48px;
}

.hero-inner {
    display: flex;
    gap: 28px;
    align-items: flex-start;
}

.hero-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
}

.hero-text { flex: 1; min-width: 0; }

.hero-name {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--heading);
    margin-bottom: 12px;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.feed-icon {
    color: var(--accent);
    vertical-align: middle;
    flex-shrink: 0;
}

.hero-bio {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 4px;
}

.hero-socials {
    display: flex;
    gap: 14px;
    margin-top: 14px;
}

.hero-social-link {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.hero-social-link:hover { color: var(--accent); }
.hero-social-link svg { width: 18px; height: 18px; }

/* ===== Divider ===== */
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 0;
}

/* ===== Section Labels ===== */
.section-title {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted);
    margin-bottom: 24px;
    font-family: 'JetBrains Mono', monospace;
}

.accent-link { color: var(--accent); }
.accent-link:hover { text-decoration: underline; }

/* ===== Posts Section ===== */
.posts-section {
    padding: 36px 0;
}

.posts-list {
    display: flex;
    flex-direction: column;
}

.post-item {
    padding: 22px 0;
    border-bottom: 1px solid var(--border);
}
.post-item:last-child { border-bottom: none; }

.post-title {
    display: block;
    color: var(--accent);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.4;
}
.post-title:hover { text-decoration: underline; }

.post-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.post-excerpt {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.65;
    margin: 0;
}

.posts-cta { margin-top: 20px; }

/* ===== Projects Section ===== */
.projects { padding: 36px 0; }

.projects-list {
    display: flex;
    flex-direction: column;
}

.project-item {
    padding: 22px 0;
    border-bottom: 1px solid var(--border);
}
.project-item:last-child { border-bottom: none; }

.project-header {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 7px;
}

.project-title {
    color: #e05555;
    font-weight: 600;
    font-size: 1.05rem;
}
.project-title:hover { text-decoration: underline; }

.project-tags {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.project-tags span {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 1px 7px;
    border-radius: 3px;
}

.project-desc {
    color: var(--text);
    font-size: 0.92rem;
    line-height: 1.65;
}

/* ===== Timeline (Experience & Education) ===== */
.timeline-section { padding: 36px 0 60px; }

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
    padding: 20px 0;
}

.timeline-line {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(to bottom, var(--accent), var(--border), var(--accent));
    transform: translateX(-50%);
    opacity: 0.3;
}

.timeline-item {
    position: relative;
    width: 50%;
    padding: 16px 40px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.timeline-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.timeline-item:nth-child(odd) {
    left: 0;
    text-align: right;
    padding-right: 56px;
}

.timeline-item:nth-child(even) {
    left: 50%;
    text-align: left;
    padding-left: 56px;
}

.timeline-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--bg);
    border: 2px solid var(--accent);
    border-radius: 50%;
    top: 24px;
    z-index: 2;
    transition: all 0.3s ease;
}

.timeline-item:nth-child(odd) .timeline-dot { right: -7px; }
.timeline-item:nth-child(even) .timeline-dot { left: -7px; }

.timeline-item:hover .timeline-dot {
    transform: scale(1.4);
    background: var(--accent);
    box-shadow: 0 0 14px var(--accent);
}

.timeline-content {
    background: linear-gradient(145deg, rgba(28, 25, 40, 0.7), rgba(28, 25, 40, 0.3));
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 20px 22px;
    border-radius: 12px;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    position: relative;
}

[data-theme="light"] .timeline-content {
    background: linear-gradient(145deg, rgba(238, 234, 248, 0.7), rgba(238, 234, 248, 0.3));
}

.timeline-content::before {
    content: '';
    position: absolute;
    top: 20px;
    width: 18px;
    height: 18px;
    background: rgba(28, 25, 40, 0.7);
    border: 1px solid var(--border);
    transform: rotate(45deg);
}

[data-theme="light"] .timeline-content::before {
    background: rgba(238, 234, 248, 0.7);
}

.timeline-item:nth-child(odd) .timeline-content::before {
    right: -9px;
    border-left: none;
    border-bottom: none;
}

.timeline-item:nth-child(even) .timeline-content::before {
    left: -9px;
    border-right: none;
    border-top: none;
}

.timeline-item:hover .timeline-content {
    border-color: var(--accent);
    box-shadow: 0 8px 30px rgba(232, 149, 109, 0.1);
}

.timeline-date {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.timeline-content h3 {
    font-size: 1rem;
    color: var(--heading);
    margin-bottom: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.timeline-company {
    color: var(--text-muted);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.timeline-item:nth-child(odd) .timeline-company { justify-content: flex-end; }

.timeline-location {
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 1px 8px;
    background: rgba(40, 36, 58, 0.6);
    border-radius: 100px;
}

[data-theme="light"] .timeline-location {
    background: rgba(200, 195, 220, 0.5);
}

/* ===== Footer ===== */
.footer {
    padding: 24px 0 32px;
    border-top: 1px solid var(--border);
}
.footer p {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ===== Selection ===== */
::selection { background: var(--accent); color: #fff; }

/* ===== Responsive ===== */
@media (max-width: 600px) {
    .hero-inner {
        flex-direction: column;
        gap: 18px;
    }

    .hero-avatar {
        width: 80px;
        height: 80px;
    }

    .nav-menu {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        background: var(--bg);
        flex-direction: column;
        padding: 16px 24px;
        border-bottom: 1px solid var(--border);
        display: none;
        gap: 10px;
        z-index: 99;
    }

    .nav-menu.active { display: flex; }
    .nav-toggle { display: flex; }

    .nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
    .nav-toggle.active span:nth-child(2) { opacity: 0; }
    .nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }
}

@media (max-width: 640px) {
    .timeline-line { left: 18px; }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        text-align: left !important;
        padding-left: 52px !important;
        padding-right: 12px !important;
    }

    .timeline-dot {
        left: 11px !important;
        right: auto !important;
    }

    .timeline-content::before {
        left: -9px !important;
        right: auto !important;
        border-right: none !important;
        border-top: none !important;
        border-left: 1px solid var(--border) !important;
        border-bottom: 1px solid var(--border) !important;
    }

    .timeline-company { justify-content: flex-start !important; }
}
