/* --- Global Styles & Variables --- */
:root {
    --indigo-100: #e0e7ff;
    --indigo-300: #a5b4fc;
    --indigo-500: #6366f1;
    --indigo-600: #4f46e5;
    --indigo-800: #3730a3;
    --indigo-900: #312e81;

    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    --white: #ffffff;
    --black: #000000;
}

html {
    scroll-behavior: smooth;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    overflow-x: hidden;
}

body {
    margin: 0;
    background-color: transparent;
    color: var(--gray-800);
    transition: background-color 0.3s, color 0.3s;
}

.dark body {
    background-color: transparent;
    color: var(--gray-300);
}

#vanta-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -10;
    pointer-events: none;
}

.container {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 1rem;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

.section {
    padding: 5rem 0;
    background-color: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(2px);
}

.dark .section {
    background-color: rgba(31, 41, 55, 0.6);
}

.section-alt {
    background-color: rgba(215, 226, 236, 0.6);
    backdrop-filter: blur(2px);
}

.dark .section-alt {
    background-color: rgba(17, 24, 39, 0.6);
}

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

.section-title h2 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--gray-800);
}

.dark .section-title h2 {
    color: var(--white);
}

.title-underline {
    width: 5rem;
    height: 4px;
    background-color: var(--indigo-600);
    margin: 0 auto;
}

.dark .title-underline {
    background-color: var(--indigo-500);
}

.text-center {
    text-align: center;
}

.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

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

.btn-secondary:hover {
    background-color: var(--indigo-600);
    color: var(--white);
}

.dark .btn-primary {
    background-color: var(--indigo-500);
}

.dark .btn-secondary {
    color: var(--indigo-500);
    border: 2px solid var(--indigo-500);
}

.dark .btn-primary:hover {
    background-color: transparent;
    color: var(--white);
    border: 2px solid var(--indigo-500);
}

.dark .btn-secondary:hover {
    background-color: var(--indigo-500);
    color: var(--white);
    border: 2px solid var(--indigo-500);
}

/* --- Navigation --- */
nav {
    position: fixed;
    width: 100%;
    height: 4rem;
    background-color: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.dark nav {
    background-color: rgba(31, 41, 55, 0.8);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 100%;
}

.nav-brand {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--indigo-600);
    text-decoration: none;
}

.dark .nav-brand {
    color: var(--indigo-500);
}

.nav-links {
    display: none;
    align-items: center;
    gap: 2.5rem;
}

@media (min-width: 768px) {
    .nav-links {
        display: flex;
    }
}

.nav-links a {
    color: var(--gray-700);
    text-decoration: none;
    transition: color 0.2s;
}

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

.dark .nav-links a {
    color: var(--gray-300);
}

.dark .nav-links a:hover {
    color: var(--indigo-500);
}

.nav-icon {
    width: 1rem;
    height: 1rem;
}

.nav-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.nav-menu-item.active {
    color: var(--indigo-600);
    font-weight: 600;
}

.dark .nav-menu-item.active {
    color: var(--indigo-500);
}

.nav-menu-item:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: #6366f1;
    transition: width 0.3s ease;
}

.nav-menu-item:hover:after {
    width: 100%;
}

#theme-toggle,
#theme-toggle-mobile {
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    border-radius: 9999px;
    color: var(--gray-600);
}

#theme-toggle:hover,
#theme-toggle-mobile:hover {
    color: var(--indigo-500);
}

.dark #theme-toggle,
.dark #theme-toggle-mobile {
    color: var(--gray-300);
}

.dark #theme-toggle:hover,
.dark #theme-toggle-mobile:hover {
    color: var(--indigo-500);
}

.menu-icon {
    color: var(--indigo-500);
}

.mobile-menu-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

@media (min-width: 768px) {
    .mobile-menu-button {
        display: none;
    }
}

#menu-btn {
    background: transparent;
    border: none;
    cursor: pointer;
}

#mobile-menu {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    z-index: 45;
}

.dark #mobile-menu {
    background-color: rgba(17, 24, 39, 0.98);
}

#mobile-menu a {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    width: 70%;
    max-width: 300px;
    border-radius: 8px;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--gray-700);
    text-decoration: none;
    text-align: center;
    transition: background-color 0.2s, color 0.2s;
    min-height: 48px;
}

.dark #mobile-menu a {
    color: var(--gray-300);
}

#mobile-menu a:hover {
    background-color: var(--indigo-500);
    color: var(--white);
}

/* --- Hero Section --- */
.hero-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding-top: 4rem;
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .hero-section h1 {
        font-size: 3.75rem;
    }
}

.hero-section .text-highlight {
    color: var(--white);
}

.hero-section p {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    max-width: 48rem;
    margin-left: auto;
    margin-right: auto;
}

@media (min-width: 768px) {
    .hero-section p {
        font-size: 1.5rem;
    }
}

.hero-buttons {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.hero-buttons .btn-primary {
    background-color: var(--white);
    color: var(--indigo-600);
}

.hero-buttons .btn-primary:hover {
    background-color: transparent;
    color: var(--white);
    border: 1px solid var(--white);
}

.hero-buttons .btn-secondary {
    border: 1px solid var(--white);
    color: var(--white);
}

.hero-buttons .btn-secondary:hover {
    background-color: var(--white);
    color: var(--indigo-600);
}

/* --- About Section --- */
.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
}

@media (min-width: 768px) {
    .about-content {
        flex-direction: row;
        gap: 3rem;
    }
}

.about-image {
    flex-shrink: 0;
    width: 290px;
    height: 290px;
}

.about-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 9999px;
    border: 4px solid var(--gray-100);
}

.dark .about-image img {
    border-color: var(--gray-700);
}

.about-text h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.dark .about-text h3 {
    color: var(--white);
}

.about-text p {
    color: var(--gray-600);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.dark .about-text p {
    color: var(--gray-400);
}

.about-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.about-info div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gray-600);
}

.dark .about-info div {
    color: var(--gray-400);
}

.about-info i {
    color: var(--indigo-600);
}

.dark .about-info i {
    color: var(--indigo-500);
}

/* --- Skills Section --- */
.skills-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 768px) {
    .skills-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1024px) {
    .skills-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.skill-card {
    background-color: var(--white);
    padding: 1.5rem;
    border-radius: 0.75rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 280px;
}

.skill-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.dark .skill-card {
    background-color: var(--gray-800);
}

.skill-icon {
    width: 4rem;
    height: 4rem;
    background-color: var(--gray-100);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1rem auto;
}

.dark .skill-icon {
    background-color: var(--gray-700);
}

.skill-icon i {
    width: 2rem;
    height: 2rem;
    color: var(--indigo-600);
}

.dark .skill-icon i {
    color: var(--indigo-500);
}

.skill-card h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.dark .skill-card h3 {
    color: var(--white);
}

.skill-card p {
    flex-grow: 1;
    margin-bottom: 1rem;
    color: var(--gray-600);
}

.dark .skill-card p {
    color: var(--gray-400);
}

.skill-level {
    display: inline-block;
    margin-top: auto;
    padding: 0.375rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.dark .skill-level {
    background: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
    color: var(--gray-900);
    box-shadow: 0 2px 4px rgba(129, 140, 248, 0.3);
}

/* Search Input Styling */
.filter-bar input[type="text"] {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
    display: block;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background-color: var(--white);
    font-size: 1rem;
    transition: all 0.2s;
}

.filter-bar input[type="text"]:focus {
    outline: none;
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.dark .filter-bar input[type="text"] {
    background-color: var(--gray-800);
    border-color: var(--gray-600);
    color: var(--white);
}

.dark .filter-bar input[type="text"]:focus {
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

/* --- Projects Section --- */
.projects-grid {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 100%;
}

@media (min-width: 640px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 768px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.project-card {
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 100%;
    background-color: var(--white);
}

.dark .project-card {
    background-color: var(--gray-800);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}

.project-card img {
    width: 100%;
    height: 18rem;
    object-fit: cover;
    object-position: top;
    display: block;
}

.project-info {
    padding: 1.5rem;
    background-color: transparent;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 16rem;
}

.dark .project-info {
    background-color: var(--gray-700);
}

.project-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.25rem;
    color: var(--white);
}

.dark .project-info h3 {
    color: var(--white);
}

.project-info p {
    flex-grow: 1;
    color: var(--gray-600);
    margin-bottom: 0.75rem;
}

.dark .project-info p {
    color: var(--gray-400);
}

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

.project-tags span {
    padding: 0.25rem 0.75rem;
    background-color: var(--gray-200);
    color: var(--indigo-800);
    border-radius: 9999px;
    font-size: 0.875rem;
}

.dark .project-tags span {
    background-color: var(--gray-800);
    color: var(--indigo-300);
}

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

.project-links a {
    flex: 1;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

/* --- Contact Section --- */
.contact-form {
    max-width: 48rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

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

@media (min-width: 768px) {
    .form-row {
        flex-direction: row;
    }

    .form-row input {
        flex: 1;
    }
}

.contact-form input,
.contact-form textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--gray-300);
    border-radius: 0.5rem;
    background-color: var(--white);
    box-sizing: border-box;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--indigo-500);
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.5);
}

.dark .contact-form input,
.dark .contact-form textarea {
    background-color: var(--gray-800);
    border-color: var(--gray-600);
    color: var(--white);
}

.contact-form button {
    font-size: 18px;
    font-weight: 400;
    width: 100%;
    border: none;
    cursor: pointer;
}

@media (min-width: 768px) {
    .contact-form button {
        width: 50%;
        margin: 0 auto;
    }
}

.contact-details {
    margin-top: 3rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: var(--gray-200);
    padding: 0.5rem 1rem;
    border-radius: 0.5rem;
    color: var(--gray-700);
    text-decoration: none;
    transition: transform 0.3s, background-color 0.3s;
}

.contact-item:hover {
    transform: scale(1.1);
    background-color: var(--gray-300);
}

.social-icon {
    color: var(--indigo-600);
}

.dark .contact-item {
    background-color: var(--gray-800);
    color: var(--gray-300);
}

.dark .contact-item:hover {
    background-color: var(--gray-700);
}

.contact-item i {
    color: var(--indigo-600);
}

.dark .contact-item i {
    color: var(--indigo-500);
}

/* ----- Web3forms contact form ----- */
.form-message {
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 0.5rem;
    text-align: center;
    font-size: 0.95rem;
    font-weight: 500;
    animation: slideDown 0.3s ease-out;
}

.form-message.hidden {
    display: none;
}

.form-message-success {
    background-color: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.dark .form-message-success {
    background-color: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.form-message-error {
    background-color: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.dark .form-message-error {
    background-color: rgba(239, 68, 68, 0.2);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Button Animation */
.contact-form button[type="submit"] {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

.contact-form button[type="submit"] .btn-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.contact-form button[type="submit"]:disabled {
    cursor: not-allowed;
}

/* Slide down animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Hidden class for honeypot */
.hidden {
    display: none !important;
}

/* Improve form input focus states */
.contact-form input:focus,
.contact-form textarea:focus {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
}

.dark .contact-form input:focus,
.dark .contact-form textarea:focus {
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
}

/* Button hover effect */
.contact-form button[type="submit"]:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.3);
}

/* Mobile responsiveness for form message */
@media (max-width: 767px) {
    .form-message {
        padding: 0.875rem 1rem;
        font-size: 0.9rem;
    }
}

/* --- Footer --- */
footer {
    padding: 2rem 0;
    background-color: var(--gray-800);
    color: var(--gray-400);
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding-bottom: 3rem;
}

@media (min-width: 768px) {
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
    }
}

.footer-brand h3 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--indigo-500);
    margin-bottom: 1rem;
}

.footer-brand p {
    max-width: 24rem;
    margin: 0;
}

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

.footer-links h4 {
    font-size: 1.125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--indigo-500);
    margin-bottom: 1rem;
}

.footer-links ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    color: var(--gray-400);
    text-decoration: none;
    font-size: 0.875rem;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--white);
}

.footer-bottom {
    padding-top: 2rem;
    border-top: 1px solid var(--gray-700);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

@media (min-width: 768px) {
    .footer-bottom {
        flex-direction: row;
        justify-content: space-between;
    }
}

.footer-bottom p {
    font-size: 0.875rem;
    margin: 0;
}

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

.social-icons a {
    color: var(--gray-400);
    transition: color 0.2s;
}

.social-icons a:hover {
    color: var(--white);
}

.fa-x-twitter {
    padding-top: 2px;
    font-size: 20px;
}

/* Preloader */
#preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    transition: opacity 0.6s ease, visibility 0.6s ease, background 0.3s ease;
    background: linear-gradient(135deg, #0f172a, #1e1b4b);
}

html.light #preloader {
    background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top: 5px solid #8b5cf6;
    border-radius: 50%;
    animation: spin 1s linear infinite, glow 2s ease-in-out infinite;
    padding: 1rem;
    margin: 2rem;
}

html.light .spinner {
    border: 5px solid rgba(0, 0, 0, 0.1);
    border-top: 5px solid #8b5cf6;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes glow {

    0%,
    100% {
        box-shadow: 0 0 10px #8b5cf6, 0 0 20px #6366f1;
    }

    50% {
        box-shadow: 0 0 20px #6366f1, 0 0 30px #8b5cf6;
    }
}

#preloader.fade-out {
    opacity: 0;
    visibility: hidden;
}

/* Mobile UI Improvements */
/* Fix body and html to prevent horizontal overflow */
html,
body {
    width: 100%;
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

/* Fix container to use full width on mobile */
@media (max-width: 767px) {
    .container {
        max-width: 100%;
        width: 100%;
        padding: 0 1rem;
        margin: 0;
        box-sizing: border-box;
    }

    /* Ensure sections cover full width */
    .section,
    .section-alt {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 3.5rem 0;
        box-sizing: border-box;
    }

    /* Fix hero section */
    .hero-section {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        padding: 5rem 1rem 3rem;
        margin: 0;
        box-sizing: border-box;
    }

    .hero-section .container {
        width: 100%;
        max-width: 100%;
        padding: 0 1rem;
    }

    /* Fix navigation */
    nav {
        width: 100%;
        max-width: 100%;
        height: 3.5rem;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .nav-container {
        width: 100%;
        max-width: 100%;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .nav-brand {
        font-size: 1.25rem;
    }

    .mobile-menu-button {
        gap: 0.75rem;
    }

    #menu-btn,
    #theme-toggle-mobile {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
    }

    /* Fix mobile menu */
    #mobile-menu {
        width: 100%;
        max-width: 100%;
        padding: 4rem 1rem 2rem;
        margin: 0;
        box-sizing: border-box;
    }

    #mobile-menu a {
        width: 90%;
        max-width: 350px;
        padding: 1rem 1.5rem;
        font-size: 1.125rem;
        min-height: 56px;
        box-sizing: border-box;
    }

    /* Hero Section */
    .hero-section h1 {
        font-size: 1.875rem;
        line-height: 1.2;
        margin-bottom: 1.25rem;
        word-wrap: break-word;
        padding: 0;
    }

    .hero-section p {
        font-size: 1.05rem;
        line-height: 1.6;
        margin-bottom: 2rem;
        padding: 0 0.5rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    .hero-buttons {
        flex-direction: column;
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        gap: 1rem;
    }

    .hero-buttons .btn {
        width: 100%;
        padding: 1rem 1.5rem;
        font-size: 1rem;
        min-height: 50px;
        box-sizing: border-box;
    }

    /* Section title */
    .section-title {
        width: 100%;
        max-width: 100%;
        margin-bottom: 2.5rem;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .section-title h2 {
        font-size: 1.875rem;
        line-height: 1.3;
    }

    .title-underline {
        width: 4rem;
        height: 3px;
    }

    /* About Section */
    .about-content {
        width: 100%;
        max-width: 100%;
        gap: 2rem;
        padding: 0;
        box-sizing: border-box;
    }

    .about-image {
        width: 220px;
        height: 220px;
        margin: 0 auto;
    }

    .about-text {
        width: 100%;
        max-width: 100%;
        text-align: center;
        padding: 0 0.5rem;
        box-sizing: border-box;
    }

    .about-text h3 {
        font-size: 1.375rem;
        margin-bottom: 1.25rem;
    }

    .about-text p {
        font-size: 1rem;
        line-height: 1.7;
        margin-bottom: 1.25rem;
        word-wrap: break-word;
    }

    .about-info {
        justify-content: center;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .about-info div {
        font-size: 0.95rem;
    }

    /* Skills Section */
    .skills-grid {
        width: 100%;
        max-width: 100%;
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .skill-card {
        width: 100%;
        max-width: 100%;
        padding: 1.5rem 1rem;
        min-height: auto;
        box-sizing: border-box;
    }

    .skill-card h3 {
        font-size: 1.125rem;
    }

    .skill-card p {
        font-size: 0.95rem;
        line-height: 1.6;
    }

    /* Projects Section */
    .projects-grid {
        width: 100%;
        max-width: 100%;
        gap: 1.75rem;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .project-card {
        width: 100%;
        max-width: 100%;
        border-radius: 1rem;
        box-sizing: border-box;
    }

    .project-card img {
        width: 100%;
        height: 15rem;
        object-fit: cover;
    }

    .project-info {
        width: 100%;
        max-width: 100%;
        padding: 1.25rem;
        height: auto;
        min-height: 16rem;
        box-sizing: border-box;
    }

    .project-info h3 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .project-info p {
        font-size: 0.95rem;
        line-height: 1.6;
        margin-bottom: 1rem;
    }

    .project-tags {
        gap: 0.5rem;
        margin-bottom: 1rem;
        flex-wrap: wrap;
    }

    .project-tags span {
        font-size: 0.8125rem;
        padding: 0.375rem 0.75rem;
    }

    .project-links {
        flex-direction: column;
        gap: 0.75rem;
        width: 100%;
    }

    .project-links a {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.9375rem;
        min-height: 44px;
        box-sizing: border-box;
    }

    /* Contact Section */
    .contact-form {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }

    .form-row {
        gap: 1.25rem;
        width: 100%;
    }

    .contact-form input,
    .contact-form textarea {
        width: 100%;
        font-size: 1rem;
        padding: 0.875rem 1rem;
        border-radius: 0.5rem;
        box-sizing: border-box;
    }

    .contact-form textarea {
        min-height: 150px;
    }

    .contact-form button {
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        min-height: 50px;
        box-sizing: border-box;
    }

    .contact-details {
        width: 100%;
        max-width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 0;
        margin-top: 2.5rem;
        box-sizing: border-box;
    }

    .contact-item {
        width: 100%;
        justify-content: center;
        padding: 1rem 1.25rem;
        font-size: 0.95rem;
        min-height: 50px;
        box-sizing: border-box;
    }

    .contact-item span {
        word-break: break-word;
        overflow-wrap: break-word;
    }

    /* Search bar */
    .filter-bar {
        width: 100%;
        max-width: 100%;
        padding: 0;
        margin-bottom: 2rem;
        box-sizing: border-box;
    }

    .filter-bar input[type="text"] {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
        box-sizing: border-box;
    }

    /* Footer */
    footer {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 2rem 0;
        box-sizing: border-box;
    }

    .footer-content {
        width: 100%;
        max-width: 100%;
        gap: 2.5rem;
        text-align: center;
        padding-bottom: 2rem;
        box-sizing: border-box;
    }

    .footer-brand {
        width: 100%;
        max-width: 100%;
        margin: 0 auto;
        padding: 0 1rem;
        box-sizing: border-box;
    }

    .footer-brand h3 {
        font-size: 1.5rem;
    }

    .footer-brand p {
        font-size: 0.95rem;
        line-height: 1.6;
        max-width: 100%;
    }

    .footer-links {
        width: 100%;
        flex-direction: column;
        gap: 2rem;
        align-items: center;
    }

    .footer-links>div {
        text-align: center;
    }

    .footer-links ul {
        align-items: center;
    }

    .footer-links a {
        font-size: 0.9375rem;
        padding: 0.25rem 0;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.5rem;
    }

    .footer-bottom {
        width: 100%;
        max-width: 100%;
        text-align: center;
        gap: 1.5rem;
        padding-top: 1.5rem;
        box-sizing: border-box;
    }

    .footer-bottom p {
        font-size: 0.875rem;
    }

    .social-icons {
        gap: 2rem;
    }

    .social-icons a {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Fix Vanta background */
    #vanta-bg {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        z-index: -10;
        pointer-events: none;
    }

    /* Smooth animations on mobile */
    .skill-card:hover,
    .project-card:hover {
        transform: translateY(-5px);
    }

    .contact-item:hover {
        transform: scale(1.03);
    }

    /* Button improvements */
    .btn {
        min-height: 48px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
    }
}

/* Extra small screens (smaller phones) */
@media (max-width: 374px) {
    .hero-section h1 {
        font-size: 1.625rem;
    }

    .hero-section p {
        font-size: 0.95rem;
    }

    .section-title h2 {
        font-size: 1.625rem;
    }

    .about-image {
        width: 180px;
        height: 180px;
    }

    .project-card img {
        height: 13rem;
    }

    .project-info {
        min-height: 14rem;
    }

    .contact-item {
        padding: 0.875rem 1rem;
        font-size: 0.875rem;
    }
}

/* Landscape mode on mobile */
@media (max-width: 767px) and (orientation: landscape) {
    .hero-section {
        min-height: auto;
        padding: 5rem 1rem 2.5rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
        margin-bottom: 1rem;
    }

    .hero-section p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
    }

    .hero-buttons {
        flex-direction: row;
        max-width: 500px;
        gap: 1rem;
    }

    .hero-buttons .btn {
        width: auto;
        flex: 1;
    }

    .section {
        padding: 2.5rem 0;
    }

    .about-image {
        width: 180px;
        height: 180px;
    }
}

/* Tablet screens */
@media (min-width: 768px) and (max-width: 1023px) {
    .container {
        padding: 0 2rem;
    }

    .hero-section h1 {
        font-size: 2.75rem;
    }

    .hero-section p {
        font-size: 1.25rem;
    }

    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .about-content {
        gap: 2.5rem;
    }

    .contact-form button {
        width: 60%;
    }
}

/* Medium tablets */
@media (min-width: 641px) and (max-width: 767px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero-buttons {
        flex-direction: row;
        max-width: 500px;
        gap: 1.5rem;
    }

    .hero-buttons .btn {
        flex: 1;
    }
}

/* Improve touch targets globally */
@media (hover: none) and (pointer: coarse) {

    a,
    button,
    .btn,
    .nav-menu-item,
    .contact-item {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Prevent text overflow everywhere */
@media (max-width: 767px) {
    * {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }

    h1,
    h2,
    h3,
    h4,
    h5,
    h6,
    p {
        max-width: 100%;
    }
}

/* ============================================
   FIX PRELOADER FOR MOBILE
   ============================================ */
@media (max-width: 767px) {
    #preloader {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 9999;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    #preloader h2 {
        font-size: 1.125rem;
        padding: 0 1rem;
        text-align: center;
        margin: 0;
        color: var(--indigo-600);
    }

    .spinner {
        width: 50px;
        height: 50px;
        margin: 1.5rem;
        border: 4px solid rgba(255, 255, 255, 0.3);
        border-top: 4px solid #8b5cf6;
    }

    html.light .spinner {
        border: 4px solid rgba(0, 0, 0, 0.1);
        border-top: 4px solid #8b5cf6;
    }
}

/* Improve readability in dark mode on mobile */
@media (max-width: 767px) {

    .dark .hero-section p,
    .dark .about-text p,
    .dark .skill-card p,
    .dark .project-info p {
        color: var(--gray-300);
    }
}

/* Fix for very small screens */
@media (max-width: 320px) {
    .container {
        padding: 0 0.75rem;
    }

    .hero-section {
        padding: 4.5rem 0.75rem 2.5rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .hero-section p {
        font-size: 0.9rem;
    }

    .section-title h2 {
        font-size: 1.5rem;
    }

    .nav-brand {
        font-size: 1.125rem;
    }

    .about-image {
        width: 160px;
        height: 160px;
    }
}

/* Ensure all images are responsive */
@media (max-width: 767px) {
    img {
        max-width: 100%;
        height: auto;
    }
}