@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;800&display=swap');

:root {
    --bg-body: #050505;
    --mac-body: #121212;
    --mac-bezel: #000;
    --screen-bg: #0a0a0a;
    --text-main: #fff;
    --text-muted: #a1a1aa;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: rgba(0, 0, 0, 0.2);
    --input-bg: rgba(0, 0, 0, 0.4);
    --monitor-shadow: 0 30px 60px rgba(0,0,0,0.9), 0 0 100px rgba(0,0,0,0.5);
    --bezel-glare: inset 0 0 0 1px rgba(255,255,255,0.1);
    --border-radius: 30px;
    --transition: 0.8s cubic-bezier(0.16, 1, 0.3, 1);
    --ambilight-opacity: 0.4;
    --bg-pattern: radial-gradient(rgba(255,255,255,0.05) 1px, transparent 1px);
    --hero-gradient: linear-gradient(45deg, #818cf8, #c084fc, #818cf8);
    --hero-bg: radial-gradient(circle at center, rgba(30, 27, 75, 0.4), transparent);
    --work-bg: radial-gradient(circle at center, rgba(236, 72, 153, 0.15), transparent);
    
    /* Apple Stand */
    --stand-neck: linear-gradient(to right, #444, #777, #444);
    --stand-base: linear-gradient(to bottom, #777, #444);
}

[data-theme="light"] {
    --bg-body: #e5e5ea;
    --mac-body: #f5f5f7;
    --mac-bezel: #ffffff;
    --screen-bg: #f3f4f6; /* slightly darker than white for contrast */
    --text-main: #111827; /* almost black for readability */
    --text-muted: #4b5563; /* stronger dark gray */
    --glass-bg: rgba(255, 255, 255, 0.85); /* more opaque */
    --glass-border: rgba(0, 0, 0, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.1); /* slightly stronger shadow */
    --input-bg: rgba(255, 255, 255, 0.9);
    --monitor-shadow: 0 30px 60px rgba(0,0,0,0.15), 0 0 100px rgba(0,0,0,0.05);
    --bezel-glare: inset 0 0 0 1px rgba(0,0,0,0.05);
    --ambilight-opacity: 0.9; /* much more visible in light mode */
    --bg-pattern: radial-gradient(rgba(0,0,0,0.05) 1px, transparent 1px);
    --hero-gradient: linear-gradient(45deg, #4338ca, #7e22ce, #4338ca); /* Darker purple for readability */
    --hero-bg: radial-gradient(circle at center, rgba(99, 102, 241, 0.1), transparent);
    --work-bg: radial-gradient(circle at center, rgba(236, 72, 153, 0.08), transparent);
    
    /* Apple Stand Light */
    --stand-neck: linear-gradient(to right, #d1d1d6, #ffffff, #d1d1d6);
    --stand-base: linear-gradient(to bottom, #e5e5ea, #d1d1d6);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    min-height: 100vh;
    width: 100vw;
    overflow-x: hidden; /* prevents horizontal body scroll */
    overflow-y: auto; /* Allow scrolling the whole page if screen is too small */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5vh;
    padding-bottom: 2vh;
    position: relative;
    perspective: 1000px;
    transition: background-color var(--transition), color var(--transition);
}

/* Theme Toggle Button */
.theme-toggle {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 100;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    transition: 0.3s;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 5px 15px var(--glass-shadow);
}
.theme-toggle:hover {
    transform: scale(1.1);
}

/* Ambilight - Dynamic glow behind the monitor */
.ambilight-shadow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 70vw;
    height: 70vh;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: #4f46e5;
    filter: blur(120px);
    opacity: var(--ambilight-opacity);
    transition: background 1.5s ease-in-out, opacity var(--transition);
    z-index: 0;
    pointer-events: none;
    will-change: background;
}

/* Monitor Setup */
.monitor-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: var(--transition);
}

.monitor {
    width: 85vw;
    max-width: 1400px;
    height: 75vh;
    background: var(--mac-body);
    border: 14px solid var(--mac-bezel);
    border-radius: var(--border-radius);
    position: relative;
    box-shadow: 
        var(--bezel-glare),
        var(--monitor-shadow);
    overflow: hidden;
    transition: var(--transition);
}

/* Dynamic Island / Camera Notch (visible mostly on mobile but adds Apple flavor) */
.dynamic-island {
    position: absolute;
    top: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: 110px;
    height: 30px;
    background: #000;
    border-radius: 20px;
    z-index: 100;
    display: none; /* Shown on mobile */
    transition: 0.3s;
    box-shadow: inset 0 0 4px rgba(255,255,255,0.1), 0 5px 10px rgba(0,0,0,0.5);
}
.dynamic-island::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #0a0a2a;
    box-shadow: inset -2px -2px 4px rgba(255,255,255,0.2), inset 2px 2px 4px rgba(0,0,0,0.8);
}

/* Home Indicator for iPhone look */
.home-indicator {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 130px;
    height: 5px;
    background: rgba(255,255,255,0.4);
    border-radius: 10px;
    z-index: 100;
    display: none;
}
[data-theme="light"] .home-indicator {
    background: rgba(0,0,0,0.4);
}

.monitor::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: #111;
    border-radius: 50%;
    box-shadow: 0 0 2px rgba(255,255,255,0.2) inset; /* Camera lens PC */
    z-index: 101;
}

/* Inside the Screen */
.screen {
    width: 100%;
    height: 100%;
    overflow-y: auto; 
    overflow-x: hidden; /* Fix horizontal overflow */
    -webkit-overflow-scrolling: touch; /* Smooth scroll on iOS */
    scroll-snap-type: y mandatory;
    scroll-behavior: smooth;
    background-color: var(--screen-bg);
    background-image: var(--bg-pattern);
    background-size: 30px 30px;
    animation: moveBg 20s linear infinite;
    scrollbar-width: none; /* Firefox */
    transition: background-color var(--transition);
}

@keyframes moveBg {
    0% { background-position: 0 0; }
    100% { background-position: 30px 30px; }
}

.screen::-webkit-scrollbar {
    display: none; /* Chrome */
}

/* Custom Scrollbar for Textareas */
textarea::-webkit-scrollbar {
    width: 6px;
}
textarea::-webkit-scrollbar-track {
    background: transparent;
}
textarea::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}
[data-theme="light"] textarea::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.2);
}
textarea::-webkit-scrollbar-thumb:hover {
    background: var(--primary, #6366f1);
}

/* Sections */
.snap-section {
    width: 100%;
    min-height: 100%; /* Allows content to be taller than the screen */
    height: auto;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 6rem 2rem 4rem 2rem; /* Extra top padding for the camera/notch */
}

/* Mac Stand */
.stand-neck {
    width: 140px;
    height: 70px;
    background: var(--stand-neck);
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    box-shadow: 
        inset 0 5px 15px rgba(0,0,0,0.3),
        0 5px 10px rgba(0,0,0,0.1);
    position: relative;
    z-index: 5;
    transition: background var(--transition);
}

.stand-base {
    width: 320px;
    height: 12px;
    background: var(--stand-base);
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    box-shadow: 0 15px 30px rgba(0,0,0,0.3);
    position: relative;
    z-index: 5;
    transition: background var(--transition);
}

/* Pagination - Fluid iOS style */
.pagination-wrapper {
    position: absolute;
    bottom: 25px;
    z-index: 20;
    display: flex;
    justify-content: center;
    width: 100%;
    pointer-events: none;
}

.pagination {
    pointer-events: auto;
    display: flex;
    gap: 15px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 50px;
    border: 1px solid var(--glass-border);
    box-shadow: 0 10px 30px var(--glass-shadow);
    transition: background var(--transition), border var(--transition);
}

.bullet {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    opacity: 0.5;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.bullet:hover {
    opacity: 0.8;
}

.bullet.active {
    background: var(--text-main);
    opacity: 1;
    transform: scale(1.6);
    box-shadow: 0 0 15px var(--text-muted);
}

/* Glassmorphism Utilities */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 3rem;
    box-shadow: 0 20px 40px var(--glass-shadow);
    color: var(--text-main);
    transition: background var(--transition), border var(--transition), box-shadow var(--transition);
}

.content-container {
    max-width: 900px;
    width: 100%;
    text-align: center;
    z-index: 2;
    position: relative;
}

h2 {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--text-main), var(--text-muted));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* SECTION: HERO */
#hero {
    background: var(--hero-bg);
    position: relative;
    overflow: hidden; /* Prevent light beam from spilling onto next section */
}
.hero-content {
    text-align: center;
    z-index: 2;
}
.hero-content h1 {
    font-size: 6rem;
    font-weight: 800;
    letter-spacing: -2px;
    background: var(--hero-gradient);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: shine 5s linear infinite;
    margin-bottom: 1rem;
}
.hero-content p {
    font-size: 1.5rem;
    color: var(--text-muted);
    font-weight: 300;
}
.abstract-bg {
    position: absolute;
    width: 120%;
    height: 120%;
    background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="50" cy="50" r="30" fill="rgba(99,102,241,0.15)" filter="blur(15px)"/></svg>') center/cover;
    z-index: 1;
    animation: rotateBg 20s linear infinite;
}

@keyframes shine {
    to { background-position: 200% center; }
}
@keyframes rotateBg {
    from { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    to { transform: rotate(360deg) scale(1); }
}

/* SECTION: BIO */
#bio {
    background: radial-gradient(circle at top left, rgba(16, 185, 129, 0.1), transparent);
}
.airy-text {
    font-size: 1.3rem;
    line-height: 1.9;
    color: var(--text-muted);
    font-weight: 300;
}

/* SECTION: STACK */
#stack {
    background: radial-gradient(circle at right, rgba(245, 158, 11, 0.1), transparent);
}
.tech-grid {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 3rem;
    flex-wrap: wrap;
}
.tech-grid i {
    font-size: 5rem;
    transition: 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    filter: drop-shadow(0 0 15px rgba(100,100,100,0.1));
    cursor: pointer;
    color: var(--text-main);
}
.tech-grid i:hover {
    transform: translateY(-15px) scale(1.2);
    filter: drop-shadow(0 20px 30px currentColor);
}

/* SECTION: WORK */
#work {
    background: var(--work-bg);
    position: relative;
    overflow: hidden;
}
.carousel-container {
    position: relative;
    width: 100%;
    margin: 1rem 0;
    display: flex;
    align-items: center;
}
.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    width: 45px;
    height: 45px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 10;
    transition: 0.3s;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px);
}
.carousel-btn:hover {
    background: var(--text-main);
    color: var(--bg-body);
}
.prev-btn { left: -10px; }
.next-btn { right: -10px; }

.carousel-wrapper {
    flex: 1;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 1rem 0;
    scroll-behavior: smooth;
}
.carousel-wrapper::-webkit-scrollbar { display: none; }

.carousel-track {
    display: flex;
    gap: 1.5rem;
    padding: 0 40px; /* Space for buttons */
    width: max-content;
}
.carousel-track::after {
    content: '';
    width: 1rem; /* Buffer at the end */
}

.project-card {
    width: 280px;
    flex-shrink: 0;
    scroll-snap-align: center;
    padding: 1.2rem;
    text-align: left;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s;
    cursor: pointer;
}
.project-card:hover {
    transform: translateY(-8px) scale(1.02);
    background: var(--glass-bg);
    box-shadow: 0 20px 40px rgba(0,0,0,0.15);
}
.project-card img {
    width: 100%;
    height: 130px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 1rem;
}
.project-img-placeholder {
    width: 100%;
    height: 130px;
    background: var(--glass-border);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}
.project-card h3 { 
    margin-bottom: 0.5rem;
    font-size: 1.2rem;
}
.project-card p { 
    font-size: 0.9rem; 
    color: var(--text-muted); 
    margin-bottom: 1rem; 
}
.project-link {
    color: #ec4899;
    text-decoration: none;
    font-weight: 600;
    transition: 0.3s;
}
.project-link:hover { color: #f472b6; }

.external-link {
    display: inline-block;
    color: var(--text-main);
    text-decoration: none;
    font-weight: 600;
    padding: 1rem 2rem;
    border-radius: 50px;
    transition: 0.3s;
}
.external-link:hover {
    background: var(--glass-border);
    transform: translateY(-3px);
}

/* SECTION: CONTACT */
#contact {
    background: radial-gradient(circle at bottom, rgba(99, 102, 241, 0.15), transparent);
}
.glass-form-contact {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    margin-top: 2rem;
    background: var(--glass-bg);
    padding: 3rem;
    border-radius: 24px;
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    box-shadow: 0 20px 40px var(--glass-shadow);
}
.input-group {
    display: flex;
    gap: 1.5rem;
}
.glass-form-contact input, .glass-form-contact textarea {
    flex: 1;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    padding: 18px;
    border-radius: 12px;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    outline: none;
    transition: 0.3s;
}
.glass-form-contact input:focus, .glass-form-contact textarea:focus {
    border-color: #6366f1;
    background: var(--glass-bg);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}
.glass-form-contact button {
    background: linear-gradient(45deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    padding: 18px;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.3s;
}
.glass-form-contact button:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(99, 102, 241, 0.5);
}

/* FOOTER */
.footer {
    width: 100%;
    padding: 1rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    opacity: 0.8;
    margin-top: 1rem;
}

/* Responsive / Device Morphing */
@media (max-width: 1024px) {
    .monitor {
        width: 90vw;
        height: 80vh;
    }
    .hero-content h1 { font-size: 4rem; }
    h2 { font-size: 2.5rem; }
}

@media (max-width: 768px) {
    .monitor {
        width: 85vw;
        max-width: 450px;
        height: 85vh;
        border-width: 12px;
        border-radius: 45px; /* iPad / iPhone look */
    }
    .monitor::after {
        display: none; /* Hide standard camera lens */
    }
    .dynamic-island {
        display: block; /* Show dynamic island to simulate iPhone */
    }
    .home-indicator {
        display: block; /* Show home indicator */
    }
    .stand-neck, .stand-base {
        display: none; /* Hide stand for mobile mode */
    }
    .ambilight-shadow {
        width: 100vw;
        height: 90vh;
    }
    .input-group {
        flex-direction: column;
    }
    .hero-content h1 { font-size: 3rem; }
    .pagination-wrapper { bottom: -40px; } /* Push out of monitor or adjust if needed */
    .glass-panel { padding: 1.5rem; }
    .tech-grid i { font-size: 3rem; }
    .snap-section { padding: 4rem 1rem 3rem 1rem; }
    .screen { 
        scroll-snap-type: none; /* Remove vertical snap entirely on mobile for a silky smooth scroll */
    }
    .carousel-btn { width: 35px; height: 35px; font-size: 0.9rem; }
}

@media (max-width: 480px) {
    .theme-toggle {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
    .monitor {
        width: 90vw;
        height: 90vh;
        border-width: 10px;
        border-radius: 40px; /* iPhone look */
    }
    .dynamic-island {
        width: 100px;
        height: 28px;
        top: 10px;
    }
    .hero-content h1 { font-size: 2.5rem; }
    .glass-form-contact { padding: 1.5rem; }
    .pagination { padding: 8px 15px; gap: 8px; }
    .bullet { width: 8px; height: 8px; }
    .snap-section { padding: 5rem 1rem 3rem 1rem; }
}
