* {
    margin: 0;
    padding: 0;
    /* font-family: 'Avrile Sans', sans-serif; */
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-family: 'BR Segma', sans-serif;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background: #0f1117; /* Richer dark background with a slight blue tone */
    color: #f0f0f0;
}

#header {
    width: 100%;
    height: 100vh;
    /* Use min-height for better Safari support */
    min-height: 100vh; 
    background-image: linear-gradient(rgba(15, 17, 23, 0.7), rgba(15, 17, 23, 0.8)), url(images/background.png);
    background-size: cover;
    background-position: center;
    /* Remove fixed attachment for Safari iOS compatibility */
    background-attachment: scroll;
    background-repeat: no-repeat;
    position: relative; /* Enable positioning for particles */
    /* Ensure proper rendering on Safari iOS */
    -webkit-background-size: cover;
    -webkit-transform: translate3d(0,0,0); /* Hardware acceleration for Safari */
}

/* Particles.js background container */
#particles-js {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    z-index: 1; /* Behind the content */
    background: transparent;
    pointer-events: auto; /* Ensure particles can receive mouse events */
}

/* Three.js canvas specific styling */
#particles-js canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
    pointer-events: auto; /* Explicitly enable mouse events on canvas */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1; /* Ensure canvas stays behind content */
}

/* Ensure header content stays above particles */
#header .container {
    position: relative;
    z-index: 2; /* Above the particles */
    pointer-events: none; /* Allow mouse events to pass through to particles */
    /* Safari mobile fixes */
    -webkit-transform: translate3d(0,0,0);
    transform: translate3d(0,0,0);
    /* Ensure full height on Safari */
    min-height: 100vh;
}

/* Re-enable pointer events for interactive elements */
#header .container nav,
#header .container nav a,
#header .container nav ul,
#header .container nav ul li,
#header .container nav ul li a,
#header .container nav .fas {
    pointer-events: auto; /* Enable interactions for navigation */
}

/* Section divider styles */
.section-divider {
    height: 0.5px; /* Ultra thin divider */
    background: linear-gradient(to right, transparent, #E7D1BB, transparent); /* Warm beige color */
    margin: 0 auto;
    width: 40%; /* Narrower width */
    position: relative;
    opacity: 0.7; /* Slightly more subtle */
}

.container {
    padding: 10px 10%;
}

nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    padding: 15px 0;
}

.logo {
    width: 140px;
}

nav ul li {
    display: inline-block;
    list-style: none;
    margin: 10px 20px;
}

nav ul li a {
    color: #E7D1BB; /* Warm beige for navigation menu text */
    font-family: 'Noto Sans Devanagari', sans-serif;
    text-decoration: none;
    font-size: 18px;
    position: relative;
    transition: color 0.3s;
}

nav ul li a::after {
    content: '';
    width: 0;
    height: 2px; /* Thinner underline */
    background: #E7D1BB; /* Warm beige underline to match text */
    position: absolute;
    left: 0;
    bottom: -6px;
    transition: 0.5s;
}

nav ul li a:hover {
    color: #c8b39e; /* Slightly darker beige on hover */
}

nav ul li a:hover::after {
    width: 100%;
}

.header-text {
    margin-top: 20%;
    font-size: 35px;
}

.header-text p {
    font-family: 'Noto Sans Devanagari', sans-serif;
    color: #d1d5f5; /* Light indigo-white */
}

.header-text h1 {
    font-family: 'Noto Sans Devanagari', sans-serif;
    margin-top: 30px;
    font-size: 65px;
    line-height: 1.2;
    font-weight: 600;
    color: #E7D1BB; /* Warm beige for main header */
}

.header-text h1 span {
    font-family: 'Noto Sans Devanagari', sans-serif;
    color: #6366f1; /* Indigo accent */
}

/* ---------about------------ */
#about {
    padding: 80px 0;
    color: #b8bbd0; /* Lighter text with indigo hint */
    position: relative;
}

/* Add divider before about section */
#about::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 0.5px; /* Ultra thin divider */
    background: linear-gradient(to right, transparent, #E7D1BB, transparent);
    opacity: 0.7; /* Slightly more subtle */
}

.row {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
}

.about-col-1 {
    flex-basis: 35%;
}

.about-col-1 img {
    width: 100%;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(99, 102, 241, 0.1); /* Subtle indigo shadow */
}

.about-col-2 {
    flex-basis: 60%;
}

.sub-title {
    font-family: 'Noto Sans Devanagari', sans-serif;
    font-size: 65px;
    font-weight: 600;
    color: #E7D1BB; /* Warm beige for section headers */
    margin-bottom: 20px;
}

.about-col-2 p {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
}

.about-col-2 p span {
    color: #00a6fb; /* Restored original blue color */
}

.tab-titles {
    display: flex;
    font-size: 20px;
    margin: 20px 0 30px;
}

.tab-titles p {
    font-size: 20px;
    font-weight: bold;
}

.tab-links {
    margin-right: 50px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    position: relative;
    color: #b8bbd0;
    transition: color 0.3s;
}

.tab-links:hover {
    color: #f0f0f0;
}

.tab-links::after {
    content: '';
    width: 0;
    height: 2px; /* Thinner underline */
    background: #6366f1; /* Indigo color */
    position: absolute;
    left: 0;
    bottom: -8px;
    transition: 0.5s;
}

.tab-links.active-link {
    color: #f0f0f0;
}

.tab-links.active-link::after {
    width: 50%;
}

.tab-contents {
    display: none;
    min-height: 220px; /* Minimum height instead of fixed height */
}

.tab-contents.active-tab {
    display: block;
    animation: fadeIn 0.5s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.tab-contents ul li {
    list-style: none;
    font-size: 15px;
    margin: 10px 0;
    line-height: 1.5;
}

.tab-contents ul li span {
    color: #6366f1; /* Indigo color */
    font-size: 15px;
    font-weight: 500;
}

/* -----------portfolio-------------- */
#portfolio {
    padding: 60px 0;
    position: relative;
    background: #10121e; /* Slightly lighter background for section differentiation */
}

/* Add divider before portfolio section */
#portfolio::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 0.5px; /* Ultra thin divider */
    background: linear-gradient(to right, transparent, #E7D1BB, transparent);
    opacity: 0.7; /* Slightly more subtle */
}

.work-list {
    display: grid;
    /* Responsive grid layout to prevent text cutoff on smaller displays */
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    grid-gap: 40px;
    margin-top: 50px;
}

.work {
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3); 
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(99, 102, 241, 0.05); /* Very subtle border */
}

.work:hover {
    transform: translateY(-10px);
    box-shadow: 0 15px 30px rgba(99, 102, 241, 0.2); /* Indigo shadow on hover */
}

.work img {
    width: 100%;
    border-radius: 10px;
    display: block;
    transition: transform 0.5s;
}

.layer {
    width: 100%;
    height: 0;
    background: linear-gradient(rgba(10, 10, 18, 0.8), rgba(99, 102, 241, 0.9)); /* Indigo gradient */
    border-radius: 10px;
    position: absolute;
    left: 0;
    bottom: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 0 40px;
    text-align: center;
    font-size: 14px;
    transition: height 0.5s;
}

.layer h3 {
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffffff;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    text-align: center;
    line-height: 1.3;
}

.layer p {
    color: #e2e4ff;
    line-height: 1.6;
    overflow-wrap: break-word;
    word-wrap: break-word;
    hyphens: auto;
    text-align: center;
}

.layer a {
    margin-top: 20px;
    color: #6366f1;
    text-decoration: none;
    font-size: 18px;
    line-height: 60px;
    background: #fff;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    text-align: center;
    transition: all 0.3s;
}

.layer a:hover {
    background: #6366f1;
    color: white;
}

.work:hover img {
    transform: scale(1.1);
}

.work:hover .layer {
    height: 100%;
}

.btn {
    display: block;
    margin: 50px auto;
    width: fit-content;
    border: 1px solid #6366f1; /* Indigo border */
    padding: 14px 50px;
    border-radius: 6px;
    text-decoration: none;
    color: #E7D1BB; /* Warm beige text color */
    transition: all 0.3s;
    background: transparent;
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 0;
    height: 100%;
    background: #6366f1; /* Indigo background */
    z-index: -1;
    transition: 0.5s;
}

.btn:hover::before {
    width: 100%;
}

.btn:hover {
    color: #E7D1BB; /* Keep warm beige text color on hover */
}

.btn:active,
.btn:focus {
    color: #E7D1BB; /* Keep warm beige text color on active/focus states */
}

/* ------------publications---------------- */
#services {
    padding: 60px 0;
    position: relative;
}

/* Add divider before services section */
#services::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 0.5px; /* Ultra thin divider */
    background: linear-gradient(to right, transparent, #E7D1BB, transparent);
    opacity: 0.7; /* Slightly more subtle */
}

.services-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    grid-gap: 40px;
    margin-top: 50px;
}

.services-list div {
    background: #181b2e; /* Slightly lighter background with indigo hint */
    padding: 40px;
    font-size: 13px;
    font-weight: 300;
    border-radius: 10px;
    transition: all 0.5s;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.1); /* Subtle indigo border */
}

.services-list div i {
    font-size: 50px;
    margin-bottom: 30px;
    color: #6366f1; /* Indigo color */
}

.services-list div h2 {
    font-size: 20px;
    font-weight: 500;
    margin-bottom: 15px;
    font-style: italic;
    color: #f0f0f0;
}

.services-list div p {
    color: #b8bbd0;
    line-height: 1.5;
}

.services-list div a {
    text-decoration: none;
    color: #00a6fb; /* Restored original blue color */
    font-size: 13px;
    margin-top: 20px;
    display: inline-block;
    transition: all 0.3s;
}

.services-list div a i {
    font-size: 15px;
    margin-right: 5px;
    color: #00a6fb; /* Restored original blue color */
}

.services-list div:hover {
    background: linear-gradient(135deg, #181b2e, #4f46e5); /* Gradient on hover */
    transform: translateY(-10px);
    border-color: #6366f1;
}

.services-list div:hover h2,
.services-list div:hover p {
    color: white;
}

.services-list div:hover a {
    color: white;
}

.services-list div:hover a i {
    color: white;
}

/* -----------contact------------- */
#contact {
    padding: 60px 0;
    position: relative;
    background: #10121e; /* Slightly different background */
}

/* Add divider before contact section */
#contact::before {
    content: '';
    position: absolute;
    top: 0;
    left: 15%;
    right: 15%;
    height: 0.5px; /* Ultra thin divider */
    background: linear-gradient(to right, transparent, #E7D1BB, transparent);
    opacity: 0.7; /* Slightly more subtle */
}

.contact-left {
    flex-basis: 35%;
}

.contact-right {
    flex-basis: 60%;
}

.contact-left p {
    margin-top: 30px;
    color: #b8bbd0;
}

.contact-left p i {
    color: #6366f1; /* Indigo color */
    margin-right: 15px;
    font-size: 25px;
}

.social-icons {
    margin-top: 30px;
}

.social-icons a {
    text-decoration: none;
    font-size: 30px;
    margin-right: 15px;
    color: #6366f1; /* Indigo color */
    display: inline-block;
    transition: all 0.3s;
}

.social-icons a:hover {
    color: #00a6fb; /* Blue color */
    transform: translateY(-5px);
}

.btn.btn2 {
    display: inline-block;
    background: #6366f1; /* Indigo background */
    border: 1px solid #6366f1;
    color: #E7D1BB; /* Consistent warm beige text color */
}

.btn.btn2:hover {
    color: #E7D1BB; /* Keep warm beige text color on hover */
}

.btn.btn2:active,
.btn.btn2:focus {
    color: #E7D1BB; /* Keep warm beige text color on active/focus states */
}

.contact-right form {
    width: 100%;
}

form input,
form textarea {
    width: 100%;
    border: 1px solid #292d46; /* Subtle border */
    outline: none;
    background: #181b2e; /* Slightly lighter background */
    padding: 15px;
    margin: 15px 0;
    color: #f0f0f0;
    font-size: 16px;
    border-radius: 6px;
    resize: none;
    transition: all 0.3s;
}

form input:focus,
form textarea:focus {
    border-color: #6366f1; /* Indigo border on focus */
    box-shadow: 0 0 5px rgba(99, 102, 241, 0.2);
}

form .btn2 {
    padding: 14px 60px;
    font-size: 18px;
    margin-top: 20px;
    cursor: pointer;
}

.copyright {
    width: 100%;
    text-align: center;
    padding: 25px 0;
    background: #181b2e;
    font-weight: 300;
    margin-top: 20px;
    border-top: 1px solid rgba(99, 102, 241, 0.1); /* Subtle border */
}

/* ---------------css for small screen------------ */
nav .fas {
    display: none;
}

/* Responsive breakpoints for portfolio grid layout */
/* Large screens (1600px+) - 4 cards per row for 15+ inch displays */
@media only screen and (min-width: 1600px) {
    .work-list {
        grid-template-columns: repeat(4, 1fr);
        max-width: 1400px;
        margin: 50px auto 0;
    }
}

/* Medium-large screens (1200px-1599px) - 3 cards per row for 13-14 inch displays */
@media only screen and (min-width: 1200px) and (max-width: 1599px) {
    .work-list {
        grid-template-columns: repeat(3, 1fr);
        grid-gap: 30px;
    }
}

/* Medium screens (900px-1199px) - 2 cards per row for tablets/small laptops */
@media only screen and (min-width: 900px) and (max-width: 1199px) {
    .work-list {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 30px;
    }
}

/* Small screens (768px-899px) - 2 cards per row for larger tablets */
@media only screen and (min-width: 768px) and (max-width: 899px) {
    .work-list {
        grid-template-columns: repeat(2, 1fr);
        grid-gap: 25px;
    }
}

/* Mobile and tablet responsive design for portfolio */
@media only screen and (max-width: 767px) {
    .work-list {
        grid-template-columns: 1fr;
        grid-gap: 20px;
        margin-top: 30px;
    }
    
    .work {
        margin: 0 auto;
        max-width: 100%;
    }
    
    .layer {
        font-size: 13px;
        padding: 0 30px;
    }
    
    .layer h3 {
        font-size: 18px;
        margin-bottom: 15px;
        line-height: 1.3;
    }
    
    .layer p {
        font-size: 13px;
        line-height: 1.5;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }
}

@media only screen and (max-width: 600px) {
    #header {
        background-image: linear-gradient(rgba(15, 17, 23, 0.7), rgba(15, 17, 23, 0.8)), url(images/phone-background.png);
        /* Ensure background is visible on Safari iOS */
        background-size: cover;
        background-position: center center;
        background-attachment: scroll; /* Important for Safari iOS */
        background-repeat: no-repeat;
        /* Fix for Safari viewport issues */
        height: 100vh;
        min-height: 100vh;
        max-height: 100vh;
        /* Safari iOS specific fixes */
        -webkit-background-size: cover;
        -webkit-transform: translate3d(0,0,0);
        /* Force hardware acceleration */
        transform: translate3d(0,0,0);
    }

    /* Optimize particles for mobile performance */
    #particles-js {
        opacity: 0.7; /* Slightly reduced visibility on mobile */
        /* Improve Safari performance */
        -webkit-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
    }

    .header-text {
        /* Adjust positioning for mobile devices - moved lower to ~70% from top */
        margin-top: calc(50vh + env(safe-area-inset-top, 0px)); /* Works for both Safari and Chrome */
        /* Fallback for browsers that don't support env() */
        margin-top: 50vh;
        font-size: 16px;
        /* Ensure text doesn't get cut off on mobile */
        padding: 0 20px;
        /* Additional padding for better spacing */
        padding-top: 20px;
        /* Center positioning adjustments */
        position: relative;
        z-index: 10;
        top: 0;
        /* Mobile text rendering improvements */
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }

    .header-text h1 {
        font-size: 30px;
        /* Better line spacing for Safari */
        line-height: 1.3;
        /* Prevent text from being too close to edges */
        margin: 20px 0;
    }

    .header-text p {
        /* Ensure subtitle is properly spaced */
        margin-bottom: 10px;
    }

    nav .fas {
        display: block;
        font-size: 25px;
        color: #f0f0f0;
    }

    nav ul {
        background: #181b2e; /* Dark background with indigo hint */
        position: fixed;
        top: 0;
        right: -200px;
        width: 200px;
        height: 100vh;
        /* Safari mobile viewport fix */
        min-height: 100vh;
        max-height: 100vh;
        padding-top: 50px;
        z-index: 1000; /* Higher z-index for Safari */
        transition: right 0.5s;
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.3);
        border-left: 1px solid rgba(99, 102, 241, 0.1); /* Very subtle border */
        /* Safari optimizations */
        -webkit-transform: translate3d(0,0,0);
        transform: translate3d(0,0,0);
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
    }

    nav ul li {
        display: block;
        margin: 25px;
    }

    nav ul li a {
        color: #E7D1BB; /* Warm beige for side menu text */
    }

    nav ul li a:hover {
        color: #c8b39e; /* Slightly darker beige on hover for side menu */
    }

    nav ul .fas {
        position: absolute;
        top: 25px;
        left: 25px;
        cursor: pointer;
    }

    .sub-title {
        font-size: 40px;
    }

    .about-col-1, .about-col-2 {
        flex-basis: 100%;
    }

    .about-col-1 {
        margin-bottom: 30px;
    }

    .about-col-2 {
        font-size: 14px;
        /* Ensure text content matches image width constraints */
        max-width: 100%;
        padding-right: 0;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }

    .about-col-2 p{
        font-size: 14px;
        /* Ensure paragraph text doesn't overflow */
        width: 100%;
        max-width: 100%;
        text-align: justify;
        overflow-wrap: break-word;
        word-wrap: break-word;
        line-height: 1.6;
    }

    .about-col-2 .tab-links {
        font-size: 16px;
        margin-right: 15px; /* Reduced margin to ensure all tabs fit in one line */
    }

    /* Ensure tab titles maintain original layout on mobile */
    .about-col-2 .tab-titles {
        max-width: 100%;
        /* Keep original flex behavior - no wrapping */
    }

    .about-col-2 .tab-contents {
        max-width: 100%;
        overflow-wrap: break-word;
    }

    .about-col-2 .tab-contents ul li {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        line-height: 1.5;
    }

    /* Ensure sub-title doesn't overflow on mobile */
    .about-col-2 .sub-title {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
    }

    .contact-left,
    .contact-right {
        flex-basis: 100%;
    }

    form input,
    form textarea {
        font-size: 16px;
    }
    
    .copyright {
        font-size: 14px;
    }
}

/* Safari iOS specific fixes */
@supports (-webkit-appearance: none) and (stroke-color: transparent) {
    @media only screen and (max-width: 600px) {
        #header {
            /* Force Safari to show background image */
            background-image: linear-gradient(rgba(15, 17, 23, 0.7), rgba(15, 17, 23, 0.8)), url(images/phone-background.png) !important;
            background-size: cover !important;
            background-position: center center !important;
            background-attachment: scroll !important;
            /* Fix Safari viewport height issues */
            height: 100vh !important;
            min-height: 100vh !important;
            /* Safari rendering optimization */
            -webkit-backface-visibility: hidden;
            backface-visibility: hidden;
            -webkit-perspective: 1000;
            perspective: 1000;
        }
        

        
        #header .container {
            /* Ensure container spans full viewport in Safari */
            min-height: 100vh;
            height: 100vh;
            /* Fix Safari container positioning */
            padding-top: env(safe-area-inset-top, 0px);
        }
    }
}

/* iOS Safari landscape orientation fix */
@media only screen and (max-width: 600px) and (orientation: landscape) {
    .header-text {
        margin-top: 25vh; /* Adjusted for landscape mode to maintain lower positioning */
        font-size: 14px;
    }
    
    .header-text h1 {
        font-size: 25px;
        line-height: 1.2;
    }
}

#msg {
    color: #61b752;
    margin-top: 10px;
    display: block;
}