/* ============================================
   3D Portfolio — Stylesheet
   Dark theme · Neon accents · Glassmorphism
   ============================================ */

/* ---------- Reset & Base ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #05050f;
    --bg-alt: #0a0a1a;
    --surface: rgba(15, 15, 35, 0.6);
    --border: rgba(255, 255, 255, 0.08);
    --border-bright: rgba(0, 240, 255, 0.3);
    --text: #e8e8f0;
    --text-dim: #8888a0;
    --text-muted: #555568;
    --cyan: #00f0ff;
    --purple: #a855f7;
    --pink: #ec4899;
    --green: #10b981;
    --font-display: 'Space Grotesk', 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
    --font-mono: 'JetBrains Mono', 'SF Mono', 'Monaco', monospace;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-display);
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    cursor: none;
    line-height: 1.6;
}

/* ---------- Canvas ---------- */
#webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
}

/* ---------- Loading Screen ---------- */
#loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition: opacity 0.8s ease, visibility 0.8s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
}

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

.loader-ring {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    border: 2px solid rgba(0, 240, 255, 0.1);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loader-text {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--text-dim);
    letter-spacing: 0.1em;
    margin-bottom: 16px;
}

.loader-progress {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 2px;
    overflow: hidden;
    margin: 0 auto;
}

.loader-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--purple));
    transition: width 0.3s ease;
}

/* ---------- Custom Cursor ---------- */
#cursor-outer,
#cursor-inner {
    position: fixed;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 10000;
    border-radius: 50%;
    transition: transform 0.15s ease-out, width 0.3s, height 0.3s, background 0.3s;
}

#cursor-outer {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(0, 240, 255, 0.4);
    transform: translate(-50%, -50%);
}

#cursor-inner {
    width: 6px;
    height: 6px;
    background: var(--cyan);
    transform: translate(-50%, -50%);
}

#cursor-outer.hover {
    width: 56px;
    height: 56px;
    border-color: var(--cyan);
    background: rgba(0, 240, 255, 0.05);
}

#cursor-inner.hover {
    width: 0;
    height: 0;
}

/* ---------- Navigation ---------- */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 48px;
    transition: padding 0.3s ease, background 0.3s ease;
}

#navbar.scrolled {
    padding: 16px 48px;
    background: rgba(5, 5, 15, 0.7);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.nav-logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    text-decoration: none;
}

.nav-logo span {
    color: var(--cyan);
}

.nav-links {
    display: flex;
    gap: 32px;
    list-style: none;
}

.nav-link {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-dim);
    text-decoration: none;
    position: relative;
    transition: color 0.3s ease;
    padding: 4px 0;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background: var(--cyan);
    transition: width 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

#menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: none;
    padding: 8px;
}

#menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text);
    transition: transform 0.3s ease;
}

/* ---------- Main Content ---------- */
main {
    position: relative;
    z-index: 1;
}

.section {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 120px 48px 80px;
    position: relative;
}

.section-content {
    max-width: 1100px;
    width: 100%;
}

/* ---------- Reveal Animation ---------- */
.reveal {
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Section Label & Title ---------- */
.section-label {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--cyan);
    letter-spacing: 0.15em;
    text-transform: uppercase;
    margin-bottom: 16px;
    padding: 6px 14px;
    border: 1px solid var(--border-bright);
    border-radius: 100px;
    background: rgba(0, 240, 255, 0.03);
}

.section-title {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 48px;
    line-height: 1.1;
}

/* ---------- Hero Section ---------- */
#hero {
    text-align: center;
}

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

.hero-greeting {
    font-family: var(--font-mono);
    font-size: 0.875rem;
    color: var(--cyan);
    letter-spacing: 0.1em;
    margin-bottom: 16px;
    opacity: 0;
    animation: fadeInUp 0.8s 0.3s forwards;
}

.hero-title {
    font-size: clamp(3rem, 10vw, 7rem);
    font-weight: 700;
    line-height: 0.95;
    letter-spacing: -0.04em;
    margin-bottom: 24px;
    opacity: 0;
    animation: fadeInUp 0.8s 0.5s forwards;
}

.gradient-text {
    display: inline-block;
    background: linear-gradient(135deg, var(--cyan), var(--purple), var(--pink));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: gradientShift 6s ease infinite;
    background-size: 200% 200%;
}

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

.outline-text {
    display: block;
    -webkit-text-stroke: 2px var(--text);
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.hero-subtitle {
    font-size: clamp(1rem, 2vw, 1.25rem);
    color: var(--text-dim);
    margin-bottom: 40px;
    opacity: 0;
    animation: fadeInUp 0.8s 0.7s forwards;
}

.hero-cta {
    display: flex;
    gap: 16px;
    justify-content: center;
    opacity: 0;
    animation: fadeInUp 0.8s 0.9s forwards;
}

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

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    border-radius: 100px;
    transition: all 0.3s ease;
    cursor: none;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--cyan);
    color: var(--bg);
    border-color: var(--cyan);
}

.btn-primary:hover {
    background: transparent;
    color: var(--cyan);
    box-shadow: 0 0 30px rgba(0, 240, 255, 0.3);
}

.btn-ghost {
    border-color: var(--border);
    color: var(--text);
}

.btn-ghost:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

/* ---------- Scroll Hint ---------- */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    opacity: 0;
    animation: fadeInUp 0.8s 1.2s forwards;
}

.scroll-hint span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.scroll-line {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, var(--cyan), transparent);
    position: relative;
    overflow: hidden;
}

.scroll-line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--cyan);
    animation: scrollDown 2s ease-in-out infinite;
}

@keyframes scrollDown {
    to { top: 100%; }
}

/* ---------- About Section ---------- */
.about-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 64px;
    align-items: start;
}

.about-text p {
    font-size: 1.05rem;
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.8;
}

.highlight {
    color: var(--cyan);
    font-weight: 500;
}

.about-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.stat-item {
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    backdrop-filter: blur(10px);
    text-align: center;
    transition: transform 0.3s ease, border-color 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    border-color: var(--border-bright);
}

.stat-number {
    display: inline-block;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--cyan);
    line-height: 1;
}

.stat-suffix {
    display: inline-block;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--cyan);
    margin-left: 2px;
    vertical-align: super;
}

.stat-label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-dim);
    margin-top: 8px;
    letter-spacing: 0.05em;
}

/* ---------- Projects Section ---------- */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.project-card {
    position: relative;
    padding: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    backdrop-filter: blur(10px);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s ease;
}

.project-card:hover {
    transform: translateY(-8px);
    border-color: var(--card-color);
}

.project-glow {
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, var(--card-color), transparent 70%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.project-card:hover .project-glow {
    opacity: 0.15;
}

.project-number {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--card-color);
    margin-bottom: 16px;
}

.project-card h3 {
    font-size: 1.4rem;
    font-weight: 600;
    margin-bottom: 12px;
}

.project-card p {
    font-size: 0.9rem;
    color: var(--text-dim);
    margin-bottom: 20px;
    line-height: 1.7;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.project-tags span {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text-dim);
}

.project-link {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--card-color);
    text-decoration: none;
    transition: gap 0.3s ease;
}

.project-link:hover {
    letter-spacing: 0.02em;
}

/* ---------- Skills Section ---------- */
.skills-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 48px;
}

.skill-group h3 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 24px;
    color: var(--cyan);
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.skill-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px;
}

.skill-name {
    font-size: 0.875rem;
    color: var(--text);
}

.skill-percent {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-dim);
}

.skill-bar {
    grid-column: 1 / -1;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.skill-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--cyan), var(--purple));
    border-radius: 4px;
    transition: width 1.2s cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Contact Section ---------- */
.contact-content {
    text-align: center;
}

.contact-content .section-label {
    margin-left: auto;
    margin-right: auto;
}

.contact-text {
    font-size: 1.1rem;
    color: var(--text-dim);
    margin-bottom: 48px;
    line-height: 1.8;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    justify-content: center;
    margin-bottom: 80px;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 100px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.contact-link:hover {
    border-color: var(--cyan);
    color: var(--cyan);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 240, 255, 0.1);
}

.contact-icon {
    font-size: 1rem;
    color: var(--cyan);
}

.footer {
    text-align: center;
    padding: 24px 0;
    border-top: 1px solid var(--border);
    width: 100%;
    max-width: 1100px;
}

.footer p {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .skills-container {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    #navbar {
        padding: 20px 24px;
    }

    #navbar.scrolled {
        padding: 12px 24px;
    }

    .section {
        padding: 100px 24px 60px;
    }

    .nav-links {
        display: none;
    }

    #menu-toggle {
        display: flex;
    }

    body {
        cursor: auto;
    }

    #cursor-outer,
    #cursor-inner {
        display: none;
    }

    .hero-cta {
        flex-direction: column;
        align-items: center;
    }
}

@media (max-width: 500px) {
    .about-stats {
        grid-template-columns: 1fr;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* ---------- Selection ---------- */
::selection {
    background: var(--cyan);
    color: var(--bg);
}

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 240, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}
