/* ===================================
   VARIABLES & THEMES
   =================================== */
   :root {
    /* Base Variables */
    --font-primary: 'Space Grotesk', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 2rem;
    --spacing-lg: 4rem;
    --spacing-xl: 8rem;
    
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    
    --transition: 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Midnight Theme (Default) */
[data-theme="midnight"] {
    --bg-primary: #0a0a0c;
    --bg-secondary: #111114;
    --bg-tertiary: #1a1a1f;
    --text-primary: #ffffff;
    --text-secondary: #a1a1aa;
    --accent: #6366f1; /* Indigo */
    --accent-glow: rgba(99, 102, 241, 0.3);
    --border: rgba(255, 255, 255, 0.1);
}

/* Terminal Theme */
[data-theme="terminal"] {
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --bg-tertiary: #21262d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent: #3fb950; /* Green */
    --accent-glow: rgba(63, 185, 80, 0.3);
    --border: #30363d;
}

/* Sunset Theme */
[data-theme="sunset"] {
    --bg-primary: #1a1016;
    --bg-secondary: #2d1b25;
    --bg-tertiary: #402634;
    --text-primary: #fff0f5;
    --text-secondary: #dcb5cb;
    --accent: #f472b6; /* Pink */
    --accent-glow: rgba(244, 114, 182, 0.3);
    --border: rgba(244, 114, 182, 0.2);
}

/* ===================================
   RESET & BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color 0.5s ease, color 0.5s ease;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===================================
   LAYOUT UTILS
   =================================== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.section {
    padding: var(--spacing-xl) 0;
}

.section-header {
    margin-bottom: var(--spacing-lg);
    display: flex;
    align-items: baseline;
    gap: 1rem;
}

.section-number {
    font-family: var(--font-mono);
    color: var(--accent);
    font-size: 1.2rem;
    font-weight: 500;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===================================
   NAVIGATION
   =================================== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 1.5rem 0;
    background: rgba(10, 10, 12, 0.8); /* Fallback */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    border-bottom: 1px solid transparent;
    transition: all 0.3s ease;
}

[data-theme="midnight"] .navbar { background: rgba(10, 10, 12, 0.8); }
[data-theme="terminal"] .navbar { background: rgba(13, 17, 23, 0.8); }
[data-theme="sunset"] .navbar { background: rgba(26, 16, 22, 0.8); }

.navbar.scrolled {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.05em;
}

.accent {
    color: var(--accent);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-menu {
    display: flex;
    gap: 2rem;
}

.nav-link {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.nav-link:hover {
    color: var(--accent);
}

/* Theme Switcher */
.theme-switcher {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn {
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
}

.theme-btn:hover {
    color: var(--accent);
    background: var(--bg-tertiary);
}

.theme-menu {
    position: absolute;
    top: 120%;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 120px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: var(--transition);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.theme-switcher:hover .theme-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.theme-menu button {
    text-align: left;
    padding: 0.5rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.theme-menu button:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Hamburger */
.hamburger {
    display: none;
    flex-direction: column;
    gap: 6px;
    cursor: pointer;
}

.hamburger span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: var(--transition);
}

/* ===================================
   HERO SECTION
   =================================== */
.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    padding-top: 80px; /* Nav height */
}

.hero-container {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.hero-content {
    flex: 1;
    max-width: 650px;
}

.hero-image {
    flex: 0 0 350px;
    height: 350px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 40vw; /* Prevent overflow on smaller screens */
}

.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 2rem;
    border: 1px solid var(--border);
    box-shadow: 20px 20px 0 var(--bg-secondary);
    transition: var(--transition);
    /* Removed grayscale to make it visible immediately */
}

.hero-image:hover img {
    transform: translate(-5px, -5px);
    box-shadow: 25px 25px 0 var(--accent);
}

.hero-name {
    font-size: clamp(3rem, 6vw, 4.5rem);
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 1rem;
    background: linear-gradient(to right, var(--text-primary), var(--text-secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.hero-title {
    font-family: var(--font-mono);
    font-size: clamp(1.2rem, 3vw, 1.5rem);
    color: var(--accent);
    margin-bottom: 1.5rem;
}

.hero-value {
    font-size: clamp(1.1rem, 2vw, 1.25rem);
    color: var(--text-secondary);
    max-width: 600px;
    margin-bottom: 3.5rem; /* Increased spacing */
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-bottom: 4rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: var(--transition);
    font-size: 1rem;
}

.btn-primary {
    background: var(--accent);
    color: #fff; /* Always white text on accent */
    box-shadow: 0 4px 15px var(--accent-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--accent-glow);
}

.social-links {
    display: flex;
    gap: 1.5rem;
}

.social-links a {
    color: var(--text-secondary);
    transition: var(--transition);
}

.social-links a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

/* Skills Ticker */
.skills-ticker {
    width: 100%;
    overflow: hidden;
    position: relative;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 1rem 0;
    display: flex;
    mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 10%, black 90%, transparent);
}

.ticker-content {
    display: flex;
    gap: 2rem;
    animation: ticker 30s linear infinite;
    white-space: nowrap;
    padding-right: 2rem;
}

.ticker-content span {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

@keyframes ticker {
    0% { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.scroll-indicator {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.7;
}

.scroll-indicator span {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-secondary);
}

.scroll-indicator .line {
    width: 1px;
    height: 40px;
    background: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.scroll-indicator .line::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--accent);
    animation: scrollLine 2s cubic-bezier(0.77, 0, 0.175, 1) infinite;
}

@keyframes scrollLine {
    0% { transform: translateY(-100%); }
    100% { transform: translateY(100%); }
}

/* ===================================
   ABOUT SECTION
   =================================== */
.about-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr; /* More balanced */
    gap: 3rem; /* Reduced gap */
    align-items: center; /* Center vertically */
}

.about-text p {
    font-size: 1.15rem; /* Slightly larger */
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 600px; /* Prevent lines from being too long */
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

.stat {
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.stat:hover {
    border-color: var(--accent);
    transform: translateY(-5px);
}

.stat-num {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ===================================
   PROJECTS SECTION
   =================================== */
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 6rem;
}

.project-item {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    gap: 4rem;
    align-items: center;
}

.project-item.reverse {
    direction: rtl;
}

.project-item.reverse .project-content {
    direction: ltr;
}

.project-content {
    position: relative;
    z-index: 2;
}

.project-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.project-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    background: var(--bg-secondary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 2rem;
}

.project-tags span {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    color: var(--accent);
    background: rgba(255, 255, 255, 0.05);
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
}

.project-links {
    display: flex;
    gap: 1.5rem;
}

.link-with-icon {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid transparent;
}

.link-with-icon:hover {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* Project Visuals */
.project-visual {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    aspect-ratio: 16/9;
    transition: var(--transition);
}

.project-visual:hover {
    border-color: var(--accent);
    box-shadow: 0 0 30px var(--accent-glow);
}

/* Game Container */
.game-container {
    background: #000;
}

.game-wrapper {
    width: 100%;
    height: 100%;
    position: relative;
}

.game-wrapper iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    z-index: 10;
}

.game-overlay span {
    font-size: 1.5rem;
    font-weight: 700;
    color: #fff;
    padding: 1rem 2rem;
    border: 2px solid #fff;
    border-radius: var(--radius-md);
}

.game-wrapper.active .game-overlay {
    opacity: 0;
    pointer-events: none;
}

/* QueryVeil Visual */
.queryveil-visual {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    height: 100%;
    direction: ltr;
}

.search-bar-simulation {
    width: 100%;
    max-width: 500px;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.search-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-primary);
    color: var(--text-primary);
    width: 100%;
}

.search-icon {
    opacity: 0.5;
}

.cursor {
    animation: blink 1s ease-in-out infinite;
    color: var(--accent);
}

@keyframes blink { 
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.noise-badge {
    font-size: 0.7rem;
    background: var(--accent);
    color: #fff;
    padding: 0.35rem 0.75rem;
    border-radius: 100px;
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
}

.noise-badge.active {
    opacity: 1;
}

.queryveil-container {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 85%;
    align-items: center;
}

.request-log-simulation {
    width: 100%;
    max-width: 500px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem;
    height: 160px;
    overflow: hidden;
    position: relative;
    opacity: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
    transform: translateY(-10px);
}

.request-log-simulation.active {
    opacity: 1;
    transform: translateY(0);
}

.log-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.log-item {
    animation: slideIn 0.3s ease-out forwards;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.log-method {
    color: var(--accent);
    font-weight: 600;
    flex-shrink: 0;
}

.log-url {
    color: var(--text-primary);
    opacity: 0.8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.log-status {
    color: #3fb950;
    font-weight: 600;
    flex-shrink: 0;
}

@keyframes slideIn {
    0% {
        opacity: 0;
        transform: translateX(-10px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Collaborative Editor Visual */
.editor-simulation {
    background: #1e1e1e; /* VS Code dark */
    height: 100%;
    display: flex;
    flex-direction: column;
    font-family: 'Consolas', 'Monaco', monospace;
    border-radius: var(--radius-lg); /* Ensure radius matches container */
    overflow: hidden; /* Clip content */
}

.editor-header {
    background: #252526;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-bottom: 1px solid #333;
}

.dots {
    display: flex;
    gap: 8px;
}

.dots span {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.dots span:nth-child(1) { background: #ff5f56; } /* Red */
.dots span:nth-child(2) { background: #ffbd2e; } /* Yellow */
.dots span:nth-child(3) { background: #27c93f; } /* Green */

.filename {
    color: #cccccc;
    font-size: 0.85rem;
    opacity: 0.8;
}

.editor-body {
    flex: 1;
    padding: 1rem;
    display: flex;
    gap: 1rem;
    position: relative;
    overflow: hidden; /* Prevent scrollbars, just clip */
    background: #1e1e1e;
}

.line-numbers {
    display: flex;
    flex-direction: column;
    color: #858585;
    text-align: right;
    gap: 0; /* Reset gap */
    user-select: none;
    font-size: 14px;
    line-height: 24px; /* Match JS lineHeight */
    min-width: 25px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
}

.code-area {
    color: #d4d4d4;
    flex: 1;
    position: relative;
    white-space: pre; /* Keep pre for code structure */
    font-size: 14px;
    line-height: 24px; /* Match JS lineHeight */
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-variant-ligatures: none;
}

.code-line {
    height: 24px;
    overflow: hidden; /* Clip long lines */
}

.sim-cursor {
    position: absolute;
    width: 2px;
    height: 24px; /* Match line height */
    transition: all 0.1s linear;
    z-index: 10;
    pointer-events: none;
}

.sim-cursor.blink {
    animation: blink 1s ease-in-out infinite;
}

.sim-cursor::after {
    content: attr(data-user);
    position: absolute;
    top: -1.2em;
    left: 0;
    background: inherit;
    color: #fff;
    font-size: 0.7rem;
    padding: 1px 4px;
    border-radius: 2px;
    white-space: nowrap;
}

/* ===================================
   CONTACT SECTION
   =================================== */
.contact-container {
    text-align: center;
    max-width: 900px; /* Increased width */
}

.contact-text {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.contact-links {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-large {
    padding: 1.5rem 2rem;
    font-size: 1.1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-width: 180px;
    gap: 0.5rem;
}

.btn-subtext {
    font-size: 0.8rem;
    opacity: 0.7;
    font-weight: 400;
    font-family: var(--font-mono);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* ===================================
   FOOTER
   =================================== */
.footer {
    padding: 2rem 0;
    border-top: 1px solid var(--border);
    margin-top: 4rem;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-logo {
    font-weight: 700;
    font-size: 1.2rem;
}

.clock-widget {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    border: 1px solid var(--border);
}

.clock-label {
    font-size: 0.8rem;
    opacity: 0.7;
}

.footer-right {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===================================
   RESPONSIVE
   =================================== */
@media (max-width: 1024px) {
    .container {
        padding: 0 1.5rem;
    }
    
    .hero-name {
        font-size: 3.5rem;
    }
}

@media (max-width: 968px) {
    .hero-container {
        flex-direction: column-reverse;
        text-align: center;
        gap: 3rem;
        padding-top: 2rem;
    }

    .hero-content {
        max-width: 100%;
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    .hero-image {
        width: 280px;
        height: 280px;
        flex: 0 0 auto;
        max-width: 80vw;
    }

    .hero-actions {
        justify-content: center;
    }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .project-item {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .project-item.reverse {
        direction: ltr;
    }
    
    .project-item.reverse .project-content {
        direction: ltr;
    }
    
    .project-visual {
        order: -1; /* Visual first on mobile */
        aspect-ratio: 16/10;
    }
}

@media (max-width: 768px) {
    :root {
        --spacing-lg: 3rem;
        --spacing-xl: 5rem;
    }

    .section-title {
        font-size: 2rem;
    }

    .nav-menu {
        display: none;
    }
    
    .hamburger {
        display: flex;
        z-index: 1001;
    }
    
    .nav-menu.active {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100vh;
        background: var(--bg-primary);
        padding: 6rem 2rem 2rem;
        align-items: center;
        justify-content: flex-start;
        gap: 2rem;
        z-index: 1000;
        overflow-y: auto;
    }

    .nav-menu.active li {
        width: 100%;
        text-align: center;
    }

    .nav-menu.active .nav-link {
        font-size: 1.5rem;
        display: block;
        padding: 1rem;
    }
    
    .hero-name {
        font-size: 2.5rem;
    }

    .hero-title {
        font-size: 1.1rem;
    }

    .hero-value {
        font-size: 1rem;
    }
    
    .hero-actions {
        flex-direction: column;
        align-items: center;
        width: 100%;
        gap: 1rem;
    }

    .hero-actions .btn, 
    .hero-actions .social-links {
        width: 100%;
        justify-content: center;
    }

    .about-stats {
        grid-template-columns: 1fr;
    }

    .project-title {
        font-size: 1.5rem;
    }

    .contact-links {
        flex-direction: column;
        width: 100%;
    }

    .btn-large {
        width: 100%;
    }
    
    .footer-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }

    .hero-image {
        width: 200px;
        height: 200px;
    }

    .project-tags {
        justify-content: center;
    }
    
    .ticker-content span {
        font-size: 0.8rem;
    }
}
