/* ==================== */
/* CSS Variables & Reset */
/* ==================== */

:root {
    /* Light Mode Colors */
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --accent-color: #3b82f6;
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --bg-primary: #ffffff;
    --bg-secondary: #f3f4f6;
    --bg-tertiary: #e5e7eb;
    --border-color: #d1d5db;
    --shadow: rgba(0, 0, 0, 0.1);
    --shadow-lg: rgba(0, 0, 0, 0.15);
    
    /* Transitions */
    --transition: all 0.3s ease;
}

[data-theme="dark"] {
    /* Dark Mode Colors */
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
    --accent-color: #2563eb;
    --text-primary: #f9fafb;
    --text-secondary: #d1d5db;
    --bg-primary: #111827;
    --bg-secondary: #1f2937;
    --bg-tertiary: #374151;
    --border-color: #4b5563;
    --shadow: rgba(0, 0, 0, 0.3);
    --shadow-lg: rgba(0, 0, 0, 0.5);
}

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

html {
    scroll-behavior: smooth;
}

/* ==================== */
/* FOUC Prevention      */
/* ==================== */

/* Applied by JS inline script in <head> BEFORE first paint.
   Blocks all transitions so the correct theme shows instantly.
   Removed 50ms later so normal transitions resume. */
.no-transition,
.no-transition *,
.no-transition *::before,
.no-transition *::after {
    transition: none !important;
    animation: none !important;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    /* iOS momentum scrolling */
    -webkit-overflow-scrolling: touch;
    /* Prevent horizontal scroll on mobile */
    overflow-x: hidden;
    /* Base font size - smaller on mobile */
    font-size: 16px;
}

a {
    text-decoration: none;
    color: inherit;
}

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

/* Prevent iOS blue tap highlight on interactive elements */
a, button, .btn, .theme-toggle, .hamburger, .filter-btn, .nav-menu a {
    -webkit-tap-highlight-color: transparent;
}

/* Ensure minimum touch target size for accessibility (44x44px) */
.theme-toggle,
.hamburger {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==================== */
/* Container */
/* ==================== */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    /* Mobile safe area support */
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

/* ==================== */
/* Navigation */
/* ==================== */

.navbar {
    background-color: var(--bg-primary);
    box-shadow: 0 2px 10px var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    transition: var(--transition);
    /* iOS safe area for notched phones */
    padding-top: env(safe-area-inset-top);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.navbar .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 20px;
    position: relative;
}

.nav-brand {
    display: flex;
    align-items: center;
    transition: var(--transition);
}

.nav-brand img {
    height: 40px;
    width: 40px;
    min-width: 40px;
    object-fit: contain;
    border-radius: 50%;
    background-color: var(--bg-primary);
    padding: 6px;
    box-shadow: 0 2px 8px var(--shadow);
    transition: var(--transition);
    cursor: pointer;
    aspect-ratio: 1 / 1;
    /* Smooth rendering for all devices */
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

.nav-brand img:hover {
    transform: scale(1.05) translateZ(0);
    box-shadow: 0 4px 12px var(--shadow-lg);
}

.nav-brand h2 {
    color: var(--primary-color);
    font-size: 1.8rem;
    font-weight: 700;
}

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

.nav-menu a {
    color: var(--text-primary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--primary-color);
    transition: width 0.3s ease;
}

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

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.theme-toggle {
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-primary);
    margin-left: 1rem;
    transition: var(--transition);
}

.theme-toggle:hover {
    color: var(--primary-color);
    transform: scale(1.1);
}

.hamburger {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 5px;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background-color: var(--text-primary);
    /* Faster transition for mobile menu icon */
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    /* Hardware acceleration */
    will-change: transform, opacity;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

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

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

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

/* ==================== */
/* Hero Section */
/* ==================== */

.hero {
    padding: 100px 0;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

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

.hero-text h1 {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.highlight {
    color: var(--primary-color);
    position: relative;
}

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

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 12px 30px;
    border-radius: 8px;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    /* Mobile touch target - minimum 44x44px */
    min-height: 44px;
    min-width: 44px;
    /* Better touch feedback */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--shadow);
}

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

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

.hero-image {
    display: flex;
    justify-content: center;
}

.profile-image {
    width: 300px;
    height: 300px;
    max-width: 80vw;
    max-height: 80vw;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--accent-color);
    box-shadow: 0 20px 40px var(--shadow-lg);
}

.image-placeholder {
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8rem;
    color: white;
    box-shadow: 0 20px 40px var(--shadow-lg);
}

/* ==================== */
/* Animations */
/* ==================== */

.fade-in {
    animation: fadeIn 1s ease-in;
}

.fade-in-delay {
    animation: fadeIn 1s ease-in 0.3s backwards;
}

.fade-in-delay-2 {
    animation: fadeIn 1s ease-in 0.6s backwards;
}

.fade-in-delay-3 {
    animation: fadeIn 1s ease-in 0.9s backwards;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== */
/* About Section */
/* ==================== */

.about {
    padding: 80px 0;
    background-color: var(--bg-primary);
}

.section-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 3rem;
    color: var(--text-primary);
    position: relative;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

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

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

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

.info-card {
    background-color: var(--bg-secondary);
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow);
    transition: var(--transition);
}

.info-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px var(--shadow-lg);
}

.info-card i {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.info-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.info-card p {
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
}

.info-card .small {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ==================== */
/* Skills Section */
/* ==================== */

.skills {
    padding: 80px 0;
    background-color: var(--bg-secondary);
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.skill-card {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 5px 15px var(--shadow);
    transition: var(--transition);
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px var(--shadow-lg);
}

.skill-card i {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.skill-card h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* ==================== */
/* Page Header */
/* ==================== */

.page-header {
    padding: 80px 0 40px;
    text-align: center;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-primary) 100%);
}

.page-header h1 {
    font-size: 3rem;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.page-header p {
    font-size: 1.2rem;
    color: var(--text-secondary);
}

/* ==================== */
/* Filter Section */
/* ==================== */

.filter-section {
    padding: 40px 0;
    background-color: var(--bg-primary);
}

.filter-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 10px 25px;
    border: 2px solid var(--border-color);
    background-color: transparent;
    color: var(--text-primary);
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.filter-btn:hover,
.filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* ==================== */
/* Projects Section */
/* ==================== */

.projects-section {
    padding: 40px 0 80px;
    background-color: var(--bg-primary);
}

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

.project-card {
    background-color: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--shadow);
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px var(--shadow-lg);
}

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

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
    transition: transform 0.3s ease;
}

.project-image:hover img {
    transform: scale(1.1);
}

.project-image i {
    position: absolute;
    z-index: 1;
}

.project-image.has-image i {
    display: none;
}

.project-content {
    padding: 1.5rem;
}

.project-content h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

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

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

.tech-badge {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.project-link {
    color: var(--primary-color);
    font-weight: 600;
    transition: var(--transition);
}

.project-link:hover {
    color: var(--secondary-color);
}

.project-link i {
    margin-right: 5px;
}

/* ==================== */
/* Contact Section */
/* ==================== */

.contact-section {
    padding: 60px 0 80px;
    background-color: var(--bg-primary);
}

.contact-wrapper {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
}

.contact-info h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.contact-info > p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    line-height: 1.8;
}

.info-items {
    margin-bottom: 3rem;
}

.info-item {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    align-items: start;
}

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

.info-text h3 {
    font-size: 1.2rem;
    margin-bottom: 0.3rem;
    color: var(--text-primary);
}

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

.social-links h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.social-icons {
    display: flex;
    gap: 1rem;
}

.social-icon {
    width: 45px;
    height: 45px;
    background-color: var(--bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.3rem;
    transition: var(--transition);
}

.social-icon:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-5px);
}

/* ==================== */
/* Contact Form */
/* ==================== */

.contact-form-wrapper h2 {
    font-size: 2rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

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

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

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

.form-group input,
.form-group textarea {
    padding: 12px 15px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px; /* MUST be 16px minimum — prevents iOS auto-zoom on focus */
    font-family: inherit;
    transition: var(--transition);
    /* iOS styling reset */
    -webkit-appearance: none;
    appearance: none;
    border-radius: 8px; /* Re-declare after appearance reset */
    /* Mobile optimizations */
    min-height: 44px; /* Minimum touch target size */
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    width: 100%; /* Full width on mobile */
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-group textarea {
    resize: vertical;
}

.form-message {
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    display: none;
}

.form-message.success {
    background-color: #d1fae5;
    color: #065f46;
    display: block;
}

.form-message.error {
    background-color: #fee2e2;
    color: #991b1b;
    display: block;
}

/* ==================== */
/* Footer */
/* ==================== */

.footer {
    background-color: var(--bg-secondary);
    padding: 3rem 0 1rem;
    margin-top: auto;
    /* iOS safe area for home indicator */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
}

.footer-info h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.footer-info p {
    color: var(--text-secondary);
}

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

.footer-links a {
    width: 40px;
    height: 40px;
    background-color: var(--bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    font-size: 1.2rem;
    transition: var(--transition);
}

.footer-links a:hover {
    background-color: var(--primary-color);
    color: white;
    transform: translateY(-3px);
}

.footer-bottom {
    padding-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
}

/* ==================== */
/* Responsive Design */
/* ==================== */

@media (max-width: 968px) {
    .hero-content,
    .about-content,
    .contact-wrapper {
        grid-template-columns: 1fr;
    }

    .hero-image {
        order: -1;
    }

    .image-placeholder {
        width: 250px;
        height: 250px;
        font-size: 6rem;
    }

    .hero-text h1 {
        font-size: 2.5rem;
    }

    .hero-text h2 {
        font-size: 1.5rem;
    }

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

    .projects-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
}

@media (max-width: 1024px) {
    /* iPad and below - Center logo, corner buttons */
    .navbar .container {
        display: grid;
        grid-template-columns: 1fr auto 1fr;
        align-items: center;
        justify-items: center;
        padding: 1rem 20px;
    }

    .nav-brand {
        grid-column: 2;
        justify-self: center;
    }

    .nav-menu {
        display: none !important;
    }

    .theme-toggle {
        grid-column: 3;
        justify-self: end;
        margin-left: 0;
        margin-right: 0;
    }

    .hamburger {
        display: flex;
        grid-column: 1;
        justify-self: start;
    }
}

@media (max-width: 768px) {
    .nav-brand img {
        height: 36px;
        width: 36px;
        min-width: 36px;
        padding: 5px;
    }

    .nav-menu {
        display: flex !important;
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background-color: var(--bg-secondary);
        width: 100%;
        text-align: center;
        /* Optimized for mobile - faster transition with hardware acceleration */
        transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
        transform: translateX(-100%);
        box-shadow: 0 10px 27px var(--shadow);
        padding: 2rem 0;
        /* iOS safe area for notch/home indicator */
        padding-bottom: calc(2rem + env(safe-area-inset-bottom));
        z-index: 999;
        /* Hardware acceleration for smooth animation */
        will-change: transform;
        backface-visibility: hidden;
        -webkit-backface-visibility: hidden;
    }

    .nav-menu li {
        padding: 0.2rem 0;
    }

    .nav-menu a {
        display: block;
        padding: 0.8rem 2rem; /* Large touch target */
        font-size: 1.1rem;
        min-height: 44px; /* iOS/Android minimum touch target */
        display: flex;
        align-items: center;
        justify-content: center;
    }

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

    .navbar .container {
        padding: 1rem 15px;
    }

    .theme-toggle {
        font-size: 1.2rem;
    }

    .hero {
        padding: 60px 0;
    }

    .hero-text h1 {
        font-size: 1.75rem;
    }

    .hero-text h2 {
        font-size: 1.1rem;
    }
    
    .hero-text p {
        font-size: 0.9rem;
    }
    
    .about-text p {
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .info-card h3 {
        font-size: 1.1rem;
    }
    
    .info-card p {
        font-size: 0.85rem;
    }

    .hero-buttons {
        flex-direction: column;
    }

    .btn {
        width: 100%;
        justify-content: center;
        min-height: 44px; /* Touch target size */
        font-size: 0.9rem;
        padding: 10px 20px;
    }

    .skills-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1.5rem;
    }

    .filter-buttons {
        gap: 0.5rem;
    }

    .filter-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    /* Smaller project cards on mobile */
    .project-card {
        border-radius: 8px;
    }
    
    .project-image {
        height: 120px;
        font-size: 2.5rem;
    }
    
    .project-content {
        padding: 1rem;
    }
    
    .project-content h3 {
        font-size: 0.95rem;
        margin-bottom: 0.5rem;
        line-height: 1.3;
    }
    
    .project-content p {
        font-size: 0.7rem;
        line-height: 1.4;
        margin-bottom: 0.75rem;
    }
    
    .project-tech {
        margin-bottom: 0.75rem;
    }
    
    .tech-badge {
        padding: 3px 8px;
        font-size: 0.7rem;
    }
    
    .project-links {
        gap: 0.5rem;
    }
    
    .project-link {
        font-size: 0.75rem;
    }

    .contact-wrapper {
        gap: 3rem;
    }

    .footer-content {
        flex-direction: column;
        gap: 2rem;
        text-align: center;
    }
    
    .footer-info h3 {
        font-size: 1.1rem;
    }
    
    .footer-info p {
        font-size: 0.85rem;
    }
    
    .footer-bottom p {
        font-size: 0.8rem;
    }

    .page-header h1 {
        font-size: 1.75rem;
    }

    .page-header p {
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .navbar .container {
        padding: 0.8rem 12px;
        padding-left: calc(12px + env(safe-area-inset-left));
        padding-right: calc(12px + env(safe-area-inset-right));
    }

    .nav-brand img {
        height: 32px;
        width: 32px;
        min-width: 32px;
        padding: 4px;
    }

    .theme-toggle {
        font-size: 1.1rem;
    }

    .hamburger span {
        width: 22px;
        height: 2.5px;
    }

    .hero-text h1 {
        font-size: 1.5rem;
    }
    
    .hero-text h2 {
        font-size: 1rem;
    }
    
    .hero-text p {
        font-size: 0.85rem;
    }

    .image-placeholder {
        width: 200px;
        height: 200px;
        font-size: 5rem;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    /* Ensure projects stay 2 columns even on very small screens */
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .project-image {
        height: 90px;
    }
    
    .project-content {
        padding: 0.6rem;
    }
    
    .project-content h3 {
        font-size: 0.8rem;
    }
    
    .project-content p {
        font-size: 0.6rem;
    }
    
    .tech-badge {
        font-size: 0.6rem;
        padding: 2px 5px;
    }
    
    .project-link {
        font-size: 0.65rem;
    }

    .social-icons {
        justify-content: center;
    }
    
    /* Mobile form improvements */
    .form-group input,
    .form-group textarea {
        font-size: 16px; /* Prevents iOS zoom on focus */
        padding: 14px 16px;
    }
    
    .contact-wrapper {
        gap: 2rem;
    }
    
    .page-header {
        padding-top: calc(80px + env(safe-area-inset-top));
    }
    
    /* Better spacing on small screens */
    .container {
        padding-left: calc(20px + env(safe-area-inset-left));
        padding-right: calc(20px + env(safe-area-inset-right));
    }
}

/* ==================== */
/* Extra Small Screens  */
/* ==================== */

@media (max-width: 360px) {
    .hero-text h1 {
        font-size: 1.6rem;
    }

    .hero-text h2 {
        font-size: 1.1rem;
    }

    .section-title {
        font-size: 1.3rem;
    }

    .page-header h1 {
        font-size: 1.5rem;
    }
    
    .page-header p {
        font-size: 0.8rem;
    }

    .btn {
        padding: 10px 20px;
        font-size: 0.95rem;
    }

    .skill-card {
        padding: 1.2rem;
    }

    .skill-card i {
        font-size: 2.2rem;
    }

    .contact-form-wrapper h2,
    .contact-info h2 {
        font-size: 1.25rem;
        margin-bottom: 1.5rem;
    }
    
    .contact-info > p {
        font-size: 0.85rem;
    }
    
    .info-text h3 {
        font-size: 1rem;
    }
    
    .info-text p {
        font-size: 0.85rem;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-group input,
    .form-group textarea {
        font-size: 14px;
        padding: 10px 12px;
    }
}

/* ==================== */
/* iOS Specific Fixes   */
/* ==================== */

/* Fix for iOS input styling */
input[type="text"],
input[type="email"],
textarea {
    -webkit-appearance: none;
    border-radius: 8px;
}

/* Fix for iOS button styling */
button, .btn {
    -webkit-appearance: none;
}

/* Smooth font rendering on all Apple devices */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==================== */
/* Additional Mobile Optimizations */
/* ==================== */

/* Prevent text size adjustment on iOS */
html {
    -webkit-text-size-adjust: 100%;
    -moz-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Better scrolling on mobile */
* {
    -webkit-overflow-scrolling: touch;
}

/* Improve touch response on mobile */
button, a, .btn, .theme-toggle, .hamburger {
    touch-action: manipulation;
}

/* Prevent pull-to-refresh on mobile (optional - can be removed if you want it) */
body {
    overscroll-behavior-y: contain;
}

/* Better focus states for mobile */
input:focus,
textarea:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Improve image loading on mobile */
img {
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Better mobile menu animation - already optimized above */