/*******************************
 * 1. Variables & Global Settings
 *******************************/
:root {
    --primary-color: #333;
    --accent-color: #e9d8c6;
    --bg-color: #f5f0eb;
    --text-color: #666;
    --card-bg: #ffffff;
    --nav-bg: rgba(51, 51, 51, 0.95);
    --shadow: 0 4px 15px rgba(0,0,0,0.1);
    --border-color: #eee;
    --popup-shadow: 0 2px 4px rgba(0,0,0,0.1);
    --transition: all 0.3s ease;
    --image-filter: none;
    --banner-image: url('banner.jpg'); /* 添加背景图片变量 */
}

/* Dark mode variables */
@media (prefers-color-scheme: dark) {
    :root {
        --primary-color: #ffffff;
        --accent-color: #e9d8c6;
        --bg-color: #1a1a1a;
        --text-color: #b0b0b0;
        --card-bg: #2d2d2d;
        --nav-bg: rgba(26, 26, 26, 0.95);
        --shadow: 0 4px 15px rgba(0,0,0,0.3);
        --border-color: #404040;
        --popup-shadow: 0 2px 4px rgba(0,0,0,0.3);
        --image-filter: brightness(0.8) contrast(1.2);
    }
}

/*******************************
 * 2. Base Styles
 *******************************/
html {
    scroll-behavior: smooth;
}

body, html {
    margin: 0;
    padding: 0;
    font-family: 'Noto Sans SC', sans-serif;
    background-color: var(--bg-color);
    color: var(--primary-color);
}

/*******************************
 * 3. Navigation
 *******************************/
nav {
    background-color: var(--nav-bg);
    padding: 15px 0;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    transition: var(--transition);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.logo {
    color: var(--accent-color);
    font-size: 1.5em;
    font-weight: 700;
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-links a {
    color: var(--accent-color);
    text-decoration: none;
    padding: 8px 15px;
    border-radius: 4px;
    transition: var(--transition);
    font-weight: 500;
}

.nav-links a:hover {
    background-color: var(--accent-color);
    color: var(--primary-color);
}

/* 响应式导航栏 */
@media (max-width: 768px) {
    .nav-container {
        padding: 10px 15px;
    }
    
    .nav-logo {
        height: 30px;
    }
    
    .nav-links {
        font-size: 0.9rem;
    }
}

/*******************************
 * 4. Banner/Carousel
 *******************************/
.banner {
    height: 100vh;
    position: relative;
    color: white;
    text-align: center;
    overflow: hidden;
}

.carousel, .carousel-inner, .carousel-item {
    height: 100%;
}

.banner-slide {
    height: 100vh;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    opacity: 0;
}

.banner-slide.loaded {
    opacity: 1;
}

.banner-slide::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
}

.banner-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100%;
    max-width: 800px;
    padding: 0 20px;
    z-index: 2;
}

.banner h1 {
    margin: 0;
    font-size: 4em;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    letter-spacing: 2px;
    color: white;
}

.banner p {
    font-size: 1.2em;
    margin-top: 20px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    color: white;
}

.banner-button {
    display: inline-block;
    margin-top: 30px;
    padding: 12px 30px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 25px;
    font-weight: 500;
    transition: var(--transition);
    border: 2px solid var(--accent-color);
}

.banner-button:hover {
    background-color: transparent;
    color: white;
    border-color: white;
}

.carousel-control-prev,
.carousel-control-next {
    width: 5%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.carousel:hover .carousel-control-prev,
.carousel:hover .carousel-control-next {
    opacity: 0.8;
}

.carousel-indicators {
    margin-bottom: 30px;
}

.carousel-indicators button {
    width: 12px !important;
    height: 12px !important;
    border-radius: 50% !important;
    background-color: rgba(255, 255, 255, 0.5) !important;
    border: none !important;
    margin: 0 6px !important;
    transition: var(--transition);
}

.carousel-indicators button.active {
    background-color: var(--accent-color) !important;
    transform: scale(1.2);
}

/* 轮播图移动端优化 */
@media (max-width: 576px) {
    .banner-content {
        padding: 20px;
    }
    
    .banner-content h1 {
        font-size: 1.8rem;
        margin-bottom: 10px;
    }
    
    .banner-content p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    .banner-button {
        padding: 8px 20px;
        font-size: 0.9rem;
    }
}

/*******************************
 * 5. Portfolio
 *******************************/
.portfolio-header {
    padding: 5rem 0;  /* Increased padding */
    text-align: center;
    padding: 3rem 0;
    
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    padding: 1rem;
}

.portfolio-item {
    break-inside: avoid;
    margin-bottom: 1.5rem;
    transition: transform 0.3s ease;
}

.portfolio-item:hover {
    transform: translateY(-5px);
}

.portfolio-item img {
    width: 100%;
    height: auto;
    border-radius: 12px;
    display: block;
    object-fit: cover;
}

.portfolio-item.video {
    width: 100%;
    margin-bottom: 1.5rem;
}

.video-container {
    width: 100%;
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

.video-container.shorts {
    padding-bottom: 177.78%; /* 9:16 比例 */
}

.video-container.landscape {
    padding-bottom: 56.25%; /* 16:9 比例 */
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    object-fit: contain;
}

/* 移动端视频容器调整 */
@media screen and (max-width: 768px) {
    .portfolio-item.video {
        grid-column: 1 / -1;
        margin-bottom: 1rem;
    }

    .video-container {
        border-radius: 8px;
    }

    .video-container.shorts {
        max-width: 350px;
        margin: 0 auto;
    }
}

.nav-logo {
    width: 50px;  /* Updated width */
    height: auto;
    margin-right: 10px;
}

/* 小屏幕视频调整 */
@media screen and (max-width: 480px) {
    .video-container.shorts {
        max-width: 250px;
    }
}

/* 视频部分样式 */
.video-section {
    width: 100%;
}

.video-container {
    position: relative;
    padding-bottom: 100%; /* 1:1 比例，与图片一致 */
    height: 0;
    overflow: hidden;
    margin-bottom: 2rem;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 15px;
    object-fit: cover;
}

/* 移动端响应式样式 */
@media screen and (max-width: 768px) {
    /* 调整字体大小 */
    body {
        font-size: 14px;
    }

    .banner h1 {
        font-size: 2.5em;
    }

    .banner p {
        font-size: 1em;
    }

    /* 调整导航栏 */
    .nav-container {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.2em;
    }

    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        padding: 6px 10px;
        font-size: 0.9em;
    }

    /* 作品集网格布局调整为两列 */
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 0.8rem;
    }

    /* 调整作品集标题和描述 */
    .portfolio-header h2 {
        font-size: 1.8em;
    }

    .portfolio-header p {
        font-size: 0.9em;
    }

    /* 视频容器适配 */
    .portfolio-item.video {
        grid-column: span 2;
    }
}

/* 更小屏幕的额外优化 */
@media screen and (max-width: 480px) {
    .banner h1 {
        font-size: 2em;
    }

    .banner-button {
        padding: 10px 20px;
        font-size: 0.9em;
    }
}

/*******************************
 * 6. About Section
 *******************************/
.about-section {
    padding: 80px 20px;
    max-width: 1400px;
    margin: 0 auto;
}

.about-container {
    background-color: var(--card-bg);
    border-radius: 15px;
    padding: 100px;
    box-shadow: var(--shadow);
    text-align: center;
}

.about-header {
    margin-bottom: 40px;
}

.about-header h1 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 2.5em;
}

.about-header p {
    color: var(--text-color);
    line-height: 1.6;
    margin-bottom: 10px;
}

.intro-section {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.intro-section h2 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.8em;
    text-align: center;
}

.intro-section p {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    text-align: left;
}

.intro-section > div {
    margin-top: 30px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
}

.contact-info {
    margin-top: 40px;
    text-align: center;
}

.contact-info h3 {
    color: var(--primary-color);
    margin-bottom: 20px;
    font-size: 1.5em;
    text-align: center;
}

.contact-details {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.social-media {
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.social-icon {
    color: var(--primary-color);
    font-size: 1.5em;
    transition: var(--transition);
    padding: 10px;
    border-radius: 50%;
    background-color: var(--accent-color);
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.social-icon:hover {
    transform: translateY(-3px);
    background-color: var(--primary-color);
    color: var(--accent-color);
}

/* 社交媒体图标优化 */
@media (max-width: 480px) {
    .social-media {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 15px;
        justify-items: center;
    }
    
    .social-icon {
        font-size: 1.5rem;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .nav-links {
        gap: 15px;
    }

    .nav-links a {
        padding: 6px 12px;
        font-size: 0.9em;
    }

    .banner-content h1 {
        font-size: 2em;
    }

    .banner-content p {
        font-size: 1em;
    }

    .banner-button {
        padding: 8px 20px;
        font-size: 0.9em;
    }

    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
        padding: 15px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0 15px;
    }

    .logo {
        font-size: 1.2em;
    }

    .banner-content {
        padding: 0 15px;
    }

    .banner-content h1 {
        font-size: 1.8em;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }
}

/* 移动端关于部分样式调整 */
@media screen and (max-width: 768px) {
    .about-section {
        padding: 2rem 0.5rem;
    }

    .about-container {
        padding: 0 0.5rem;
        max-width: 100%;
    }

    .contact-info {
        padding: 1rem 0;
    }

    .social-media {
        gap: 1rem;
    }
}

/* iPhone 尺寸优化 */
@media screen and (max-width: 480px) {
    .about-section {
        padding: 2.5rem 0.15rem;
    }

    .about-container {
        padding: 0 0.15rem;
    }

    .about-header {
        margin-bottom: 2rem;
    }

    .about-header h1 {
        font-size: 1.4em;
        margin-bottom: 1.2rem;
    }

    .about-header p {
        font-size: 0.85em;
        margin-bottom: 1rem;
        padding: 0 0.25rem;
    }

    .intro-section {
        font-size: 0.85em;
        margin-top: 2rem;
        padding: 0 0.25rem;
    }

    .intro-section p {
        margin-bottom: 0.8rem;
    }

    .contact-info {
        margin-top: 2rem;
        padding: 1.2rem 0.25rem;
    }

    .contact-info h3 {
        font-size: 1.2em;
        margin-bottom: 1.2rem;
    }

    .social-media {
        gap: 1rem;
        justify-content: center;
        flex-wrap: wrap;
        padding: 0.5rem 0;
    }

    .social-icon {
        font-size: 1.2em;
        padding: 0.5rem;
    }
}

/*******************************
 * 7. Product Detail
 *******************************/
.product-detail {
    padding-top: 80px;
    min-height: 100vh;
    background-color: var(--bg-color);
}

.product-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
}

.product-header {
    text-align: center;
    margin-bottom: 40px;
}

.product-header h1 {
    font-size: 2.5em;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.product-meta {
    display: flex;
    justify-content: center;
    gap: 20px;
    color: var(--text-color);
    font-size: 0.9em;
}

.product-gallery {
    margin-bottom: 60px;
}

.main-image {
    width: 100%;
    height: 600px;
    object-fit: cover;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.image-grid img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 8px;
    transition: var(--transition);
    cursor: pointer;
}

.image-grid img:hover {
    transform: scale(1.05);
}

.product-content {
    background-color: var(--card-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 40px;
}

.product-tags {
    margin-bottom: 30px;
}

.product-description h2 {
    color: var(--primary-color);
    font-size: 1.5em;
    margin: 30px 0 15px;
}

.product-description p {
    color: var(--text-color);
    line-height: 1.8;
    margin-bottom: 20px;
}

.product-description ul {
    color: var(--text-color);
    padding-left: 20px;
    margin-bottom: 20px;
}

.product-description li {
    margin-bottom: 10px;
    line-height: 1.6;
}

.related-products {
    margin-top: 60px;
}

.related-products h2 {
    text-align: center;
    margin-bottom: 30px;
    color: var(--primary-color);
}

.related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.related-item {
    background-color: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.related-item:hover {
    transform: translateY(-5px);
}

.related-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.related-item h3 {
    padding: 15px;
    margin: 0;
    color: var(--primary-color);
    font-size: 1.1em;
}

.related-item .category {
    display: block;
    padding: 0 15px 15px;
    color: var(--text-color);
    font-size: 0.9em;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .product-container {
        padding: 20px;
    }

    .product-header h1 {
        font-size: 2em;
    }

    .main-image {
        height: 400px;
    }

    .image-grid {
        grid-template-columns: 1fr;
    }

    .product-content {
        padding: 20px;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }
}

/*******************************
 * 8. 404 Page
 *******************************/
.error-container {
    padding-top: 80px; /* Compensate for fixed nav */
    min-height: calc(100vh - 80px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    text-align: center;
}

.error-code {
    font-size: 120px;
    font-weight: 700;
    color: var(--accent-color);
    margin: 0;
    line-height: 1;
}

.error-message {
    font-size: 24px;
    color: var(--primary-color);
    margin: 20px 0;
}

.error-description {
    color: var(--text-color);
    margin-bottom: 30px;
    max-width: 600px;
}

.back-home {
    display: inline-block;
    padding: 12px 30px;
    background-color: var(--accent-color);
    color: var(--primary-color);
    text-decoration: none;
    border-radius: 4px;
    transition: var(--transition);
    font-weight: 500;
}

.back-home:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}

.back-home:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* 1. 优化动画效果 */
.banner-slide, [data-lang] {
    transition: opacity 0.3s ease;
}

/* 2. 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .nav-link, .social-icon {
        color: rgba(255,255,255,0.87);
    }
    
    .about-section {
        background-color: rgba(255,255,255,0.05);
    }
}

/* 3. 响应式布局优化 */
@media (max-width: 768px) {
    .banner-content h1 {
        font-size: 2rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
}

/* 4. 图片悬停效果 */
.portfolio-item img {
    transition: transform 0.3s ease;
}

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

/*******************************
 * 9. Responsive Design
 *******************************/
/* Large screens */
@media screen and (min-width: 1200px) {
    /* ... large screen styles ... */
}

/* Medium screens */ 
@media screen and (max-width: 768px) {
    .portfolio-items {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 15px;
    }
    
    .portfolio-item {
      margin-bottom: 0;
    }
  }

/* Small screens */
@media screen and (max-width: 480px) {
    .portfolio-items {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
      }
      
      .portfolio-item {
        margin-bottom: 0;
      }
    } 

/* darkmode */
.social-icon i {
    color: #3e3737; /* Change to white for better visibility in dark mode */
}

/* 添加页脚样式 */
.footer {
    background-color: #f8f9fa;
    padding: 20px 0;
    margin-top: 50px;
    text-align: center;
}

/* 深色模式支持 */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #ffffff;
    }
    
    .about-section {
        background-color: rgba(255,255,255,0.05);
    }
    
    .nav-link, .social-icon {
        color: #ffffff;
    }
    
    .banner-content {
        text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    }
}

/* 1. 平滑过渡 */
[data-lang] {
    transition: opacity 0.3s ease;
}

/* 3. 加载动画优化 */
.banner-slide {
    transition: opacity 0.5s ease;
    opacity: 0;
}

.banner-slide.loaded {
    opacity: 1;
}

/* 4. 响应式图片优化 */
.portfolio-item img {
    width: 100%;
    height: auto;
    transition: transform 0.3s ease;
}

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

/* 触摸设备优化 */
@media (hover: none) {
    .banner-button:active {
        transform: scale(0.95);
    }
    
    .social-icon:active {
        opacity: 0.7;
    }
}

/* 内容区域移动端优化 */
@media (max-width: 768px) {
    .about-container {
        padding: 20px 15px;
    }
    
    .about-header h1 {
        font-size: 1.6rem;
    }
    
    .about-header p {
        font-size: 0.95rem;
        line-height: 1.6;
    }
    
    .intro-section p {
        font-size: 0.9rem;
        margin-bottom: 10px;
    }
}