* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --accent-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #1a1a1a;
    --text-color: #333;
    --text-light: #777;
    --shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

html {
    /* 改善移动端滚动体验 */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-color);
    background-color: #fff;
    overflow-x: hidden;
    /* 改善移动端触摸体验 */
    -webkit-tap-highlight-color: transparent;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition);
}

ul {
    list-style: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
    /* 改善移动端图片渲染 */
    -webkit-user-drag: none;
    -khtml-user-drag: none;
    -moz-user-drag: none;
    -o-user-drag: none;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.btn {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    /* 改善移动端触摸体验 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* 确保按钮文字在移动端可读 */
    font-size: 1rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    background-color: #2980b9;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-outline {
    background-color: transparent;
    border: 2px solid var(--secondary-color);
    color: var(--secondary-color);
}

.btn-outline:hover {
    background-color: var(--secondary-color);
    color: white;
}

.section {
    padding: 80px 0;
}

.section-title {
    text-align: center;
    margin-bottom: 50px;
}

.section-title h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 15px;
    position: relative;
    display: inline-block;
}

.section-title h2::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 3px;
    background-color: var(--secondary-color);
}

.section-title p {
    color: var(--text-light);
    max-width: 600px;
    margin: 0 auto;
}

/* 导航栏样式 */
header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    z-index: 1000;
    transition: transform 0.3s ease, background-color 0.3s ease, padding 0.3s ease;
    /* 改善移动端性能 */
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
}

.header-scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    padding: 10px 0;
}

.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary-color);
}

.logo span {
    color: var(--secondary-color);
}

.nav-links {
    display: flex;
}

.nav-links li {
    margin-left: 30px;
}

.nav-links a {
    font-weight: 600;
    position: relative;
    /* 改善移动端触摸体验 */
    padding: 8px 0;
    display: block;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--secondary-color);
    transition: var(--transition);
}

.nav-links a:hover::after {
    width: 100%;
}

.mobile-menu {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    /* 改善移动端触摸体验 */
    padding: 8px;
    -webkit-tap-highlight-color: transparent;
}

/* 英雄区域样式 */
.hero {
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('../img/index.jpg') no-repeat center center/cover;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: white;
    /* 改善移动端性能 */
    background-attachment: scroll;
}

.hero-content {
    max-width: 800px;
    padding: 0 20px;
}

.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.hero p {
    font-size: 1.2rem;
    margin-bottom: 30px;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* 作品集区域样式 */
.portfolio {
    background-color: #f9f9f9;
}

.portfolio-filter {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
    gap: 8px;
}

.filter-btn {
    padding: 8px 20px;
    background-color: transparent;
    border: 1px solid var(--text-light);
    border-radius: 30px;
    cursor: pointer;
    transition: var(--transition);
    /* 改善移动端触摸体验 */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.filter-btn.active, .filter-btn:hover {
    background-color: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.portfolio-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-shadow: var(--shadow);
    height: 250px;
    /* 改善移动端性能 */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
}

.portfolio-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: var(--transition);
    padding: 20px;
    text-align: center;
    color: white;
    /* 改善移动端触摸体验 */
    cursor: pointer;
}

.portfolio-item:hover .portfolio-overlay,
.portfolio-item:focus .portfolio-overlay,
.portfolio-item:active .portfolio-overlay {
    opacity: 1;
}

.portfolio-item:hover img,
.portfolio-item:focus img,
.portfolio-item:active img {
    transform: scale(1.1);
}

.portfolio-overlay h3 {
    margin-bottom: 10px;
    transform: translateY(20px);
    transition: var(--transition);
}

.portfolio-overlay p {
    transform: translateY(20px);
    transition: var(--transition);
    transition-delay: 0.1s;
}

.portfolio-item:hover .portfolio-overlay h3,
.portfolio-item:focus .portfolio-overlay h3,
.portfolio-item:active .portfolio-overlay h3,
.portfolio-item:hover .portfolio-overlay p,
.portfolio-item:focus .portfolio-overlay p,
.portfolio-item:active .portfolio-overlay p {
    transform: translateY(0);
}

/* 关于区域样式 */
.about-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
    align-items: center;
}

.about-text h3 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.about-text p {
    margin-bottom: 20px;
    color: var(--text-light);
}

.about-image {
    position: relative;
}

.about-image img {
    border-radius: 8px;
    box-shadow: var(--shadow);
}

/* 联系区域样式 */
.contact {
    background-color: var(--primary-color);
    color: white;
}

.contact .section-title h2 {
    color: white;
}

.contact .section-title p {
    color: rgba(255, 255, 255, 0.7);
}

.contact-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 50px;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.contact-item {
    display: flex;
    align-items: flex-start;
    gap: 15px;
}

.contact-icon {
    background-color: var(--secondary-color);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-weight: 600;
}

.form-control {
    padding: 12px 15px;
    border: none;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1rem;
    /* 改善移动端表单体验 */
    -webkit-appearance: none;
    appearance: none;
    min-height: 48px;
}

textarea.form-control {
    min-height: 150px;
    resize: vertical;
}

/* iframe 样式 */
iframe {
    display: block;
    width: 100%;
    height: 365px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    border: none;
}

/* 响应式设计 - 平板 */
@media (max-width: 992px) {
    .about-content, .contact-content {
        grid-template-columns: 1fr;
    }
    
    .footer-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .hero h1 {
        font-size: 2.8rem;
    }
    
    .section-title h2 {
        font-size: 2.2rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    
    iframe {
        height: 450px;
    }
}

/* 响应式设计 - 平板小尺寸 */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 0;
    }
    
    .nav-links {
        position: fixed;
        top: 70px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 70px);
        background-color: white;
        flex-direction: column;
        align-items: center;
        justify-content: flex-start;
        padding-top: 50px;
        transition: var(--transition);
        box-shadow: var(--shadow);
        /* 改善移动端滚动 */
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .nav-links.active {
        left: 0;
    }
    
    .nav-links li {
        margin: 0 0 30px 0;
        width: 100%;
        text-align: center;
    }
    
    .nav-links a {
        padding: 12px 0;
        font-size: 1.1rem;
        width: 100%;
    }
    
    .mobile-menu {
        display: block;
    }
    
    .hero {
        height: 70vh;
        min-height: 500px;
    }
    
    .hero h1 {
        font-size: 2.2rem;
    }
    
    .hero p {
        font-size: 1.1rem;
    }
    
    .section {
        padding: 60px 0;
    }
    
    .section-title {
        margin-bottom: 40px;
    }
    
    .section-title h2 {
        font-size: 1.8rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 15px;
    }
    
    .portfolio-item {
        height: 220px;
    }
    
    .about-content {
        gap: 30px;
    }
    
    .about-text h3 {
        font-size: 1.6rem;
    }
    
    .contact-content {
        gap: 30px;
    }
    
    .btn {
        padding: 10px 25px;
        font-size: 0.95rem;
    }
    
    .container {
        width: 95%;
        padding: 0 10px;
    }
    
    iframe {
        height: 400px;
    }
}

/* 响应式设计 - 手机 */
@media (max-width: 576px) {
    .footer-content {
        grid-template-columns: 1fr;
        gap: 30px;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    .hero {
        height: 60vh;
        min-height: 400px;
    }
    
    .hero h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    
    .hero p {
        font-size: 1rem;
        margin-bottom: 25px;
    }
    
    .section {
        padding: 50px 0;
    }
    
    .section-title {
        margin-bottom: 30px;
    }
    
    .section-title h2 {
        font-size: 1.6rem;
    }
    
    .section-title p {
        font-size: 0.9rem;
    }
    
    .portfolio-filter {
        margin-bottom: 30px;
    }
    
    .filter-btn {
        padding: 6px 15px;
        font-size: 0.9rem;
        min-height: 36px;
    }
    
    .portfolio-item {
        height: 200px;
    }
    
    .about-text h3 {
        font-size: 1.4rem;
    }
    
    .about-text p {
        font-size: 0.9rem;
    }
    
    .contact-item {
        flex-direction: column;
        text-align: center;
        gap: 10px;
    }
    
    .contact-icon {
        align-self: center;
    }
    
    .logo {
        font-size: 1.5rem;
    }
    
    .btn {
        width: 100%;
        max-width: 280px;
    }
    
    .newsletter-form {
        flex-direction: column;
    }
    
    .newsletter-form input {
        border-radius: 4px;
        margin-bottom: 10px;
    }
    
    .newsletter-form button {
        border-radius: 4px;
        width: 100%;
    }
    
    iframe {
        height: 300px;
    }
}

/* 响应式设计 - 小屏手机 */
@media (max-width: 375px) {
    .hero h1 {
        font-size: 1.6rem;
    }
    
    .hero p {
        font-size: 0.9rem;
    }
    
    .section-title h2 {
        font-size: 1.4rem;
    }
    
    .portfolio-item {
        height: 180px;
    }
    
    .container {
        width: 100%;
        padding: 0 15px;
    }
    
    iframe {
        height: 250px;
    }
}

/* 改善高分辨率屏幕显示 */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .hero {
        background-image: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), url('../img/index.jpg');
    }
}

/* 改善横屏模式 */
@media (max-height: 500px) and (orientation: landscape) {
    .hero {
        height: auto;
        min-height: 100vh;
        padding: 100px 0;
    }
    
    .nav-links {
        height: calc(100vh - 60px);
        padding-top: 20px;
    }
}

/* 改善深色模式支持 */
@media (prefers-color-scheme: dark) {
    :root {
        --text-color: #f0f0f0;
        --light-color: #2a2a2a;
    }
    
    body {
        background-color: #1a1a1a;
        color: #f0f0f0;
    }
}

/* 改善可访问性 - 减少动画 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

        /* Lightbox样式 */
        .lightbox {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: rgba(0, 0, 0, 0.95);
            z-index: 2000;
            overflow: hidden;
        }

        .lightbox-content {
            position: relative;
            width: 100%;
            height: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .lightbox-image {
            max-width: 90%;
            max-height: 90%;
            object-fit: contain;
            border-radius: 4px;
            box-shadow: 0 5px 25px rgba(0, 0, 0, 0.5);
        }

        .lightbox-close {
            position: absolute;
            top: 20px;
            right: 20px;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
            transition: var(--transition);
            font-size: 1.5rem;
            border: none;
        }

        .lightbox-close:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: scale(1.1);
        }

        .lightbox-nav {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(255, 255, 255, 0.2);
            color: white;
            width: 50px;
            height: 50px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            z-index: 10;
            transition: var(--transition);
            border: none;
            font-size: 1.5rem;
        }

        .lightbox-nav:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-50%) scale(1.1);
        }

        .lightbox-prev {
            left: 20px;
        }

        .lightbox-next {
            right: 20px;
        }

        .lightbox-info {
            position: absolute;
            bottom: 0;
            left: 0;
            width: 100%;
            background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, transparent 100%);
            color: white;
            padding: 30px 20px 20px;
            text-align: center;
            opacity: 0;
            transition: var(--transition);
        }

        .lightbox:hover .lightbox-info {
            opacity: 1;
        }

        .lightbox-title {
            font-size: 1.5rem;
            margin-bottom: 5px;
        }

        .lightbox-description {
            font-size: 1rem;
            opacity: 0.8;
            max-width: 600px;
            margin: 0 auto;
        }
        /* 作品集网格布局 */
        .portfolio-container {
            padding: 50px 0;
        }

        .portfolio-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }

        .portfolio-item {
            position: relative;
            overflow: hidden;
            border-radius: 8px;
            box-shadow: var(--shadow);
            height: 300px;
            -webkit-transform: translateZ(0);
            transform: translateZ(0);
            cursor: pointer;
            transition: var(--transition);
        }

        .portfolio-item:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 30px rgba(0, 0, 0, 0.15);
        }

        .portfolio-item img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: var(--transition);
        }

        .portfolio-overlay {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.7) 100%);
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            align-items: flex-start;
            padding: 20px;
            color: white;
            opacity: 0;
            transition: var(--transition);
        }

        .portfolio-item:hover .portfolio-overlay {
            opacity: 1;
        }

        .portfolio-overlay h3 {
            margin-bottom: 5px;
            font-size: 1.2rem;
        }

        .portfolio-overlay p {
            font-size: 0.9rem;
            opacity: 0.8;
        }

iframe {
    display: block;
    width: 100%;
    height: 365px;
    box-shadow: 0 4px 8px rgba(0,0,0,.1);
    border-radius: 10px
}

footer {
    margin-top: auto;
    padding: 20px;
    background: #f8f9fa;
    text-align: center
}

@keyframes fadeIn {
    from {
        opacity: 0
    }

    to {
        opacity: 1
    }
}

@media screen and (min-width: 1300px) {
    .пословица {
        padding:10px
    }

    #quoteDisplay {
        font-size: 1.4rem
    }
}

@media (max-width: 1300px) {
    iframe {
        height:450px
    }
}

@media (max-width: 1100px) {
    iframe {
        height:750px
    }
}

@media screen and (max-width: 991px) {
    .пословица {
        width:100%;
        padding: 10px
    }
}

@media (max-width: 768px) {
    .menu-toggle {
        display:flex
    }

    .header-content {
        padding: 0 20px
    }

    .sidebar {
        width: 250px;
        transform: translateX(-100%);
        transition: transform .3s;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: auto;
        touch-action: pan-y
    }

    .sidebar.active {
        transform: translateX(0)
    }

    .sidebar::-webkit-scrollbar {
        width: 3px
    }

    .sidebar::-webkit-scrollbar-thumb {
        border-radius: 1.5px
    }

    .main-content {
        margin-left: 0
    }

    iframe {
        height: 750px
    }
}

@media screen and (max-width: 576px) {
    .пословица {
        width:100%;
        padding: 8px;
        margin: 6px auto
    }

    #quoteDisplay {
        font-size: 1rem;
        line-height: 1.4
    }
}

@media (max-width: 480px) {
    iframe {
        height:600px
    }
}

@media (prefers-color-scheme: dark) {
    * {
        scrollbar-color:#db91f3 #2d2d2d
    }

    ::-webkit-scrollbar,::-webkit-scrollbar-track,::-webkit-scrollbar-corner,.sidebar::-webkit-scrollbar,.sidebar::-webkit-scrollbar-track,.sidebar::-webkit-scrollbar-corner {
        background: #2d2d2d
    }
}
