/* =========================================
   1. VARIABLES & RESET
   ========================================= */
:root { 
    /* Palette */
    --bg: #FBFAF9; 
    --text: #111111; 
    --accent: #D9835C; 
    --card-bg: #ffffff;
    --border: #f0eeec;
    
    /* UI Colors */
    --switcher-bg: #eeeae7;
    --mac-frame: #1a1a1b; 
    --iphone-frame: #eeeae7;
    
    /* Dimensions */
    --container: 1140px; 
}

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

body { 
    font-family: 'Inter', sans-serif; 
    background: var(--bg); 
    color: var(--text); 
    -webkit-font-smoothing: antialiased; 
    overflow-x: hidden; 
}

.hidden { display: none !important; }

/* =========================================
   2. TYPOGRAPHY & HERO SECTIONS
   ========================================= */
h1, h2, h3 { font-family: 'Playfair Display', serif; }

/* Index Page Header */
.index-hero { padding: 40px 20px 20px; text-align: center; max-width: var(--container); margin: 0 auto; }
.site-title { font-size: 0.7rem; font-weight: 600; letter-spacing: 5px; text-transform: uppercase; color: var(--accent); }
.selected-work-label { color: var(--accent); font-size: 0.85rem; font-weight: 600; margin-bottom: 10px; display: block; }
.hero-title { font-size: clamp(2.5rem, 5vw, 4rem); font-weight: 500; margin-bottom: 40px; }

/* Inner Page Header */
.inner-hero { padding: 30px 0px; text-align: left; max-width: var(--container); margin: 0 auto; }
.back-link { 
    text-decoration: none; color: #888; font-weight: 600; font-size: 0.75rem; 
    letter-spacing: 2px; text-transform: uppercase; display: inline-block; 
    margin-bottom: 20px; transition: 0.3s; 
}
.back-link:hover { color: var(--accent); transform: translateY(-2px); }
.hero-meta { color: var(--accent); font-weight: 600; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 3px; display: block; margin-bottom: 10px; }
.inner-title { font-size: 44px; line-height: 1.1; font-weight: 500; }

/* =========================================
   3. PREMIUM SWITCHER (SHARED)
   ========================================= */
.switcher-wrapper { display: flex; justify-content: center; margin-bottom: 30px; }

.switcher-pill { 
    display: inline-flex; 
    background: var(--switcher-bg); 
    padding: 6px; 
    border-radius: 40px; 
    position: relative;
    border: 1px solid rgba(0,0,0,0.03);
}

.switcher-pill button { 
    background: none; border: none; 
    font-family: 'Inter'; font-size: 0.85rem; 
    color: #777; cursor: pointer; 
    transition: color 0.4s ease; 
    font-weight: 600; padding: 10px 24px; 
    border-radius: 30px; 
    z-index: 2; 
    position: relative;
    display: flex; align-items: center; gap: 8px;
}

.switcher-pill button.active { color: #fff; }
.switcher-pill button svg { width: 18px; height: 18px; fill: currentColor; }

.pill-bg {
    position: absolute;
    height: calc(100% - 12px);
    background: #1a1a1b;
    border-radius: 30px;
    top: 6px; left: 6px;
    z-index: 1;
    width: 129px;
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* =========================================
   4. INDEX PAGE: AUTH GATE
   ========================================= */
/* --- Updated Auth Gate Styles --- */
#gatekeeper { 
    position: fixed; inset: 0; 
    background: #FBFAF9; /* Solid fallback */
    display: flex; justify-content: center; align-items: center; z-index: 9999; 
}

.auth-card {
    position: relative; z-index: 10;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    padding: 50px 40px; /* Refined padding */
    border-radius: 32px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 30px 60px rgba(0,0,0,0.1);
    text-align: center; 
    width: 100%;
    max-width: 420px; /* Slightly wider for better breathing room */
    margin: 20px;
}

.auth-card h2 {
    font-size: 1.8rem;
    margin-bottom: 30px;
    font-weight: 500;
}

.auth-card input { 
    width: 100%; 
    padding: 16px 20px; 
    border-radius: 12px; 
    border: 1px solid #e2e2e2; 
    background: #fff; 
    outline: none; 
    margin-bottom: 20px; /* Better spacing */
    text-align: center;
    font-family: 'Inter'; 
    font-size: 1rem;
    transition: border-color 0.3s;
}

.auth-card input:focus {
    border-color: var(--accent);
}

.auth-card button { 
    width: 100%; 
    padding: 16px; 
    background: var(--text); 
    color: white; 
    border: none; 
    border-radius: 12px; 
    font-weight: 600; 
    cursor: pointer; 
    transition: all 0.3s ease;
    letter-spacing: 1px;
}

.auth-card button:hover { 
    background: #333;
    transform: translateY(-1px);
}

/* =========================================
   5. INDEX PAGE: PROJECT GRID
   ========================================= */
#main-content { 
    display: none; 
    padding: 0 20px 0px; 
    width: 100%;
    max-width: var(--container);
    margin: 0 auto; /* Centering Fix */
    opacity: 0; 
    transition: opacity 0.8s ease; 
}

.grid { 
    display: grid; 
    grid-template-columns: repeat(3, 1fr); 
    gap: 30px; 
    width: 100%;
}

.card { 
    text-decoration: none; color: inherit; display: flex; flex-direction: column; opacity: 0; 
    background: var(--card-bg); border-radius: 28px; padding: 12px; border: 1px solid var(--border); 
    transition: transform 0.4s ease, box-shadow 0.4s ease;
    height: 100%;
}
.card:hover { transform: translateY(-10px); box-shadow: 0 25px 50px rgba(40, 30, 20, 0.05); }

/* Card Previews */
.web-preview { width: 100%; aspect-ratio: 16/10; background: #fcfbf9; border-radius: 20px; overflow: hidden; }
.web-preview img { width: 100%; height: 100%; object-fit: cover; transition: 0.8s ease; }

.mobile-preview { 
    width: 100%; aspect-ratio: 3 / 4; border-radius: 20px; 
    display: flex; align-items: center; justify-content: center; 
    overflow: hidden; background: #ffffff; 
}
/* Fixed size for index card iphone only */
.mobile-preview .iphone-frame { width: 190px; height: 395px; max-width: 100%; }

.card-footer { padding: 25px 10px 10px; display: flex; justify-content: space-between; align-items: center; }
.card h3 { font-size: 1.4rem; font-weight: 600; transition: color 0.3s ease; }
.card:hover h3 { color: var(--accent); }
.card p { color: #888; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.arrow-icon { width: 42px; height: 42px; background: #f8f7f6; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: 0.3s; font-size: 1.2rem; min-width: 42px;}
.card:hover .arrow-icon { background: var(--text); color: white; transform: rotate(45deg); }

/* =========================================
   6. INNER PAGE: LAYOUT & SIDEBAR
   ========================================= */
.container { max-width: var(--container); margin: 0 auto; padding: 0 20px; }

.project-layout {
    display: grid; grid-template-columns: 220px 1fr; gap: 60px;
    align-items: start;
    max-width: var(--container); margin: 0 auto;
    padding-top: 40px;
}

.sidebar { position: sticky; top: 40px; padding-top: 20px; }
.sidebar-title { 
    font-size: 0.7rem; color: #999; text-transform: uppercase; 
    letter-spacing: 2px; margin-bottom: 10px; font-weight: 700; 
}
.page-list { list-style: none; }
.page-btn {
    display: block; width: 100%; text-align: left;
    background: none; border: none; padding: 12px 0;
    font-family: 'Inter', sans-serif; font-size: 1rem; color: #555;
    cursor: pointer; border-bottom: 1px solid transparent; transition: 0.3s ease;
}
.page-btn:hover { color: var(--accent); padding-left: 5px; }
.page-btn.active { color: var(--text); font-weight: 600; border-bottom: 1px solid var(--accent); }

.stage-area { display: flex; flex-direction: column; align-items: center; width: 100%; }
.mockup-container { position: relative; width: 100%; display: flex; justify-content: center; }


/* =========================================
   7. SHARED DEVICE MOCKUPS
   ========================================= */
/* iPhone Frame */
.iphone-frame {
    background: var(--iphone-frame); 
    border-radius: 40px; 
    padding: 5px; 
    position: relative;
    border: 1px solid #e8e6e3; 
    box-shadow: 0 0px 30px rgba(0,0,0,0.05);
    transition: transform 0.4s ease;
}

.iphone-screen { 
    width: 100%; height: 100%; background: #fff; 
    border-radius: 35px; overflow: hidden; position: relative; 
    border: 1px solid rgba(0,0,0,0.03); 
}

/* Inner Page iPhone Scroll Logic */
.iphone-wrap .iphone-screen { overflow-y: auto; scrollbar-width: none; }
.iphone-wrap .iphone-screen::-webkit-scrollbar { display: none; }

.iphone-screen img { width: 100%; height: auto; display: block; object-fit: cover; }
.iphone-wrap .iphone-screen img { height: auto; object-fit: contain; } 

/*.dynamic-island { 
    position: absolute; top: 7px; left: 50%; transform: translateX(-50%); 
    width: 44px; height: 14px; background: #000; border-radius: 20px; z-index: 10; 
}*/

/* Inner Page Specific Wrappers */
.iphone-wrap { width: 320px; height: 680px; position: relative; animation: fadeScale 0.6s ease forwards; }
.iphone-wrap .iphone-frame { width: 100%; height: 100%; }

/* MacBook (Inner Page Only) */
.macbook-wrap { width: 100%; max-width: 900px; position: relative; animation: fadeScale 0.6s ease forwards; }
.mac-frame { background: var(--mac-frame); border-radius: 20px 20px 0 0; padding: 12px; position: relative; border: 1px solid #333; }
.mac-screen { 
    width: 100%; aspect-ratio: 16/10; background: #fff; 
    border-radius: 8px; overflow-y: auto; scrollbar-width: none; position: relative; 
}
.mac-screen::-webkit-scrollbar { display: none; }
.mac-screen img { width: 100%; height: auto; display: block; transition: opacity 0.3s ease; }
.mac-base { width: 110%; height: 12px; background: #d1d1d4; margin-left: -5%; border-radius: 2px 2px 14px 14px; border-bottom: 4px solid #b2b2b5; }

/* Scroll Hint */
.scroll-hint {
    position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
    background: rgba(0,0,0,0.8); color: white; padding: 10px 22px; border-radius: 30px;
    font-size: 0.65rem; font-weight: 700; letter-spacing: 2px; pointer-events: none;
    animation: pulseHint 2s infinite; z-index: 30; transition: opacity 0.5s ease, visibility 0.5s;
}
.scroll-hint.fade-out { opacity: 0; visibility: hidden; }

/* =========================================
   8. ANIMATIONS & FOOTER
   ========================================= */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.fade-up { animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

@keyframes fadeScale { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: scale(1); } }
@keyframes pulseHint { 0%, 100% { transform: translate(-50%, 0); } 50% { transform: translate(-50%, 10px); } }

footer { padding: 30px 0 30px; text-align: center; border-top: 1px solid var(--border); color: #888; font-size: 0.8rem; letter-spacing: 1px; margin-top: 40px; }

/* =========================================
   9. RESPONSIVE
   ========================================= */
/* =========================================
   9. IMPROVED MOBILE RESPONSIVE
   ========================================= */
@media (max-width: 992px) { 
    .grid { grid-template-columns: repeat(2, 1fr); } 
    
    .project-layout { 
        grid-template-columns: 1fr; 
        gap: 20px; 
        padding-top: 0px;
        align-content: start;
    }

    /* --- SIDEBAR TO HORIZONTAL SCROLL --- */
    .sidebar { 
        position: sticky; 
        top: 0; 
        z-index: 100;
        background: var(--bg);
        padding: 15px 0;
        padding: 15px 20px;
        border-bottom: 1px solid var(--border);
        overflow: scroll;
    }

    .sidebar-title { display: none; } /* Hide title on mobile to save space */

    .page-list { 
        display: flex; 
        overflow-x: auto; 
        white-space: nowrap; 
        gap: 10px;
        scrollbar-width: none; /* Hide scrollbar Firefox */
        -webkit-overflow-scrolling: touch;
        padding-bottom: 5px;
         margin: 0 -20px; /* Bleed to edges */
    }

    .page-list::-webkit-scrollbar { display: none; } /* Hide scrollbar Chrome/Safari */

    .page-list li { flex: 0 0 auto; }

    .page-btn { 
        padding: 8px 18px; 
        background: #eeeae7; 
        border-radius: 20px; 
        font-size: 0.85rem; 
        border: none;
    }

    .page-btn.active { 
        background: var(--text); 
        color: #fff; 
        border-bottom: none; 
    }
    .page-btn:hover { color: var(--accent); padding-left: 0px; }

    /* Adjust Stages for Mobile */
    .inner-hero { padding: 10px 20px 30px; text-align: center}
    .iphone-wrap { width: 280px; height: 580px; }
    .macbook-wrap {width: 90%}
    
    .hero-meta {margin-bottom: 5px; font-size: 0.7rem}
}



@media (max-width: 768px) { 
    .grid { grid-template-columns: 1fr; } 
    .inner-title { font-size: 28px; }
}