/* ============================================
   Design Tokens
   ============================================ */
:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f8f9fb;
    --color-bg-alt-2: #f0f2f5;
    --color-text: #1a1d24;
    --color-text-muted: #5a6072;
    --color-text-subtle: #8b90a0;
    --color-accent: #2563eb;
    --color-accent-dark: #1d4ed8;
    --color-accent-light: #dbeafe;
    --color-accent-glow: rgba(37, 99, 235, 0.12);
    --color-border: #e2e5ec;
    --color-border-light: #eef0f4;
    --color-footer: #0f172a;
    --color-footer-text: #cbd5e1;
    --color-footer-muted: #64748b;
    --color-success: #059669;
    --color-success-bg: #ecfdf5;
    --max-width: 1100px;
    --max-width-narrow: 780px;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.04);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.1);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --header-height: 64px;
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--header-height);
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-dark); }

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--color-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

h1, h2, h3 { line-height: 1.25; color: var(--color-text); }
h1 { font-size: clamp(2.4rem, 5vw, 3.6rem); font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: clamp(1.7rem, 3vw, 2.2rem); font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.15rem; font-weight: 600; }

/* ============================================
   Skip Link (accessibility)
   ============================================ */
.skip-link {
    position: absolute; left: -9999px; top: 0;
    background: var(--color-accent); color: #fff;
    padding: 8px 16px; z-index: 200; border-radius: 0 0 4px 0;
}
.skip-link:focus { left: 0; }

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

/* ============================================
   Section Shared
   ============================================ */
.section {
    padding: 88px 0;
}

.section-alt {
    background-color: var(--color-bg-alt);
    border-top: 1px solid var(--color-border-light);
    border-bottom: 1px solid var(--color-border-light);
}

.section-label {
    display: inline-block;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 5px 14px;
    border-radius: 999px;
    margin-bottom: 16px;
}

.section-label-light {
    color: #93c5fd;
    background: rgba(59, 130, 246, 0.15);
}

section h2 {
    margin-bottom: 32px;
}

#about p + p { margin-top: 16px; }
#about p {
    font-size: 1.05rem;
    color: var(--color-text-muted);
}

/* ============================================
   Navigation
   ============================================ */
#navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--header-height);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(16px);
    border-bottom: 1px solid var(--color-border-light);
    z-index: 100;
    transition: background var(--transition);
}

#navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: var(--shadow-sm);
}

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

.logo {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
}

.nav-links {
    list-style: none;
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-links a {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    color: var(--color-text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--color-text);
    background: var(--color-bg-alt);
}

.nav-cta {
    color: var(--color-accent) !important;
    font-weight: 600 !important;
    background: var(--color-accent-light) !important;
}

.nav-cta:hover {
    background: var(--color-accent-glow) !important;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
}

.nav-toggle:hover { background: var(--color-bg-alt); }

.nav-toggle span {
    width: 22px; height: 2px;
    background: var(--color-text);
    border-radius: 2px;
    transition: all 0.3s;
}

.nav-toggle.active span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.active span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.active span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* ============================================
   Hero
   ============================================ */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 100px 24px 64px;
    text-align: center;
    background: linear-gradient(180deg, var(--color-bg-alt) 0%, var(--color-bg) 40%);
}

.hero-content {
    max-width: 720px;
}

.hero-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 28px;
}

.hero-avatar {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid #fff;
    box-shadow: var(--shadow-lg);
}

.hero-status {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: var(--color-success);
    border: 3px solid #fff;
    border-radius: 50%;
}

.hero-kicker {
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--color-accent);
    margin-bottom: 18px;
}

.hero-lede {
    font-size: 1.15rem;
    color: var(--color-text-muted);
    max-width: 640px;
    margin: 0 auto 36px;
    line-height: 1.75;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-bottom: 36px;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 24px;
    color: var(--color-text-subtle);
    font-size: 0.9rem;
    font-weight: 500;
}

.hero-meta a { color: var(--color-text-muted); font-weight: 500; }
.hero-meta a:hover { color: var(--color-accent); }

/* ============================================
   Buttons
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 13px 28px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius);
    transition: all var(--transition);
    cursor: pointer;
    border: 2px solid transparent;
}

.btn-primary {
    background: var(--color-accent);
    color: #fff;
    border-color: var(--color-accent);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
    background: var(--color-accent-dark);
    border-color: var(--color-accent-dark);
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.35);
    transform: translateY(-1px);
    color: #fff;
}

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

.btn-outline:hover {
    border-color: var(--color-text-muted);
    background: var(--color-bg-alt);
    color: var(--color-text);
}

/* ============================================
   Skills
   ============================================ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.skill-group {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: box-shadow var(--transition), transform var(--transition);
}

.skill-group:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.skill-icon-wrap {
    width: 44px; height: 44px;
    background: var(--color-accent-light);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 18px;
}

.skill-icon {
    width: 22px; height: 22px;
    color: var(--color-accent);
}

.skill-group h3 {
    font-size: 1.05rem;
    margin-bottom: 14px;
    color: var(--color-text);
}

.skill-group ul {
    list-style: none;
}

.skill-group li {
    padding: 4px 0;
    color: var(--color-text-muted);
    font-size: 0.92rem;
    position: relative;
    padding-left: 20px;
}

.skill-group li::before {
    content: '';
    position: absolute;
    left: 0; top: 12px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--color-accent);
}

/* ============================================
   Experience Timeline
   ============================================ */
.timeline {
    display: grid;
    gap: 0;
    padding-left: 20px;
}

.timeline-item {
    position: relative;
    padding-left: 36px;
    padding-bottom: 44px;
    border-left: 2px solid var(--color-border);
}

.timeline-item:last-child {
    border-left-color: transparent;
    padding-bottom: 0;
}

.timeline-marker {
    position: absolute;
    left: -9px;
    top: 6px;
    width: 16px;
    height: 16px;
    background: var(--color-accent);
    border: 3px solid #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 2px var(--color-accent);
}

.timeline-body h3 {
    font-size: 1.2rem;
    margin-bottom: 4px;
}

.timeline-org {
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.timeline-date {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle);
    background: var(--color-bg-alt);
    padding: 3px 10px;
    border-radius: 999px;
    margin-bottom: 10px;
}

.timeline-body ul {
    list-style: disc;
    padding-left: 20px;
    color: var(--color-text-muted);
    font-size: 0.95rem;
}

.timeline-body li { padding: 3px 0; }

/* ============================================
   Projects
   ============================================ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.project-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: box-shadow var(--transition), transform var(--transition);
}

.project-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
}

.project-card h3 {
    font-size: 1.15rem;
    margin-bottom: 10px;
}

.project-card p {
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 18px;
    flex-grow: 1;
}

.project-tags {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.project-tags li {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 4px 10px;
    border-radius: 999px;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    font-size: 0.9rem;
    margin-top: auto;
    transition: gap var(--transition);
}

.project-link:hover { gap: 8px; }

.project-link svg {
    width: 14px; height: 14px;
    transition: transform var(--transition);
}

.project-link:hover svg { transform: translateX(2px); }

/* ============================================
   Education
   ============================================ */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.education-card {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    transition: border-color var(--transition);
}

.education-card:hover {
    border-color: var(--color-accent);
}

.edu-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-accent);
    background: var(--color-accent-light);
    padding: 4px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}

.education-card h3 {
    font-size: 1rem;
    margin-bottom: 6px;
}

.education-org {
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.education-note {
    margin-top: 28px;
    color: var(--color-text-subtle);
    font-size: 0.95rem;
}

/* ============================================
   Footer / Contact
   ============================================ */
.footer {
    background-color: var(--color-footer);
    color: var(--color-footer-text);
    padding: 80px 0 40px;
    text-align: center;
}

.footer h2 {
    color: #f1f5f9;
    font-size: 2rem;
    margin-bottom: 12px;
}

.footer > .container > p {
    color: var(--color-footer-muted);
    font-size: 1rem;
    margin-bottom: 32px;
}

.contact-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 24px 32px;
    margin-bottom: 44px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #93c5fd;
    font-weight: 500;
    font-size: 0.95rem;
    transition: color var(--transition);
}

.contact-link:hover {
    color: #bfdbfe;
    text-decoration: underline;
}

.contact-link svg {
    width: 16px; height: 16px;
    flex-shrink: 0;
}

.copyright {
    font-size: 0.85rem;
    color: var(--color-footer-muted);
    padding-top: 32px;
    border-top: 1px solid rgba(255,255,255,0.08);
}

/* ============================================
   Back to Top
   ============================================ */
.back-to-top {
    position: fixed;
    bottom: 24px; right: 24px;
    width: 44px; height: 44px;
    background: var(--color-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    box-shadow: var(--shadow-md);
    transition: all 0.3s;
    z-index: 99;
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: var(--color-accent-dark);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.back-to-top svg {
    width: 18px; height: 18px;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 768px) {
    .section { padding: 64px 0; }

    .nav-links {
        position: absolute;
        top: var(--header-height);
        left: 0; right: 0;
        background: rgba(255,255,255,0.98);
        backdrop-filter: saturate(180%) blur(16px);
        flex-direction: column;
        padding: 16px 24px 24px;
        border-bottom: 1px solid var(--color-border);
        display: none;
        box-shadow: var(--shadow-md);
    }

    .nav-links.active { display: flex; }

    .nav-links a {
        width: 100%;
        padding: 12px 16px;
        font-size: 1rem;
    }

    .nav-toggle { display: flex; }

    .hero { padding-top: 120px; }
    .hero-avatar { width: 120px; height: 120px; }
    .hero-lede { font-size: 1.05rem; }

    .projects-grid { grid-template-columns: 1fr; }
    .timeline { padding-left: 12px; }
    .timeline-item { padding-left: 24px; }
}

@media (max-width: 480px) {
    .container { padding: 0 16px; }
    .hero-meta { gap: 14px; }
    .btn { padding: 12px 22px; font-size: 0.9rem; }
    .skills-grid { grid-template-columns: 1fr; }
    .education-grid { grid-template-columns: 1fr; }
    .contact-list { gap: 16px; flex-direction: column; align-items: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}