/* GLOBAL DESIGN SYSTEM - SoloDeveloper */
:root {
    --bg: #080808;
    --text: #94938D;
    --accent: #FFFFFF;
    --border: rgba(255, 255, 255, 0.08);
    --glass: rgba(255, 255, 255, 0.03);
    --font-sans: 'Inter', sans-serif;
    --font-serif: 'Playfair Display', serif;
}

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

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

/* Grain & Cursor */
.grain {
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    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");
    opacity: 0.04;
    pointer-events: none;
    z-index: 9999;
}

.cursor-glow {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    transform: translate(-50%, -50%);
}

/* Navbar */
.navbar-pill {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 1100px;
    height: 64px;
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(40px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    border-radius: 100px;
    z-index: 1000;
    padding: 0 32px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-links-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-link {
    text-decoration: none;
    color: var(--text);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 100px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.nav-link:hover,
.nav-link.active {
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
}

.nav-logo {
    font-weight: 800;
    letter-spacing: 0.1em;
    color: var(--accent);
    text-decoration: none;
    font-size: 14px;
}

/* Structure */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 40px;
    position: relative;
    z-index: 10;
}

.section {
    padding: 160px 0;
    position: relative;
}

/* Typography */
.serif-xl {
    font-family: var(--font-serif);
    font-size: clamp(60px, 10vw, 160px);
    font-style: italic;
    color: var(--accent);
    line-height: 0.85;
    margin-bottom: 40px;
}

.serif-lg {
    font-family: var(--font-serif);
    font-size: clamp(40px, 6vw, 90px);
    font-style: italic;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 30px;
}

/* Assets */
.asset {
    position: absolute;
    background: linear-gradient(135deg, #111, #000);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 50px 100px rgba(0, 0, 0, 0.8);
    z-index: 1;
    pointer-events: none;
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.4s;
}

.reveal {
    opacity: 0;
    transform: translateY(40px);
}

/* Footer */
.footer {
    padding: 100px 0 40px;
    border-top: 1px solid var(--border);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 40px;
}

.footer-col h4 {
    color: var(--accent);
    margin-bottom: 24px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 12px;
}

.footer-links a {
    color: var(--text);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--accent);
}

/* MOBILE RESPONSIVENESS */
@media (max-width: 768px) {
    .container {
        padding: 0 20px;
    }

    .section {
        padding: 80px 0;
    }

    .serif-xl {
        font-size: clamp(40px, 12vw, 80px);
    }

    .navbar-pill {
        padding: 0 16px;
        height: 56px;
        top: 16px;
        width: 98%;
    }

    .nav-link {
        padding: 6px 10px;
        font-size: 9px;
    }

    .nav-logo {
        font-size: 11px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 40px;
        text-align: center;
    }

    .footer-col {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .nav-links-wrap {
        gap: 0;
    }

    /* =========================================
       CHAT CANVAS LAYER (Transparent Overlay)
       ========================================= */
    #chat-canvas-layer {
        position: fixed !important;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: 2147483647 !important;
        /* Max Z-Index */
        background: transparent !important;
        pointer-events: none !important;
        /* Let clicks pass through empty areas */
    }

    /* The Chat Widget Itself */
    div.pubble-app {
        position: absolute !important;
        /* Relative to the fixed layer */
        right: 0 !important;
        bottom: 0 !important;
        max-width: 100vw !important;
        overflow: visible !important;
        pointer-events: none;
        /* Container doesn't block */
    }

    /* Enable Interactivity for Chat Elements */
    div.pubble-app iframe,
    div.pubble-app * {
        pointer-events: auto !important;
    }

    /* Scale down chat button heavily on small screens */
    @media (max-width: 480px) {
        div.pubble-app {
            /* transform: scale(0.85) !important;  <-- REMOVED: Breaks full screen chat */
            /* transform-origin: bottom right !important; */
            right: 0 !important;
            bottom: 0 !important;
            width: 100% !important;
            height: 100% !important;
        }

        .giant-text {
            /* Ensure it doesn't overflow */
            font-size: clamp(40px, 12vw, 80px) !important;
        }
    }
}

/* =========================================
   PORTFOLIO NAVIGATION SWAP
   ========================================= */

/* Default State: Controls are Hidden */
.slider-controls-custom {
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: all 0.5s ease;
}

/* Active State: Controls appear when in Portfolio */
body.in-portfolio-view .slider-controls-custom {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateY(0) !important;
}

/* Navbar disappears when in Portfolio */
body.in-portfolio-view .navbar-pill {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: translateY(-20px) translateX(-50%) !important;
}

/* =========================================
   MOBILE CONTROLS OPTIMIZATION
   ========================================= */
@media (max-width: 768px) {
    .slider-controls-custom {
        width: 95% !important;
        top: 16px !important;
        height: 56px !important;
        margin-bottom: 40px !important;
    }

    .controls-inner {
        padding: 0 12px !important;
    }

    .slider-btn {
        padding: 8px 12px !important;
        font-size: 11px !important;
    }

    .project-meta {
        transform: scale(0.85);
        transform-origin: center;
    }

    .meta-title {
        font-size: 13px !important;
    }
}

/* =========================================
   AGGRESSIVE MOBILE OVERHAUL (< 768px)
   ========================================= */
@media (max-width: 768px) {

    html,
    body {
        overflow-x: hidden !important;
        width: 100% !important;
        position: relative;
    }

    .container {
        width: 100% !important;
        padding: 0 20px !important;
        overflow-x: hidden !important;
        max-width: 100vw !important;
    }

    /* TYPOGRAPHY FIXES */
    h1,
    h2,
    h3,
    .serif-xl,
    .giant-text {
        overflow-wrap: break-word;
        word-wrap: break-word;
        max-width: 100%;
    }

    /* Specific fix for "Freelance..." title */
    h3[style*="font-size: 56px"] {
        font-size: 32px !important;
        /* Force smaller size */
        line-height: 1.3 !important;
    }

    /* NAVBAR & CONTROLS FIXES */
    .navbar-pill {
        width: 92% !important;
        left: 50% !important;
        transform: translateX(-50%) !important;
        padding: 0 16px !important;
    }

    /* Fixed TOP Controls for Mobile (Swapping with Navbar) */
    .slider-controls-custom {
        position: fixed !important;
        top: 16px !important;
        /* Match Navbar Position */
        bottom: auto !important;
        left: 50% !important;
        transform: translate(-50%, -20px) !important;
        /* Start slightly above */
        width: 92% !important;
        padding: 0 10px !important;
        margin: 0 !important;
        z-index: 10000 !important;
    }

    /* Ensure active state animates down correctly on mobile */
    body.in-portfolio-view .slider-controls-custom {
        transform: translate(-50%, 0) !important;
    }

    .nav-link {
        font-size: 10px !important;
        padding: 6px 8px !important;
    }
}