/* ============================================================
   3D Art Portfolio Stylesheet
   Dark, minimalist, pixel aesthetic
   ============================================================ */

@font-face {
    font-family: "FusionPixel";
    src: url("fonts/Fusion-Pixel-Regular.woff2") format("woff2"),
         url("fonts/Fusion-Pixel-Regular.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --bg: #0a0a0a;
    --bg-alt: #111111;
    --fg: #e8e6e1;
    --fg-muted: #8a8a84;
    --fg-dim: #5a5a55;
    --border: #262626;
    --accent: #c9b98f;
    --accent-muted: rgba(201, 185, 143, 0.15);
    --font-serif: "FusionPixel", "Microsoft YaHei", "PingFang SC", sans-serif;
    --font-sans: "FusionPixel", "Microsoft YaHei", "PingFang SC", sans-serif;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: grayscale;
    font-smooth: never;
    overflow-x: hidden;
}

::selection {
    background: var(--accent-muted);
    color: var(--accent);
}

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

/* Scroll progress */
.progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    height: 2px;
    width: 0;
    background: var(--accent);
    z-index: 300;
    transition: width 0.08s linear;
}

/* ============================================================
   Navigation
   ============================================================ */

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.6rem 4rem;
    transition: background 0.4s var(--ease), padding 0.4s var(--ease),
        border-color 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
    border-bottom: 1px solid transparent;
}

.nav.scrolled {
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    padding: 1rem 4rem;
    border-color: var(--border);
}

.nav-logo {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    letter-spacing: 0.08em;
    text-decoration: none;
    color: var(--fg);
    text-transform: uppercase;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-links a {
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    position: relative;
    transition: color 0.3s var(--ease);
}

.nav-links a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.35s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--fg);
}

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

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--fg);
    transition: 0.3s var(--ease);
}

/* ============================================================
   Hero
   ============================================================ */

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    text-align: center;
    padding: 0 2rem;
    overflow: hidden;
    background: var(--bg);
    isolation: isolate;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
}

.hero-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    animation: heroZoom 18s var(--ease) both;
}

.hero-overlay {
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(
        to bottom,
        rgba(10, 10, 10, 0.55),
        rgba(10, 10, 10, 0.25) 45%,
        var(--bg) 98%
    );
}

.hero-content {
    position: relative;
    z-index: 1;
    padding-bottom: 6rem;
    text-shadow: 0 2px 30px rgba(0, 0, 0, 0.5);
}

.hero-content > * {
    animation: fadeUp 1.2s var(--ease) both;
}

.hero-name {
    font-family: var(--font-sans);
    font-size: clamp(3rem, 9vw, 6.4rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    color: var(--fg);
    margin: 0;
}

@keyframes heroZoom {
    from { transform: scale(1.12); }
    to { transform: scale(1); }
}

.scroll-indicator {
    position: absolute;
    bottom: 2.5rem;
    left: 50%;
    transform: translateX(-50%);
    color: var(--fg-dim);
    animation: float 2.5s ease-in-out infinite;
    transition: color 0.3s;
}

.scroll-indicator:hover {
    color: var(--accent);
}

@keyframes float {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8px); }
}

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

/* ============================================================
   Sections (shared)
   ============================================================ */

section {
    padding: 6rem 4rem;
}

.section-title {
    font-family: var(--font-serif);
    font-size: clamp(1.7rem, 3vw, 2.4rem);
    font-weight: 400;
    letter-spacing: 0.06em;
    text-align: center;
    margin-bottom: 4rem;
}

.section-title::after {
    content: "";
    display: block;
    width: 44px;
    height: 1px;
    background: var(--accent);
    margin: 1.2rem auto 0;
}

/* ============================================================
   Works
   ============================================================ */

.works {
    background: var(--bg);
    padding: 7rem 4rem;
}

/* Category filter */
.category-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.2rem;
    margin-bottom: 4.5rem;
}

.category-link {
    color: var(--fg-dim);
    text-decoration: none;
    font-size: 1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: color 0.3s var(--ease);
    position: relative;
}

.category-sep {
    color: var(--fg-dim);
    font-family: var(--font-serif);
    font-size: 1rem;
}

.category-link:hover,
.category-link.active {
    color: var(--accent);
}

.category-block {
    margin-bottom: 6rem;
}

.category-block:last-child {
    margin-bottom: 0;
}

.category-block .section-title {
    margin-bottom: 3rem;
    font-size: clamp(1.5rem, 2.6vw, 2rem);
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.4rem;
    max-width: 1240px;
    margin: 0 auto;
}

.work-item {
    position: relative;
    overflow: hidden;
    background: var(--bg-alt);
    cursor: pointer;
    aspect-ratio: 3 / 2;
    border: 1px solid var(--border);
    transition: transform 0.5s var(--ease), border-color 0.5s var(--ease);
}

.work-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--ease), filter 0.5s var(--ease);
    filter: saturate(0.85);
}

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

.work-item:hover img {
    transform: scale(1.05);
    filter: saturate(1);
}

.work-info {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.4rem;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.85),
        rgba(0, 0, 0, 0) 60%
    );
    opacity: 0;
    transition: opacity 0.4s var(--ease);
}

.work-item:hover .work-info {
    opacity: 1;
}

.work-info h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 400;
    letter-spacing: 0.04em;
    margin-bottom: 0.35rem;
}

.work-info span {
    font-size: 0.78rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* Placeholder work tiles (characters) */
.work-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
}

.placeholder-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--fg-dim);
    text-align: center;
    padding: 2rem;
}

.placeholder-inner .placeholder-plus {
    font-family: var(--font-serif);
    font-size: 2.6rem;
    line-height: 1;
    color: var(--fg-dim);
    transition: color 0.3s var(--ease);
}

.placeholder-inner p {
    font-size: 0.9rem;
    letter-spacing: 0.05em;
    line-height: 1.7;
}

.work-item:hover .placeholder-plus {
    color: var(--accent);
}

/* Placeholders: keep overlay caption hidden (nothing to display yet) */
.work-placeholder .work-info {
    opacity: 0 !important;
}

/* ============================================================
   About
   ============================================================ */

.about {
    background: var(--bg-alt);
    border-top: 1px solid var(--border);
}

.about-content {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.about-text {
    color: var(--fg-muted);
    font-size: 1.1rem;
    line-height: 1.95;
    margin-bottom: 3.5rem;
    letter-spacing: 0.03em;
}

.software-icons {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
    justify-items: center;
    align-items: center;
    gap: 2.2rem 2.5rem;
    max-width: 640px;
    margin: 0 auto;
}

.software-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    max-width: 120px;
}

.software-item img {
    width: 84px;
    height: 84px;
    object-fit: contain;
    padding: 14px;
    background: rgba(10, 10, 10, 0.5);
    border: 1px solid var(--border);
    border-radius: 18px;
    transition: transform 0.4s var(--ease), border-color 0.4s var(--ease);
}

.software-item:hover img {
    transform: translateY(-4px);
    border-color: var(--accent);
}

.software-item span {
    font-size: 0.76rem;
    color: var(--fg-muted);
    letter-spacing: 0.03em;
    text-align: center;
}

/* ============================================================
   Contact
   ============================================================ */

.contact {
    background: var(--bg);
    padding-bottom: 8rem;
}

.contact-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    max-width: 480px;
    margin: 0 auto;
}

.contact-link {
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 1.05rem;
    letter-spacing: 0.03em;
    padding: 0.9rem 2rem;
    border: 1px solid var(--border);
    width: 100%;
    justify-content: center;
    transition: all 0.35s var(--ease);
}

.contact-link svg {
    flex-shrink: 0;
    color: var(--accent);
}

.contact-link:hover {
    color: var(--fg);
    border-color: var(--accent);
    background: var(--accent-muted);
    transform: translateY(-2px);
}

/* ============================================================
   Footer
   ============================================================ */

.footer {
    border-top: 1px solid var(--border);
    padding: 2.5rem;
    text-align: center;
}

.footer p {
    font-size: 0.82rem;
    color: var(--fg-dim);
    letter-spacing: 0.06em;
}

/* ============================================================
   Lightbox
   ============================================================ */

.lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(10, 10, 10, 0.94);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s var(--ease), visibility 0.35s var(--ease);
    padding: 3rem;
}

.lightbox.open {
    opacity: 1;
    visibility: visible;
}

.lightbox.loading .lightbox-image {
    opacity: 0;
}

.lightbox-image {
    max-width: min(90vw, 1100px);
    max-height: 78vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
    transform: scale(0.96);
    opacity: 1;
    transition: opacity 0.4s var(--ease), transform 0.35s var(--ease);
}

.lightbox.open .lightbox-image {
    transform: scale(1);
}

.lightbox-info {
    margin-top: 1.5rem;
    text-align: center;
}

.lightbox-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 1.3rem;
    letter-spacing: 0.06em;
    margin-bottom: 0.4rem;
}

.lightbox-software {
    font-size: 0.85rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.lightbox-close {
    position: absolute;
    top: 2rem;
    right: 2.5rem;
    background: none;
    border: none;
    color: var(--fg-muted);
    font-size: 2.6rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.3s, transform 0.3s var(--ease);
}

.lightbox-close:hover {
    color: var(--accent);
    transform: rotate(90deg);
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1024px) {
    .works-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    section {
        padding: 4rem 1.5rem;
    }

    .work-info {
        opacity: 1;
        background: linear-gradient(
            to top,
            rgba(0, 0, 0, 0.9),
            rgba(0, 0, 0, 0) 55%
        );
    }

    .nav {
        padding: 1.2rem 1.5rem;
    }

    .nav.scrolled {
        padding: 0.9rem 1.5rem;
    }

    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        height: 100vh;
        width: 70%;
        max-width: 320px;
        background: rgba(10, 10, 10, 0.98);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 2.5rem;
        transition: right 0.45s var(--ease);
        z-index: 99;
    }

    .nav-links.open {
        right: 0;
    }

    .nav-links a {
        font-size: 1.1rem;
    }

    .nav-toggle {
        display: flex;
        z-index: 100;
    }

    .nav-toggle.open span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.open span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.open span:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .software-icons {
        gap: 1.8rem 1.5rem;
    }

    .lightbox {
        padding: 2rem;
    }

    .lightbox-close {
        top: 1.2rem;
        right: 1.5rem;
    }
}

@media (max-width: 560px) {
    .works-grid {
        grid-template-columns: 1fr;
    }

    .software-icons {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.8rem 1.2rem;
    }

    .software-item img {
        width: 64px;
        height: 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        scroll-behavior: auto !important;
    }
}
