/* Base Reset */
:root {
    --bg-color: #050505;
    --text-color: #ffffff;
    --text-muted: #888888;
    --card-bg: #131313;
    --border-color: #222222;
    --primary-color: #CF0000;
    --navbar-bg: linear-gradient(to top, #131416 0%, #000000 100%);
    --hero-overlay: linear-gradient(to right, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.6) 40%, rgba(0,0,0,0.2) 100%);
}

body.light-mode {
    --bg-color: #ffffff;
    --text-color: #000000;
    --text-muted: #444444;
    --card-bg: #fdfdfd;
    --border-color: #eeeeee;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --hero-overlay: linear-gradient(to right, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.7) 40%, rgba(255,255,255,0.3) 100%);
}

body.light-mode .experience-content {
    background-color: transparent;
    margin-right: 16px;
}

body.light-mode .experience-border-frame {
    border-color: #000000;
    background-color: #f9f9f9;
}

body.light-mode .experience-scroll-wrapper::-webkit-scrollbar-thumb {
    background: #000000;
}

body.light-mode .experience-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #333333;
}

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

body {
    font-family: "PingFang SC", "Microsoft YaHei", "Inter", sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    overflow-x: hidden;
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* Global Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

/* Navbar */
.navbar {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 30px 8%;
    z-index: 100;
    background: var(--navbar-bg);
}

.logo {
    font-size: 20px;
    color: var(--text-color);
    letter-spacing: 1px;
}

.nav {
    display: flex;
    align-items: center;
    gap: 40px;
}

.nav a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 16px;
    position: relative;
    transition: color 0.3s ease;
}

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

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

.nav a.active::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--primary-color);
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding-left: 10px;
    transition: color 0.3s;
}

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

.theme-toggle img {
    width: 20px;
    height: 20px;
    display: block;
}

.hero {
    height: 100vh;
    width: 100vw;
    display: flex;
    align-items: center;
    padding-left: 10%;
    position: relative;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background-size: cover;
    background-position: center;
}

.hero-bg::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--hero-overlay), 
                linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 20%);
}

.hero-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.hero-content {
    max-width: 1000px;
    animation: fadeIn 1s ease-out forwards;
    position: relative; /* 必须设为 relative 才能让内部按钮绝对定位 */
}

.hero-title-img {
    width: 100%;
    max-width: 850px;
    height: auto;
    display: block;
    filter: drop-shadow(0 5px 20px rgba(207, 0, 0, 0.4));
}

.hero-content .btn-primary {
    position: absolute;
    /* 默认位置示例：你可以修改这里的 top 和 left 进行细调 */
    top: 65%; 
    left: 10%; 
    z-index: 10;
}

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

.subtitle {
    font-size: 26px;
    color: #B0B0B0;
    line-height: 1.6;
    margin-bottom: 5px;
    font-family: "Microsoft YaHei UI Light", "Microsoft YaHei Light", "微软雅黑 Light", sans-serif;
    font-weight: 300;
}

.highlight {
    color: var(--primary-color);
}

.title {
    font-size: 80px;
    color: var(--primary-color);
    font-family: "Microsoft YaHei UI", "Microsoft YaHei", "微软雅黑", sans-serif;
    font-weight: bold;
    margin: 15px 0 50px;
    letter-spacing: 4px;
}

/* Button */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 15px;
    padding: 16px 36px;
    background-color: var(--card-bg);
    color: var(--text-color);
    text-decoration: none;
    font-size: 18px;
    border-radius: 6px;
    border-top: 1px solid var(--border-color);
    border-left: 1px solid var(--border-color);
    border-right: 2px solid var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--bg-color);
    color: var(--text-color);
    transform: translateY(-2px);
    box-shadow: 2px 5px 15px rgba(255, 0, 0, 0.15);
}

.arrow {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.btn-primary:hover .arrow {
    transform: translateX(5px);
}

/* Responsive Design for Mobile */
@media screen and (max-width: 768px) {
    .navbar {
        padding: 20px;
        flex-direction: column;
        gap: 20px;
    }

    .nav {
        gap: 25px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .nav a {
        font-size: 15px;
    }

    .hero {
        padding: 0 20px;
        justify-content: center;
        background: linear-gradient(rgba(0,0,0,0.85), rgba(0,0,0,0.85)), url('../images/bg.jpg') center/cover no-repeat;
    }

    .hero-content {
        text-align: center;
    }

    .subtitle {
        font-size: 20px;
    }

    .title {
        font-size: 55px;
        margin: 10px 0 30px;
    }

    .btn-primary {
        padding: 14px 30px;
        font-size: 16px;
    }
}

/* Portfolio Page */
.portfolio-page {
    padding: 150px 8% 100px;
}

.portfolio-header {
    margin-bottom: 60px;
}

.portfolio-title-wrapper {
    display: flex;
    align-items: center;
}

.line {
    height: 1px;
    background-color: #ff0000;
    width: 60px;
}

.portfolio-title {
    font-size: 40px;
    color: var(--text-color);
    font-weight: 300;
    padding: 0 20px;
    letter-spacing: 2px;
}

.portfolio-filters {
    display: flex;
    gap: 40px;
    list-style: none;
    margin-top: 50px;
}

.portfolio-filters li {
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    padding-bottom: 8px;
    position: relative;
    transition: color 0.3s;
}

.portfolio-filters li:hover,
.portfolio-filters li.active {
    color: var(--text-color);
}

.portfolio-filters li.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: #ff0000;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    align-items: start;
}

.portfolio-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    min-height: 260px;
}

.portfolio-item img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.portfolio-media-button {
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    display: block;
    position: relative;
    cursor: pointer;
}

.portfolio-video-preview {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.video-play-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.55);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    transition: transform 0.3s ease, background 0.3s ease;
    pointer-events: none;
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to top, rgba(0,0,0,0.95) 0%, rgba(0,0,0,0.4) 50%, transparent 100%);
    opacity: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 30px;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover img {
    transform: scale(1.05); /* subtle zoom effect */
}

.portfolio-item:hover .portfolio-video-preview {
    transform: scale(1.05);
}

.portfolio-item:hover .video-play-badge {
    transform: translate(-50%, -50%) scale(1.08);
    background: rgba(230, 0, 0, 0.78);
}

.portfolio-overlay h3 {
    font-size: 22px;
    font-weight: 500;
    margin-bottom: 10px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.portfolio-overlay p {
    font-size: 13px;
    color: #cccccc;
    margin-bottom: 20px;
    line-height: 1.6;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.portfolio-item:hover .portfolio-overlay h3,
.portfolio-item:hover .portfolio-overlay p,
.portfolio-item:hover .portfolio-overlay .tags {
    transform: translateY(0);
}

.tags {
    display: flex;
    gap: 10px;
    transform: translateY(20px);
    transition: transform 0.4s ease;
    transition-delay: 0.1s;
}

.tags span {
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 4px;
    color: #eeeeee;
}

.portfolio-pagination {
    margin-top: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.pagination-summary {
    font-size: 14px;
    color: var(--text-muted);
}

.pagination-controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
}

.pagination-button {
    min-width: 44px;
    height: 44px;
    padding: 0 16px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    color: var(--text-color);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.pagination-button:hover:not(:disabled) {
    border-color: #ff0000;
    transform: translateY(-1px);
}

.pagination-button.active {
    background: #e60000;
    border-color: #e60000;
    color: #ffffff;
}

.pagination-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pagination-nav {
    min-width: 88px;
}

.video-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.82);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

.video-modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.video-modal {
    width: min(960px, 100%);
    background: #0b0b0b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.4);
}

.video-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.video-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: #ffffff;
    font-weight: 500;
}

.video-modal-close {
    border: none;
    background: transparent;
    color: #ffffff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}

.video-modal-content {
    background: #000000;
}

.video-modal-content video {
    width: 100%;
    max-height: 80vh;
    display: block;
    background: #000000;
}

/* Portfolio Header specifics */
.navbar-solid {
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

@media screen and (max-width: 900px) {
    .portfolio-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media screen and (max-width: 600px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    .portfolio-filters {
        flex-wrap: wrap;
        gap: 20px;
    }

    .portfolio-item {
        min-height: 220px;
    }

    .pagination-button {
        min-width: 40px;
        height: 40px;
        padding: 0 12px;
    }

    .video-modal-overlay {
        padding: 12px;
    }

    .video-modal-header {
        padding: 14px 16px;
    }

    .video-play-badge {
        width: 56px;
        height: 56px;
        font-size: 24px;
    }
}

/* Password Modal */
.password-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #050505;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.password-modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.password-modal {
    width: 100%;
    max-width: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
}

.lock-icon {
    width: 64px;
    height: 64px;
    background-color: #141414;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 25px;
}

.lock-icon svg {
    width: 32px;
    height: 32px;
    fill: var(--text-color);
}

.password-modal .modal-title {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    color: #ffffff;
    font-weight: 300;
    margin-bottom: 15px;
    width: 100%;
}

.password-modal .modal-title .line {
    width: 50px;
    height: 1px;
    background-color: #ff0000;
    margin: 0 15px;
}

.modal-subtitle {
    font-size: 15px;
    color: #666666;
    margin-bottom: 35px;
}

.modal-card {
    background-color: var(--card-bg); /* Very dark gray for contrast against #050505 */
    width: 100%;
    padding: 35px 30px 25px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
}

.modal-card label {
    display: block;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.modal-card input {
    width: 100%;
    background-color: #222222;
    border: 1px solid #333333;
    border-radius: 6px;
    padding: 15px;
    color: #ffffff;
    font-size: 15px;
    outline: none;
    margin-bottom: 25px;
    transition: border-color 0.3s;
}

.modal-card input:focus {
    border-color: #ff0000;
}

.error-msg {
    color: #ff4444;
    font-size: 13px;
    margin-top: -15px;
    margin-bottom: 15px;
    display: none;
}

.btn-submit {
    width: 100%;
    background-color: #e60000;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    padding: 15px;
    font-size: 16px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn-submit:hover {
    background-color: #ff0000;
}

.modal-divider {
    height: 1px;
    background-color: #222222;
    margin: 25px 0 20px;
}

.modal-footer {
    font-size: 13px;
    color: #555555;
    text-align: center;
}

/* Utilities */
.justify-center {
    justify-content: center;
}

/* About Page */
.about-page {
    padding: 150px 8% 100px;
}

.about-grid {
    display: grid;
    grid-template-columns: 240px 1fr;
    grid-template-rows: auto auto auto;
    gap: 25px;
    max-width: 1000px;
    margin: 0 auto;
}

.about-avatar {
    grid-column: 1 / 2;
    grid-row: 1 / 2;
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
}

.about-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.about-card {
    background-color: var(--card-bg);
    border-radius: 10px;
    padding: 35px;
    border: 1px solid var(--border-color);
}

.card-title {
    font-size: 20px;
    font-weight: 400;
    color: #aaaaaa;
    margin-bottom: 25px;
}

.intro-card {
    grid-column: 2 / 3;
    grid-row: 1 / 2;
}

.intro-text {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
    word-break: break-all;
}

.intro-text strong {
    color: var(--text-color);
    font-weight: 500;
}

.experience-card {
    grid-column: 1 / 3;
    grid-row: 2 / 3;
}

.experience-border-frame {
    border: 2px solid var(--primary-color);
    border-radius: 12px;
    /* overflow: hidden removed to show scrollbar outside */
    background-color: #131416;
    margin-right: 16px; /* Create space for scrollbar */
    position: relative;
}

.experience-scroll-wrapper {
    max-height: 480px;
    overflow-y: auto;
    padding: 0; 
    margin-right: -16px; /* Push scrollbar outside the border */
    position: relative;
    border-radius: 0 10px 10px 0; /* Apply radius to side that bleeds? or just ignore */
    /* Fade effect for scrolling content */
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 40px, black calc(100% - 40px), transparent 100%);
    mask-image: linear-gradient(to bottom, transparent 0, black 40px, black calc(100% - 40px), transparent 100%);
}

.experience-content {
    border: none; 
    padding: 25px 30px;
    /* background-color moved to frame */
}

/* Custom Scrollbar for Experience Wrapper */
.experience-scroll-wrapper::-webkit-scrollbar {
    width: 6px;
}

.experience-scroll-wrapper::-webkit-scrollbar-track {
    background: transparent;
}

.experience-scroll-wrapper::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 10px;
}

.experience-scroll-wrapper::-webkit-scrollbar-thumb:hover {
    background: #ff0000;
}

.exp-date {
    font-size: 16px;
    color: var(--text-color);
    font-weight: 500;
    margin: 25px 0 15px;
}

.exp-item ul {
    list-style: disc;
    padding-left: 20px;
}

.exp-item li {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 12px;
}

.exp-item li strong {
    color: var(--text-color);
    font-weight: 500;
}

.workflow-card {
    grid-column: 1 / 2;
    grid-row: 3 / 4;
}

.workflow-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.workflow-tags span {
    background-color: var(--border-color);
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
    padding: 8px 15px; /* Added horizontal padding */
    border-radius: 6px;
    text-align: center;
    white-space: nowrap; /* Prevent tag text from wrapping inside the tag */
}

.skills-card {
    grid-column: 2 / 3;
    grid-row: 3 / 4;
}

.skills-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    list-style: disc;
    padding-left: 20px;
    gap: y 10px; /* actually we just use line-height */
}

.skills-list li {
    font-size: 13px;
    color: #888888;
    margin-bottom: 12px;
}

.skills-list li.empty {
    list-style: none;
}

@media screen and (max-width: 900px) {
    .about-grid {
        grid-template-columns: 1fr;
        grid-template-rows: auto;
    }
    
    .about-avatar {
        grid-column: 1 / -1;
        grid-row: 1;
        max-width: 240px;
        margin: 0 auto;
    }
    
    .intro-card {
        grid-column: 1 / -1;
        grid-row: 2;
    }
    
    .experience-card, .workflow-card, .skills-card {
        grid-column: 1 / -1;
        grid-row: auto;
    }
    
    .workflow-tags span:nth-child(4) {
        font-size: 14px;
    }
}

/* Contact Page */
.contact-page {
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: var(--bg-color);
    padding-top: 50px;
    position: relative;
}

.contact-page::before {
    display: none;
}

.contact-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    background-size: cover;
    background-position: center;
    overflow: hidden;
}

.contact-bg::after {
    content: "";
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: var(--hero-overlay);
    opacity: 0.8;
}

.contact-bg video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-header, .contact-list {
    position: relative;
    z-index: 1;
}

.contact-header {
    text-align: center;
    margin-bottom: 60px;
}

.contact-subtitle {
    font-size: 15px;
    color: #666666;
    margin-top: 20px;
}

.contact-list {
    display: flex;
    flex-direction: column;
    gap: 25px;
    width: 100%;
    max-width: 320px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 20px;
}

.contact-icon {
    width: 54px;
    height: 54px;
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}

.contact-icon svg,
.contact-icon img {
    width: 26px;
    height: auto;
    fill: var(--text-color);
}

.contact-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.contact-label {
    font-size: 13px;
    color: var(--text-muted);
}

.contact-value {
    font-size: 17px;
    color: var(--text-color);
}
