
:root {
    --primary: #4361EE;
    /* 活力蓝 */
    --on-primary: #FFFFFF;
    --primary-container: #D7E3FF;
    --on-primary-container: #001B3D;
    --secondary: #3A0CA3;
    /* 深紫 */
    --on-secondary: #FFFFFF;
    --secondary-container: #E8DEF8;
    --on-secondary-container: #1D192B;
    --tertiary: #F72585;
    /* 粉红 */
    --on-tertiary: #FFFFFF;
    --tertiary-container: #FFD8E4;
    --on-tertiary-container: #31111D;
    --surface: #F8F9FA;
    --surface-dim: #E9ECEF;
    --surface-bright: #FFFFFF;
    --surface-container-lowest: #FFFFFF;
    --surface-container-low: #F1F3F5;
    --surface-container: #ECEEF0;
    --surface-container-high: #E6E8EB;
    --surface-container-highest: #E0E2E5;
    --on-surface: #212529;
    --on-surface-variant: #495057;
    --outline: #6C757D;
    --outline-variant: #CED4DA;
    --accent: #4CC9F0;
    /* 亮蓝 */
}

@media (prefers-color-scheme: dark) {
    :root {
        --primary: #4CC9F0;
        --on-primary: #00344D;
        --primary-container: #004D6D;
        --on-primary-container: #C4E7FF;
        --secondary: #B388FF;
        --on-secondary: #1F0057;
        --secondary-container: #3E1F7A;
        --on-secondary-container: #E9DDFF;
        --tertiary: #FF7096;
        --on-tertiary: #5E0027;
        --tertiary-container: #8E0044;
        --on-tertiary-container: #FFD8E4;
        --surface: #121212;
        --surface-dim: #1A1A1A;
        --surface-bright: #2D2D2D;
        --surface-container-lowest: #0D0D0D;
        --surface-container-low: #1F1F1F;
        --surface-container: #242424;
        --surface-container-high: #2E2E2E;
        --surface-container-highest: #383838;
        --on-surface: #E0E0E0;
        --on-surface-variant: #BDBDBD;
        --outline: #757575;
        --outline-variant: #424242;
        --accent: #F72585;
    }
}

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

body {
    font-family: 'Roboto', sans-serif;
    background-color: var(--surface);
    color: var(--on-surface);
    line-height: 1.6;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    background-color: var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 100;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: transform 0.3s ease;
}

.logo:hover {
    transform: scale(1.05);
}

.logo .material-icons {
    font-size: 2rem;
}

nav ul {
    display: flex;
    list-style: none;
    gap: 1rem;
}

nav a {
    text-decoration: none;
    color: var(--on-surface);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 1.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background-color: var(--accent);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.3s ease;
}

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

nav a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

main {
    margin-top: 5rem;
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 2rem;
    background: linear-gradient(135deg, var(--primary-container), var(--surface));
    position: relative;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    /* background: radial-gradient(circle, rgba(var(--primary-rgb), 0.1) 0%, transparent 70%);
    animation: float 15s infinite linear; */
    z-index: 0;
}

@keyframes float {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.hero-content {
    position: relative;
    z-index: 1;
}

.hero h1 {
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    margin-bottom: 1.5rem;
    background: linear-gradient(to right, var(--primary), var(--tertiary));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    padding: 0 1rem;
    animation: fadeInUp 1s ease;
}

.hero p {
    font-size: clamp(1rem, 2.5vw, 1.25rem);
    max-width: 800px;
    margin-bottom: 2rem;
    color: var(--on-surface-variant);
    padding: 0 1rem;
    animation: fadeInUp 1s ease 0.3s both;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scroll-indicator {
    margin-top: 3rem;
    animation: bounce 2s infinite;
    cursor: pointer;
    transition: transform 0.3s ease;
    position: relative;
    z-index: 1;
}

.scroll-indicator:hover {
    transform: scale(1.2);
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-20px);
    }

    60% {
        transform: translateY(-10px);
    }
}

section {
    padding: 6rem 1rem;
    width: 100%;
    max-width: 100%;
}

.section-title {
    font-size: clamp(2rem, 4vw, 2.5rem);
    margin-bottom: 3rem;
    text-align: center;
    color: var(--primary);
    padding: 0 1rem;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--tertiary));
    border-radius: 2px;
}

.project-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 4rem;
    background-color: var(--surface-container);
    border-radius: 0;
    padding: 2rem 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    width: 100%;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 5px;
    height: 100%;
    background: linear-gradient(to bottom, var(--primary), var(--tertiary));
    transition: width 0.3s ease;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.project-card:hover::before {
    width: 8px;
}

.project-image {
    width: 100%;
    max-width: 600px;
    border-radius: 0;
    overflow: hidden;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    margin-bottom: 2rem;
}

.swiper {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    overflow: hidden;
}

.swiper-slide {
    text-align: center;
    background: var(--surface-container-low);
    display: flex;
    justify-content: center;
    align-items: center;
}

.swiper-slide img {
    max-width: 100%;
    height: auto;
    transition: opacity 0.3s ease;
}

img[loading="lazy"] {
    opacity: 0;
}

img.loaded {
    opacity: 1;
}

.swiper-pagination-bullet {
    background-color: var(--outline);
    opacity: 0.6;
    width: 10px;
    height: 10px;
    transition: all 0.3s ease;
}

.swiper-pagination-bullet-active {
    background-color: var(--primary);
    opacity: 1;
    transform: scale(1.2);
}

.swiper-button-next,
.swiper-button-prev {
    color: var(--primary);
    background-color: rgba(255, 255, 255, 0.7);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.swiper-button-next::after,
.swiper-button-prev::after {
    font-size: 1.2rem;
}

.swiper-button-next:hover,
.swiper-button-prev:hover {
    background-color: var(--primary);
    color: white;
    transform: scale(1.1);
}

.project-content {
    width: 100%;
    max-width: 600px;
    padding: 0 1rem;
}

.project-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    margin-bottom: 1rem;
    color: var(--primary);
    position: relative;
    display: inline-block;
}

.project-title::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 50px;
    height: 3px;
    background-color: var(--accent);
    border-radius: 3px;
}

.project-description {
    margin-bottom: 1.5rem;
    color: var(--on-surface-variant);
    font-size: clamp(0.9rem, 2vw, 1rem);
}

.project-features {
    margin-bottom: 2rem;
}

.project-features h3 {
    font-size: clamp(1.1rem, 2.5vw, 1.25rem);
    margin-bottom: 1rem;
    color: var(--secondary);
}

.project-features ul {
    list-style: none;
}

.project-features li {
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: clamp(0.9rem, 2vw, 1rem);
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 8px;
}

.project-features li:hover {
    background-color: var(--surface-container-high);
    transform: translateX(5px);
}

.project-features .material-icons {
    color: var(--accent);
    font-size: 1.2rem;
}

.project-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 1.5rem;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2vw, 1rem);
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, var(--primary), var(--tertiary));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--on-primary);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 16px rgba(67, 97, 238, 0.4);
}

.btn-outline {
    border: 1px solid var(--outline);
    color: var(--primary);
}

.btn-outline:hover {
    border-color: transparent;
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(67, 97, 238, 0.3);
}

footer {
    background-color: var(--surface-container-high);
    padding: 3rem 1rem;
    text-align: center;
    width: 100%;
    position: relative;
}

footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--primary), var(--tertiary));
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    color: var(--on-surface);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: clamp(0.9rem, 2vw, 1rem);
    position: relative;
    padding: 0.5rem 0;
}

.footer-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent);
    transition: width 0.3s ease;
}

.footer-links a:hover {
    color: var(--primary);
}

.footer-links a:hover::after {
    width: 100%;
}

.copyright {
    color: var(--on-surface-variant);
    font-size: 0.9rem;
}

/* 浮动元素动画 */
.floating-element {
    position: absolute;
    background-color: var(--accent);
    opacity: 0.1;
    border-radius: 50%;
    animation: float 15s infinite linear;
    z-index: 0;
}

@media (min-width: 840px) {
    .project-card {
        flex-direction: row;
        max-width: 1200px;
        margin-left: auto;
        margin-right: auto;
        padding: 3rem;
        border-radius: 1.5rem;
    }

    .project-card:nth-child(even) {
        flex-direction: row-reverse;
    }

    .project-image {
        margin-bottom: 0;
        margin-right: 3rem;
        border-radius: 1rem;
        flex: 1;
    }

    .project-card:nth-child(even) .project-image {
        margin-right: 0;
        margin-left: 3rem;
    }

    .project-content {
        flex: 1;
    }

    section {
        padding: 6rem 2rem;
    }
}

@media (max-width: 600px) {
    header {
        padding: 0.75rem;
        flex-direction: column;
        align-items: center;
        gap: 0.5rem;
        background-color: var(--surface-container-low);
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo .material-icons {
        font-size: 1.5rem;
    }

    nav {
        width: 100%;
        display: flex;
        justify-content: center;
    }

    nav ul {
        gap: 0.5rem;
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
    }

    nav a {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
        border-radius: 1rem;
    }

    main {
        margin-top: 7rem;
    }

    .hero {
        padding: 1.5rem 1rem;
        min-height: 80vh;
    }

    .hero h1 {
        font-size: 1.8rem;
        margin-bottom: 1rem;
        line-height: 1.3;
    }

    .hero p {
        font-size: 0.95rem;
        margin-bottom: 1.5rem;
        line-height: 1.5;
    }

    .scroll-indicator {
        margin-top: 2rem;
    }

    section {
        padding: 3rem 1rem;
    }

    .section-title {
        font-size: 1.8rem;
        margin-bottom: 2rem;
    }

    .project-card {
        padding: 1.5rem 0.8rem;
        margin-bottom: 2rem;
        border-radius: 0.8rem;
        box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    }

    .project-image {
        margin-bottom: 1.5rem;
        max-height: 200px;
        overflow: hidden;
    }

    .swiper-slide img {
        object-fit: cover;
        height: 200px;
    }

    .project-title {
        font-size: 1.4rem;
        margin-bottom: 0.8rem;
    }

    .project-description {
        font-size: 0.9rem;
        margin-bottom: 1rem;
        line-height: 1.5;
    }

    .project-features h3 {
        font-size: 1.1rem;
        margin-bottom: 0.8rem;
    }

    .project-features li {
        font-size: 0.85rem;
        padding: 0.4rem;
        margin-bottom: 0.3rem;
    }

    .project-features .material-icons {
        font-size: 1rem;
    }

    .project-actions {
        justify-content: center;
        gap: 0.75rem;
        flex-wrap: wrap;
        margin-top: 1.5rem;
    }

    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
        width: 100%;
        justify-content: center;
        margin-bottom: 0.5rem;
    }

    .swiper-button-next,
    .swiper-button-prev {
        display: none;
    }

    .image-preview .close-btn {
        top: 10px;
        right: 10px;
        font-size: 1.5rem;
        width: 35px;
        height: 35px;
    }

    .zoom-controls {
        bottom: 15px;
    }

    .zoom-btn {
        width: 35px;
        height: 35px;
    }

    #about, #contact {
        padding: 2.5rem 1rem;
    }

    #about p, #contact p {
        font-size: 0.9rem;
        line-height: 1.6;
    }

    footer {
        padding: 2rem 1rem;
    }

    .footer-links {
        gap: 0.8rem;
        margin-bottom: 1.5rem;
    }

    .footer-links a {
        font-size: 0.85rem;
        padding: 0.4rem 0.6rem;
    }

    .copyright {
        font-size: 0.8rem;
    }

    /* 修复浮动元素在移动端的位置 */
    .floating-element {
        opacity: 0.05;
    }

    /* 增加项目卡片的触摸反馈 */
    .project-card {
        -webkit-tap-highlight-color: transparent;
        position: relative;
    }
    
    .project-card:active {
        transform: scale(0.98);
        transition: transform 0.2s ease;
    }
    
    /* 优化项目卡片中按钮的可点击区域 */
    .btn {
        position: relative;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* 优化导航链接的可触摸区域 */
    nav a {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    * {
        -webkit-tap-highlight-color: transparent;
    }

    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }

    .hero, section, .project-card, .btn, nav a, img {
        animation: none !important;
        transition: opacity 0.3s ease, transform 0.3s ease !important;
    }
}

/* 增加中等屏幕尺寸的适配 */
@media (min-width: 601px) and (max-width: 839px) {
    .project-card {
        padding: 2rem 1.5rem;
    }

    .project-image {
        max-width: 100%;
        margin-bottom: 2rem;
    }

    .swiper-slide img {
        height: 300px;
        object-fit: cover;
    }

    .btn {
        padding: 0.7rem 1.3rem;
        font-size: 0.95rem;
    }

    section {
        padding: 4rem 1.5rem;
    }
}

/* 新增预览组件样式 */
.image-preview {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-preview.active {
    opacity: 1;
}

.preview-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-image {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.3s ease;
    transform-origin: center center;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    color: white;
    font-size: 2rem;
    cursor: pointer;
    z-index: 1;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.zoom-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 1;
}

.zoom-btn {
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
}

/* 添加Swiper懒加载样式 */
.swiper-lazy-preloader {
    width: 42px;
    height: 42px;
    position: absolute;
    left: 50%;
    top: 50%;
    margin-left: -21px;
    margin-top: -21px;
    z-index: 10;
    transform-origin: 50%;
    animation: swiper-preloader-spin 1s infinite linear;
    box-sizing: border-box;
    border: 4px solid var(--primary);
    border-radius: 50%;
    border-top-color: transparent;
}
.ba{
    color: var(--on-surface);
    text-decoration: none;
    padding: 0.5rem 0.5rem;
}

@keyframes swiper-preloader-spin {
    100% {
        transform: rotate(360deg);
    }
}

/* 返回顶部按钮样式 */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background-color: var(--primary);
    color: var(--on-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.back-to-top.visible {
    opacity: 1;
    transform: translateY(0);
}

@media (max-width: 600px) {
    .back-to-top {
        width: 36px;
        height: 36px;
        bottom: 15px;
        right: 15px;
    }
}

/* 移动端优化样式 */
.touch-ripple {
    position: absolute;
    border-radius: 50%;
    background-color: var(--primary);
    opacity: 0.2;
    transform: scale(0);
    pointer-events: none;
    animation: touch-ripple 0.6s linear;
}

@keyframes touch-ripple {
    to {
        transform: scale(2.5);
        opacity: 0;
    }
}

.btn:active::after, 
nav a:active::after,
.project-title:active::after,
.footer-links a:active::after {
    background-color: var(--accent);
    transition: none;
}

/* 优化移动端过渡效果 */
@media (max-width: 600px) {
    * {
        -webkit-tap-highlight-color: transparent;
    }

    .hero, section, .project-card, .btn, nav a, img {
        animation: none !important;
        transition: opacity 0.3s ease, transform 0.3s ease !important;
    }

    /* 避免Safari移动端点击闪烁 */
    a, button, .btn, nav a, .project-card, .project-features li {
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        user-select: none;
    }
}