/* === BASE STYLES === */
:root {
    --bg-color: #050505;
    --card-bg: rgba(26, 26, 26, 0.6);
    --text-main: #ffffff;
    --text-muted: #888899;
    --accent: #ff3b3b;
    --accent-light: #ff5555;
    --hover-bg: rgba(45, 45, 45, 0.8);
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow: rgba(0, 0, 0, 0.5);
    --profile-glow: rgba(255, 59, 59, 0.4);
}

[data-theme="light"] {
    --bg-color: #ffffff;
    --card-bg: rgba(245, 245, 247, 0.6);
    --text-main: #1a1a1a;
    --text-muted: #666666;
    --accent: #3b82f6;
    --accent-light: #60a5fa;
    --hover-bg: rgba(229, 231, 235, 0.8);
    --border-color: rgba(0, 0, 0, 0.08);
    --shadow: rgba(0, 0, 0, 0.1);
    --profile-glow: rgba(59, 130, 246, 0.5);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'JetBrains Mono', monospace;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
    overflow-y: auto;
}

/* Desktop: Custom cursor, Mobile: Default */
@media (hover: hover) and (pointer: fine) {
    body {
        cursor: none;
    }
}

/* === LOADING SCREEN === */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loading-screen.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-content {
    text-align: center;
}

.loading-logo {
    margin-bottom: 30px;
    animation: logoSpin 2s linear infinite;
}

.loading-center {
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-dot {
    animation: dotPulse 1.5s ease-in-out infinite;
}

@keyframes logoSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { r: 15; opacity: 1; }
    50% { r: 18; opacity: 0.7; }
}

@keyframes dotPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.loading-bar {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 20px auto;
}

.loading-progress {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
    box-shadow: 0 0 10px var(--accent);
}

.loading-text {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 2px;
}

/* === CUSTOM CURSOR === */
.custom-cursor {
    position: fixed;
    width: 8px;
    height: 8px;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    mix-blend-mode: difference;
    transition: transform 0.1s ease;
    transform: translate(-50%, -50%);
}

.cursor-follower {
    position: fixed;
    width: 35px;
    height: 35px;
    border: 2px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transition: all 0.15s ease;
    opacity: 0.5;
    transform: translate(-50%, -50%);
}

.cursor-follower.hover {
    width: 50px;
    height: 50px;
    border-color: var(--accent-light);
    opacity: 0.8;
    background: rgba(255, 59, 59, 0.1);
}

[data-theme="light"] .cursor-follower.hover {
    background: rgba(59, 130, 246, 0.1);
}

/* === ANIMATED BACKGROUND === */
.bg-grid {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    opacity: 0.03;
    background-image: 
        linear-gradient(var(--text-main) 1px, transparent 1px),
        linear-gradient(90deg, var(--text-main) 1px, transparent 1px);
    background-size: 60px 60px;
    animation: gridMove 20s linear infinite;
}

@keyframes gridMove {
    0% { transform: translate(0, 0); }
    100% { transform: translate(60px, 60px); }
}

.particle {
    position: fixed;
    background: var(--accent);
    border-radius: 50%;
    pointer-events: none;
    opacity: 0;
    z-index: 0;
    animation: floatParticle linear infinite;
}

@keyframes floatParticle {
    0% {
        opacity: 0;
        transform: translateY(100vh) scale(0) rotate(0deg);
    }
    10% {
        opacity: 0.6;
    }
    90% {
        opacity: 0.6;
    }
    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1) rotate(360deg);
    }
}

.cursor-glow {
    position: fixed;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--profile-glow) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
    transform: translate(-50%, -50%);
    opacity: 0.3;
    transition: opacity 0.3s ease;
}

/* === CONTAINER === */
.container {
    width: 100%;
    max-width: 420px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    animation: containerFadeIn 0.8s ease-out;
    position: relative;
    z-index: 1;
}

@keyframes containerFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === THEME & SOUND TOGGLES === */
.theme-toggle, .sound-toggle {
    position: fixed;
    top: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
}

@media (hover: hover) and (pointer: fine) {
    .theme-toggle, .sound-toggle {
        cursor: none;
    }
}

.theme-toggle {
    right: 20px;
}

.sound-toggle {
    right: 75px;
}

.theme-toggle:hover, .sound-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    border-color: var(--accent);
}

.theme-toggle svg, .sound-toggle svg {
    width: 22px;
    height: 22px;
    fill: var(--text-main);
    transition: fill 0.3s ease;
}

/* === PROFILE SECTION === */
.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.pfp-wrapper {
    position: relative;
    width: 120px;
    height: 120px;
}

.pfp-wrapper::before {
    content: '';
    position: absolute;
    top: -6px;
    left: -6px;
    right: -6px;
    bottom: -6px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent);
    border-right-color: var(--accent);
    animation: spinRing 4s linear infinite;
    z-index: 1;
}

@keyframes spinRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pfp {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--card-bg);
    position: relative;
    z-index: 2;
    animation: pulseGlow 3s ease-in-out infinite;
    transition: transform 0.3s ease;
}

.pfp:hover {
    transform: scale(1.05);
}

@keyframes pulseGlow {
    0%, 100% {
        box-shadow: 0 0 20px var(--profile-glow),
                    0 0 40px var(--profile-glow);
    }
    50% {
        box-shadow: 0 0 30px var(--profile-glow),
                    0 0 60px var(--profile-glow);
    }
}

.status-dot {
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 18px;
    height: 18px;
    background: #22c55e;
    border-radius: 50%;
    border: 3px solid var(--bg-color);
    z-index: 3;
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
    }
}

h1 {
    font-size: 1.6rem;
    font-weight: 700;
    letter-spacing: 1px;
    position: relative;
    display: inline-block;
}

.glitch-wrapper {
    position: relative;
    display: inline-block;
}

.glitch-wrapper::before,
.glitch-wrapper::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

.glitch-wrapper:hover::before {
    animation: glitch1 0.3s ease-in-out;
    color: var(--accent);
    opacity: 0.8;
}

.glitch-wrapper:hover::after {
    animation: glitch2 0.3s ease-in-out;
    color: var(--accent-light);
    opacity: 0.8;
}

@keyframes glitch1 {
    0% { transform: translate(0); }
    20% { transform: translate(-2px, 2px); }
    40% { transform: translate(2px, -2px); }
    60% { transform: translate(-1px, 1px); }
    80% { transform: translate(1px, -1px); }
    100% { transform: translate(0); }
}

@keyframes glitch2 {
    0% { transform: translate(0); }
    20% { transform: translate(2px, -2px); }
    40% { transform: translate(-2px, 2px); }
    60% { transform: translate(1px, -1px); }
    80% { transform: translate(-1px, 1px); }
    100% { transform: translate(0); }
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    animation: fadeInUp 0.8s ease-out 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* === LINKS SECTION === */
.links-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--card-bg);
    padding: 16px 20px;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-main);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px);
    animation: cardSlideIn 0.5s ease-out forwards;
}

@media (hover: hover) and (pointer: fine) {
    .link-card {
        cursor: none;
    }
}

.link-card:nth-child(1) { animation-delay: 0.4s; }
.link-card:nth-child(2) { animation-delay: 0.5s; }
.link-card:nth-child(3) { animation-delay: 0.6s; }
.link-card:nth-child(4) { animation-delay: 0.7s; }
.link-card:nth-child(5) { animation-delay: 0.8s; }

@keyframes cardSlideIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.link-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.08),
        transparent
    );
    transition: left 0.6s ease;
}

.link-card:hover::before {
    left: 100%;
}

.link-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 12px;
    border: 1px solid transparent;
    transition: border-color 0.3s ease;
    pointer-events: none;
}

.link-card:hover::after {
    border-color: var(--accent);
    box-shadow: inset 0 0 20px rgba(255, 59, 59, 0.05);
}

[data-theme="light"] .link-card:hover::after {
    box-shadow: inset 0 0 20px rgba(59, 130, 246, 0.05);
}

.link-card:hover {
    background-color: var(--hover-bg);
}

.link-card:focus {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.link-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

.icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    transition: transform 0.3s ease, fill 0.3s ease;
}

.link-card:hover .icon {
    transform: scale(1.15) rotate(-5deg);
    fill: var(--accent);
}

.app-name {
    font-weight: 700;
    font-size: 1rem;
    position: relative;
}

.app-name::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    transition: width 0.3s ease;
}

.link-card:hover .app-name::after {
    width: 100%;
}

.arrow {
    opacity: 0.5;
    transition: transform 0.3s ease, opacity 0.3s ease;
    font-size: 1.1rem;
}

.link-card:hover .arrow {
    opacity: 1;
    transform: translateX(5px);
    color: var(--accent);
}

.link-card.disabled {
    opacity: 0.3;
    filter: grayscale(100%);
    pointer-events: none;
}

.link-card.disabled:hover {
    transform: none;
    background-color: var(--card-bg);
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.3;
    transform: scale(0);
    animation: rippleAnim 0.6s ease-out;
    pointer-events: none;
}

@keyframes rippleAnim {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* === EMAIL FOOTER === */
.email-footer {
    margin-top: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    transition: color 0.3s ease;
    position: relative;
    display: inline-block;
    padding: 8px 16px;
    border-radius: 8px;
    opacity: 0;
    animation: fadeInUp 0.5s ease-out 1s both;
}

@media (hover: hover) and (pointer: fine) {
    .email-footer {
        cursor: none;
    }
}

.email-footer:hover {
    color: var(--accent);
}

.copied-toast {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.copied-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(-15px);
}

/* === ACCESSIBILITY & REDUCED MOTION === */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .bg-grid { animation: none; }
    .particle { display: none; }
    .cursor-glow { display: none; }
    .custom-cursor { display: none; }
    .cursor-follower { display: none; }
    body { cursor: auto; }
    .pfp-wrapper::before {
        animation: none;
        border: 2px solid var(--accent);
        opacity: 0.5;
    }
    .pfp {
        animation: none;
        box-shadow: 0 0 20px var(--profile-glow);
    }
    .status-dot {
        animation: none;
        box-shadow: none;
    }
    .link-card { transition: none; }
    .link-card:hover { transform: none; }
    .link-card::before, .link-card::after { display: none; }
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
    .container { gap: 1.8rem; }
    h1 { font-size: 1.4rem; }
    .theme-toggle, .sound-toggle { width: 40px; height: 40px; }
    .theme-toggle { right: 15px; }
    .sound-toggle { right: 65px; }
    .theme-toggle svg, .sound-toggle svg { width: 20px; height: 20px; }
    body { cursor: auto; }
    .custom-cursor, .cursor-follower { display: none !important; }
    .theme-toggle, .sound-toggle, .link-card, .email-footer { cursor: pointer; }
}

/* Touch devices: Always show default cursor */
@media (hover: none) {
    body {
        cursor: auto;
    }
    .custom-cursor, .cursor-follower {
        display: none !important;
    }
    .theme-toggle, .sound-toggle, .link-card, .email-footer {
        cursor: pointer;
    }
}