/* 基本样式与暗色主题 */
body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #000;
    color: #fff;
    overflow: hidden; /* 隐藏滚动条，由JS控制滚动 */
    text-shadow: 0 0 8px rgba(0, 0, 0, 0.8);
}

/* WebGL画布样式 */
#gl-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1; /* 将画布置于最底层 */
}

/* 导航栏样式 */
header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 20px 50px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    z-index: 10;
}

nav a {
    color: #fff;
    text-decoration: none;
    margin: 0 20px;
    font-size: 16px;
    font-weight: 500;
    transition: color 0.3s ease;
}

nav a:hover, nav a.active {
    color: #F09819; /* Replaced cyan with a warm amber/gold color */
}

/* 内容区域基本样式 */
main {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow-y: scroll;
    scroll-snap-type: y mandatory;
}

section {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    scroll-snap-align: start;
    text-align: center;
}

.content {
    background: rgba(0, 0, 0, 0.1); /* Made background more transparent */
    padding: 30px;
    border-radius: 10px;
    max-width: 90%;
    margin: 0 auto;
}

h1 {
    font-size: 3rem;
    margin-bottom: 10px;
}

h2 {
    font-size: 2.5rem;
    border-bottom: 2px solid #F09819; /* Replaced cyan with a warm amber/gold color */
    padding-bottom: 10px;
    display: inline-block;
}

/* --- Mobile Optimization --- */
@media (max-width: 768px) {
    header {
        padding: 15px 10px;
    }

    nav a {
        margin: 0 10px;
        font-size: 14px;
    }

    .content {
        padding: 20px;
        max-width: 90%;
    }

    h1 {
        font-size: 2.5rem;
    }

    h2 {
        font-size: 1.8rem;
    }
}

/* --- Content Specific Styles --- */
.content p {
    line-height: 1.8;
    text-align: left;
    margin-bottom: 20px;
    max-width: 700px; /* Improve readability for long texts */
    margin-left: auto;
    margin-right: auto;
}

.about-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 40px;
    text-align: left;
}

.photo-frame {
    width: 250px;
    height: 250px;
    border-radius: 50%;
    border: 3px solid #F09819;
    overflow: hidden;
    flex-shrink: 0;
    cursor: pointer;
}

.about-container .photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 0px center;
    transform: scale(1.0);
    transition: transform 0.3s ease;
}

.about-container .photo-frame:hover img {
    transform: scale(1.3);
}

.about-text {
    flex: 1;
    max-width: 600px;
}

.about-text p {
    margin-bottom: 10px;
}

.works-grid, .research-grid, .courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    width: 100%;
    text-align: left;
}

.grid-item {
    background: transparent;
    padding: 20px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.grid-item.active {
    /* No background change to keep it consistent */
}

.grid-item h3 {
    margin-top: 0;
    color: #F09819;
    border-bottom: 1px solid rgba(240, 152, 25, 0.5);
    padding-bottom: 10px;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-left: 25px;
}

.grid-item h3::before {
    content: '+';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    transition: transform 0.3s ease;
    font-size: 1.4rem;
    line-height: 1;
}

.grid-item.active h3::before {
    transform: translateY(-50%) rotate(45deg);
}

.grid-item ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, margin-top 0.4s ease-in-out;
}

.grid-item.active ul {
    margin-top: 15px;
}

.grid-item li {
    padding: 5px 0;
}

.download-cv {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    border: 2px solid #F09819;
    color: #F09819;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.download-cv:hover {
    background-color: #F09819;
    color: #000;
}

@media (max-width: 768px) {
    .about-container {
        flex-direction: column;
    }
}

/* --- Modal/Lightbox Styles --- */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    padding-top: 60px;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.9);
}

/* Modal Content (image) */
.modal-content {
    margin: auto;
    display: block;
    width: 80%;
    max-width: 700px;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
}

.modal-close:hover,
.modal-close:focus {
    color: #bbb;
    text-decoration: none;
    cursor: pointer;
} 

.photo-frame img:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 25px rgba(240, 152, 25, 0.4);
}

/* Modal for Content Iframe */
#contentModal .modal-content-container {
    position: relative;
    background-color: #1a1a1a;
    margin: 1vh auto; /* Further reduced top/bottom margin */
    padding: 20px;
    border: 1px solid var(--accent-color);
    width: 90%; /* Increased width */
    max-width: 1200px; /* Increased max-width */
    height: 88vh; /* Further increased height */
    border-radius: 8px;
    box-shadow: 0 4px 8px 0 rgba(0,0,0,0.2),0 6px 20px 0 rgba(0,0,0,0.19);
    display: flex;
    flex-direction: column;
    overflow-y: auto; /* 允许垂直方向滚动 */
}

#contentModalClose {
    align-self: flex-end;
    position: sticky;
    top: 0;
    z-index: 10;
}

#contentModalClose:hover,
#contentModalClose:focus {
    color: #F09819;
    text-decoration: none;
    transform: scale(1.1);
}


#contentFrame {
    width: 100%;
    height: 100%;
    border: none;
    flex-grow: 1; /* 让iframe填满剩余空间 */
}

/* Work link style */
.work-link {
    color: #e0e0e0;
    text-decoration: none;
    transition: color 0.3s ease, text-shadow 0.3s ease;
}

.work-link:hover {
    color: #F09819;
    text-shadow: 0 0 10px rgba(240, 152, 25, 0.7);
    cursor: pointer;
}

/* Scroll Down Indicator */
.scroll-down {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 48px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 50px;
    cursor: pointer;
}

.scroll-down::before {
    content: '';
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: scroll-down-animation 2s infinite;
}

@keyframes scroll-down-animation {
    0% {
        transform: translate(-50%, 0);
        opacity: 0;
    }
    40% {
        opacity: 1;
    }
    80% {
        transform: translate(-50%, 20px);
        opacity: 0;
    }
    100% {
        opacity: 0;
    }
}

/* Contact Links */
.contact-links {
    margin-top: 2rem;
    display: flex;
    gap: 1.5rem;
    justify-content: flex-start;
    align-items: center;
}

.contact-links a {
    color: #ccc;
    text-decoration: none;
    font-size: 1rem;
    padding: 8px 15px;
    border: 1px solid #ccc;
    border-radius: 20px;
    transition: all 0.3s ease;
}

.contact-links a:hover {
    color: #0c0c0c;
    background-color: #F09819;
    border-color: #F09819;
    box-shadow: 0 0 15px rgba(240, 152, 25, 0.6);
}


@media (max-width: 768px) {
    #contentModal .modal-content-container {
        width: 95%;
        height: 85vh;
        margin: 7.5vh auto;
    }
     #contentModalClose {
        top: 10px;
        right: 15px;
        font-size: 40px;
    }

    .scroll-down {
        bottom: 20px;
    }

    .contact-links {
        flex-wrap: wrap;
        gap: 1rem;
    }
} 

.content h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.works-categories {
    display: flex;
    flex-direction: column; /* Change to vertical layout */
    justify-content: center; /* Center items vertically */
    align-items: center; /* Center items horizontally */
    gap: 1.5rem; /* Adjust gap for vertical layout */
    width: 100%;
    max-width: 500px; /* Limit max width for better appearance on large screens */
    margin: 2rem auto 0; /* Center the container and add top margin */
}

.works-categories a {
    flex: 1;
    width: 100%; /* Make links take full width of the container */
    text-decoration: none;
    color: var(--text-color);
    background-color: transparent;
    border: 1px solid var(--accent-color-translucent);
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.works-categories a:hover {
    background-color: rgba(240, 152, 25, 0.1);
    transform: translateY(-5px);
    border-color: var(--accent-color);
}

.works-categories h3 {
    margin-bottom: 0.5rem;
    color: var(--accent-color);
    font-size: 1.5rem;
}

.works-categories p {
    margin: 0;
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    text-align: center; /* Ensure text is centered */
}

.works-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    width: 100%;
    text-align: left;
}

.grid-item {
    background: rgba(255, 255, 255, 0.05);
    padding: 20px;
    border-radius: 8px;
    transition: background-color 0.3s ease;
}

.grid-item.active {
    background: rgba(255, 255, 255, 0.1);
}

.grid-item h3 {
    margin-top: 0;
    color: #F09819;
    border-bottom: 1px solid rgba(240, 152, 25, 0.5);
    padding-bottom: 10px;
    position: relative;
    cursor: pointer;
    user-select: none;
    padding-left: 25px;
}

.grid-item h3::before {
    content: '+';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-weight: bold;
    transition: transform 0.3s ease;
    font-size: 1.4rem;
    line-height: 1;
}

.grid-item.active h3::before {
    transform: translateY(-50%) rotate(45deg);
}

.grid-item ul {
    list-style: none;
    padding-left: 0;
    margin: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-in-out, margin-top 0.4s ease-in-out;
}

.grid-item.active ul {
    margin-top: 15px;
}

.grid-item li {
    padding: 5px 0;
}

.download-cv {
    display: inline-block;
    margin-top: 20px;
    padding: 12px 25px;
    border: 2px solid #F09819;
    color: #F09819;
    text-decoration: none;
    border-radius: 5px;
    transition: background-color 0.3s, color 0.3s;
}

.download-cv:hover {
    background-color: #F09819;
    color: #000;
}

@media (max-width: 768px) {
    .works-categories {
        gap: 1rem;
        padding: 0 1rem; /* Add some padding on mobile */
    }

    .about-container {
        flex-direction: column;
    }
    .content h1 {
        font-size: 3rem;
    }
} 

/* --- Consolidated Mobile Styles --- */
@media (max-width: 768px) {
    header {
        padding: 15px 10px;
    }

    nav a {
        margin: 0 10px;
        font-size: 14px;
    }

    .content {
        padding: 20px;
        max-width: 90%;
    }

    h1 {
        font-size: 2.5rem;
    }

    .content h1 {
        font-size: 3rem;
    }

    h2 {
        font-size: 1.8rem;
    }

    /* About Section Mobile Layout */
    .about-container {
        flex-direction: column;
        gap: 20px;
    }

    .photo-frame {
        width: 200px;
        height: 200px;
        margin-bottom: 1rem;
    }

    .about-text {
        text-align: center;
    }
    
    .about-text p {
        text-align: justify;
    }

    .contact-links {
        justify-content: center;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    /* Modal Mobile Layout */
    #contentModal .modal-content-container {
        width: 95%;
        height: 82vh;
        margin: 0.0vh auto;
    }

    #contentModalClose {
        top: 10px;
        right: 15px;
        font-size: 40px;
    }

    .scroll-down {
        bottom: 20px;
    }

    /* Works/Courses Section Mobile Layout */
    .works-categories {
        gap: 1rem;
        padding: 0 1rem;
    }
} 

/* PDF Viewer Modal Styles */
.pdf-viewer-modal {
    display: none; /* Hidden by default */
    position: fixed;
    z-index: 1001; /* Higher than content modal */
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.95);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.pdf-viewer-header {
    width: 100%;
    max-width: 90vw;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    color: var(--heading-color);
}

.pdf-viewer-title {
    font-size: 1.2rem;
    font-weight: 600;
}

.pdf-close-btn {
    background: var(--accent-color);
    color: #000;
    border: none;
    padding: 0.6rem 1.2rem;
    cursor: pointer;
    border-radius: 5px;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.pdf-close-btn:hover {
    background-color: #fff;
}

.pdf-viewer {
    width: 100%;
    max-width: 90vw;
    height: 85vh;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

