:root {
    --bg-dark: #fbf7f0; /* Soft sunlit beach sand */
    --text-main: #0b2241; /* Deep ocean navy */
    --text-muted: #5e7a91; /* Soft ocean mist */
    --accent-red: #ff8c69; /* Sunrise coral pink */
    --accent-orange: #ffcc5c; /* Morning sun */
    --accent-blue: #00b4d8; /* Tropical ocean */
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(255, 255, 255, 0.4);
}

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

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

/* Background Blobs */
.blob {
    position: fixed;
    border-radius: 50%;
    z-index: -1;
    opacity: 0.5;
    animation: drift 20s infinite alternate ease-in-out;
    will-change: transform;
    pointer-events: none;
}

.blob-1 {
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, var(--accent-red) 0%, transparent 70%);
    top: -20vh;
    left: -10vw;
}

.blob-2 {
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, var(--accent-blue) 0%, transparent 70%);
    bottom: -10vh;
    right: -10vw;
    animation-delay: -5s;
}

.blob-3 {
    width: 30vw;
    height: 30vw;
    background: radial-gradient(circle, var(--accent-orange) 0%, transparent 70%);
    top: 40vh;
    left: 40vw;
    animation-delay: -10s;
}

@keyframes drift {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(30px, 50px) scale(1.1); }
}

/* Typography */
h1 {
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.highlight {
    background: linear-gradient(90deg, #0077b6, #00b4d8, #48cae4); /* Vibrant Ocean Wave */
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Header / Hero */
.hero {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    position: relative;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-muted);
    font-weight: 300;
    max-width: 600px;
    margin: 0 auto 3rem;
}

.scroll-down {
    display: inline-block;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.3s;
    animation: bounce 2s infinite;
}

.scroll-down:hover {
    opacity: 1;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Portfolio Section */
.portfolio-section {
    padding: 5rem 2rem 10rem;
    max-width: 1400px;
    margin: 0 auto;
}

.gallery-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    padding-top: 5rem;
}

/* Scattered Gallery Item */
.gallery-item {
    position: relative;
    width: 320px;
    height: 480px;
    border-radius: 20px;
    overflow: hidden;
    cursor: pointer;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    transition: transform 0.6s cubic-bezier(0.2, 0.8, 0.2, 1), 
                box-shadow 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
    transform: translateY(var(--offsetY, 0)) rotate(var(--rotate, 0deg));
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.gallery-item:hover {
    transform: translateY(calc(var(--offsetY, 0) - 15px)) rotate(0deg) scale(1.03);
    box-shadow: 0 25px 60px rgba(0,0,0,0.6);
    z-index: 10;
}

.gallery-image-wrapper {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.gallery-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.5;
    filter: grayscale(80%) contrast(1.2);
    transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
}

.gallery-item:hover .gallery-image-wrapper img {
    opacity: 1;
    filter: grayscale(0%) contrast(1);
    transform: scale(1.05);
}

.gallery-item-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 3rem 1.5rem 1.5rem;
    background: linear-gradient(to top, rgba(251, 247, 240, 0.95) 0%, rgba(251, 247, 240, 0.7) 60%, transparent 100%);
    transform: translateY(100%);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
}

.gallery-item:hover .gallery-item-content {
    transform: translateY(0);
    opacity: 1;
}

.gallery-item h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.gallery-item span {
    font-size: 0.85rem;
    color: #0077b6; /* Deep ocean blue for high contrast */
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-weight: 800;
}

/* Modal */
.modal {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(251, 247, 240, 0.6);
    backdrop-filter: blur(15px);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
    z-index: 100;
    color: var(--text-main);
}

.modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content.glass {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    max-width: 1140px;
    width: 100%;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    position: relative;
    overflow: hidden;
    transform: translateY(30px) scale(0.95);
    transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.modal.active .modal-content {
    transform: translateY(0) scale(1);
}

.close-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    color: var(--text-main);
    font-size: 2rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.3s, transform 0.3s;
    z-index: 10;
}

.close-button:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: rotate(90deg);
}

.modal-body {
    display: flex;
    flex-direction: column-reverse; /* Put image/link on top for mobile */
    gap: 2rem;
    padding: 2rem;
    max-height: 85vh;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-body {
        flex-direction: row;
        padding: 3rem;
        overflow-y: hidden; /* Lock modal body scroll on desktop */
        align-items: flex-start;
    }
}

.modal-left-column {
    flex: 1.4;
    display: flex;
    flex-direction: column;
    min-height: 0;
    max-height: 78vh;
}

.modal-scrollable-content {
    flex: 1;
    color: var(--text-muted);
    min-height: 0;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .modal-scrollable-content {
        padding-right: 2rem;
    }
}

/* Custom Scrollbar for the description */
.modal-scrollable-content::-webkit-scrollbar {
    width: 6px;
}
.modal-scrollable-content::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.05);
    border-radius: 4px;
}
.modal-scrollable-content::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 4px;
}

.modal-stationary-sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    position: sticky; /* Keep it stationary if there is any overflow on mobile */
    top: 0;
}

.modal-image-container img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.modal-scrollable-content h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    color: var(--text-main);
}

.modal-scrollable-content p {
    font-size: 1.1rem;
    line-height: 1.8;
}

.btn {
    display: inline-block;
    width: 100%; /* Make button span the full width of sidebar */
    box-sizing: border-box;
    text-align: center;
    background: linear-gradient(90deg, var(--accent-blue), #00d2ff);
    color: #fff;
    text-decoration: none;
    padding: 1rem 2rem;
    border-radius: 30px;
    font-weight: 600;
    transition: transform 0.3s, box-shadow 0.3s;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(30, 144, 255, 0.4);
}

.btn-secondary {
    background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
    color: #fff;
    border: none;
    box-shadow: 0 4px 10px rgba(255, 140, 105, 0.2);
}

.btn-secondary:hover {
    background: linear-gradient(90deg, var(--accent-red), var(--accent-orange));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 20px rgba(255, 140, 105, 0.4);
}

/* Modal Skills Integration */
.modal-skills-section {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    padding-bottom: 2rem;
    border-top: 1px solid var(--glass-border);
    align-items: center;
}

.modal-software-icon {
    width: 62px;
    height: 62px;
    border-radius: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.modal-software-icon:hover .icon-title { 
    opacity: 1; 
}

.modal-software-icon .icon-face img {
    width: 32px;
    height: auto;
    object-fit: contain;
}

.modal-software-icon .icon-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(2px);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
    padding: 0.2rem;
}

.modal-skill-tag {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--text-main);
}

/* Deeper Dive Project Pages */
.back-link {
    display: inline-block;
    font-weight: 600;
    color: var(--accent-blue);
    text-decoration: none;
    margin-bottom: 1.5rem;
    transition: transform 0.3s;
}

.back-link:hover {
    transform: translateX(-5px);
}

.project-meta {
    margin-bottom: 2.5rem;
}

.category-tag {
    display: inline-block;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.hero-image {
    width: 100%;
    height: auto;
    border-radius: 24px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.1);
    margin-bottom: 3rem;
}

footer {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--glass-border);
}

/* Interior Pages */
.page-content {
    max-width: 900px;
    margin: 8rem auto 4rem;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

.page-title {
    font-size: 4rem;
    margin-bottom: 2rem;
    color: var(--text-main);
}

.page-subtitle {
    font-size: 2rem;
    line-height: 1.4;
    margin-bottom: 3rem;
    color: var(--text-muted);
    font-weight: 400;
}

.text-block p {
    font-size: 1.15rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.text-block a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 600;
}

.text-block a:hover {
    text-decoration: underline;
}

/* Expertise Section */
.expertise-section {
    margin-bottom: 4rem;
}

.expertise-section h2 {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--glass-border);
    padding-bottom: 0.5rem;
}

.software-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.software-icon {
    width: 90px;
    height: 90px;
    border-radius: 16px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.software-icon:hover {
    transform: translateY(-8px);
    box-shadow: 0 15px 30px rgba(0,0,0,0.1);
}

.icon-face {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    transition: opacity 0.3s;
}

.icon-face img {
    width: 52px;
    height: auto;
    object-fit: contain;
}

.icon-title {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(2px);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    transition: opacity 0.3s;
    text-align: center;
    padding: 0.5rem;
}

.icon-title.long-text {
    font-size: 0.65rem;
    letter-spacing: 0.5px;
    padding: 0.2rem;
}

.software-icon:hover .icon-title {
    opacity: 1;
}

.skills-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.skill-tag {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.75rem 1.5rem;
    border-radius: 30px;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0,0,0,0.02);
    transition: background 0.3s, transform 0.3s;
}

.skill-tag:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-2px);
}

.language-list {
    list-style: none;
    font-size: 1.15rem;
    color: var(--text-main);
}

.language-list li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Navigation Menu */
.home-link {
    position: fixed;
    top: 2rem;
    left: 2rem;
    z-index: 1000;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: -0.5px;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    padding: 0.6rem 1.2rem;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, background 0.3s;
}

.home-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.8);
}

.drawer-home-icon {
    position: absolute;
    top: 2.5rem;
    right: 7rem;
    color: var(--text-main);
    transition: transform 0.3s;
    z-index: 1001;
}

.drawer-home-icon:hover {
    transform: translateY(-2px);
}

.menu-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.5);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 50%;
    width: 60px;
    height: 60px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.3s;
}

.menu-toggle:hover {
    background: rgba(255, 255, 255, 0.8);
}

.menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--text-main);
    transition: transform 0.3s, opacity 0.3s;
}

.about-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 100%;
    max-width: 450px;
    height: 100vh;
    background: rgba(251, 247, 240, 0.95);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--glass-border);
    z-index: 999;
    transition: right 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    padding: 6rem 3rem 3rem;
    box-shadow: -10px 0 40px rgba(0,0,0,0.5);
}

.about-drawer.open {
    right: 0;
}

.close-drawer {
    position: absolute;
    top: 2.5rem;
    right: 2.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 2.5rem;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s;
}

.close-drawer:hover {
    color: var(--text-main);
    transform: rotate(90deg);
}

.drawer-nav {
    list-style: none;
    padding: 0;
    margin: 4rem 0 0 0;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.drawer-link {
    font-size: 3rem;
    font-weight: 800;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s, padding-left 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    display: inline-block;
}

.drawer-link:hover {
    color: var(--text-main);
    padding-left: 1.5rem;
}

.connected-earth-link {
    position: fixed;
    top: 2rem;
    right: 8.5rem;
    z-index: 1000;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-main);
    text-decoration: none;
    letter-spacing: 0.03em;
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(10px);
    padding: 0 1.1rem;
    height: 60px;
    border-radius: 30px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    transition: transform 0.3s, background 0.3s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.connected-earth-link img {
    height: 32px;
    width: 32px;
    object-fit: contain;
    border-radius: 50%;
}

.connected-earth-link:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.8);
}

/* ================================
   Mobile Styles (max-width: 767px)
   ================================ */
@media (max-width: 767px) {

    /* Modal — floating bottom sheet */
    .modal {
        padding: 1rem;
        align-items: flex-end;
    }

    .modal-content.glass {
        border-radius: 20px;
        max-height: 88vh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        width: 100%;
    }

    .modal.active .modal-content {
        transform: translateY(0) scale(1);
    }

    .modal-body {
        flex: 1;
        min-height: 0;
        max-height: none;
        flex-direction: column;
        overflow: hidden;
        padding: 1.5rem 1.25rem 0;
        gap: 0.75rem;
    }

    /* Hide image on mobile */
    .modal-image-container {
        display: none;
    }

    /* Left column fills space, text scrolls */
    .modal-left-column {
        flex: 1;
        min-height: 0;
        max-height: none;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    .modal-scrollable-content {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        padding-right: 0;
    }

    /* Skills pinned below text */
    .modal-skills-section {
        flex-shrink: 0;
        gap: 0.5rem;
        margin-top: 0.75rem;
        padding-top: 0.75rem;
        padding-bottom: 0;
    }

    /* Sidebar — just the button, no image */
    .modal-stationary-sidebar {
        flex: none;
        gap: 0;
    }

    .modal-stationary-sidebar .btn {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        margin-bottom: 1rem;
    }

    .modal-scrollable-content h2 {
        font-size: 1.6rem;
        margin-bottom: 0.75rem;
    }

    .modal-scrollable-content p {
        font-size: 0.95rem;
        line-height: 1.7;
    }

    .modal-software-icon {
        width: 46px;
        height: 46px;
        border-radius: 8px;
    }

    .modal-software-icon .icon-face img {
        width: 30px;
    }

    .modal-software-icon .icon-title {
        font-size: 0.6rem;
        letter-spacing: 0;
    }

    .modal-skill-tag {
        font-size: 0.78rem;
        padding: 0.4rem 0.8rem;
    }

    /* Hide nav when modal open on mobile */
    body:has(.modal.active) .home-link,
    body:has(.modal.active) .menu-toggle {
        display: none;
    }

    /* Close button — larger tap target */
    .close-button {
        width: 44px;
        height: 44px;
        font-size: 1.5rem;
        top: 1rem;
        right: 1rem;
    }

    /* Gallery */
    .gallery-container {
        gap: 2rem;
        padding-top: 3rem;
    }

    .gallery-item {
        width: min(300px, 85vw);
        height: 420px;
    }

    /* Interior pages */
    .page-content {
        margin-top: 5.5rem;
        padding: 1.25rem;
    }

    .page-title {
        font-size: 2.5rem;
        margin-bottom: 1.25rem;
    }

    .page-subtitle {
        font-size: 1.4rem;
        margin-bottom: 2rem;
    }
}
