/* =================================================================
   Global & Page Transition Styles
   ================================================================= */

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: #000;
    color: #fff;
    margin: 0;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
    position: relative;
    overflow-x: hidden;
}

body.page-enter {
    opacity: 1;
}

body.page-exit {
    opacity: 0;
}

.portfolio-page {
    background-color: #000;
}


/* Animated Background (For Portfolio Pages) */

.animated-bg {
    position: fixed;
    /* Changed back to fixed to cover the whole viewport */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background: linear-gradient(-45deg, #000000, #333333, #000000, #3c3c3c);
    background-size: 400% 400%;
    /*animation: gradientBG 30s ease infinite;*/
}

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


/* =================================================================
   Landing Page: Split Screen
   ================================================================= */

.split-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    overflow: hidden;
}

.split {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: clip-path 0.8s cubic-bezier(0.7, 0, 0.3, 1);
}

.split::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1;
    transition: background-color 0.5s ease;
}

.split:hover::before {
    background-color: rgba(0, 0, 0, 0.2);
}

.split-bg {
    position: absolute;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transform: scale(1);
    filter: grayscale(100%);
    transition: transform 1s cubic-bezier(0.19, 1, 0.22, 1), filter 1s cubic-bezier(0.19, 1, 0.22, 1);
}

.split:hover .split-bg {
    transform: scale(1.05);
    filter: grayscale(0%);
}

#split-left {
    clip-path: polygon(0 0, 65% 0, 35% 100%, 0 100%);
    justify-content: flex-start;
}

#split-right {
    clip-path: polygon(65% 0, 100% 0, 100% 100%, 35% 100%);
    justify-content: flex-end;
}


/* Landing Page Exit Animations */

.split-container.page-exit-left #split-left {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.split-container.page-exit-left #split-right {
    clip-path: polygon(100% 0, 100% 0, 100% 100%, 100% 100%);
}

.split-container.page-exit-right #split-right {
    clip-path: polygon(0 0, 100% 0, 100% 100%, 0 100%);
}

.split-container.page-exit-right #split-left {
    clip-path: polygon(0 0, 0 0, 0 100%, 0 100%);
}

.split-content {
    position: relative;
    z-index: 2;
    color: white;
    padding: 0 12rem;
    width: 50%;
    transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out, padding 0.5s ease;
}

#split-left .split-content {
    text-align: left;
}

#split-right .split-content {
    text-align: right;
}

.split-container:hover .split:not(:hover) .split-content {
    opacity: 0;
}

.split-heading {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    margin-bottom: 1.5rem;
    transform: scale(1);
    transition: transform 0.7s cubic-bezier(0.19, 1, 0.22, 1);
    line-height: 0.9;
}

.split:hover .split-heading {
    transform: scale(1.2);
}

.split-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    border: 2px solid white;
    border-radius: 9999px;
    text-decoration: none;
    font-weight: 700;
    white-space: nowrap;
    transition: all 0.3s ease;
    color: white;
    background-color: transparent;
    transform: scale(0.8);
}

.split-button:hover {
    background-color: white;
    color: black;
}

.split:hover .split-button {
    transform: scale(1);
}


/* =================================================================
   Portfolio Pages: General Styles
   ================================================================= */

.page-header {
    padding: 1.5rem 3rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 20;
    transition: background-color 0.3s ease, padding 0.3s ease, box-shadow 0.3s ease;
    box-sizing: border-box;
}

.page-header.scrolled {
    background-color: rgba(10, 10, 10, 0.7);
    backdrop-filter: blur(10px);
    padding: 1rem 3rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.header-logo img {
    height: 2rem;
    width: auto;
    transition: height 0.3s ease;
}

.page-header.scrolled .header-logo img {
    height: 1.75rem;
}

.main-nav {
    display: none;
}

@media (min-width: 768px) {
    .main-nav {
        display: flex;
        align-items: center;
        gap: 2rem;
    }
}

.nav-link {
    font-weight: 700;
    text-decoration: none;
    color: #ccc;
    letter-spacing: 0.05em;
    font-size: 0.875rem;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: white;
}

.hero-section {
    height: 100vh;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
    background-color: #000;
    /* Static background for hero */
    background-size: cover;
    background-position: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
}

.hero-section.portfolio::before {
    background: linear-gradient(to right, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.85) 70%);
}

.hero-section.gallery::before {
    background: linear-gradient(to left, rgba(0, 0, 0, 0) 30%, rgba(0, 0, 0, 0.85) 70%);
}

.hero-content,
.hero-about {
    position: relative;
    z-index: 2;
    color: white;
    width: 45%;
}

.hero-heading {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    line-height: 0.9;
}

.content-wrapper {
    padding: 5rem 1.5rem;
    position: relative;
    background-color: transparent;
    /* Changed to allow animated bg to show through */
    z-index: 5;
}

.content-container {
    max-width: 80rem;
    margin: auto;
    position: relative;
    z-index: 2;
}

.section-title {
    font-size: 2.25rem;
    font-weight: 900;
    margin-bottom: 3rem;
    text-align: center;
}


/* Scroll Animation */

.scroll-animate {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.scroll-animate.is-visible {
    opacity: 1;
    transform: translateY(0);
}


/* Footer */

.main-footer {
    background-color: #000;
    padding: 3rem 1.5rem;
    color: #6b7280;
    position: relative;
    z-index: 5;
}

.footer-container {
    max-width: 80rem;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.footer-logo img {
    height: 1.75rem;
    filter: grayscale(1) brightness(2);
}

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

.social-links a {
    color: #6b7280;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: white;
}

.copyright {
    font-size: 0.875rem;
    text-align: center;
}


/* =================================================================
   Portfolio Pages Specifics & Glassmorphism
   ================================================================= */

.hero-section.portfolio {
    justify-content: space-between;
    padding: 0 6rem;
}

.hero-section.portfolio .hero-content {
    text-align: left;
}

.hero-section.portfolio .hero-about {
    text-align: right;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #d1d5db;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 2rem;
}

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

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

.project-card {
    background-color: rgba(26, 26, 26, 0.5);
    /* Glass background */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    /* Safari support */
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.75rem;
    /* Slightly larger radius */
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px) !important;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

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

.card-content {
    padding: 1.5rem;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: #fff;
}

.card-text {
    color: #9ca3af;
    margin-bottom: 1rem;
}

.tag-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag {
    background-color: rgba(51, 51, 51, 0.7);
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 9999px;
    color: #ccc;
}


/* Gallery Page */

.hero-section.gallery {
    justify-content: space-between;
    padding: 0 6rem;
}

.hero-section.gallery .hero-content {
    text-align: right;
}

.hero-section.gallery .hero-about {
    text-align: left;
    font-size: 1.1rem;
    line-height: 1.7;
    color: #d1d5db;
}

.gallery-grid {
    columns: 2;
    gap: 1rem;
}

@media (min-width: 768px) {
    .gallery-grid {
        columns: 3;
    }
}

@media (min-width: 1024px) {
    .gallery-grid {
        columns: 4;
    }
}

.gallery-item {
    margin-bottom: 1rem;
    break-inside: avoid;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, filter 0.3s ease;
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
}

.gallery-item:hover {
    transform: scale(1.03) !important;
    filter: brightness(1.2);
}


/* =================================================================
   Responsive Overrides
   ================================================================= */

@media (max-width: 768px) {
    /* Landing page mobile */
    .split {
        justify-content: center !important;
    }
    #split-left {
        clip-path: polygon(0 0, 100% 0, 100% 30%, 0 70%);
    }
    #split-right {
        clip-path: polygon(0 70%, 100% 30%, 100% 100%, 0 100%);
    }
    .split-content {
        width: 85%;
        padding: 0 1.5rem;
        text-align: center !important;
    }
    #split-left .split-content {
        transform: translateY(-25vh);
    }
    #split-right .split-content {
        transform: translateY(25vh);
    }
    .split-heading {
        font-size: 2.5rem;
        line-height: 1;
    }
    /* Portfolio pages mobile */
    .page-header {
        padding: 1rem 1.5rem;
    }
    .page-header.scrolled {
        padding: 0.75rem 1.5rem;
    }
    .header-logo img {
        height: 1.75rem;
    }
    .hero-section {
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        padding: 0 1.5rem;
        text-align: center;
    }
    .hero-section.gallery {
        flex-direction: column-reverse;
    }
    .hero-section.portfolio::before,
    .hero-section.gallery::before {
        background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 70%);
    }
    .hero-content,
    .hero-about {
        width: 100%;
        text-align: center !important;
    }
    .hero-heading {
        font-size: 2.5rem;
        margin-bottom: 0;
    }
    .hero-about {
        font-size: 1rem;
    }
}