:root {
    /* Light Theme (Default) */
    --bg-color: #f2f2f2;
    /* Greyer off-white */
    --text-color: #333333;
    --meta-color: #888888;
    --border-color: #d0d0d0;
    --accent-color: #000000;

    /* Final Font Stack */
    --font-main: 'Crimson Pro', 'Zen Old Mincho', 'Noto Serif TC', serif;
    --font-sans: 'Inter', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
    /* Added for code elements */

    --container-width: 900px;
}

body.dark-theme {
    /* Dark Theme */
    --bg-color: #222222;
    /* Lighter black */
    --text-color: #e0e0e0;
    --meta-color: #999999;
    --border-color: #444444;
    --accent-color: #ffffff;
}

/* Special Typography: Backslant l, L, I */
.slant-char {
    display: inline-block;
    transform: skewX(15deg);
    /* Tilts top-left to bottom-right like \ */
    transition: transform 0.1s ease-out;
}

/* Scaled Chinese Characters */
.cjk-char {
    font-size: 0.85em;
    display: inline-block;
    /* Ensures transform/scaling works well if needed, though font-size works on inline too */
}

.slant-char.backslash {
    transform: skewX(-15deg);
    /* Default Vertical (Counter-skewed) */
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-main);
    font-size: 18px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s ease, color 0.3s ease;
}

a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color 0.2s;
}

a:hover {
    border-bottom: 1px solid var(--text-color);
}

.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 4rem 2rem;
    position: relative;
}

/* Theme Toggle Icon - Handled by .control-btn now */

/* Header / Bio */
header {
    margin-bottom: 6rem;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Header Controls */
.header-controls {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    /* Increased gap for cleaner look */
}

.control-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: var(--text-color);
    opacity: 0.5;
    /* Start more subtle */
    transition: opacity 0.2s ease, transform 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 24px;
    /* Fixed height for alignment */
}

.control-btn:hover {
    opacity: 1;
}

.theme-toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    /* Ensure clean stroke */
    stroke: currentColor;
    stroke-width: 1.5;
    /* Thinner, more elegant stroke */
}

.theme-toggle:hover {
    transform: rotate(15deg);
}

.lang-toggle {
    font-family: var(--font-main);
    /* Serif */
    font-weight: 500;
    font-size: 1.1rem;
    /* Slightly larger to match icon visual weight */
    line-height: 1;
    letter-spacing: 0.05em;
}

.bio-intro {
    font-weight: 400;
    max-width: 800px;
    margin-bottom: 4rem;
}

.bio-en,
.bio-cn {
    font-size: 32px;
    /* Increased from 25px to restore size */
    line-height: 1.3;
    letter-spacing: -0.5px;
    font-weight: 500;
}

.bio-en {
    margin-bottom: 2rem;
    white-space: pre-line;
}

.bio-cn {
    white-space: pre-line;
}

/* Contact Section */
.contact-section {
    margin-bottom: 6rem;
    /* Increased spacing */
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.contact-section h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
}

.contact-list {
    list-style: none;
    display: flex;
    /* Changed from grid to flex for space-between */
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.contact-list .info-item {
    display: block;
    margin-bottom: 0;
}

/* Info Grid (Experience / Exhibitions) */
.info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 6rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
}

.info-column h3 {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-color);
}

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

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.info-label {
    color: var(--text-color);
    /* display: inline-flex; REMOVED: Causes layout issues with text spans */
    /* align-items: center; */
    /* gap: 0.3rem; */
    display: block;
    /* Ensure it takes width but allows text wrap */
}

.link-arrow {
    font-family: var(--font-mono);
    font-weight: bold;
    font-size: 0.8em;
    transition: transform 0.2s ease;
}

.info-label:hover .link-arrow {
    transform: translateX(3px);
}

.info-value {
    color: var(--meta-color);
    text-align: right;
    flex-shrink: 0;
    /* Prevent year from shrinking */
    white-space: nowrap;
    /* Keep year on one line */
}
}

/* Projects Section */
.section-title {
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2rem;
    color: var(--text-color);
}

/* Filter Menu */
.filter-menu {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
}

.filter-btn {
    background: none;
    border: none;
    color: var(--meta-color);
    cursor: pointer;
    padding: 0.2rem 0;
    transition: color 0.2s;
}

.filter-btn:hover,
.filter-btn.active {
    color: var(--text-color);
    font-weight: 500;
}

.project-list {
    display: flex;
    flex-direction: column;
}

.project-item {
    padding: 2rem 0;
    border-top: 1px solid var(--border-color);
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
    transition: opacity 0.3s ease;
}

.project-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

.project-main {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.project-title {
    font-size: 1.4rem;
    font-weight: 500;
}

.project-desc {
    font-size: 1rem;
    color: var(--meta-color);
    max-width: 500px;
}

.project-meta {
    text-align: right;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--meta-color);
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Experiments (Smaller list) */
.experiments-section {
    margin-top: 6rem;
}

.experiment-item {
    display: flex;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    font-size: 1rem;
}

.experiment-item:last-child {
    border-bottom: 1px solid var(--border-color);
}

/* Mobile */
@media (max-width: 768px) {
    .theme-toggle {
        top: 1rem;
        right: 1rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }

    .contact-list {
        flex-direction: column;
        /* Stack vertically on mobile */
        align-items: flex-start;
        gap: 1rem;
    }

    .contact-list .info-item {
        text-align: left;
    }

    .project-item {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }

    .project-meta {
        text-align: left;
        flex-direction: row;
        gap: 1rem;
        margin-top: 0.5rem;
    }

    /* Mobile Typography Adjustments */
    .bio-en,
    .bio-cn {
        font-size: 22px;
        /* Reduced from 32px for better mobile fit */
        line-height: 1.4;
        /* Slightly looser line height for small screens */
    }
}

@keyframes glitch-anim {
    0% {
        clip-path: inset(50% 0 30% 0);
        transform: translate(-5px, 0);
    }

    20% {
        clip-path: inset(10% 0 60% 0);
        transform: translate(5px, 0);
    }

    40% {
        clip-path: inset(40% 0 40% 0);
        transform: translate(-5px, 0);
    }

    60% {
        clip-path: inset(80% 0 5% 0);
        transform: translate(5px, 0);
    }

    80% {
        clip-path: inset(10% 0 70% 0);
        transform: translate(-5px, 0);
    }

    100% {
        clip-path: inset(30% 0 50% 0);
        transform: translate(5px, 0);
    }
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}