@font-face {
    font-family: 'MyCustomHeroFont';
    src: url('fonts/Halyard\ Display.woff2') format('woff2'),
         url('fonts/Halyard\ Display.woff2') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap; 
}

/* --- CSS Variables for Japandi Aesthetic --- */
:root {
    --bg-color: #F9F7F3; /* Warm, off-white beige */
    --text-color: #2C2A29; /* Soft charcoal */
    --accent-color: #8C8273; /* Muted stone/walnut */
    --font-primary: 'Inter', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* --- Navigation --- */
header {
    /* THE FIX: Locks the menu to the top */
    position: sticky;
    top: 0;
    z-index: 9000; /* Keeps it above the 3D track, but below your overlays */
    
    /* Adds a solid background so it's readable when scrolling over your 3D cards */
    background-color: var(--bg-color); 
    
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 5%;

    background-color: rgba(249, 247, 243, 0.85); /* 85% opacity of your off-white */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.logo {
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

nav a {
    color: var(--text-color);
    text-decoration: none;
    margin-left: 2rem;
    font-weight: 300;
    transition: color 0.3s ease;
}

nav a:hover {
    color: var(--accent-color);
}

/* --- Mobile Navigation --- */
.menu-toggle {
    display: none; 
    flex-direction: column;
    gap: 8px;
    background: none;
    border: none;
    cursor: none; 
    z-index: 10001; 
    position: relative;
    padding: 10px;
}

.hamburger-line {
    width: 35px;
    height: 2px;
    background-color: var(--text-color);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.4s ease;
}

.menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(10px) rotate(45deg);
}
.menu-toggle.active .hamburger-line:nth-child(2) {
    transform: translateY(-10px) rotate(-45deg);
}

.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    text-align: center;
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.mobile-link {
    font-family: 'Anton', 'MyCustomHeroFont', sans-serif; 
    font-size: clamp(3rem, 15vw, 6rem);
    color: var(--text-color);
    text-decoration: none;
    text-transform: uppercase;
    line-height: 0.9;
}

.mobile-socials {
    display: flex;
    gap: 2rem;
}

.mobile-socials a {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 1rem;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 1px;
}

@media (max-width: 768px) {
    .desktop-nav {
        display: none; 
    }
    .menu-toggle {
        display: flex; 
    }
}

/* --- Aggressive Full-Screen Hero --- */
.hero-bold {
    height: 100vh; 
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 5%;
    position: relative;
}

.hero-title {
    font-family: 'MyCustomHeroFont', sans-serif;
    font-size: clamp(4rem, 15vw, 18rem); 
    font-weight: 900; 
    line-height: 0.85; 
    letter-spacing: -0.04em; 
    text-transform: uppercase;
    margin-bottom: 2rem;
    perspective: 1000px; /* For 3D text effect */
}

.line-wrapper {
    display: block;
    overflow: hidden; 
}

.line {
    display: block; 
}

.hero-meta {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-top: 2px solid var(--text-color);
    padding-top: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- Typographic Play Modifiers --- */
.italic-line {
    font-style: italic;
    padding-right: 0.1em;
    display: inline-block;
}

.motion-line {
    display: inline-block;
    animation: cinematicMotion 4s cubic-bezier(0.45, 0, 0.55, 1) infinite alternate;
}

@keyframes cinematicMotion {
    0% { transform: translateX(-2%) skewX(5deg); letter-spacing: -0.05em; }
    100% { transform: translateX(2%) skewX(-15deg); letter-spacing: 0.02em; }
}

.three-d-line {
    display: inline-block;
    color: var(--text-color);
    transform-style: preserve-3d;
    text-shadow: 
        1px 1px 0 var(--accent-color),
        2px 2px 0 var(--accent-color),
        3px 3px 0 var(--accent-color),
        4px 4px 0 var(--accent-color),
        5px 5px 0 var(--accent-color),
        6px 6px 0 var(--accent-color),
        7px 7px 0 var(--accent-color),
        8px 8px 15px rgba(0,0,0,0.15); 
    will-change: transform;
}

.scroll-prompt {
    font-size: 0.8rem;
    animation: pulse 2s infinite ease-in-out;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* --- Cinematic Portfolio Filters --- */
.portfolio-filters {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    pointer-events: auto; 
}

.filter-btn {
    background: none;
    border: 1px solid rgba(249, 247, 243, 0.3); 
    color: #2c2a2970; 
    font-family: var(--font-primary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.6rem 1.8rem;
    border-radius: 50px;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    cursor: none; 
}

.filter-btn.active, .filter-btn:hover {
    border-color: #F9F7F3;
    background-color: #F9F7F3;
    color: #0f0f0f;
}

/* --- 3D Horizontal Scroll Section --- */
.portfolio-3d-wrapper {
    position: relative;
    width: 100%;
    height: 100vh;
    background-color: #F9F7F3; 
    color: #F9F7F3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    perspective: 2000px; 
    
    /* THE FIX: Enable Native Horizontal Scrolling */
    overflow-x: auto; 
    overflow-y: hidden; /* Prevents vertical jitter */
    -webkit-overflow-scrolling: touch; /* Buttery smooth momentum scrolling on iOS */
    
    /* Hide the ugly default scrollbar for a clean cinematic look */
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

/* Hides scrollbar in Chrome/Safari */
.portfolio-3d-wrapper::-webkit-scrollbar {
    display: none; 
}

.portfolio-header {
    text-align: center;
    position: sticky;
    left: 0;
    
    /* THE FIX: Clean vertical spacing */
    top: 0; 
    padding-top: 5vh; /* Gives space from the top of the screen */
    margin-bottom: 4rem; /* Pushes the 3D track down away from the text */
    
    width: 100vw;
    z-index: 100;
}

.portfolio-3d-track {
    display: flex;
    align-items: center;
    gap: 2rem;
    width: max-content;
    padding: 0 50vw; 
    transform-style: preserve-3d; 
}

.card-3d {
    position: relative;
    height: clamp(250px, 35vh, 400px); 
    flex-shrink: 0;
    border-radius: 16px;
    overflow: hidden;
    will-change: transform; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    transform-origin: center center; 
}

.ratio-16-9 { aspect-ratio: 16 / 9; }
.ratio-9-16 { aspect-ratio: 9 / 16; }

.card-3d .media-content {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* --- 3D Carousel Progress Bar --- */
.carousel-progress-bar {
    position: sticky;
    left: 0;
    
    /* THE FIX: Tell the browser exactly where to pin it vertically */
    bottom: 5vh; /* Adjust this value to float it perfectly above the bottom edge */
    
    width: 100vw; 
    z-index: 100;
}

.progress-fill {
    width: 100%;
    height: 100%;
    background-color: #2C2A29; 
    transform-origin: left center; 
    transform: scaleX(0); 
    will-change: transform;
}

/* --- About & Contact Section --- */
.about-contact-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5rem;
    padding: 8rem 5% 5rem;
    border-top: 2px solid var(--text-color);
    margin-top: 5rem;
}

.section-title {
    font-size: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 2rem;
}

.about-bio {
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    font-weight: 300;
    line-height: 1.4;
    margin-bottom: 4rem;
}

.tech-stack h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    color: var(--accent-color);
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

.stack-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.stack-list li {
    padding: 0.5rem 1rem;
    border: 1px solid var(--text-color);
    border-radius: 50px;
    font-size: 0.85rem;
}

/* Right Side Contact */
.contact-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    width: 100%; 
    height: 100%;
}

.contact-label {
    font-family: 'Anton', 'MyCustomHeroFont', sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    text-transform: uppercase;
    color: var(--text-color);
    margin-bottom: 2rem;
    line-height: 1;
}

.profile-card {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 400px;
    margin-left: auto; 
    margin-right: 0;
    margin-bottom: 3rem;
}

.profile-image-wrapper {
    width: 100%;
    aspect-ratio: 4 / 5; 
    border-radius: 24px; 
    overflow: hidden;
    background-color: #E5E0D8;
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.1); 
    transition: filter 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s ease;
}

.profile-image-wrapper:hover .profile-img {
    filter: grayscale(0%) contrast(1);
    transform: scale(1.03);
}

.premium-email-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 1.2rem 1.5rem;
    border: 1px solid var(--text-color);
    border-radius: 50px; 
    color: var(--text-color);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    z-index: 100;
}

.btn-arrow {
    font-size: 1.2rem;
    transition: transform 0.4s ease;
}

.premium-email-btn:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

.premium-email-btn:hover .btn-arrow {
    transform: translate(4px, -4px); 
}

.social-links {
    display: flex;
    justify-content: center; 
    width: 100%;
    padding-top: 0.5rem;
}

.social-link {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.9rem;
    position: relative;
}

.social-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0%;
    height: 2px;
    background-color: var(--text-color);
    transition: width 0.3s ease;
}

.social-link:hover::after {
    width: 100%;
}

@media (max-width: 900px) {
    .about-contact-section {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    .contact-content {
        align-items: flex-start;
        text-align: left;
    }
    .profile-card {
        margin-left: 0;
    }
}

/* --- Cinematic Project Overlay (Modal) --- */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    
    /* THE FIX: Tempered Glass Effect */
    background-color: rgba(15, 15, 15, 0.55); /* Drops the solid black to 55% opacity */
    backdrop-filter: blur(28px) saturate(120%); /* Heavy blur, and slightly boosts the colors of the 3D room behind it */
    -webkit-backdrop-filter: blur(28px) saturate(120%); /* Required for Safari support */
    
    z-index: 99999;
    color: #F9F7F3;
    opacity: 0;
    visibility: hidden;
}

.modal-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
    background: linear-gradient(to bottom, rgba(15, 15, 15, 1), transparent);
}

.close-modal-btn {
    background: none;
    border: none;
    color: #F9F7F3;
    font-size: 0.9rem;
    font-family: var(--font-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: none; 
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-scroll-area {
    width: 100%;
    height: 100vh;
    overflow-y: auto;
    padding-top: 6rem;
    padding-bottom: 5rem;
    
    /* THE FIX: Traps the scroll inside the modal, preventing bleed-through */
    overscroll-behavior: contain; 
    
    /* THE FIX: Forces momentum-based smooth scrolling for iOS users inside the modal */
    -webkit-overflow-scrolling: touch; 
}

.modal-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 5%;
}

.modal-title {
    font-size: clamp(3rem, 6vw, 5rem);
    font-family: 'Anton', 'MyCustomHeroFont', sans-serif;
    text-transform: uppercase;
    line-height: 1;
    margin-bottom: 3rem;
}

.modal-meta {
    display: flex;
    gap: 4rem;
    border-top: 1px solid rgba(249, 247, 243, 0.2);
    border-bottom: 1px solid rgba(249, 247, 243, 0.2);
    padding: 1.5rem 0;
    margin-bottom: 3rem;
    flex-wrap: wrap;
}

.meta-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.meta-label {
    font-size: 0.75rem;
    color: rgba(249, 247, 243, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.meta-value {
    font-size: 1.1rem;
    font-weight: 500;
}

.modal-text-block {
    max-width: 800px;
    font-size: 1.25rem;
    line-height: 1.6;
    color: rgba(249, 247, 243, 0.8);
    margin-bottom: 5rem;
}

.modal-gallery {
    column-count: 2; 
    column-gap: 1.5rem;
}

.modal-media {
    width: 100%;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    break-inside: avoid;
    object-fit: cover;
}

/* --- Forces a specific image/video to break out of the 2-column layout --- */
.modal-media.full-width {
    column-span: all; /* The magic property that breaks the column grid */
    display: block;
    width: 100%;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .modal-gallery { column-count: 1; }
    .modal-meta { gap: 2rem; }
}

/* --- Footer --- */
footer {
    text-align: center;
    padding: 3rem 0;
    font-size: 0.8rem;
    color: var(--accent-color);
}

/* --- Custom Cursor Micro-interactions --- */
@media (hover: hover) and (pointer: fine) {
    body {
        cursor: none; 
    }

    .custom-cursor {
        position: fixed;
        top: 0;
        left: 0;
        width: 15px;
        height: 15px;
        background-color: var(--accent-color);
        border-radius: 50%;
        pointer-events: none; 
        transform: translate(-50%, -50%);
        transition: width 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                    height 0.3s cubic-bezier(0.16, 1, 0.3, 1), 
                    background-color 0.3s ease;
        
        /* THE FIX: Boosted from 9999 to 999999 so it sits above EVERYTHING, including modals and preloaders */
        z-index: 999999; 
    }

    /* --- Cursor Light Mode (For dark backgrounds) --- */
    .custom-cursor.light-mode {
        background-color: var(--bg-color); /* Swaps to your off-white beige */
    }

    .custom-cursor.active {
        width: 80px;
        height: 80px;
        background-color: rgba(255, 255, 255, 0.1); 
        backdrop-filter: blur(2px) contrast(1.1) brightness(1.1);
        -webkit-backdrop-filter: blur(2px) contrast(1.1) brightness(1.1);
        box-shadow: 
            inset 0 0 12px rgba(255, 255, 255, 0.3),
            inset 2px 2px 6px rgba(255, 255, 255, 0.6), 
            0 8px 24px rgba(0, 0, 0, 0.12);
        border: 1px solid rgba(255, 255, 255, 0.35);
        animation: liquidDistort 4s ease-in-out infinite;  
    }
} 

@keyframes liquidDistort {
    0%, 100% { border-radius: 50% 50% 50% 50% / 50% 50% 50% 50%; }
    25% { border-radius: 46% 54% 48% 52% / 53% 47% 51% 49%; }
    50% { border-radius: 53% 47% 52% 48% / 48% 52% 47% 53%; }
    75% { border-radius: 48% 52% 47% 53% / 54% 46% 52% 48%; }
}

@media (hover: none) {
    .custom-cursor {
        display: none;
    }
}

/* --- Floating Back to Top Button --- */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 5%; 
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.1); 
    backdrop-filter: blur(6px) contrast(1.1) brightness(1.1);
    -webkit-backdrop-filter: blur(6px) contrast(1.1) brightness(1.1);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    color: var(--text-color);
    font-size: 1.5rem;
    cursor: none; 
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0; 
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 99; 
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* --- Cinematic Preloader --- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background-color: var(--text-color); 
    color: var(--bg-color); 
    z-index: 10000;
    display: flex;
    justify-content: flex-end; 
    align-items: flex-end; 
    padding: 0 5% 2vh;
}

.preloader-counter {
    font-family: 'Anton', 'MyCustomHeroFont', sans-serif; 
    font-size: clamp(6rem, 25vw, 30rem); 
    font-weight: 900;
    line-height: 0.75;
    letter-spacing: -0.04em;
}