/* =========================================================
   Lizhuoyuan Wan — Portfolio
   Minimal editorial redesign
   ========================================================= */

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

html {
    scroll-behavior: smooth;
}

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

/* ---------- Tokens ---------- */
:root {
    /* dark = default */
    --bg: #0e0e10;
    --text: #ededec;
    --text-muted: rgba(237, 237, 236, 0.58);
    --text-faint: rgba(237, 237, 236, 0.4);
    --line: rgba(255, 255, 255, 0.12);
    --line-strong: rgba(255, 255, 255, 0.34);
    --panel: rgba(255, 255, 255, 0.04);
    --header-bg: rgba(14, 14, 16, 0.72);

    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

    --maxw: 1180px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);

    /* hero stays a dark image banner in both themes */
    --hero-scrim: linear-gradient(
        100deg,
        rgba(10, 10, 12, 0.94) 0%,
        rgba(10, 10, 12, 0.74) 48%,
        rgba(10, 10, 12, 0.52) 100%
    );
}

body.theme-light {
    --bg: #f3f3f1;
    --text: #16161a;
    --text-muted: rgba(22, 22, 26, 0.62);
    --text-faint: rgba(22, 22, 26, 0.42);
    --line: rgba(22, 22, 26, 0.14);
    --line-strong: rgba(22, 22, 26, 0.32);
    --panel: rgba(22, 22, 26, 0.045);
    --header-bg: rgba(243, 243, 241, 0.8);
}

/* ---------- Base ---------- */
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

::selection {
    background: var(--text);
    color: var(--bg);
}

a {
    color: inherit;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.1rem clamp(1.5rem, 5vw, 3.4rem);
    background: var(--header-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.01em;
    text-decoration: none;
}

.nav {
    display: flex;
    align-items: center;
    gap: clamp(1rem, 2.4vw, 2rem);
}

.nav a {
    font-size: 0.9rem;
    text-decoration: none;
    color: var(--text-muted);
    transition: color 0.18s ease;
}

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

.theme-toggle,
.lang-toggle {
    font-family: var(--font-body);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: transparent;
    border: 1px solid var(--line-strong);
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    transition: color 0.18s ease, border-color 0.18s ease;
}

.theme-toggle:hover,
.lang-toggle:hover {
    color: var(--text);
    border-color: var(--text);
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    min-height: clamp(560px, 86vh, 900px);
    display: flex;
    align-items: center;
    overflow: hidden;
    isolation: isolate;
    color: #f4f4f3;
}

.hero-media {
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: var(--hero-scrim), url("assets/hero/hero-collage.webp");
    background-size: cover, cover;
    background-position: center, center;
}

.hero::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 140px;
    background: linear-gradient(to top, var(--bg), transparent);
    z-index: -1;
}

.hero-inner {
    width: 100%;
    max-width: var(--maxw);
    margin: 0 auto;
    padding: 8rem clamp(1.5rem, 5vw, 3.4rem) 6rem;
}

.hero-eyebrow {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: rgba(244, 244, 243, 0.66);
    margin-bottom: 1.4rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.9rem, 7.5vw, 5.4rem);
    line-height: 1.02;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

.hero-lead {
    max-width: 36rem;
    font-size: clamp(1.05rem, 1.7vw, 1.3rem);
    color: rgba(244, 244, 243, 0.82);
    margin-bottom: 2.4rem;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem 1.6rem;
    align-items: center;
}

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s var(--ease), color 0.2s var(--ease),
        border-color 0.2s var(--ease);
}

.btn-primary {
    padding: 0.8rem 1.7rem;
    border: 1px solid rgba(244, 244, 243, 0.5);
    color: #f4f4f3;
}

.btn-primary:hover {
    background: #f4f4f3;
    color: #111113;
    border-color: #f4f4f3;
}

.btn-text {
    padding: 0.8rem 0;
    color: rgba(244, 244, 243, 0.82);
    border-bottom: 1px solid transparent;
}

.btn-text:hover {
    color: #f4f4f3;
    border-bottom-color: currentColor;
}

/* ---------- Sections ---------- */
.section {
    max-width: var(--maxw);
    margin-inline: auto;
    padding: clamp(4.5rem, 9vw, 8.5rem) clamp(1.5rem, 5vw, 3.4rem);
}

.section-label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-faint);
    padding-bottom: 1.6rem;
    margin-bottom: 3rem;
    border-bottom: 1px solid var(--line);
}

/* ---------- About ---------- */
.about-lead {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.4rem, 2.7vw, 2.15rem);
    line-height: 1.42;
    letter-spacing: -0.01em;
    max-width: 42rem;
    margin-bottom: 3.6rem;
}

.about-cols {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.5rem;
    max-width: 40rem;
}

.about-h {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    padding-bottom: 0.9rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--line);
}

.plain-list {
    list-style: none;
}

.plain-list li {
    padding: 0.4rem 0;
    color: var(--text-muted);
}

/* ---------- Work ---------- */
.work-list {
    display: flex;
    flex-direction: column;
    gap: clamp(5rem, 10vw, 9rem);
}

.project {
    display: flex;
    flex-direction: column;
    gap: clamp(1.8rem, 3.5vw, 3rem);
}

.project-visual {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: var(--panel);
}

.project-visual img,
.project-visual iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    object-fit: cover;
}

.project-visual img {
    transition: transform 0.7s var(--ease);
}

.project:hover .project-visual img {
    transform: scale(1.04);
}

.project-visual.is-empty {
    aspect-ratio: auto;
    min-height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
}

.visual-note {
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
}

/* stacked layout: info rail + main column below the image */
.project-grid {
    display: grid;
    grid-template-columns: minmax(0, 220px) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4rem);
    align-items: start;
}

.project-aside {
    position: sticky;
    top: 6rem;
}

.project-index {
    display: block;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 2.4rem;
    line-height: 1;
    color: var(--text-faint);
    margin-bottom: 1.6rem;
}

.project-meta dt {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--text-faint);
    margin-bottom: 0.25rem;
}

.project-meta dd {
    font-size: 0.92rem;
    color: var(--text);
    margin-bottom: 1.2rem;
}

.project-meta dd:last-of-type {
    margin-bottom: 0;
}

.project-main {
    max-width: 44rem;
}

.project-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.8rem, 3.4vw, 2.8rem);
    line-height: 1.08;
    letter-spacing: -0.02em;
    margin-bottom: 0.45rem;
}

.project-kind {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-faint);
    margin-bottom: 1.7rem;
}

.project-desc {
    color: var(--text-muted);
    margin-bottom: 2.6rem;
}

/* inline rules / process figure — kept small so it doesn't dominate */
.project-figure {
    max-width: 340px;
    margin: 0 0 2.6rem;
}

.project-figure img {
    width: 100%;
    border: 1px solid var(--line);
}

.project-figure figcaption {
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-faint);
}

/* embedded video in project content */
.project-video {
    margin: 0 0 2.6rem;
}

.project-video iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

.project-video figcaption {
    margin-top: 0.7rem;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.title-note {
    font-weight: 400;
    font-size: 0.62em;
    letter-spacing: 0.02em;
    color: var(--text-faint);
}

/* screenshot gallery */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin: 0 0 2.6rem;
}

.project-gallery img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border: 1px solid var(--line);
}

.project-gallery figcaption {
    grid-column: 1 / -1;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-faint);
}

/* VR gallery — two scene shots paired + a wider report */
.vr-gallery {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    margin: 0 0 2.6rem;
}

.vr-gallery img {
    width: 100%;
    border: 1px solid var(--line);
}

.vr-gallery .vr-report {
    grid-column: 1 / -1;
    width: auto;
    max-width: 560px;
}

.vr-gallery figcaption {
    grid-column: 1 / -1;
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-faint);
}

.detail-block {
    margin-bottom: 2.2rem;
}

.detail-h {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    padding-bottom: 0.8rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid var(--line);
}

.detail-list {
    list-style: none;
    display: grid;
    gap: 0.7rem;
}

.detail-list li {
    position: relative;
    padding-left: 1.5rem;
    color: var(--text-muted);
}

.detail-list li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-faint);
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1.5rem;
    margin-top: 2.6rem;
}

/* ---------- Links ---------- */
.link {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--line-strong);
    text-underline-offset: 0.28em;
    text-decoration-thickness: 1px;
    transition: text-decoration-color 0.2s ease;
}

.link:hover {
    text-decoration-color: currentColor;
}

.link-note {
    font-size: 0.9rem;
    color: var(--text-faint);
}

/* ---------- Contact ---------- */
.contact-lead {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: clamp(1.3rem, 2.4vw, 1.95rem);
    line-height: 1.42;
    letter-spacing: -0.01em;
    max-width: 38rem;
    margin-bottom: 3rem;
}

.contact-links {
    list-style: none;
    max-width: 40rem;
}

.contact-links li {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--line);
}

.contact-links li:last-child {
    border-bottom: 1px solid var(--line);
}

.contact-k {
    flex: 0 0 6rem;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
}

/* ---------- Footer ---------- */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 0.5rem 2rem;
    max-width: var(--maxw);
    margin-inline: auto;
    padding: 2.4rem clamp(1.5rem, 5vw, 3.4rem);
    border-top: 1px solid var(--line);
    font-size: 0.85rem;
    color: var(--text-faint);
}

/* ---------- Motion ---------- */
.js-reveal .reveal {
    opacity: 0;
    transform: translateY(28px);
}

.js-reveal .reveal.in {
    opacity: 1;
    transform: none;
}

.reveal {
    transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

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

.hero-eyebrow,
.hero-title,
.hero-lead,
.hero-actions {
    animation: heroRise 0.85s var(--ease) both;
}

.hero-eyebrow { animation-delay: 0.05s; }
.hero-title { animation-delay: 0.16s; }
.hero-lead { animation-delay: 0.28s; }
.hero-actions { animation-delay: 0.4s; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
    .project-grid {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }
    .project-aside {
        position: static;
    }
    .about-cols {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
}

@media (max-width: 560px) {
    .nav {
        gap: 0.9rem;
    }
    .contact-links li {
        flex-direction: column;
        gap: 0.3rem;
    }
    .project-gallery,
    .vr-gallery {
        grid-template-columns: 1fr;
    }
}

/* ---------- Modal (games experience) ---------- */
.modal-trigger {
    display: inline-block;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--text);
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    position: relative;
}

.about-extra {
    margin-top: 2.4rem;
}

.modal-trigger::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -3px;
    height: 1px;
    background: var(--line-strong);
    transition: background-color 0.2s ease;
}

.modal-trigger:hover::after {
    background: currentColor;
}

.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 4vh 4vw;
}

.modal[aria-hidden="true"] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}

.modal-panel {
    position: relative;
    width: 100%;
    max-width: 1040px;
    max-height: 88vh;
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.32s var(--ease) both;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

.modal-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1.7rem 1.9rem 0.9rem;
    border-bottom: 1px solid var(--line);
}

.modal-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    letter-spacing: -0.01em;
}

.modal-close {
    font-family: var(--font-body);
    font-size: 1.6rem;
    line-height: 1;
    background: transparent;
    border: 0;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0.15rem 0.45rem;
    transition: color 0.18s ease;
}

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

.modal-intro {
    padding: 1.1rem 1.9rem 0;
    color: var(--text-muted);
    font-size: 0.92rem;
}

.modal-body {
    padding: 1.4rem 1.9rem 1.9rem;
    overflow-y: auto;
}

/* games — categories grid */
.games-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1.7rem 2.2rem;
}

.games-cat-h {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--text-faint);
    padding-bottom: 0.55rem;
    margin-bottom: 0.8rem;
    border-bottom: 1px solid var(--line);
}

.games-list {
    font-size: 0.92rem;
    color: var(--text-muted);
    line-height: 1.75;
}

.games-list .hrs {
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

body.modal-open {
    overflow: hidden;
}

/* dual-language inline content (used inside the modal) */
html[lang="en"] .lang-zh { display: none; }
html[lang="zh-CN"] .lang-en { display: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    .hero-eyebrow,
    .hero-title,
    .hero-lead,
    .hero-actions {
        animation: none;
    }
    .js-reveal .reveal {
        opacity: 1;
        transform: none;
    }
    .project-visual img,
    .project:hover .project-visual img {
        transition: none;
        transform: none;
    }
}


/* ---------- Work dashboard ---------- */
.work-dash { margin-bottom: clamp(3rem, 6vw, 5rem); }

.dash-hint {
    color: var(--text-muted);
    max-width: 44rem;
    margin-bottom: 1.4rem;
}

.dash-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.6rem;
}

.dash-filters button {
    font: inherit;
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.45rem 0.9rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.dash-filters button:hover { color: var(--text); }
.dash-filters button.is-active { border-color: var(--text); color: var(--text); }

.dash-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.1rem;
}

.dash-card {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    background: var(--panel);
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.35s var(--ease);
}

.dash-card:hover,
.dash-card:focus-visible {
    border-color: var(--line-strong);
    transform: translateY(-2px);
    outline: none;
}

.dash-card.is-hidden { display: none; }

.dash-thumb {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.dash-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s var(--ease);
}

.dash-card:hover .dash-thumb img { transform: scale(1.04); }

.dash-body {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    flex: 1;
    padding: 1rem 1.1rem 1rem;
}

.dash-head {
    display: flex;
    gap: 0.7rem;
    align-items: baseline;
}

.dash-index {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-faint);
    flex: none;
}

.dash-card .project-title {
    font-size: 1.12rem;
    line-height: 1.2;
    margin: 0;
}

.dash-card .project-kind {
    margin: 0;
    font-size: 0.7rem;
}

.dash-meta {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.2rem 0.75rem;
    margin: 0.2rem 0 0;
    font-size: 0.8rem;
}

.dash-meta dt {
    font-size: 0.64rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-faint);
    padding-top: 0.2rem;
}

.dash-meta dd { color: var(--text); }

.dash-card .project-desc {
    margin: 0.2rem 0 0;
    font-size: 0.86rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.dash-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: auto;
    padding-top: 0.5rem;
}

.dash-tag {
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.18rem 0.5rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--text-muted);
}

.dash-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1rem;
    align-items: center;
    padding: 0.75rem 1.1rem;
    border-top: 1px solid var(--line);
    font-size: 0.8rem;
}

.dash-details {
    margin-left: auto;
    font: inherit;
    font-size: 0.8rem;
    background: none;
    border: 0;
    color: var(--text);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--line-strong);
}

.dash-details:hover { text-decoration-color: var(--text); }

/* detail region: hidden until a card is opened */
.work-detail { display: none; }
.work-detail.is-open { display: block; }

.work-back {
    font: inherit;
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-muted);
    padding: 0.5rem 0.9rem;
    cursor: pointer;
    margin-bottom: 2.4rem;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.work-back:hover { color: var(--text); border-color: var(--text); }

.work-list .project { display: none; }
.work-list.has-open .project.is-open { display: flex; }

@media (max-width: 980px) {
    .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

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