/* ========================================
   Personal Site - Main Stylesheet
   ======================================== */

/* ========================================
   CSS VARIABLES / DESIGN TOKENS
   ======================================== */
:root {
    /* Color Palette - Dark Mode */
    --bg: #1a1a1a;
    --bg-card: #121218;
    --text: #ffffff;
    --text-muted: #8b8b8b;
    --accent: #ced2cf;
    --accent-light: #dfe3e0;
    --accent-lighter: #eef0ef;
    --accent-dark: #a8ada9;
    --border: #2a2a30;

    /* Light Mode Colors (Applied via .light-mode class) */
    --light-bg: #f5f6f5;
    --light-bg-card: #ffffff;

    /* Dynamic Username Color */
    --username-color: #ced2cf;

    /* Spacing */
    --container-max-width: 800px; /* Increased from 680px */
    --section-spacing: 30px; /* Tightened from 40px */

    /* Animation Timings */
    --transition-fast: 0.2s;
    --transition-normal: 0.3s;
    --transition-slow: 0.5s;

    /* Z-Index Layers */
    --z-background: 0;
    --z-content: 1;
    --z-float: 2;
    --z-header: 10;
    --z-modal: 1000;
}

/* ========================================
   RESET & BASE STYLES
   ======================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    min-height: 100vh;
    line-height: 1.6;
}

/* ========================================
   ANIMATED STARFIELD BACKGROUND
   ======================================== */
#starfield {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--z-background);
    pointer-events: none;
}

/* ========================================
   HERO BANNER SECTION
   ======================================== */
.hero-banner {
    position: relative;
    width: 100%;
    height: 400px; /* Increased from 300px */
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 50%, var(--accent-lighter) 100%);
    overflow: hidden;
    will-change: transform; /* Optimize for parallax */
}

.hero-banner img,
.hero-banner video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.8;
}

/* Curved bottom edge using clip-path */
.hero-banner::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 80px;
    background: var(--bg);
    clip-path: polygon(0 50%, 100% 0, 100% 100%, 0 100%);
}

/* Header Buttons (Share, Theme, Pause) */
.header-buttons {
    position: absolute;
    top: 20px;
    right: 20px;
    display: flex;
    gap: 12px;
    z-index: var(--z-header);
}

.share-button,
.theme-toggle-button,
.pause-button {
    background: rgba(18, 18, 24, 0.8);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.share-button:hover,
.theme-toggle-button:hover,
.pause-button:hover {
    background: rgba(206, 210, 207, 0.25);
    border-color: var(--accent);
    transform: scale(1.1);
}

/* Prevent active state from sticking during scroll on mobile */
.share-button:active,
.theme-toggle-button:active,
.pause-button:active {
    transition: none;
}

@media (hover: none) and (pointer: coarse) {
    .share-button:hover,
    .theme-toggle-button:hover,
    .pause-button:hover {
        background: rgba(18, 18, 24, 0.8);
        border-color: var(--border);
        transform: scale(1);
    }
}

.share-button svg,
.theme-toggle-button svg,
.pause-button svg {
    width: 20px;
    height: 20px;
    fill: var(--text);
}

/* Light Mode Icon Colors */
body.light-mode .share-button svg,
body.light-mode .theme-toggle-button svg,
body.light-mode .pause-button svg {
    fill: #2e2162;
}

body.light-mode .share-button,
body.light-mode .theme-toggle-button,
body.light-mode .pause-button {
    background: rgba(250, 250, 250, 0.95);
    border-color: #d2d2d7;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */
.container {
    position: relative;
    z-index: var(--z-content);
    max-width: var(--container-max-width);
    margin: -100px auto 0;
    padding: 0 20px 60px;
}

/* ========================================
   PROFILE CARD
   ======================================== */
.profile-card {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, rgba(206, 210, 207, 0.03) 0%, rgba(206, 210, 207, 0.01) 100%);
    border-radius: 24px;
    backdrop-filter: blur(10px);
}

/* Avatar Wrapper - Enables 3D transformations */
.avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
    perspective: 1000px;
    transform-style: preserve-3d;
}

.avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 4px solid var(--bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    object-fit: cover;
    backface-visibility: visible;
    transform-style: preserve-3d;
    transition: transform var(--transition-normal) ease, box-shadow var(--transition-normal) ease;
}

/* Avatar hover effect - bounce and glow */
@media (hover: hover) {
    .avatar-wrapper:hover .avatar {
        transform: translateY(-15px) scale(1.15);
    }
}

/* Avatar particles container (for emojis) */
.avatar-particles {
    position: absolute;
    inset: -40px;
    pointer-events: none;
    z-index: var(--z-background);
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
}

.avatar-wrapper:hover .avatar-particles {
    opacity: 1;
}

/* Individual avatar particle/emoji */
.avatar-particle {
    position: absolute;
    font-size: 28px; /* Larger emojis */
    opacity: 0;
    pointer-events: none;
    /* Animation will be controlled by GSAP */
}

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    .avatar {
        transition: none;
    }
    .avatar-wrapper:hover .avatar {
        transform: none;
    }
    .avatar-particles,
    .avatar-particle {
        display: none;
    }
}

/* Profile Name */
.profile-name-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.profile-name {
    font-size: 32px; /* Increased from 28px */
    font-weight: 700;
    letter-spacing: -0.5px;
}

.profile-name.gradient {
    width: fit-content;
    display: inline-block;
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    -webkit-text-fill-color: transparent;
    animation: gradientFlow 3s ease infinite;
    filter: drop-shadow(0 0 8px rgba(206, 210, 207, 0.4));
}

.profile-name.solid {
    color: var(--username-color);
}

@keyframes gradientFlow {
    0%, 100% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .profile-name.gradient {
        animation: none;
        background-size: 100% 100%;
    }
}

/* Badges */
.badges {
    display: inline-flex;
    gap: 6px;
    align-items: center;
    vertical-align: middle;
}

.badge {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
    line-height: 0;
}

.badge svg {
    width: 22px;
    height: 22px;
    display: block;
}

.badge .tooltip {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast) ease;
    z-index: 100;
}

.badge:hover .tooltip {
    opacity: 1;
}

/* Bio */
.bio {
    color: var(--text-muted);
    font-size: 16px; /* Increased from 15px */
    line-height: 1.6;
    margin-bottom: 16px;
}

/* ========================================
   DISCORD BUTTON
   ======================================== */
.discord-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 18px;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    position: relative;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

.discord-button:hover {
    border-color: #5865F2;
    background: rgba(88, 101, 242, 0.1);
}

@media (hover: none) and (pointer: coarse) {
    .discord-button:hover {
        border-color: var(--border);
        background: var(--bg-card);
    }
}

.discord-button svg {
    width: 20px;
    height: 20px;
    fill: #5865F2;
}

.discord-username {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
}

.copied-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #5865F2;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-normal) ease;
}

.copied-overlay.show {
    opacity: 1;
}

/* ========================================
   LINKS SECTION
   ======================================== */
.links-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: var(--section-spacing);
}

/* Link Button */
.link-button {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 20px;
    text-decoration: none;
    transition: all var(--transition-normal) ease;
    overflow: visible;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
    will-change: transform; /* Optimize for GSAP animations */
}

.link-button:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 8px 24px rgba(57, 112, 252, 0.2);
    z-index: var(--z-header);
}

@media (hover: none) and (pointer: coarse) {
    .link-button:hover {
        transform: none;
        border-color: var(--border);
        box-shadow: none;
    }
}

.link-button.featured {
    background: linear-gradient(135deg, rgba(57, 112, 252, 0.15) 0%, rgba(91, 142, 255, 0.1) 100%);
    border: 1px solid var(--accent);
}

.link-button.featured:hover {
    background: linear-gradient(135deg, rgba(57, 112, 252, 0.25) 0%, rgba(91, 142, 255, 0.15) 100%);
    box-shadow: 0 12px 32px rgba(57, 112, 252, 0.3);
}

/* Link Icon Float (3D effect) */
.link-icon-float {
    position: relative;
    width: 64px; /* Increased from 56px */
    height: 64px;
    border-radius: 14px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    margin: 0;
    overflow: visible;
    transform-style: preserve-3d;
    transform-origin: center center;
    transform: translateZ(0px) rotateX(0deg) rotateY(0deg);
    transition:
        transform var(--transition-normal) cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow var(--transition-normal) ease,
        filter var(--transition-normal) ease;
    z-index: var(--z-float);
    isolation: isolate;
}

.link-icon-float-image {
    width: 48px; /* Increased from 42px */
    height: 48px;
    padding: 2px;
    object-fit: cover;
    border-radius: 25%;
    position: relative;
    z-index: 3;
    transform-style: preserve-3d;
    pointer-events: none;
    isolation: isolate;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Sparkle particles container */
.icon-sparkles {
    position: absolute;
    inset: -12px;
    pointer-events: none;
    z-index: 1;
    opacity: 0;
    transition: opacity var(--transition-normal) ease;
}

.icon-sparkles.active {
    opacity: 0.5;
}

/* Individual sparkle particle */
.sparkle-particle {
    position: absolute;
    width: 2px;
    height: 8px;
    background: currentColor;
    opacity: 0;
    filter: blur(0.3px);
    animation: sparkleFloat 1.5s ease-in-out infinite;
}

.sparkle-particle::after {
    content: "";
    position: absolute;
    inset: 0;
    background: currentColor;
    transform: rotate(90deg);
}

/* Sparkle positions */
.sparkle-particle:nth-child(1) { top: 10%; left: 5%; animation-delay: 0s; }
.sparkle-particle:nth-child(2) { top: 5%; left: 50%; animation-delay: 0.2s; }
.sparkle-particle:nth-child(3) { top: 15%; right: 10%; animation-delay: 0.4s; }
.sparkle-particle:nth-child(4) { bottom: 20%; left: 8%; animation-delay: 0.6s; }
.sparkle-particle:nth-child(5) { bottom: 10%; right: 12%; animation-delay: 0.8s; }
.sparkle-particle:nth-child(6) { top: 50%; left: 3%; animation-delay: 1s; }
.sparkle-particle:nth-child(7) { top: 50%; right: 5%; animation-delay: 1.2s; }
.sparkle-particle:nth-child(8) { bottom: 50%; left: 10%; animation-delay: 1.4s; }

@keyframes sparkleFloat {
    0%, 100% {
        opacity: 0;
        transform: translateY(0) scale(0.3);
    }
    20% {
        opacity: 1;
        transform: translateY(-3px) scale(0.6);
    }
    50% {
        opacity: 0.8;
        transform: translateY(-5px) scale(0.9);
    }
    80% {
        opacity: 0.4;
        transform: translateY(-2px) scale(1.2);
    }
}

/* Beacon Animation (pulse dot) */
.link-button-beacon {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
        box-shadow: 0 0 8px 2px currentColor;
    }
    50% {
        opacity: 0.6;
        transform: scale(1.25);
        box-shadow: 0 0 16px 4px currentColor;
    }
}

/* Link Text */
.link-block-text-wrapper {
    flex: 1;
    min-width: 0;
}

.link-name {
    font-size: 17px; /* Increased from 16px */
    font-weight: 600;
    color: var(--text);
    margin-bottom: 2px;
}

.link-url {
    font-size: 13px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Link Arrow */
.link-arrow-wrapper {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.link-arrows {
    width: 16px;
    height: 16px;
    opacity: 0.6;
    transition: all var(--transition-normal) ease;
    color: var(--accent);
}

.link-button:hover .link-arrows {
    opacity: 1;
    transform: translateX(2px);
}

/* ========================================
   SPOTIFY EMBED
   ======================================== */
.spotify-embed {
    margin-bottom: var(--section-spacing);
    border-radius: 12px;
    overflow: hidden;
}

.spotify-embed iframe {
    width: 100%;
    height: 80px;
    border: 0;
    border-radius: 12px;
}

/* ========================================
   SECTION DIVIDER
   ======================================== */
.section-divider {
    position: relative;
    height: 1px;
    background: var(--border);
    margin: 40px 0;
}

.section-divider.with-emoji {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
}

.section-divider.with-emoji::before,
.section-divider.with-emoji::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.divider-emoji {
    font-size: 20px;
    padding: 0 16px;
    background: var(--bg);
}

/* ========================================
   FOOTER
   ======================================== */
.footer {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
}

.footer a {
    color: #8b5cf6;
    text-decoration: none;
    transition: color var(--transition-normal) ease;
}

.footer a:hover {
    color: #a78bfa;
}

/* ========================================
   SHARE MODAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    padding: 20px;
}

.modal-overlay.show {
    display: flex;
}

.share-modal {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 100%;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

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

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 24px;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all var(--transition-normal) ease;
}

.modal-close:hover {
    background: var(--border);
    color: var(--text);
}

.modal-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

.share-platforms {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.share-platform {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
    text-decoration: none;
    color: var(--text);
}

.share-platform:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.share-platform svg {
    width: 24px;
    height: 24px;
}

.share-platform-name {
    font-size: 12px;
    font-weight: 500;
}

.qr-section {
    text-align: center;
    padding: 20px;
    background: var(--bg);
    border-radius: 12px;
    margin-bottom: 16px;
}

#qr-code {
    margin: 16px auto;
    padding: 16px;
    background: white;
    border-radius: 8px;
    display: inline-block;
}

.copy-link-button {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all var(--transition-normal) ease;
}

.copy-link-button:hover {
    background: var(--accent-light);
    transform: translateY(-1px);
}

.copy-link-button.copied {
    background: #10b981;
}

/* ========================================
   RESPONSIVE DESIGN - MOBILE
   ======================================== */
@media (max-width: 768px) {
    .hero-banner {
        height: 250px; /* Reduced from 400px on desktop */
    }

    .container {
        margin-top: -80px;
    }

    .avatar {
        width: 100px;
        height: 100px;
    }

    .profile-name {
        font-size: 26px;
    }

    .profile-card {
        padding: 20px;
    }

    .link-icon-float {
        width: 56px;
        height: 56px;
    }

    .link-icon-float-image {
        width: 42px;
        height: 42px;
    }

    .share-modal {
        padding: 24px;
    }

    .share-platforms {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ========================================
   RESPONSIVE DESIGN - TABLET
   ======================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .hero-banner {
        height: 350px;
    }

    .container {
        max-width: 720px;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    #starfield,
    .hero-banner,
    .header-buttons,
    .avatar-particles,
    .icon-sparkles,
    .sparkle-particle,
    .modal-overlay {
        display: none !important;
    }

    body {
        background: white;
        color: black;
    }

    .container {
        margin-top: 0;
    }
}
