/* --- HIGH-END TYPOGRAPHY & RESET --- */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@300;400;800&family=Syncopate:wght@700&family=Space+Mono:wght@400;700&display=swap');

:root {
    /* DEFAULT: TECHNICAL MODE (Cyber / Cool) */
    --bg: #050505;
    --text: #e1e1e1;
    --accent: #00F0FF; /* Cyan */
    --particle-color: 0, 240, 255; /* RGB for JS injection */
    --grid: rgba(255,255,255,0.05);
    --transition-ease: cubic-bezier(0.25, 1, 0.5, 1);
}

/* CREATIVE MODE OVERRIDES (Organic Espresso) */
body.mode-creative {
    --bg: #271C19; /* Organic Espresso */
    --text: #f5f5f4;
    --accent: #F59E0B; /* Amber Gold */
    --particle-color: 245, 158, 11; /* Amber RGB */
}

* { box-sizing: border-box; margin: 0; padding: 0; cursor: none; /* Custom Cursor */ }

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Manrope', sans-serif;
    overflow-x: hidden;
    width: 100vw;
    transition: background-color 0.8s var(--transition-ease), color 0.8s var(--transition-ease);
}

body.no-scroll { overflow: hidden; }

/* --- NOISE GRAIN OVERLAY --- */
.noise {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

/* --- CUSTOM CURSOR --- */
.cursor-dot, .cursor-circle {
    position: fixed;
    top: 0;
    left: 0;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    z-index: 3000; /* Higher than modal */
    pointer-events: none;
}

.cursor-dot {
    width: 8px;
    height: 8px;
    background: var(--text);
    transition: background 0.8s var(--transition-ease);
}

.cursor-circle {
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255,255,255,0.5);
    transition: width 0.3s, height 0.3s, background 0.3s, border-color 0.8s;
}

/* Hover State for Cursor */
body.hovering .cursor-circle {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(2px);
    border-color: transparent;
}

/* --- BACKGROUND CANVAS --- */
#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    opacity: 0.6; /* Boosted opacity for better visibility */
    transition: opacity 0.8s;
}

/* --- MAIN LAYOUT --- */
main {
    position: relative;
    z-index: 10;
    padding: 0 5vw;
}

header {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-bottom: 1px solid var(--grid);
}

.pre-title {
    font-family: 'Syncopate', sans-serif;
    font-size: 0.8rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 20px;
    display: block;
    transition: color 0.8s var(--transition-ease);
}

/* KINETIC TYPE */
.hero-title {
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(3rem, 10vw, 8rem);
    font-weight: 700;
    line-height: 0.9;
    text-transform: uppercase;
    mix-blend-mode: exclusion;
    position: relative;
}

.hero-title span {
    display: block;
    transition: transform 0.5s cubic-bezier(0.2, 1, 0.3, 1);
}

.hero-title:hover span {
    transform: translateX(20px);
    color: transparent;
    -webkit-text-stroke: 1px var(--text);
}

.role-scroller {
    margin-top: 40px;
    font-size: 1.5rem;
    color: #888;
    overflow: hidden;
    height: 1.5em;
}

.role-scroller div {
    animation: scrollUp 6s infinite cubic-bezier(0.8, 0, 0.2, 1);
}

@keyframes scrollUp {
    0%, 20% { transform: translateY(0); }
    25%, 45% { transform: translateY(-100%); }
    50%, 70% { transform: translateY(-200%); }
    75%, 95% { transform: translateY(-300%); }
    100% { transform: translateY(-400%); }
}

/* --- HUD SWITCH --- */
.hud-switch {
    position: fixed;
    top: 40px;
    right: 5vw;
    z-index: 3000; /* Enhanced z-index above all content */
    display: flex;
    gap: 30px;
    font-family: 'Syncopate', sans-serif;
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    /* Enhanced backdrop for better visibility */
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, opacity 0.3s ease, background-color 0.8s var(--transition-ease);
}

/* Creative mode nav styling */
body.mode-creative .hud-switch {
    background: rgba(39, 28, 25, 0.9); /* Organic Espresso background */
}

/* Hide nav when modal is open */
body.no-scroll .hud-switch {
    transform: translateY(-120px);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.switch-btn {
    position: relative;
    padding: 8px 12px;
    color: #888;
    cursor: none;
    text-transform: uppercase;
    border-radius: 8px;
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Mobile scroll behavior */
@media (max-width: 768px) {
    .hud-switch {
        top: 15px;
        right: 15px;
        padding: 10px 15px;
        gap: 12px;
        font-size: 0.65rem;
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.4s ease;
    }
    
    .hud-switch.hide-on-scroll {
        transform: translateY(-100px);
        opacity: 0;
        pointer-events: none;
    }
    
    /* Ensure nav is properly hidden on mobile when modal is open */
    body.no-scroll .hud-switch {
        transform: translateY(-120px) !important;
        opacity: 0 !important;
        pointer-events: none !important;
    }
}

.switch-btn::before {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 10px;
    width: 0%;
    height: 1px;
    transition: color 0.3s ease-out;
    display: inline-block;
    background: var(--accent);
    transition: width 0.3s ease, background 0.8s var(--transition-ease);
}

.switch-btn.active { color: var(--text); }
.switch-btn.active::before { width: calc(100% - 20px); }
.switch-btn:hover { color: var(--text); }

/* --- SECTIONS --- */
.grid-section {
    display: grid;
    grid-template-columns: 1fr 2fr;
    border-bottom: 1px solid var(--grid);
}

.grid-label {
    padding: 80px 0;
    border-right: 1px solid var(--grid);
    font-family: 'Syncopate', sans-serif;
    text-transform: uppercase;
    font-size: 0.9rem;
    color: #666;
    position: sticky;
    top: 0;
    height: fit-content;
}

.grid-content {
    padding: 80px 0 80px 60px;
    transition: opacity 0.3s ease;
}

.project-item {
    margin-bottom: 100px;
    position: relative;
}

.project-title {
    font-size: 3rem;
    font-weight: 300;
    margin-bottom: 16px;
    transition: letter-spacing 0.3s;
}

.project-item:hover .project-title {
    letter-spacing: 2px;
    color: var(--accent);
}

.project-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 24px;
    font-family: 'Space Mono', monospace;
    font-size: 0.75rem;
    color: #888;
    align-items: center;
}

.company-label {
    color: var(--accent);
    font-weight: 700;
    margin-right: 8px;
    transition: color 0.8s var(--transition-ease);
}

.tag { 
    border: 1px solid rgba(255,255,255,0.2); 
    padding: 4px 12px; 
    border-radius: 4px; 
    background: rgba(255,255,255,0.02);
    margin-bottom: 0.5rem; /* Improved mobile wrapping */
    transition: border-color 0.3s;
}

.project-item:hover .tag { border-color: var(--accent); }

.project-desc {
    max-width: 600px;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.8;
    color: #ccc;
}

/* Optional line clamping for variable text lengths */
.card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3; /* Standard property for compatibility */
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 600px;
    font-size: 1.1rem;
    font-weight: 300;
    line-height: 1.8;
    color: #ccc;
}

/* --- MODAL (SLIDE-OUT) --- */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s var(--transition-ease);
}

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

.project-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: 100%;
    max-width: 700px;
    height: 100vh;
    background: var(--bg);
    border-left: 1px solid var(--accent);
    z-index: 2000;
    transform: translateX(100%);
    transition: transform 0.6s var(--transition-ease), background-color 0.8s var(--transition-ease);
    padding: 80px 5vw;
    overflow-y: auto;
    box-shadow: -10px 0 30px rgba(0,0,0,0.5);
}

.project-modal.active {
    transform: translateX(0);
}

.close-btn {
    position: fixed;
    top: 30px;
    right: 30px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--accent);
    color: var(--accent);
    border-radius: 50%;
    cursor: none;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    z-index: 2001;
    transition: border-color 0.3s, background-color 0.3s, color 0.3s;
}

.close-btn:hover { color: var(--accent); }

.modal-title {
    font-family: 'Syncopate', sans-serif;
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 20px;
    text-transform: uppercase;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 40px;
    font-family: 'Space Mono', monospace;
    font-size: 0.85rem;
    color: var(--accent);
}

.modal-image-placeholder {
    width: 100%;
    height: 300px;
    background: rgba(255,255,255,0.05);
    border: 1px dashed var(--grid);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
    font-family: 'Space Mono', monospace;
    margin-bottom: 40px;
}

.modal-body {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #ddd;
}

.modal-body ul {
    padding-left: 20px;
    margin-top: 20px;
    list-style: none;
}

.modal-body li {
    margin-bottom: 12px;
    position: relative;
    padding-left: 20px;
}

.modal-body li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 12px;
    width: 6px;
    height: 6px;
    background-color: var(--accent);
    transform: translateY(-50%);
}

/* Technical mode: square bullets */
body:not(.mode-creative) .modal-body li::before {
    border-radius: 0;
}

/* Creative mode: circle bullets */
body.mode-creative .modal-body li::before {
    border-radius: 50%;
}

.modal-body strong {
    color: var(--text);
}

/* --- MODAL IMAGES (KINETIC STYLING) --- */
.modal-hero-image, .project-hero-image {
    width: 100%;
    border-radius: 4px;
}

/* --- GLOBAL SOCIALS FOOTER (HUD STYLE) --- */
#global-comms {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: flex;
    gap: 1rem;
    z-index: 2500;
    font-family: 'Space Mono', monospace;
    font-size: 0.8rem;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

#global-comms a {
    color: var(--accent);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: color 0.3s ease;
}

#global-comms a:hover {
    color: var(--text);
}

/* --- PROJECT SOCIAL BUTTONS --- */
.btn-social-project {
    border: 1px solid var(--accent);
    padding: 0.5rem 1rem;
    margin-right: 10px;
    margin-top: 15px;
    display: inline-block;
    border-radius: 4px;
    background: transparent;
    color: var(--text);
    text-decoration: none;
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.8s var(--transition-ease);
}

.btn-social-project:hover {
    background-color: var(--accent);
    color: var(--bg);
}

/* --- FOOTER --- */
footer {
    padding: 100px 5vw;
    border-top: 1px solid var(--grid);
}

#contact-trigger {
    text-decoration: none;
    color: inherit;
}

h2.big-link {
    font-size: clamp(2rem, 6vw, 5rem);
    text-transform: uppercase;
    font-weight: 800;
    line-height: 1;
    cursor: none;
    transition: opacity 0.3s;
}

h2.big-link:hover {
    -webkit-text-fill-color: transparent;
    -webkit-text-stroke: 1px var(--text);
}

/* --- MOBILE RESPONSIVE --- */
@media (max-width: 768px) {
    * { cursor: auto !important; } /* Revert to native cursor */
    
    .cursor-dot, .cursor-circle { display: none; }
    
    .grid-section {
        grid-template-columns: 1fr;
    }
    
    .grid-label {
        position: static;
        padding: 40px 0 20px 0;
        border-right: none;
        border-bottom: 1px solid var(--grid);
    }
    
    .grid-content {
        padding: 40px 0;
    }
    
    .hero-title {
        font-size: clamp(2.5rem, 8vw, 4rem);
    }
    
    .hud-switch {
        top: 20px;
        right: 20px;
        gap: 15px;
        padding: 12px 16px;
        font-size: 0.65rem;
    }
    
    .close-btn {
        top: 20px;
        right: 20px;
        width: 44px;
        height: 44px;
        font-size: 16px;
    }
    
    /* Remove mobile specific styling that was overridden */
    
    .project-modal {
        padding: 60px 20px;
        width: 100%;
    }
    
    .close-btn {
        top: 20px;
        right: 20px;
    }
    
    /* Mobile responsive social links */
    #global-comms {
        bottom: 15px;
        right: 15px;
        flex-direction: column;
        gap: 8px;
        font-size: 0.65rem;
        max-width: 120px;
    }
    
    #global-comms a {
        font-size: 0.65rem;
        letter-spacing: 0.5px;
    }
}