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

:root {
    color-scheme: dark;
    --bg: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a2e;
    --text: #e8e8f0;
    --text-muted: #a0a0b8;
    --accent: #6c63ff;
    --accent-strong: #554bd8;
    --accent-light: #8b83ff;
    --accent-glow: rgba(108, 99, 255, 0.15);
    --border: #2a2a3e;
    --radius: 12px;
    --focus-ring: #b6b1ff;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 5rem;
}

body {
    min-width: 320px;
    min-height: 100vh;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
}

body.nav-open {
    overflow: hidden;
}

::selection {
    color: #fff;
    background: rgba(108, 99, 255, 0.7);
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 4px;
}

.skip-link {
    position: fixed;
    top: 0.75rem;
    left: 0.75rem;
    z-index: 1000;
    padding: 0.7rem 1rem;
    border-radius: 8px;
    color: #fff;
    background: var(--accent-strong);
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-180%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
}

/* Particles canvas */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    opacity: 0.85;
}

/* ======= Navigation ======= */
nav {
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 100;
    padding: 1rem 0;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

nav.scrolled {
    border-bottom: 1px solid var(--border);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text);
    text-decoration: none;
}

.nav-logo span {
    color: var(--accent);
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
}

.nav-links a:hover,
.nav-links a.active,
.nav-links a[aria-current="location"] {
    color: var(--text);
}

.nav-links a:hover::after,
.nav-links a.active::after,
.nav-links a[aria-current="location"]::after {
    width: 100%;
}

/* ======= Hamburger Menu ======= */
.hamburger {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    z-index: 101;
    background: none;
    border: none;
    padding: 8px;
    min-width: 44px;
    min-height: 44px;
}

.hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

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

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

/* ======= Reveal Animation ======= */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.7s ease, transform 0.7s ease;
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ======= Back to Top Button ======= */
#backToTop {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 99;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

#backToTop.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

#backToTop:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.25);
}

/* ======= Hero ======= */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    padding: 6rem 2rem 4rem;
}

.hero-content {
    text-align: center;
    max-width: 800px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 1.2rem;
    background: var(--accent-glow);
    border: 1px solid rgba(108, 99, 255, 0.3);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--accent-light);
    margin-bottom: 1.5rem;
    font-weight: 500;
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--text) 0%, var(--accent-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
}

.hero-focus {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 2.5rem;
}

.hero-focus span {
    padding: 0.35rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    background: rgba(18, 18, 26, 0.72);
    font-size: 0.82rem;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 2rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s ease;
    cursor: pointer;
}

.btn-primary {
    background: var(--accent-strong);
    color: white;
    border: none;
}

.btn-primary:hover {
    background: #5f56e0;
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(108, 99, 255, 0.3);
}

.btn-secondary {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent-light);
    transform: translateY(-2px);
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8rem;
    animation: bounce 2s infinite;
}

.scroll-indicator svg {
    width: 24px;
    height: 24px;
}

@keyframes bounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

/* ======= Sections ======= */
section {
    position: relative;
    z-index: 1;
    padding: 5rem 2rem;
    scroll-margin-top: 4.5rem;
}

.section-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent-light);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.section-title {
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.section-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 3rem;
    max-width: 600px;
}

/* ======= About ======= */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
}

.about-text p {
    color: var(--text-muted);
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}

.about-highlights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.highlight-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.highlight-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.highlight-card .icon {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.highlight-card h3 {
    font-size: 1rem;
    margin-bottom: 0.3rem;
}

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

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

.skill-category {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.skill-category:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.skill-category h3 {
    font-size: 1rem;
    margin-bottom: 1rem;
    color: var(--accent-light);
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-tag {
    padding: 0.3rem 0.8rem;
    background: rgba(108, 99, 255, 0.08);
    border: 1px solid rgba(108, 99, 255, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
    transition: all 0.2s;
}

.skill-tag:hover {
    background: rgba(108, 99, 255, 0.15);
    color: var(--text);
}

/* ======= Projects ======= */
.project-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent);
    transform: scaleY(0);
    transition: transform 0.3s ease;
    transform-origin: top;
}

.project-card:hover::before {
    transform: scaleY(1);
}

.project-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
}

.featured-project {
    background:
        linear-gradient(135deg, rgba(108, 99, 255, 0.12), transparent 48%),
        var(--bg-card);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.project-header h3 {
    font-size: 1.2rem;
    font-weight: 600;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.project-tag {
    padding: 0.2rem 0.6rem;
    background: rgba(108, 99, 255, 0.1);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent-light);
    font-weight: 500;
}

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

.project-link {
    color: var(--accent-light);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.project-link:hover {
    color: var(--text);
    text-decoration: underline;
    text-underline-offset: 0.2em;
}

/* ======= Experience ======= */
.timeline {
    position: relative;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    padding-left: 2rem;
    padding-bottom: 2.5rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 6px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
}

.timeline-item h3 {
    font-size: 1.05rem;
    font-weight: 600;
}

.timeline-item .meta {
    color: var(--accent-light);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
}

.timeline-item .date {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.timeline-item p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ======= Contact ======= */
.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    justify-content: center;
    margin-top: 2rem;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

.contact-link:hover {
    border-color: var(--accent);
    background: var(--bg-card-hover);
    transform: translateY(-2px);
}

/* ======= Footer ======= */
footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 3rem 2rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.85rem;
}

footer a {
    color: var(--accent-light);
    text-decoration: none;
}

/* ======= Responsive ======= */
@media (max-width: 768px) {
    .hero h1 { font-size: 2.2rem; }
    .hero .subtitle { font-size: 1rem; }
    .hero-focus { margin-bottom: 2rem; }
    .about-grid { grid-template-columns: 1fr; }
    .about-highlights { grid-template-columns: 1fr; }
    .section-title { font-size: 1.8rem; }
    .skills-grid { grid-template-columns: 1fr; }
    section { padding: 3.5rem 1.5rem; }

    .hamburger {
        display: flex;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 250px;
        height: 100vh;
        flex-direction: column;
        background: rgba(10, 10, 15, 0.95);
        backdrop-filter: blur(30px);
        -webkit-backdrop-filter: blur(30px);
        padding: 6rem 2rem 2rem;
        gap: 1.5rem;
        border-left: 1px solid var(--border);
        visibility: hidden;
        pointer-events: none;
        transition: right 0.3s ease, visibility 0s linear 0.3s;
        z-index: 100;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    .nav-links.open {
        right: 0;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .nav-links a {
        font-size: 1.1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
    }
}

@media (max-width: 480px) {
    .nav-inner { padding: 0 1.25rem; }
    .hero { padding-inline: 1.25rem; }
    .hero-actions { flex-direction: column; }
    .hero-actions .btn { justify-content: center; width: 100%; }
    .hero-focus { gap: 0.45rem; }
    .project-header { flex-direction: column; }
    #backToTop { right: 1rem; bottom: 1rem; }
}

/* ======= Education Section ======= */
#education {
    position: relative;
    z-index: 1;
}
.education-grid {
    max-width: 700px;
    margin: 0 auto;
}
.edu-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform 0.2s, box-shadow 0.2s;
}
.edu-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px var(--accent-glow);
}
.edu-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}
.edu-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}
.edu-card h3 a {
    color: var(--text);
    text-decoration-color: rgba(139, 131, 255, 0.55);
    text-underline-offset: 0.2em;
}
.edu-card h3 a:hover {
    color: var(--accent-light);
}
.edu-meta {
    color: var(--text-muted);
    font-size: 0.875rem;
    margin-bottom: 0.75rem;
}
.edu-dot {
    margin: 0 0.5rem;
}
.edu-card p {
    color: var(--text-muted);
    font-size: 0.925rem;
    line-height: 1.6;
}
.edu-highlight {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.85rem;
    color: var(--accent-light);
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    #particles-canvas,
    .scroll-indicator {
        display: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
