/* ============================================
   Wanting Peng Portfolio — Black / Interactive
   Layout follows the original PDF pages.
   ============================================ */

:root {
    --bg: #000000;
    --text: #ffffff;
    --gray: #808080;
    --gray-dim: #4a4a4a;
    --line: #2a2a2a;

    --font-en: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --font-cn: 'Noto Sans SC', 'PingFang SC', 'Microsoft YaHei', sans-serif;
    --font-sans: var(--font-en), var(--font-cn);

    --container-max: 1440px;
    --container-pad: 4vw;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 500;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

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

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

::selection {
    background: #ffffff;
    color: #000000;
}

/* ============================================
   Interactive layers
   ============================================ */

/* Mouse spotlight */
.spotlight {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 30%),
                                rgba(255, 255, 255, 0.045),
                                transparent 65%);
    opacity: 0;
    transition: opacity 0.6s var(--ease);
}

body.mouse-active .spotlight {
    opacity: 1;
}

/* Scroll progress bar */
.scroll-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 200;
    width: 100%;
    height: 2px;
    background: #ffffff;
    transform-origin: 0 50%;
    transform: scaleX(0);
}

/* ============================================
   Navigation
   ============================================ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 22px var(--container-pad);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: background 0.4s var(--ease), backdrop-filter 0.4s var(--ease);
}

.nav.scrolled {
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
}

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

.nav-link {
    position: relative;
    color: var(--gray);
    transition: color 0.3s var(--ease);
}

.nav-link::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 100%;
    height: 1px;
    background: var(--text);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.4s var(--ease);
}

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

.nav-link:hover::after {
    transform: scaleX(1);
    transform-origin: left center;
}

/* ============================================
   Page 1 · Cover (hero)
   Layout: big title lower-left, rule, two meta
   columns — mirrors the PDF cover.
   ============================================ */
.hero {
    position: relative;
    z-index: 2;
    max-width: var(--container-max);
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100svh;
    padding: 0 var(--container-pad) 14vh;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    scroll-margin-top: 72px;
}

.hero-title {
    font-size: clamp(64px, 13vw, 210px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1;
    margin-bottom: 28px;
}

.hero-title .char {
    display: inline-block;
    opacity: 0;
    transform: translateY(60px) rotate(3deg);
    animation: char-in 1s var(--ease) forwards;
    animation-delay: calc(0.05s * var(--i) + 0.15s);
}

@keyframes char-in {
    to {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
    }
}

.hero-line {
    height: 1px;
    background: var(--line);
    transform: scaleX(0);
    transform-origin: left center;
    animation: line-in 1.4s var(--ease) 0.7s forwards;
}

@keyframes line-in {
    to { transform: scaleX(1); }
}

.hero-meta {
    display: flex;
    gap: 72px;
    padding-top: 18px;
    font-size: 13px;
    color: var(--gray);
    opacity: 0;
    animation: fade-up 1s var(--ease) 1.05s forwards;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Scroll hint */
.scroll-hint {
    position: absolute;
    bottom: 40px;
    right: var(--container-pad);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    opacity: 0;
    animation: fade-up 1s var(--ease) 1.5s forwards;
}

.scroll-hint-text {
    font-size: 11px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--gray-dim);
    writing-mode: vertical-rl;
}

.scroll-hint-line {
    width: 1px;
    height: 56px;
    background: var(--gray-dim);
    overflow: hidden;
    position: relative;
}

.scroll-hint-line::after {
    content: '';
    position: absolute;
    top: -100%;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--text);
    animation: scroll-drip 2.2s var(--ease) infinite;
}

@keyframes scroll-drip {
    0% { top: -100%; }
    55% { top: 0; }
    100% { top: 100%; }
}

/* ============================================
   Page 2 · About Me
   Two columns: portrait left, text right.
   ============================================ */
.about {
    position: relative;
    z-index: 2;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 16vh var(--container-pad) 12vh;
    scroll-margin-top: 72px;
}

.about-title {
    font-size: clamp(40px, 5.5vw, 76px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.about-tagline {
    margin-top: 18px;
    font-size: 15px;
    color: var(--gray);
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(300px, 440px) 1fr;
    gap: clamp(48px, 7vw, 120px);
    margin-top: 64px;
    align-items: stretch;
}

.about-portrait {
    overflow: hidden;
}

.about-portrait img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 1.2s var(--ease);
}

.about-portrait:hover img {
    transform: scale(1.04);
}

.about-bio {
    font-size: 15px;
    line-height: 2.1;
    color: #d9d9d9;
}

.about-divider {
    height: 1px;
    background: var(--line);
    margin: 36px 0;
}

.about-edu {
    display: flex;
    justify-content: space-between;
    gap: 24px;
    font-size: 14px;
    color: #d9d9d9;
}

.about-edu span:last-child {
    color: var(--gray);
}

.skills-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-dim);
    margin-bottom: 8px;
}

.skill-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 24px;
    padding: 18px 12px;
    margin: 0 -12px;
    border-radius: 4px;
    transition: background 0.35s var(--ease), padding-left 0.35s var(--ease);
}

.skill-item:hover {
    background: rgba(255, 255, 255, 0.05);
    padding-left: 20px;
}

.skill-cat {
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.skill-detail {
    font-size: 13px;
    color: var(--gray);
    text-align: right;
}

/* ============================================
   Page 3 · Contents
   Label, big title, rule, 4-column card grid.
   ============================================ */
.contents {
    position: relative;
    z-index: 2;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 10vh var(--container-pad) 14vh;
    scroll-margin-top: 72px;
}

.contents-label {
    font-size: 13px;
    color: var(--gray-dim);
    margin-bottom: 12px;
}

.contents-title {
    font-size: clamp(40px, 5.5vw, 76px);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.contents-line {
    height: 1px;
    background: var(--line);
    margin: 40px 0 56px;
}

.contents-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: clamp(20px, 2.5vw, 40px);
}

/* Card */
.project-card {
    cursor: pointer;
    outline: none;
}

.card-image {
    position: relative;
    width: 100%;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    background: #0d0d0d;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform: scale(1.001);
    transition: transform 1s var(--ease);
    will-change: transform;
}

.card-image::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid var(--line);
    pointer-events: none;
    transition: border-color 0.4s var(--ease);
}

.project-card:hover .card-image img,
.project-card:focus-visible .card-image img {
    transform: scale(1.07);
}

.project-card:hover .card-image::after,
.project-card:focus-visible .card-image::after {
    border-color: #6a6a6a;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-top: 18px;
    font-size: 13px;
}

.card-num {
    color: var(--gray-dim);
    font-weight: 600;
    letter-spacing: 0.06em;
    transition: color 0.3s var(--ease);
}

.card-name {
    font-weight: 700;
    letter-spacing: 0.08em;
}

.project-card:hover .card-num {
    color: var(--gray);
}

.card-sub {
    margin-top: 6px;
    font-size: 12px;
    color: var(--gray);
    transition: color 0.3s var(--ease);
}

.project-card:hover .card-sub {
    color: #b5b5b5;
}

/* ============================================
   Contact + Footer
   ============================================ */
.contact {
    position: relative;
    z-index: 2;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 14vh var(--container-pad);
    scroll-margin-top: 72px;
}

.label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--gray-dim);
    margin-bottom: 40px;
}

.contact-email {
    display: inline-block;
    font-size: clamp(20px, 3.2vw, 40px);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--gray);
    position: relative;
    transition: color 0.4s var(--ease);
}

.contact-email::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -6px;
    width: 100%;
    height: 1px;
    background: var(--text);
    transform: scaleX(0);
    transform-origin: right center;
    transition: transform 0.5s var(--ease);
}

.contact-email:hover {
    color: var(--text);
}

.contact-email:hover::after {
    transform: scaleX(1);
    transform-origin: left center;
}

.footer {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 40px var(--container-pad) 48px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--gray-dim);
}

/* ============================================
   Scroll reveal
   ============================================ */
.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}

.reveal.in-view {
    opacity: 1;
    transform: translateY(0);
}

/* ============================================
   Project detail view
   ============================================ */
.view-project {
    min-height: 100vh;
    position: relative;
    z-index: 2;
}

.project-pages {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 88px var(--container-pad) 12vh;
}

.project-page {
    margin-bottom: 24px;
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
}

.project-page.in-view {
    opacity: 1;
    transform: translateY(0);
}

.project-page img {
    width: 100%;
    height: auto;
}

/* ============================================
   Responsive
   ============================================ */
@media (max-width: 1024px) {
    .contents-grid {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 56px;
    }
}

@media (max-width: 768px) {
    .hero {
        padding-bottom: 12vh;
    }

    .hero-meta {
        gap: 40px;
    }

    .scroll-hint {
        display: none;
    }

    .about-grid {
        grid-template-columns: 1fr;
        margin-top: 48px;
    }

    .about-portrait {
        max-width: 340px;
    }

    .about-portrait img {
        height: auto;
    }

    .about-edu,
    .skill-item {
        flex-direction: column;
        gap: 6px;
    }

    .skill-detail {
        text-align: left;
    }

    .nav-links {
        gap: 18px;
    }
}

@media (max-width: 520px) {
    .contents-grid {
        grid-template-columns: 1fr;
        row-gap: 48px;
    }
}

/* ============================================
   Reduced motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .hero-title .char,
    .hero-line,
    .hero-meta,
    .scroll-hint,
    .scroll-hint-line::after {
        animation: none;
        opacity: 1;
        transform: none;
    }

    .hero-line {
        transform: scaleX(1);
    }

    .reveal,
    .project-page {
        transition: none;
        opacity: 1;
        transform: none;
    }

    .card-image img,
    .about-portrait img {
        transition: none;
    }

    .spotlight {
        display: none;
    }
}
