/* =========================
   Reset & Global Transitions
========================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, sans-serif;
    transition: background 0.4s ease, color 0.4s ease, border-color 0.4s ease, box-shadow 0.4s ease, transform 0.6s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
}

html {
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    color: #f5f6fa;
    background: #0a0c10;
    overflow-x: hidden;
}

body.light-theme {
    color: #333;
    background: #f0f4f8;
}

@keyframes backgroundMove {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* =========================
   Navbar
========================= */
.navbar {
    position: sticky;
    top: 0;
    background: rgba(20, 24, 30, 0.95);
    backdrop-filter: blur(10px);
    z-index: 1000;
    padding: 1rem 0;
}

body.light-theme .navbar {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar ul {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    list-style: none;
}

.navbar a {
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

body.light-theme .navbar a { color: #333; }

.theme-btn {
    background: none;
    border: 1.5px solid #ffffff;
    color: #ffffff;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.light-theme .theme-btn {
    border-color: #333;
    color: #333;
}

/* =========================
   Hero Section
========================= */
.hero {
    position: relative;
    padding: 8rem 2rem;
    background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)),
    url('https://images.unsplash.com/photo-1451187580459-43490279c0fa?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
    animation: backgroundMove 20s ease infinite;
}

body.light-theme .hero {
    background: linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
    url('beach.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.hero-bg-text {
    position: absolute;
    top: 20px;
    left: 20px;
    font-size: 8rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.05);
    z-index: 0;
    user-select: none;
}

body.light-theme .hero-bg-text { color: rgba(0, 0, 0, 0.03); }

.hero-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4rem;
    position: relative;
    z-index: 2;
}

.hero-text h1 { font-size: 3.2rem; color: #fff; margin-bottom: 1rem; }
body.light-theme .hero-text h1 { color: #1a1a1a; }

.hero-text .subtitle { color: #1e90ff; font-weight: 600; font-size: 1.2rem; margin-bottom: 1.5rem; }

.education-summary { border-top: 1px solid rgba(255, 255, 255, 0.2); margin-top: 2rem; padding-top: 1.5rem; }
body.light-theme .education-summary { border-color: rgba(0,0,0,0.1); }

/* =========================
   3D Carousel (Hero)
========================= */
.carousel-display {
    position: relative;
    height: 400px;
    width: 320px;
    perspective: 1200px;
}

.carousel-item {
    position: absolute;
    width: 250px;
    height: 350px;
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.7s cubic-bezier(0.25, 1, 0.5, 1);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4);
    left: 50%;
    margin-left: -125px;
}

.carousel-item img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(100%); transition: 0.5s; }
.carousel-item.active { z-index: 10; transform: translate3d(0, 0, 150px); }
.carousel-item.active img { filter: grayscale(0%); }
.carousel-item.prev { z-index: 5; transform: translate3d(-140px, 0, 0) scale(0.85); opacity: 0.7; }
.carousel-item.next { z-index: 5; transform: translate3d(140px, 0, 0) scale(0.85); opacity: 0.7; }
.carousel-item.far-prev { z-index: 2; transform: translate3d(-240px, 0, -100px) scale(0.7); opacity: 0.2; }
.carousel-item.far-next { z-index: 2; transform: translate3d(240px, 0, -100px) scale(0.7); opacity: 0.2; }
.carousel-item.hidden { opacity: 0; pointer-events: none; transform: translate3d(0, 0, -200px); }

.carousel-dots { display: flex; gap: 10px; margin-top: 2rem; justify-content: center; width: 100%; }
.dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid #fff; cursor: pointer; transition: 0.3s; }
body.light-theme .dot { border-color: #333; }
.dot.active { background: #fff; transform: scale(1.2); }
body.light-theme .dot.active { background: #333; }

/* =========================
   Portfolio Section
========================= */
#portfolio {
    padding: 6rem 0;
    background: linear-gradient(rgba(0, 0, 0, 0.9), rgba(0, 0, 0, 0.9)),
    url('https://images.unsplash.com/photo-1550751827-4bd374c3f58b?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.light-theme #portfolio {
    background: linear-gradient(rgba(255, 255, 255, 0.85), rgba(255, 255, 255, 0.85)),
    url('https://images.unsplash.com/photo-1519046904884-53103b34b206?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#portfolio h2 { text-align: center; margin-bottom: 4rem; color: white; font-size: 2.5rem; letter-spacing: 2px; }
body.light-theme #portfolio h2 { color: #333; }

.portfolio-container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 2rem;
    overflow: hidden; /* Ensure scroll isn't visible outside container */
}

.portfolio-grid {
    display: flex;
    gap: 2rem;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    width: max-content;
    padding: 20px;
    overflow-x: auto; /* Allow logic to scroll this element */
    scroll-behavior: smooth;
    scrollbar-width: none; /* Hide scrollbar for cleaner look */
}

.portfolio-grid::-webkit-scrollbar {
    display: none;
}

.portfolio-card {
    flex: 0 0 380px;
    background: rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    color: #fff;
    text-decoration: none;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

body.light-theme .portfolio-card { background: #fff; color: #333; border-color: #eee; box-shadow: 0 15px 40px rgba(0,0,0,0.1); }

.card-image-wrapper { position: relative; height: 240px; overflow: hidden; }
.portfolio-card img { width: 100%; height: 100%; object-fit: cover; }
.card-overlay { position: absolute; inset: 0; background: rgba(30, 144, 255, 0.8); display: flex; align-items: center; justify-content: center; opacity: 0; }
.portfolio-card:hover .card-overlay { opacity: 1; }

.portfolio-content { padding: 1.5rem; }
.portfolio-content h3 { color: #1e90ff; margin-bottom: 0.5rem; }

/* Portfolio Nav Buttons Styling */
.portfolio-nav {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 3rem;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

body.light-theme .nav-btn {
    background: #fff;
    border-color: #ddd;
    color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.nav-btn:hover {
    background: #1e90ff;
    border-color: #1e90ff;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(30, 144, 255, 0.4);
}

/* =========================
   Skills Section
========================= */
#skills {
    padding: 6rem 2rem;
    background: linear-gradient(rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.95)),
    url('https://images.unsplash.com/photo-1518770660439-4636190af475?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.light-theme #skills {
    background: linear-gradient(rgba(240, 244, 248, 0.95), rgba(240, 244, 248, 0.95)),
    url('beach2.jpg');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#skills h2 {
    text-align: center;
    margin-bottom: 4rem;
    color: white;
    font-size: 2.5rem;
    letter-spacing: 2px;
}

body.light-theme #skills h2 { color: #333; }

.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.skill-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 2rem 1rem;
    border-radius: 18px;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
}

body.light-theme .skill-item { background: white; border-color: rgba(0,0,0,0.08); }
.skill-item i { font-size: 2.5rem; margin-bottom: 10px; }
.skill-item span { color: #fff; font-weight: 600; font-size: 0.9rem; }
body.light-theme .skill-item span { color: #333; }

/* =========================
   Contact Section
========================= */
#contact {
    padding: 8rem 2rem;
    background: linear-gradient(rgba(0, 0, 0, 0.8), rgba(0, 0, 0, 0.8)),
    url('https://images.unsplash.com/photo-1516387933901-826145d7d81e?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

body.light-theme #contact {
    background: linear-gradient(rgba(255, 255, 255, 0.8), rgba(255, 255, 255, 0.8)),
    url('https://images.unsplash.com/photo-1519046904884-53103b34b206?auto=format&fit=crop&w=1920&q=80');
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

#contact h2 {
    text-align: center;
    margin-bottom: 3rem;
    color: white;
    font-size: 2.5rem;
    letter-spacing: 2px;
}

body.light-theme #contact h2 { color: #333; }

.contact-container {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(15px);
    padding: 3rem;
    border-radius: 24px;
    max-width: 650px;
    margin: 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .contact-container { background: #fff; border-color: #eee; }

.form-group { margin-bottom: 1.5rem; }
.form-group label { display: block; margin-bottom: 8px; color: #1e90ff; font-weight: 600; }

input, textarea {
    width: 100%;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1.5px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    outline: none;
}

body.light-theme input, body.light-theme textarea { background: #f8fafc; border-color: #e2e8f0; color: #333; }

.submit-btn {
    background: #1e90ff;
    color: white;
    border: none;
    padding: 1rem;
    width: 100%;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-size: 1.1rem;
}

footer { padding: 4rem; text-align: center; color: #666; }

/* =========================
   Mobile Responsiveness
========================= */

/* Tablets and smaller (Max-width: 992px) */
@media (max-width: 992px) {
    .hero-container {
        flex-direction: column;
        text-align: center;
        padding-top: 2rem;
        gap: 2rem;
    }

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

    .hero-bg-text {
        font-size: 5rem;
        top: 10px;
    }

    .carousel-display {
        width: 100%;
        height: 350px;
    }
}

/* Phones (Max-width: 600px) */
@media (max-width: 600px) {
    /* Navbar: Reduce gap and font size */
    .navbar ul {
        gap: 1rem;
        padding: 0 1rem;
    }

    .navbar a {
        font-size: 0.7rem;
        letter-spacing: 0.5px;
    }

    .theme-btn {
        padding: 5px 10px;
        font-size: 0.8rem;
    }

    /* Hero Section */
    .hero {
        padding: 4rem 1rem;
    }

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

    /* Portfolio: Allow cards to shrink or scroll easier */
    .portfolio-card {
        flex: 0 0 280px; /* Smaller cards on mobile */
    }

    .card-image-wrapper {
        height: 180px;
    }

    /* Skills: Use 2 columns instead of many */
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .skill-item {
        padding: 1.5rem 0.5rem;
    }

    /* Contact Form */
    .contact-container {
        padding: 1.5rem;
        margin: 0 1rem;
    }

    /* 3D Carousel Mobile Adjustments */
    .carousel-item {
        width: 180px;
        height: 260px;
        margin-left: -90px;
    }

    .carousel-item.prev { transform: translate3d(-100px, 0, 0) scale(0.8); }
    .carousel-item.next { transform: translate3d(100px, 0, 0) scale(0.8); }

    /* Hide far-items on small screens to prevent overflow */
    .carousel-item.far-prev, .carousel-item.far-next {
        display: none;
    }
}

/* Extra Small Devices */
@media (max-width: 380px) {
    .navbar ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .portfolio-card {
        flex: 0 0 240px;
    }
}