:root {
    --bg-color: #050505;
    --bg-gradient: #1a1a1a;
    --card-bg: #111111;
    --card-hover: #1a1a1a;
    --social-btn-bg: rgba(17, 17, 17, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #888888;
    --accent-color: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.5);
    --border-color: #222;
    --font-heading: 'Outfit', -apple-system, sans-serif;
    --font-body: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
    --max-width: 1200px;
    --header-height: 80px;

    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --cv-sidebar-width: 320px;
    --cv-gap: 3rem;
}

[data-theme="light"] {
    --bg-color: #F9FAFB;
    --bg-gradient: #ffffff;
    --card-bg: #FFFFFF;
    --social-btn-bg: #FFFFFF;
    --card-hover: #FFFFFF;
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --accent-color: #2563EB;
    --accent-glow: rgba(37, 99, 235, 0.15);
    --border-color: #E2E8F0;

    --glass-bg: rgba(0, 0, 0, 0.03);
    --glass-border: rgba(0, 0, 0, 0.08);
}

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

html {
    background-color: var(--bg-color);
}

body {
    background-color: var(--bg-color);
    background-image: radial-gradient(circle at 50% 0%, var(--bg-gradient) 0%, transparent 70%);
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--text-primary);
    font-family: var(--font-body);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}


h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text-primary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: 0.3s;
}

.container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* Header */
header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.logo {
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.nav-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.nav-center a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.95rem;
    transition: 0.3s;
    position: relative;
    padding: 0.5rem 0;
}

.nav-center a:hover,
.nav-center a.active {
    color: var(--text-primary);
}

.nav-center a.active::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: var(--accent-color);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-glow);
}

/* Buttons & Badges */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    background: var(--text-primary);
    color: var(--bg-color);
    font-weight: 600;
    font-size: 0.95rem;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.2);
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}

.btn-outline:hover {
    border-color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Special Blue Halo Effect */
.glow-effect {
    transition: all 0.3s ease;
}

.glow-effect:hover {
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.6);
    border-color: var(--accent-color);
}


.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 99px;
    font-size: 0.75rem;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .badge {
    background-color: #E2E8F0;
    /* Slate 200 */
    color: #0F172A;
    /* Slate 900 */
    border-color: #CBD5E1;
    /* Slate 300 */
}

/* Hero Section */
.hero {
    padding: 8rem 0 6rem;
    text-align: center;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
    background: linear-gradient(180deg, #fff 0%, #888 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 540px;
    margin: 0 auto 2.5rem;
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-bottom: 4rem;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    overflow: hidden;
    height: 100%;
}

.full-card-link {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

.card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    background: var(--card-hover);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.75rem;
}

.project-thumbnail {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    background: #222;
}

/* CV Specific */
.cv-header {
    padding: 6rem 0 4rem;
    text-align: center;
}

.timeline-item {
    position: relative;
    padding-bottom: 2rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}

/* Footer */
footer {
    padding: 3rem 0;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.9rem;
}

/* Tab & Terminal */
.tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1px;
}

@media (max-width: 768px) {

    .nav-center,
    .cmd-shortcut {
        display: none !important;
    }

    nav {
        padding: 0 1rem;
    }
}

.tab-btn {
    background: none;
    border: none;
    padding: 0.75rem 0;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    position: relative;
}

.tab-btn.active {
    color: var(--text-primary);
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--text-primary);
}

/* Terminal Window */
.terminal-window {
    background: #0d0d0d !important;
    border: 1px solid #333 !important;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

/* Social Sidebar (Burger Style) */
.social-trigger {
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.social-trigger:hover,
.social-trigger.active {
    background: var(--text-primary);
    color: var(--bg-color);
    transform: scale(1.1);
}

.social-sidebar {
    position: fixed;
    bottom: 6rem;
    /* Just above trigger */
    left: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    z-index: 999;

    /* Animation State: Hidden */
    opacity: 0;
    transform: translateY(20px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.social-sidebar.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.social-link {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--social-btn-bg);
    /* Dark glass */
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    transition: 0.3s;
}

.social-link:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}

.vertical-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--text-secondary), transparent);
    opacity: 0.3;
}

/* Page Transitions (Simple Fade) */
body {
    /* opacity: 0; Removed to prevent invisible page on load error */
    /* transition: opacity 0.3s ease-in-out; Moved to .fade-out class */
}

body.fade-in {
    opacity: 1;
}

/* Filter Buttons */
.filter-bar {
    /* Hiding scrollbar for Chrome/Safari/Opera */
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-btn {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    margin-right: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
    font-family: var(--font-body);
    font-size: 0.9rem;
}

.filter-btn:hover:not(.active) {
    color: var(--text-primary);
    border-color: var(--accent-color);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.5);
    /* Blue Halo */
}

.filter-btn.active {
    background: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
    font-weight: 600;
}

/* Google Translate Customization (Hiding the clutter) */
.goog-te-gadget-simple {
    background-color: transparent !important;
    border: none !important;
    font-size: 0.9rem !important;
}

.goog-te-gadget-simple .goog-te-menu-value {
    color: var(--text-secondary) !important;
    font-family: var(--font-body) !important;
}

.goog-te-gadget-simple .goog-te-menu-value span {
    border-left: none !important;
    /* Remove separator */
    color: var(--text-secondary) !important;
}

.goog-te-gadget-simple .goog-te-menu-value span:last-child {
    display: none;
    /* Hide the arrow if possible or style it */
}

/* Hide the top banner */
.goog-te-banner-frame.skiptranslate {
    display: none !important;
}

body {
    top: 0px !important;
}

/* Hide "Powered by Google" */
/* Language Menu */
.lang-btn {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 0.95rem;
    border-radius: 6px;
    font-family: var(--font-body);
    transition: all 0.2s;
}

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

/* --- Command Palette (Liquid Glass) --- */
#cmd-palette-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

#cmd-palette-backdrop.active {
    display: flex;
    opacity: 1;
}

#cmd-palette {
    width: 100%;
    max-width: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 16px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.95);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

#cmd-palette-backdrop.active #cmd-palette {
    transform: scale(1);
}

.cmd-header {
    display: flex;
    align-items: center;
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    gap: 12px;
}

#cmd-input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    font-size: 1.1rem;
    color: var(--text-primary);
    font-family: inherit;
}

.cmd-esc {
    font-size: 0.75rem;
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 4px;
    color: var(--text-secondary);
}

#cmd-results {
    max-height: 400px;
    overflow-y: auto;
    padding: 8px;
}

.cmd-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.1s;
    color: var(--text-secondary);
}

.cmd-item.selected,
.cmd-item:hover {
    background: var(--accent-glow);
    color: var(--text-primary);
}

.cmd-title {
    font-weight: 500;
}

.cmd-desc {
    font-size: 0.85rem;
    opacity: 0.7;
}

.highlight {
    color: var(--accent-color);
    font-weight: bold;
}

.cmd-info {
    flex: 1;
}

.cmd-hint {
    font-size: 0.8rem;
    opacity: 0.6;
}

.cmd-footer {
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.1);
    border-top: 1px solid var(--border-color);
    font-size: 0.75rem;
    color: var(--text-secondary);
    display: flex;
    gap: 16px;
}

.cmd-footer kbd {
    background: var(--bg-secondary);
    padding: 1px 4px;
    border-radius: 3px;
    font-family: monospace;
}

/* Light Mode Override for Command Palette */
[data-theme="light"] #cmd-palette-backdrop {
    background: rgba(0, 0, 0, 0.2);
    /* Slightly lighter backdrop */
}

[data-theme="light"] #cmd-palette {
    background: rgba(255, 255, 255, 0.95);
    /* More opaque */
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    /* Stronger shadow */
    border: 1px solid rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .cmd-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

/* --- Matrix Easter Egg --- */
#matrix-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    /* Behind UI until UI falls */
    display: none;
    background: black;
}

@keyframes fallDown {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(120vh) rotate(5deg);
        opacity: 0;
    }
}

.matrix-fall {
    animation: fallDown 2s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
    pointer-events: none;
    /* Disable interaction during fall */
}

/* Matrix Active State - Removes page background to reveal canvas */
body.matrix-active {
    background: transparent !important;
    background-image: none !important;
}

/* --- Upside Down Easter Egg --- */
#upsidedown-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -2;
    /* Deepest layer */
    display: none;
    background: linear-gradient(to bottom, #1a0505, #450a0a);
    /* Stranger Things Red/Black */
    pointer-events: none;
}

/* Rotate the entire world */
.world-invert {
    transform: rotate(180deg);
    transition: transform 3s ease-in-out;
    transform-origin: center center;
    overflow-x: hidden;
    /* Prevent weird scrollbars during rotation */
}

/* Instant Invert for "Crossing the Floor" effect */
.world-invert-instant {
    transform: rotate(180deg);
    transition: none !important;
    transform-origin: 50vw 50vh;
    /* Rotate around viewport center */
    overflow: hidden;
    /* Lock Scroll */
    height: 100vh;
    width: 100vw;
    position: fixed;
    /* Force fixed to viewport */
}

/* When Upside Down is Active */
body.upsidedown-active {
    background: transparent !important;
    background-image: none !important;
    overflow: hidden !important;
    /* NO SCROLL */
    height: 100vh;
    width: 100vw;
}

/* Non-functional mode: Only visual */
body.upsidedown-active a,
body.upsidedown-active button,
body.upsidedown-active input,
body.upsidedown-active .project-card {
    pointer-events: none !important;
    cursor: default !important;
}

/* LOCK EVERYTHING including Carousel Scroll */
body.upsidedown-active .container {
    pointer-events: none !important;
    /* This prevents scroll events reaching the carousel */
}

/* --- Dino Game Easter Egg --- */
#dino-game-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
    /* Hidden by default */
    background: rgba(15, 23, 42, 0.9);
    /* Dark slate panel */
    padding: 2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    flex-direction: column;
    align-items: center;
}

#dino-canvas {
    background: transparent;
    border-bottom: 2px solid #334155;
    /* max-width: 100vw; handled by JS resize */
}

body.dino-active {
    overflow: hidden;
    /* Prevent page scroll */
}

body.dino-active .container {
    pointer-events: none;
    /* Disable main UI interaction */
}

/* --- Tetris Easter Egg --- */
#tetris-game-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    display: none;
    background: #0f172a;
    padding: 10px;
    border: 4px solid #334155;
    border-radius: 4px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.8);
}

#tetris-canvas {
    background: #000;
    border: 1px solid #1e293b;
}

body.tetris-active {
    overflow: hidden;
}

body.tetris-active .container {
    pointer-events: none;
}

/* Slate 700 - Much darker than default text-secondary */
}

[data-theme="light"] .cmd-item:hover,
[data-theme="light"] .cmd-item.selected {
    background: rgba(0, 0, 0, 0.05);
    /* Proper hover state */
    color: #0F172A;
    /* Slate 900 */
}

[data-theme="light"] .cmd-footer {
    background: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}