:root {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --secondary-color: #f1f5f9;
    --accent-color: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --background: #ffffff;
    --background-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode (default) */
body {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --secondary-color: #334155;
    --accent-color: #10b981;
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-light: #94a3b8;
    --background: #0f172a;
    --background-alt: #1e293b;
    --border: #334155;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

/* Light mode */
body.light-mode {
    --primary-color: #6366f1;
    --primary-hover: #5855eb;
    --secondary-color: #f1f5f9;
    --accent-color: #10b981;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-light: #94a3b8;
    --background: #ffffff;
    --background-alt: #f8fafc;
    --border: #e2e8f0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

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

html {
    scroll-behavior: smooth;
    /* Prevent any horizontal overflow from influencing viewport width on mobile */
    overflow-x: hidden;
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--background);
    overflow-x: hidden;
}

/* Navigation */
.nav {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(15, 23, 42, 0.1);
    backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 1000;
    transition: var(--transition);
}

body.light-mode .nav {
    background: rgba(255, 255, 255, 0.1);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

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

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;           /* ensure no whitespace gap between items */
    align-items: center;
    gap: 0;                  /* no space between name and underscore */
}

.logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-underscore {
    color: var(--primary-color);
    animation: blink 1.5s infinite;
}

@keyframes blink {
    0%, 50% {
        opacity: 1;
    }
    51%, 100% {
        opacity: 0;
    }
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 50%;
    background-color: var(--primary-color);
    transition: var(--transition);
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

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

.theme-toggle {
    background: none;
    border: 2px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.2rem;
}

.theme-toggle:hover {
    background: var(--background-alt);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
}

.bar {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    margin: 3px 0;
    transition: var(--transition);
}

/* Hero Section */
.hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    align-items: center;
    padding: 0 0 40px;
    background: transparent;
    position: relative;
    overflow: hidden;
}

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 2rem 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

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

.hero-greeting {
    margin-bottom: 1rem;
}

.greeting-text {
    font-size: 1.1rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

.highlight {
    color: var(--primary-color);
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.hero-description {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    line-height: 1.7;
}

.hero-cta {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.btn {
    padding: 12px 24px;
    border-radius: var(--border-radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

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

.btn-secondary:hover {
    background: var(--background-alt);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.hero-stats {
    display: flex;
    gap: 2rem;
}

.stat {
    text-align: center;
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
}

.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Code Window */
.hero-visual {
    display: flex;
    justify-content: center;
    align-items: center;
}

.code-window {
    background: #1e293b;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    width: 100%;
    max-width: 450px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

.code-header {
    background: #334155;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.code-dots {
    display: flex;
    gap: 0.5rem;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dot.red { background: #ef4444; }
.dot.yellow { background: #f59e0b; }
.dot.green { background: #10b981; }

.code-title {
    color: #94a3b8;
    font-size: 0.9rem;
}

.code-content {
    padding: 1.5rem;
    background: #1e293b;
}

.code-line {
    display: flex;
    margin-bottom: 0.5rem;
    align-items: center;
}

.line-number {
    color: #64748b;
    margin-right: 1rem;
    min-width: 20px;
    font-size: 0.9rem;
}

.code-text {
    color: #e2e8f0;
    font-size: 0.9rem;
}

.keyword { color: #c084fc; }
.class-name { color: #fbbf24; }
.function { color: #60a5fa; }
.param { color: #34d399; }
.property { color: #f472b6; }
.string { color: #fbbf24; }

/* Common Styles */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* About Section */
.about {
    padding: 100px 0;
    background: var(--background);
}

.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.about-intro {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.about-text p {
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
    line-height: 1.7;
}

.about-highlights {
    margin-top: 2rem;
}

.highlight-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--background-alt);
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.highlight-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
}

.skills-grid {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.skill-category h3 {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

.skill-tag {
    background: var(--background-alt);
    color: var(--text-primary);
    padding: 0.5rem 1rem;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    border: 2px solid var(--border);
    transition: var(--transition);
}

.skill-tag:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

/* Projects Section */
.projects {
    padding: 100px 0;
    background: var(--background-alt);
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.project-card {
    background: var(--background);
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid var(--border);
}

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

.project-card.featured {
    border: 2px solid var(--primary-color);
}

.project-image {
    position: relative;
    height: 200px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: var(--transition);
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.project-links {
    display: flex;
    gap: 1rem;
}

.project-link {
    background: white;
    color: #1e293b;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.project-link:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Dark mode specific styling for project links */
body:not(.light-mode) .project-link {
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
}

body:not(.light-mode) .project-link:hover {
    background: var(--primary-color);
    color: white;
}

.project-icon {
    font-size: 3rem;
    color: white;
}

.project-content {
    padding: 1.5rem;
}

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

.project-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
}

.project-badge {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.project-badge.award {
    background: var(--accent-color);
}

.project-description {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

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

.tech-tag {
    background: var(--secondary-color);
    color: var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.projects-cta {
    text-align: center;
    margin-top: 3rem;
}

/* Experience Section */
.experience {
    padding: 100px 0;
    background: var(--background);
}

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

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

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    padding-left: 80px;
}

.timeline-marker {
    position: absolute;
    left: 21px;
    top: 0;
    width: 18px;
    height: 18px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 4px solid var(--background);
    box-shadow: 0 0 0 4px var(--border);
}

.timeline-content {
    background: var(--background-alt);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.timeline-header {
    margin-bottom: 1rem;
}

.timeline-header h3 {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.timeline-company {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.timeline-date {
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: 1rem;
}

.timeline-description {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.timeline-location {
    color: var(--text-light);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.certifications {
    max-width: 800px;
    margin: 0 auto;
}

.certifications h3 {
    font-size: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--text-primary);
}

.cert-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.cert-item {
    background: var(--background-alt);
    padding: 2rem;
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.cert-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.cert-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.cert-content h4 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.cert-issuer {
    color: var(--text-secondary);
    font-size: 0.9rem;
    display: block;
    margin-bottom: 0.5rem;
}

.cert-link {
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}

.cert-link:hover {
    text-decoration: underline;
}

/* Contact Section */
.contact {
    padding: 100px 0;
    background: var(--background-alt);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.contact-card {
    background: var(--background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    transition: var(--transition);
}

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

.contact-icon {
    width: 60px;
    height: 60px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.contact-details h3 {
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.contact-details p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.contact-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

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

.contact-form-container {
    background: var(--background);
    padding: 2rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.form-group input,
.form-group textarea {
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--background);
    color: var(--text-primary);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-light);
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Form message styles */
.form-message {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-top: 1rem;
    font-weight: 500;
    animation: slideIn 0.3s ease-out;
}

.form-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.form-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid #ef4444;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Ensure form inputs look good in dark mode */
body:not(.light-mode) .form-group input,
body:not(.light-mode) .form-group textarea {
    background: var(--background-alt);
    border-color: var(--border);
    color: var(--text-primary);
}

body:not(.light-mode) .form-group input:focus,
body:not(.light-mode) .form-group textarea:focus {
    background: var(--background);
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

/* Footer - Always dark regardless of theme */
.footer {
    background: #0f172a !important;
    color: white;
    padding: 4rem 0 2rem;
    margin-top: 2rem;
}

.footer-content {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    margin-bottom: 2rem;
    align-items: start;
}

.footer-left {
    max-width: 400px;
}

.footer-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0; /* remove gap so underscore touches name */
}

.footer-logo .logo-text {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-logo .logo-underscore {
    color: var(--primary-color);
    animation: blink 1.5s infinite;
}

.footer-description {
    color: #94a3b8;
    line-height: 1.6;
    font-size: 1rem;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
}

.footer-section h4 {
    margin-bottom: 1rem;
    color: white;
    font-weight: 600;
    font-size: 1.1rem;
}

.footer-section a {
    display: block;
    color: #94a3b8;
    text-decoration: none;
    margin-bottom: 0.5rem;
    transition: var(--transition);
    padding: 0.25rem 0;
    border-radius: 4px;
}

.footer-section a:hover {
    color: var(--primary-color);
    transform: translateX(5px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid #334155;
    color: #94a3b8;
    font-size: 0.9rem;
}

/* Scroll to Top Button */
.scroll-to-top {
    position: fixed;
    bottom: calc(30px + env(safe-area-inset-bottom, 0px));
    right: calc(30px + env(safe-area-inset-right, 0px));
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition);
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
    z-index: 1000;
}

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

.scroll-to-top:hover {
    background: var(--primary-hover);
    transform: translateY(-3px);
    box-shadow: var(--shadow-xl);
}

.scroll-to-top:active {
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .scroll-to-top {
        bottom: calc(20px + env(safe-area-inset-bottom, 0px));
        right: calc(20px + env(safe-area-inset-right, 0px));
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
}

/* Responsive Design */

/* Large mobile devices (481px to 600px) */
@media (min-width: 481px) and (max-width: 600px) {
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 1.5rem;
    }
    
    .project-card {
        margin: 0;
    }
    
    .project-content {
        padding: 1.5rem;
    }
    
    .timeline-item {
        padding-left: 45px;
    }
    
    .timeline-marker {
        left: 8px;
        width: 14px;
        height: 14px;
    }
    
    .timeline::before {
        left: 14px;
    }
    
    .contact-card {
        padding: 1.75rem;
        flex-direction: row;
        text-align: left;
        gap: 1.25rem;
    }
    
    .contact-icon {
        width: 55px;
        height: 55px;
        font-size: 1.4rem;
    }
    
    .footer {
        padding: 2.5rem 0 1.75rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-left {
        max-width: 100%;
    }
    
    .footer-description {
        max-width: 350px;
        margin: 0 auto;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.25rem;
        max-width: 450px;
        margin: 0 auto;
    }
    
    .footer-section a {
        font-size: 0.85rem;
    }
}

@media (max-width: 1200px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .nav-container {
        padding: 1rem 1.5rem;
    }
    
    .hero-container {
        gap: 3rem;
    }
    
    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

@media (max-width: 1024px) {
    .hero-container {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .hero-title {
        font-size: 3rem;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 3rem;
    }
    
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .footer-left {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
        gap: 2rem;
        max-width: 600px;
        margin: 0 auto;
    }
    
    .code-window {
        max-width: 400px;
    }
    
    .timeline-item {
        padding-left: 70px;
    }
    
    .cert-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        transform: translateX(-100%);
        will-change: transform;
        flex-direction: column;
        background-color: var(--background);
        width: 100%;
        text-align: center;
        transition: transform 0.3s ease;
        box-shadow: var(--shadow);
        padding: 2rem 0;
        z-index: 999;
    }

    .nav-menu.active {
        transform: translateX(0);
    }

    .nav-toggle {
        display: flex;
    }

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

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

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-8px) rotate(-45deg);
    }
    
    .hero {
        padding: 80px 0 60px;
    }
    
    .hero-title {
        font-size: 2.5rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.3rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }
    
    .hero-stats {
        justify-content: center;
        gap: 2rem;
        flex-wrap: wrap;
    }
    
    .section-title {
        font-size: 2rem;
    }
    
    .section-subtitle {
        font-size: 1rem;
        padding: 0 1rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-card {
        max-width: 500px;
        margin: 0 auto;
    }
    
    .timeline::before {
        left: 20px;
    }
    
    .timeline-item {
        padding-left: 50px;
    }
    
    .timeline-marker {
        left: 11px;
    }
    
    .cert-grid {
        grid-template-columns: 1fr;
    }
    
    .cert-item {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .footer {
        padding: 3rem 0 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    
    .footer-left {
        max-width: 100%;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
        max-width: 500px;
        margin: 0 auto;
    }
    
    .footer-section {
        text-align: center;
    }
    
    .footer-section h4 {
        margin-bottom: 0.75rem;
        font-size: 0.95rem;
    }
    
    .footer-section a {
        font-size: 0.85rem;
        margin-bottom: 0.4rem;
    }
    
    .about {
        padding: 80px 0;
    }
    
    .projects {
        padding: 80px 0;
    }
    
    .experience {
        padding: 80px 0;
    }
    
    .contact {
        padding: 80px 0;
    }
    
    .contact-card {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1.5rem;
        border-radius: 16px;
        margin-bottom: 1rem;
    }
    
    .contact-icon {
        width: 50px;
        height: 50px;
        font-size: 1.3rem;
        margin: 0 auto;
    }
    
    .contact-details h3 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    
    .contact-details p {
        font-size: 0.9rem;
        margin-bottom: 0.25rem;
    }
    
    .skill-tags {
        justify-content: center;
    }
    
    .about-highlights {
        margin-top: 2rem;
    }
    
    .highlight-item {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
        padding: 1.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
    
    .nav-container {
        padding: 1rem;
    }
    
    .nav-logo {
        font-size: 1.3rem;
    }
    
    .hero {
        padding: 80px 0 40px;
        /* Keep height stable on small screens */
        min-height: 100svh;
    }
    
    .hero-container {
        padding: 0 1rem;
        gap: 2rem;
    }
    
    .hero-title {
        font-size: 2rem;
        line-height: 1.1;
    }
    
    .hero-subtitle {
        font-size: 1.2rem;
    }
    
    .hero-description {
        font-size: 1rem;
        margin-bottom: 2rem;
    }
    
    .btn {
        padding: 12px 20px;
        font-size: 0.9rem;
    }
    
    .hero-stats {
        gap: 1.5rem;
    }
    
    .stat-number {
        font-size: 1.5rem;
    }
    
    .stat-label {
        font-size: 0.8rem;
    }
    
    .code-window {
        max-width: 280px;
        font-size: 0.8rem;
    }
    
    .code-header {
        padding: 0.8rem;
    }
    
    .code-content {
        padding: 1rem;
    }
    
    .code-text {
        font-size: 0.8rem;
    }
    
    .section-title {
        font-size: 1.8rem;
    }
    
    .section-subtitle {
        font-size: 0.95rem;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .project-card {
        margin: 0;
        border-radius: 16px;
        overflow: hidden;
    }
    
    .project-image {
        height: 160px;
    }
    
    .project-content {
        padding: 1.5rem;
    }
    
    .project-title {
        font-size: 1.2rem;
        margin-bottom: 0.75rem;
    }
    
    .project-description {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1rem;
    }
    
    .tech-tag {
        font-size: 0.8rem;
        padding: 0.3rem 0.7rem;
        margin: 0.2rem 0.3rem 0.2rem 0;
    }
    
    .project-links {
        margin-top: 1.25rem;
        gap: 0.75rem;
    }
    
    .project-link {
        width: 45px;
        height: 45px;
        font-size: 1rem;
    }
    
    .timeline-item {
        padding-left: 35px;
        margin-bottom: 2rem;
    }
    
    .timeline-marker {
        left: 4px;
        width: 12px;
        height: 12px;
    }
    
    .timeline::before {
        left: 9px;
        width: 2px;
    }
    
    .timeline-content {
        padding: 1.25rem;
        border-radius: 12px;
        margin-bottom: 0;
    }
    
    .timeline-header {
        margin-bottom: 0.75rem;
    }
    
    .timeline-header h3 {
        font-size: 1.1rem;
        margin-bottom: 0.25rem;
    }
    
    .timeline-company {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .timeline-date {
        margin-left: 0;
        margin-top: 0;
        margin-bottom: 0.75rem;
        display: inline-block;
        padding: 0.2rem 0.6rem;
        font-size: 0.8rem;
    }
    
    .timeline-description {
        font-size: 0.9rem;
        line-height: 1.5;
        margin-bottom: 0.75rem;
    }
    
    .timeline-location {
        font-size: 0.85rem;
    }
    
    .contact-form-container {
        padding: 1.5rem;
    }
    
    .form-group input,
    .form-group textarea {
        padding: 10px;
        font-size: 0.9rem;
    }
    
    .footer {
        padding: 2.5rem 0 1.5rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 2.5rem;
        text-align: center;
    }
    
    .footer-left {
        max-width: 100%;
        order: 1;
    }
    
    .footer-logo {
        font-size: 1.4rem;
        margin-bottom: 1rem;
    }
    
    .footer-description {
        font-size: 1rem;
        line-height: 1.6;
        max-width: 400px;
        margin: 0 auto;
        padding: 0;
    }
    
    .footer-links {
        /* Keep three columns even on small phones as requested */
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
        order: 2;
        max-width: 100%;
        margin: 0 auto;
    }
    
    .footer-section {
        /* Keep left-aligned so links stack naturally */
        text-align: left;
    }
    
    .footer-section h4 {
        font-size: 1.1rem;
        margin-bottom: 1rem;
        color: #ffffff;
        font-weight: 600;
    }
    
    .footer-section a {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        padding: 0.25rem 0;
        display: block; /* stack vertically, one per line */
        width: 100%;
    }
    
    .footer-bottom {
        padding-top: 1.5rem;
        font-size: 0.85rem;
    }
    
    .skill-tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .about-intro {
        font-size: 1rem;
    }
    
    .about-text p {
        font-size: 0.95rem;
    }
}

/* Extra small mobile devices (360px and below) */
@media (max-width: 360px) {
    .container {
        padding: 0 0.75rem;
    }
    
    .hero-container {
        padding: 0 0.75rem;
    }
    
    .project-card {
        border-radius: 12px;
    }
    
    .project-content {
        padding: 1.25rem;
    }
    
    .project-title {
        font-size: 1.1rem;
    }
    
    .project-description {
        font-size: 0.9rem;
    }
    
    .tech-tag {
        font-size: 0.75rem;
        padding: 0.25rem 0.6rem;
    }
    
    .timeline-content {
        padding: 1rem;
    }
    
    .timeline-item {
        padding-left: 30px;
    }
    
    .contact-card {
        padding: 1.25rem;
    }
    
    .contact-icon {
        width: 45px;
        height: 45px;
        font-size: 1.2rem;
    }
    
    .footer {
        padding: 2rem 0 1.5rem;
    }
    
    .footer-content {
        gap: 2rem;
    }
    
    .footer-logo {
        font-size: 1.3rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-description {
        font-size: 0.95rem;
        padding: 0;
        max-width: 300px;
    }
    
    .footer-links {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
        max-width: 100%;
    }
    
    .footer-section h4 {
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .footer-section a {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
        display: block;
        width: 100%;
    }
    
    .footer-bottom {
        padding-top: 1.5rem;
        font-size: 0.85rem;
        margin-top: 1rem;
    }
    
    .skill-tag {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }
}

@media (max-width: 360px) {
    .hero-title {
        font-size: 1.8rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .code-window {
        max-width: 260px;
    }
    
    .section-title {
        font-size: 1.6rem;
    }
    
    .hero-stats {
        flex-direction: column;
        gap: 1rem;
    }
    
    .nav-logo {
        font-size: 1.2rem;
    }
    
    .container {
        padding: 0 0.8rem;
    }
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hero-content > * {
    animation: fadeInUp 0.8s ease-out forwards;
    opacity: 0;
}

.hero-greeting { animation-delay: 0.1s; }
.hero-title { animation-delay: 0.2s; }
.hero-subtitle { animation-delay: 0.3s; }
.hero-description { animation-delay: 0.4s; }
.hero-cta { animation-delay: 0.5s; }
.hero-stats { animation-delay: 0.6s; }

.code-window {
    animation: fadeInUp 0.8s ease-out 0.7s forwards;
    opacity: 0;
}

/* Scroll Animation Classes */
.animate-on-scroll {
    opacity: 0;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.animate-on-scroll.animate-in {
    opacity: 1;
}

.fade-up {
    transform: translateY(30px);
}

.fade-up.animate-in {
    transform: translateY(0);
}

.fade-left {
    transform: translateX(-50px);
}

.fade-left.animate-in {
    transform: translateX(0);
}

.fade-right {
    transform: translateX(50px);
}

.fade-right.animate-in {
    transform: translateX(0);
}

.scale-in {
    transform: scale(0.8);
}

.scale-in.animate-in {
    transform: scale(1);
}

.slide-down {
    transform: translateY(-30px);
}

.slide-down.animate-in {
    transform: translateY(0);
}

/* Staggered animations for grids */
.stagger-animation .animate-on-scroll {
    transition-delay: 0s;
}

.stagger-animation .animate-on-scroll:nth-child(1) { transition-delay: 0.1s; }
.stagger-animation .animate-on-scroll:nth-child(2) { transition-delay: 0.2s; }
.stagger-animation .animate-on-scroll:nth-child(3) { transition-delay: 0.3s; }
.stagger-animation .animate-on-scroll:nth-child(4) { transition-delay: 0.4s; }
.stagger-animation .animate-on-scroll:nth-child(5) { transition-delay: 0.5s; }
.stagger-animation .animate-on-scroll:nth-child(6) { transition-delay: 0.6s; }
.stagger-animation .animate-on-scroll:nth-child(7) { transition-delay: 0.7s; }
.stagger-animation .animate-on-scroll:nth-child(8) { transition-delay: 0.8s; }

/* Scroll indicators */
.nav-link.active {
    color: var(--primary-color);
}

/* Custom scrollbar - desktop only to avoid mobile gutter issues */
@media (hover: hover) and (pointer: fine) {
    ::-webkit-scrollbar {
        width: 8px;
    }
    ::-webkit-scrollbar-track {
        background: var(--background-alt);
    }
    ::-webkit-scrollbar-thumb {
        background: var(--primary-color);
        border-radius: 4px;
    }
    ::-webkit-scrollbar-thumb:hover {
        background: var(--primary-hover);
    }
}

/* Mobile: remove visible scrollbar/gutter without affecting desktop */
@media (hover: none) and (pointer: coarse) {
    /* Keep scrolling functional but hide scrollbar UI and avoid reserving space */
    html, body {
        /* Do not reserve gutter on mobile */
        scrollbar-gutter: auto;
        /* Hide scrollbar in Firefox/old Edge while keeping scroll */
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE/Edge */
    }

    /* Hide WebKit scrollbars on mobile (Chrome/Safari/Android) */
    *::-webkit-scrollbar {
        width: 0 !important;
        height: 0 !important;
    }
    *::-webkit-scrollbar-track { background: transparent !important; }
    *::-webkit-scrollbar-thumb { background: transparent !important; }
}

/* Fallback for devices that don't report coarse pointer correctly */
@media (max-width: 1024px) {
    html, body {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    *::-webkit-scrollbar { width: 0 !important; height: 0 !important; }
    *::-webkit-scrollbar-track { background: transparent !important; }
    *::-webkit-scrollbar-thumb { background: transparent !important; }
}

/* Ripple animation for skill tags */
@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Enhanced navbar when scrolled */
.nav.scrolled {
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}

/* Smooth page entrance */
body {
    opacity: 0;
    transition: opacity 0.3s ease-in;
}

body.loaded {
    opacity: 1;
}

/* Enhanced mobile menu */
@media (max-width: 768px) {
    .nav-menu {
        backdrop-filter: blur(20px);
        border: 1px solid var(--border);
        border-radius: 0 0 15px 15px;
    }
    
    .nav-menu.active {
        animation: slideDown 0.3s ease-out;
    }
    
    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Enhanced skill tag interactions */
.skill-tag {
    cursor: pointer;
    user-select: none;
}

.skill-tag:active {
    transform: translateY(-2px) scale(0.98);
}

/* Improved loading states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* Enhanced focus states for accessibility */
.btn:focus,
.nav-link:focus,
.contact-link:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .animate-on-scroll {
        opacity: 1 !important;
        transform: none !important;
    }
}

/* Project screenshots inside cards */
.project-image {
    position: relative;
}

.project-image img.project-screenshot {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
    display: block; /* reserve space, controlled via opacity */
}

.project-image img.project-screenshot.loaded {
    opacity: 1;
}

.project-image img.project-screenshot.error {
    display: none; /* hide broken image icon if load fails */
}