:root {
    --primary: #6366f1;
    --text-main: #2d3748;
    --text-muted: #718096;
    --glass-bg: rgba(255, 255, 255, 0.65);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
    --bg-color: #f3f4f6;
    --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --primary: #818cf8;
    --text-main: #f7fafc;
    --text-muted: #a0aec0;
    --glass-bg: rgba(23, 25, 35, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 15px 35px rgba(0, 0, 0, 0.5);
    --bg-color: #0f172a;
    --card-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-color);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    overflow: hidden;
    /* Important for 3D effect containment */
    perspective: 1000px;
    transition: background-color 0.5s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#bg-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
}

#theme-toggle {
    position: fixed;
    top: 2rem;
    right: 2rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: transform 0.2s, background 0.2s;
    color: var(--text-main);
}

#theme-toggle:hover {
    transform: scale(1.1);
}

/* 3D Tilt Container */
.container {
    max-width: 480px;
    width: 100%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 30px;
    padding: 3rem 2rem;
    box-shadow: var(--card-shadow);
    text-align: center;
    transform-style: preserve-3d;
    transition: transform 0.1s ease-out;
    /* Smooth follow, but responsive */
    will-change: transform;
}

/* Content needs to float slightly above the card for depth */
.card-content {
    transform: translateZ(50px);
    transform-style: preserve-3d;
}

/* Profile Wrapper for Status */
.profile-wrapper {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 1.5rem;
    transform-style: preserve-3d;
    transform: translateZ(20px);
}

.profile-pic {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 4px solid var(--glass-border);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    margin: 0;
    transform: none;
}

.status-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    border: 4px solid var(--glass-bg);
    /* Match background to create "cutout" look */
    background-color: #747f8d;
    /* Offline gray */
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s ease;
    z-index: 10;
}

.status-online {
    background-color: #43b581;
}

.status-idle {
    background-color: #faa61a;
}

.status-dnd {
    background-color: #f04747;
}

.status-offline {
    background-color: #747f8d;
}

h1 {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.typing-container {
    height: 1.5rem;
    /* Fixed height to prevent layout shift */
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--primary);
}

.cursor {
    animation: blink 1s step-end infinite;
    margin-left: 2px;
    font-weight: 100;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.email {
    color: var(--text-muted);
    font-size: 0.95rem;
    margin-bottom: 2rem;
    display: block;
    text-decoration: none;
    transform: translateZ(10px);
}

.quote-container {
    background: rgba(255, 255, 255, 0.05);
    /* Very subtle overlay */
    padding: 1.5rem;
    border-radius: 16px;
    margin-bottom: 2rem;
    border: 1px solid var(--glass-border);
    transform: translateZ(30px);
    /* 3D pop */
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
}

.quote-text {
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
    font-style: italic;
    color: var(--text-main);
}

.quote-author {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.skills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    transform: translateZ(15px);
}

.skill-tag {
    background: var(--glass-border);
    padding: 0.5rem 1rem;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-main);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.2s ease;
}

.skill-tag:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.socials {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    transform: translateZ(25px);
}

.social-link {
    color: var(--text-muted);
    transition: all 0.3s;
}

.social-link:hover {
    color: var(--primary);
    transform: translateY(-3px) scale(1.1);
}

@media (max-width: 768px) {
    body {
        /* On mobile, 3D tilt can be distracting or glitchy with scrolling, so we reduce/disable interaction */
        overflow-y: auto;
        padding: 0;
    }

    .container {
        border-radius: 0;
        border: none;
        box-shadow: none;
        transform: none !important;
        /* Disable tilt on mobile */
        min-height: 100vh;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }
}

/* Loading Overlay */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

#loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader {
    width: 48px;
    height: 48px;
    border: 4px solid var(--text-muted);
    border-bottom-color: var(--primary);
    border-radius: 50%;
    display: inline-block;
    box-sizing: border-box;
    animation: rotation 1s linear infinite;
}

@keyframes rotation {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}