/* ===== Fonts ===== */
@font-face {
    font-family: 'Inter';
    src: url('fonts/Inter-VariableFont_opsz,wght.ttf');
    font-display: swap;
}
@font-face {
    font-family: 'NotoSansSc';
    src: url('fonts/NotoSansSC-VariableFont_wght.ttf');
    font-display: swap;
}

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

html { scroll-behavior: smooth; }

/* ===== Design Tokens ===== */
:root {
    --bg-root: #050508;
    --bg-raised: rgba(12, 12, 20, 0.65);
    --bg-card: rgba(16, 16, 28, 0.55);

    --accent: #6366f1;
    --accent-dim: rgba(99, 102, 241, 0.3);
    --accent-glow: rgba(99, 102, 241, 0.25);
    --accent-2: #818cf8;
    --accent-3: #a78bfa;

    --text-primary: #f1f1f6;
    --text-secondary: #9d9daf;
    --text-muted: #5e5e72;

    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-card: rgba(255, 255, 255, 0.07);
    --border-accent: rgba(99, 102, 241, 0.2);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;

    --font-sans: 'Inter', 'NotoSansSc', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Inter', 'SF Mono', 'Fira Code', monospace;
}

/* ===== Base ===== */
body {
    background: var(--bg-root);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle dot grid overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 65% 65% at 50% 30%, black 25%, transparent 75%);
}

strong { color: var(--accent-2); font-weight: 600; }

a { color: inherit; text-decoration: none; }

img { max-width: 100%; display: block; }

/* ===== Canvas ===== */
#bg-canvas {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
}

/* ===== Skip Link ===== */
.skip-link {
    position: fixed;
    top: -100%;
    left: 16px;
    z-index: 200;
    padding: 10px 20px;
    background: var(--accent);
    color: #fff;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    transition: top 0.2s;
}
.skip-link:focus {
    top: 0;
}

/* ===== Navbar ===== */
#navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    transition: background 0.4s, border-color 0.4s;
}

#navbar.scrolled {
    background: rgba(5, 5, 8, 0.75);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 64px;
}

.nav-logo {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s, filter 0.3s;
}
.nav-logo img {
    width: 100%;
    height: 100%;
    display: block;
}
.nav-logo:hover {
    transform: scale(1.08);
    filter: drop-shadow(0 0 14px var(--accent-glow));
}

.nav-links {
    display: flex;
    gap: 36px;
}

.nav-links a {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.8px;
    transition: color 0.25s;
    position: relative;
}
.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 1.5px;
    background: var(--accent);
    border-radius: 1px;
    transition: width 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}
.nav-links a:hover { color: #fff; }
.nav-links a:hover::after { width: 100%; }

/* ===== Hero ===== */
#hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    padding: 0 24px;
    overflow: hidden;
}

.hero-bg-glow {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.09) 0%, rgba(139, 92, 246, 0.04) 40%, transparent 70%);
    pointer-events: none;
    animation: heroBreathe 7s ease-in-out infinite alternate;
}

@keyframes heroBreathe {
    0% { opacity: 0.6; transform: translateX(-50%) scale(1); }
    100% { opacity: 1; transform: translateX(-50%) scale(1.1); }
}

.hero-content {
    position: relative;
    z-index: 1;
    max-width: 680px;
}

.hero-eyebrow {
    font-size: 12px;
    font-weight: 500;
    color: var(--accent-2);
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-bottom: 24px;
    font-family: var(--font-mono);
}

.hero-logo {
    display: block;
    max-width: min(90%, 600px);
    width: 100%;
    height: auto;
    margin: 0 auto 28px;
    animation: logoFloat 5s ease-in-out infinite alternate;
    filter: drop-shadow(0 0 48px var(--accent-glow));
}

@keyframes logoFloat {
    0% { transform: translateY(0); filter: drop-shadow(0 0 48px var(--accent-glow)); }
    100% { transform: translateY(-8px); filter: drop-shadow(0 0 64px rgba(129, 140, 248, 0.45)); }
}

.hero-desc {
    font-size: 18px;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 44px;
    font-weight: 400;
}

.text-accent {
    color: var(--accent-2);
    font-weight: 600;
}

.hero-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn-primary, .btn-outline {
    display: inline-flex;
    align-items: center;
    padding: 13px 32px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.35s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 24px var(--accent-glow);
}
.btn-primary:hover {
    background: var(--accent-2);
    box-shadow: 0 6px 36px rgba(129, 140, 248, 0.4);
    transform: translateY(-2px);
}

.btn-outline {
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-secondary);
}
.btn-outline:hover {
    border-color: var(--accent);
    color: #fff;
    background: rgba(99, 102, 241, 0.06);
    transform: translateY(-2px);
}

/* Scroll indicator */
.hero-scroll-indicator {
    position: absolute;
    bottom: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    animation: fadeInUp 1s ease 0.8s both;
}

.hero-scroll-indicator span {
    display: block;
    width: 1px;
    height: 8px;
    background: var(--text-muted);
    border-radius: 1px;
    animation: scrollDot 2s ease-in-out infinite;
}
.hero-scroll-indicator span:nth-child(2) { animation-delay: 0.2s; }
.hero-scroll-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes scrollDot {
    0%, 100% { opacity: 0.2; }
    50% { opacity: 0.8; }
}

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

/* ===== Sections Common ===== */
.section-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 32px;
    position: relative;
    z-index: 1;
}

section {
    padding: 140px 0;
    position: relative;
}

.section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent-2);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 16px;
    font-family: var(--font-mono);
}

.section-heading {
    font-size: clamp(32px, 5vw, 48px);
    font-weight: 700;
    letter-spacing: -1px;
    margin-bottom: 60px;
    color: #fff;
}

/* ===== Scroll Reveal ===== */
.reveal {
    opacity: 0;
    transform: translateY(32px);
    transition: opacity 0.8s cubic-bezier(0.22, 0.61, 0.36, 1),
                transform 0.8s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.reveal.visible {
    opacity: 1;
    transform: translateY(0);
}

/* Stagger children */
.skills-grid.reveal.visible .skill-card:nth-child(1) { transition-delay: 0s; }
.skills-grid.reveal.visible .skill-card:nth-child(2) { transition-delay: 0.1s; }
.skills-grid.reveal.visible .skill-card:nth-child(3) { transition-delay: 0.2s; }
.skills-grid.reveal.visible .skill-card:nth-child(4) { transition-delay: 0.3s; }

.works-grid.reveal.visible .work-card:nth-child(1) { transition-delay: 0s; }
.works-grid.reveal.visible .work-card:nth-child(2) { transition-delay: 0.1s; }
.works-grid.reveal.visible .work-card:nth-child(3) { transition-delay: 0.2s; }

/* ===== About ===== */
#about {
    background: linear-gradient(180deg, #050508 0%, #090910 100%);
}

.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 64px;
    margin-bottom: 64px;
}

.about-big-text {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.55;
}

.about-details p {
    color: var(--text-secondary);
    font-size: 14.5px;
    line-height: 1.8;
    margin-bottom: 16px;
    padding-left: 18px;
    border-left: 2px solid var(--border-accent);
}

.about-meta {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-raised);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius-lg);
    padding: 32px 48px;
}

.meta-item {
    flex: 1;
    text-align: center;
}

.meta-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
    font-family: var(--font-mono);
}

.meta-label {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 500;
}

.meta-divider {
    width: 1px;
    height: 36px;
    background: var(--border-card);
}

/* ===== Skills ===== */
#skills {
    background: #050508;
}

.skills-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 64px;
}

.skill-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 32px 24px;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.skill-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 16px;
    right: 16px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-accent), transparent);
    transition: all 0.5s;
}

.skill-card:hover {
    transform: translateY(-6px);
    border-color: var(--border-accent);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.08);
}
.skill-card:hover::before {
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

.skill-card-icon {
    color: var(--accent-2);
    margin-bottom: 16px;
    opacity: 0.8;
}

.skill-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 8px;
}

.skill-card p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Skill Bars */
.skill-bars {
    display: flex;
    flex-direction: column;
    gap: 22px;
    max-width: 560px;
}

.skill-bar-header {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.skill-bar-pct {
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-size: 12px;
}

.skill-bar-track {
    height: 5px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 3px;
    overflow: hidden;
}

.skill-bar-fill {
    height: 100%;
    width: 0;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-3));
    transition: width 1.2s cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ===== Works ===== */
#works {
    background: linear-gradient(180deg, #050508 0%, #090910 100%);
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.work-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 36px 28px 28px;
    display: flex;
    flex-direction: column;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    position: relative;
    cursor: default;
    will-change: transform;
}

.work-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-accent);
    box-shadow: 0 20px 56px rgba(0, 0, 0, 0.35);
}

.work-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.work-num {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 1px;
    font-family: var(--font-mono);
}

.work-tag {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--accent-2);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.15);
    padding: 4px 10px;
    border-radius: 20px;
}

.work-card h3 {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 10px;
}

.work-card p {
    font-size: 13.5px;
    color: var(--text-muted);
    line-height: 1.65;
    flex: 1;
    margin-bottom: 24px;
}

.work-card-bottom {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.work-link {
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-2);
    cursor: pointer;
    transition: color 0.3s;
}
.work-link:hover { color: #fff; }
.work-link span { transition: transform 0.3s; display: inline-block; }
.work-link:hover span { transform: translate(3px, -3px); }

/* ===== Contact ===== */
#contact {
    background: #050508;
}

.contact-sub {
    color: var(--text-secondary);
    font-size: 15px;
    margin-bottom: 48px;
    margin-top: -36px;
}

.contact-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.contact-card {
    background: var(--bg-card);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-card);
    border-radius: var(--radius);
    padding: 36px 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    will-change: transform;
}

.contact-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-accent);
    box-shadow: 0 16px 44px rgba(0, 0, 0, 0.3);
}

.contact-card-icon {
    color: var(--accent-2);
    margin-bottom: 4px;
    opacity: 0.75;
    transition: opacity 0.3s;
}
.contact-card:hover .contact-card-icon { opacity: 1; }

.contact-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 2px;
    text-transform: uppercase;
}

.contact-value {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    font-family: var(--font-mono);
}

.contact-hint {
    font-size: 12px;
    color: var(--text-muted);
}

.contact-qrcode .qrcode-img {
    width: 130px;
    height: 130px;
    border-radius: 10px;
    border: 1px solid var(--border-card);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.contact-qrcode:hover .qrcode-img {
    border-color: var(--border-accent);
    box-shadow: 0 0 22px var(--accent-glow);
}

/* ===== Footer ===== */
#footer {
    background: #030306;
    padding: 64px 0 40px;
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border-subtle);
}

.footer-inner {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 32px;
}

.footer-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 28px;
}

.footer-logo {
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    letter-spacing: 1px;
}

.footer-links {
    display: flex;
    gap: 32px;
}

.footer-links a {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    transition: color 0.25s;
}
.footer-links a:hover { color: #fff; }

.footer-line {
    height: 1px;
    background: var(--border-subtle);
    margin-bottom: 28px;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.footer-quote {
    font-size: 13px;
    color: var(--accent-2);
    font-family: var(--font-mono);
    font-weight: 500;
}

.footer-copy {
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

    .works-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin: 0 auto;
    }

    .contact-cards {
        grid-template-columns: 1fr;
        max-width: 400px;
        margin: 0 auto;
    }

    .about-meta {
        padding: 24px 20px;
    }

    .meta-num {
        font-size: 22px;
    }
}

@media (max-width: 600px) {
    section {
        padding: 80px 0;
    }

    .section-container {
        padding: 0 20px;
    }

    .nav-inner {
        padding: 0 20px;
    }

    .nav-links {
        gap: 18px;
    }
    .nav-links a {
        font-size: 12px;
    }

    .hero-eyebrow {
        font-size: 10px;
        letter-spacing: 3px;
    }

    .hero-desc {
        font-size: 15px;
    }

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

    .skills-grid {
        grid-template-columns: 1fr;
        max-width: 380px;
        margin-left: auto;
        margin-right: auto;
        margin-bottom: 48px;
    }

    .about-meta {
        flex-direction: column;
        gap: 16px;
    }
    .meta-divider {
        width: 40px;
        height: 1px;
    }

    .footer-top, .footer-bottom {
        flex-direction: column;
        gap: 16px;
        text-align: center;
    }
    .footer-links {
        gap: 20px;
    }
}

/* ===== Respect user motion preferences ===== */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    html { scroll-behavior: auto; }
}
