:root {
    --bg: #ffffff;
    --text: #1a1a1a;
    --secondary-text: #666666;
    --accent: #000000;
    --accent-light: #f0f0f0;
    --border: #e0e0e0;
    --grid-color: rgba(0, 0, 0, 0.2); /* Darkened for better visibility */
    --status-bg: #e8f5e9;
    --status-text: #2e7d32;
    --font-mono: 'JetBrains Mono', monospace;
    --navbar-bg: rgba(255, 255, 255, 0.85);
}

[data-theme='dark'] {
    --bg: #0a0a0a;
    --text: #f0f0f0;
    --secondary-text: #a0a0a0;
    --accent: #ffffff;
    --accent-light: #1a1a1a;
    --border: #2a2a2a;
    --grid-color: rgba(255, 255, 255, 0.3); /* Darkened for better visibility */
    --status-bg: #1b5e20;
    --status-text: #81c784;
    --navbar-bg: rgba(10, 10, 10, 0.85);
}

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

html {
    scroll-behavior: smooth;
    scroll-padding-top: 70px;
    background-color: var(--bg);
    transition: background-color 0.3s ease;
}

body {
    font-family: var(--font-mono);
    background-color: transparent;
    color: var(--text);
    line-height: 1.6;
    background-image: radial-gradient(var(--grid-color) 1.5px, transparent 1.5px);
    background-size: 30px 30px;
    transition: color 0.3s ease;
    position: relative;
}

#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
    display: block;
}



.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 40px;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 2560px;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 40px;
    background: var(--navbar-bg);
    backdrop-filter: blur(10px);
    border: 1px solid transparent;
    border-bottom: 1px solid var(--border);
    border-radius: 0px;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
    z-index: 1000;
    transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.navbar.scrolled {
    top: 15px;
    width: calc(100% - 40px);
    max-width: 860px;
    height: 54px;
    border-radius: 27px;
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
    padding: 0 24px;
}

[data-theme='dark'] .navbar.scrolled {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.4), 0 0 15px rgba(255, 255, 255, 0.02);
}

.logo {
    font-weight: 800;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
}

.logo-cursor {
    animation: blink 1s step-end infinite;
    color: var(--accent);
    margin-left: 2px;
    font-weight: 400;
}

.nav-actions {
    display: flex;
    align-items: center;
}

.nav-links {
    display: flex;
    gap: 20px;
}

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

.nav-links a::before {
    content: '> ';
    opacity: 0;
    color: var(--accent);
    position: absolute;
    left: -12px;
    transform: translateX(-4px);
    transition: opacity 0.2s, transform 0.2s;
}

.nav-links a.active {
    color: var(--accent);
}

.nav-links a.active::before {
    opacity: 1;
    transform: translateX(0);
}

.nav-links a:hover {
    color: var(--accent);
}

#theme-toggle {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, color 0.2s, background 0.2s;
}

#theme-toggle:hover {
    transform: scale(1.15);
    background: var(--accent-light);
}

#theme-toggle svg {
    width: 22px;
    height: 22px;
}

[data-theme='dark'] .sun,
:root:not([data-theme='dark']) .moon {
    display: none;
}

#menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 20px;
    z-index: 1001;
}

#menu-toggle span {
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transition: all 0.3s ease;
}

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

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

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

#mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: var(--navbar-bg);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

#mobile-menu.active {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-links {
    display: flex;
    flex-direction: column;
    gap: 30px;
    text-align: center;
}

.mobile-menu-links a {
    font-size: 1.5rem;
    font-weight: 800;
    text-decoration: none;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* Hero Section */


.status-badge {
    display: inline-block;
    padding: 4px 12px;
    background: var(--status-bg);
    color: var(--status-text);
    font-size: 0.75rem;
    font-weight: 700;
    border-radius: 100px;
    margin-bottom: 24px;
    text-transform: uppercase;
}

h1 {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1;
    margin-bottom: 12px;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--secondary-text);
    margin-bottom: 32px;
}

.bio {
    max-width: 600px;
    margin-bottom: 40px;
}

.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding: 100px 0 60px 0; /* Increased top padding for navbar clearance */
}

.hero-split {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 60px;
    align-items: center;
}

.hero-content {
    display: flex;
    flex-direction: column;
}

.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.photo-frame {
    position: relative;
    border: 1px solid var(--border);
    padding: 12px;
    background: var(--bg);
    box-shadow: 20px 20px 0 var(--accent-light);
    transition: transform 0.3s ease;
}

.photo-frame:hover {
    transform: translate(-4px, -4px);
    box-shadow: 24px 24px 0 var(--accent-light);
}

.photo-label {
    position: absolute;
    top: -24px;
    right: 0;
    font-size: 0.7rem;
    color: var(--secondary-text);
    font-family: var(--font-mono);
}

.profile-photo {
    width: 100%;
    max-width: 320px;
    display: block;
    filter: grayscale(100%) contrast(110%);
    mix-blend-mode: multiply;
    opacity: 0.9;
}

[data-theme='dark'] .profile-photo {
    filter: grayscale(100%) brightness(0.8) contrast(120%);
    mix-blend-mode: screen;
}

.hero > * {
    opacity: 1; /* Ensure visible if JS fails */
}

/* Typing Cursor Effect */
.typing-cursor::after {
    content: '|';
    animation: blink 1s step-end infinite;
    color: var(--accent);
    margin-left: 4px;
}

@keyframes blink {
    from, to { opacity: 1; }
    50% { opacity: 0; }
}

/* Ensure stable heights during typing */
.hero h1 {
    min-height: 1.2em;
}

.hero .subtitle {
    min-height: 1.5em;
}

.hero-socials {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    opacity: 1;
}

.social-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-btn::before {
    content: '>';
    position: absolute;
    left: 8px;
    opacity: 0;
    color: var(--accent);
    font-weight: 800;
    transform: translateX(-4px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.social-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    transform: translateY(-2px);
    padding-left: 28px;
    padding-right: 12px;
}

.social-btn:hover::before {
    opacity: 1;
    left: 12px;
    transform: translateX(0);
}

.social-btn svg {
    width: 18px;
    height: 18px;
}

.btn {
    padding: 12px 24px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 4px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn.secondary::before {
    content: '>';
    position: absolute;
    left: 10px;
    opacity: 0;
    color: var(--accent);
    font-weight: 800;
    transform: translateX(-4px);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn.secondary:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    padding-left: 32px;
    padding-right: 16px;
}

.btn.secondary:hover::before {
    opacity: 1;
    left: 14px;
    transform: translateX(0);
}

/* General Sections */
section {
    padding: 60px 0;
    border-bottom: 1px solid var(--border);
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 48px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    min-height: 1.2em; /* Ensure stable height for typing */
}

/* Education Timeline */
.timeline {
    position: relative;
    border-left: 1px solid var(--border);
    padding-left: 32px;
}

.timeline-item {
    position: relative;
    margin-bottom: 40px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -37px;
    top: 10px;
    width: 9px;
    height: 9px;
    background: var(--accent);
    border-radius: 50%;
}

.timeline-date {
    font-size: 0.875rem;
    color: var(--secondary-text);
    margin-bottom: 4px;
}

.timeline-content h3 {
    font-size: 1.25rem;
}

.institution {
    color: var(--secondary-text);
}

/* Experience Cards */
.experience-grid {
    display: grid;
    gap: 32px;
}

.experience-card {
    padding: 32px;
    border: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.experience-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -1px;
    width: 3px;
    height: 0;
    background: var(--accent);
    transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.experience-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

[data-theme='dark'] .experience-card:hover {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.3);
}

.experience-card:hover::before {
    height: 100%;
}

.card-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.company {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 12px;
}

.description {
    color: var(--secondary-text);
}

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

.skills-category h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: var(--accent);
    text-transform: uppercase;
}

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

.tags span {
    padding: 4px 16px;
    border: 1px solid var(--border);
    font-size: 0.75rem;
    font-weight: 500;
    position: relative;
    cursor: default;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: transparent;
}

.tags span::before,
.tags span::after {
    position: absolute;
    opacity: 0;
    color: var(--accent);
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tags span::before {
    content: '[';
    left: 4px;
    transform: translateX(-4px);
}

.tags span::after {
    content: ']';
    right: 4px;
    transform: translateX(4px);
}

.tags span:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: var(--accent-light);
}

.tags span:hover::before {
    opacity: 1;
    left: 8px;
    transform: translateX(0);
}

.tags span:hover::after {
    opacity: 1;
    right: 8px;
    transform: translateX(0);
}

/* Project Cards */
.project-grid {
    display: grid;
    gap: 32px;
}

.project-card {
    padding: 32px;
    border: 1px solid var(--border);
    background: var(--bg);
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -1px;
    width: 3px;
    height: 0;
    background: var(--accent);
    transition: height 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.03);
}

[data-theme='dark'] .project-card:hover {
    box-shadow: 0 10px 35px rgba(0, 0, 0, 0.3);
}

.project-card:hover::before {
    height: 100%;
}

.project-tags {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 16px;
    text-transform: uppercase;
}

.project-bullets {
    list-style: none;
    margin-bottom: 24px;
}

.project-bullets li {
    font-size: 0.875rem;
    color: var(--secondary-text);
    margin-bottom: 8px;
    position: relative;
    padding-left: 20px;
}

.project-bullets li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent);
}

.project-links {
    display: flex;
    gap: 12px;
}

.btn.sm {
    padding: 6px 16px;
    font-size: 0.75rem;
}

/* Certificates */
.cert-list {
    list-style: none;
}

.cert-list li {
    padding: 16px 0;
    border-bottom: 1px dashed var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.cert-list li:hover {
    transform: translateX(8px);
    border-bottom-style: solid;
    border-bottom-color: var(--accent);
}

.cert-list li .cert-name {
    transition: color 0.3s ease;
}

.cert-list li:hover .cert-name {
    color: var(--accent);
}

.cert-meta {
    display: flex;
    gap: 20px;
    align-items: center;
}

.cert-issuer {
    color: var(--accent);
    font-weight: 600;
    font-size: 0.875rem;
}

.cert-date {
    color: var(--secondary-text);
    font-size: 0.75rem;
    min-width: 80px;
    text-align: right;
}

/* Footer */
footer {
    padding: 60px 0;
    text-align: center;
}

footer p {
    font-size: 0.75rem;
    color: var(--secondary-text);
    margin-bottom: 20px;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 24px;
}

.social-links a {
    text-decoration: none;
    color: var(--text);
    font-weight: 700;
    font-size: 0.875rem;
}

/* Responsive */
@media (max-width: 992px) {
    .hero-split {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .hero-content {
        align-items: center;
    }

    .bio {
        text-align: center;
    }

    .hero-visual {
        order: -1;
    }

    .hero-socials {
        justify-content: center;
    }

    h1 {
        font-size: 3rem;
    }
}

@media (max-width: 768px) {
    h1 { font-size: 2.2rem; }
    .navbar { padding: 0 20px; }
    .nav-links { display: none; }
    .container { padding: 0 20px; }
    
    #menu-toggle {
        display: flex;
    }

    section {
        padding: 40px 0;
    }

    .hero {
        padding-top: 100px; /* Consistent top margin for navbar */
        align-items: flex-start; /* Stop centering from pushing content up */
        min-height: auto; /* Allow height to be determined by content on mobile */
    }

    .section-title {
        font-size: 1.5rem;
        margin-bottom: 32px;
    }

    .experience-card, .project-card {
        padding: 20px;
    }

    .card-header {
        flex-direction: column;
        gap: 4px;
    }

    .timeline {
        padding-left: 24px;
    }

    .timeline-item::before {
        left: -29px;
    }

    .cert-list li {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .cert-meta {
        width: 100%;
        justify-content: space-between;
    }

    .photo-frame {
        box-shadow: 10px 10px 0 var(--accent-light);
    }
}

@media (max-width: 480px) {
    h1 { font-size: 1.8rem; }
    .subtitle { font-size: 1.1rem; }
    .hero-socials { gap: 8px; }
    .social-btn { padding: 8px 16px; font-size: 0.75rem; }
}