:root {
    --primary-color: #3a3a3a;
    --secondary-color: #f5f5f5;
    --accent-color: #d4b895;
}

body {
    margin: 0;
    font-family: 'Noto Sans TC', sans-serif;
    color: var(--primary-color);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 5%;
    background: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.main-logo {
    font-size: 1.5rem;
    font-weight: bold;
}

.text-logo {
    font-size: 1.5rem;
    font-weight: bold;
    white-space: nowrap; /* 防止文字換行 */
}

.logo-divider {
    color: var(--accent-color);
    font-size: 1rem;
}

.partner-logo img {
    width: 100px;
    height: auto;
    vertical-align: middle; /* 確保圖片垂直置中 */
    object-fit: contain; /* 確保圖片比例正確 */
}

/* 響應式設計 */
@media (max-width: 768px) {
    .logo-container {
        gap: 0.5rem;
    }
    
    .main-logo {
        font-size: 1.2rem;
    }
    
    .partner-logo img {
        width: 80px; /* 手機版縮小圖片 */
    }
}

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

nav a {
    position: relative; /* 為下劃線動畫準備 */
    text-decoration: none;
    color: var(--primary-color);
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

/* 1. 滑動下劃線效果 */
nav a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background-color: var(--accent-color);
    transition: width 0.3s ease;
}

nav a:hover::after {
    width: 100%;
}

/* 2. 漸變背景效果 */
nav a {
    padding: 0.5rem 1rem;
    border-radius: 4px;
    background: linear-gradient(to right, var(--accent-color) 0%, var(--accent-color) 50%, transparent 50%);
    background-size: 200% 100%;
    background-position: 100% 0;
    transition: all 0.3s ease;
}

nav a:hover {
    color: white;
    background-position: 0 0;
}

/* 3. 上浮動畫效果 */
nav a {
    display: inline-block;
    transition: transform 0.3s ease;
}

nav a:hover {
    transform: translateY(-3px);
}

/* 4. 放大效果 + 文字加粗 */
nav a {
    transition: all 0.3s ease;
}

nav a:hover {
    transform: scale(1.1);
    font-weight: 600;
}

.hero {
    height: 80vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: var(--secondary-color);
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    padding: 2rem 5%;
}

.product-img {
    width: 500px;
    max-height: 100% auto;
    object-fit: cover;
}

.product-img-w {
    width: 1000px;
    max-height: 100% auto;
    object-fit: cover;
}

.product-card {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    text-align: center;
    transition: transform 0.3s ease;
}

.product-card:hover {
    transform: translateY(-5px);
}

.product-card button {
    background: var(--accent-color);
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 4px;
    color: white;
    cursor: pointer;
}

.product-card button:hover {
    background: #c8a06e;
    transform: translateY(-2px);
}

/* 添加購物車圖標 */
.product-card .add-to-cart-btn::before {
    content: '🛒 ';
    margin-right: 5px;
}

.product-card .see-details-btn::before {
    content: '🔍 ';
    margin-right: 5px;
}

.section {
    padding: 4rem 0;
    background-color: var(--secondary-color);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

/* .section-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--primary-color);
} */

.section-title {
    text-align: center;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 2rem;
    color: var(--primary-color);
}

.title-decoration {
    color: var(--accent-color);
    font-size: 1.2em;
    font-weight: normal;
}

/* 響應式設計調整 */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.5rem;
        gap: 0.3rem;
    }
    
    .title-decoration {
        font-size: 1em;
    }
}

.section-content {
    text-align: center;
    line-height: 1.6;
    max-width: 800px;
    margin: 0 auto;
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.partners {
    padding: 4rem 0;
    background: #f8f9fa;
  }
  
  .section-title {
    text-align: center;
    margin-bottom: 3rem;
    font-size: 2rem;
    color: #333;
  }
  
  .partners-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 250px));
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    justify-content: center; /* 新增：使 grid items 水平置中 */
    align-items: center; /* 新增：使 grid items 垂直置中 */
    padding: 0 1rem; /* 新增：增加兩側留白 */
  }
  
  .partner-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: white;
    border-radius: 8px;
    transition: transform 0.3s ease;
    position: relative;
    overflow: hidden; /* 防止 overlay 超出範圍 */
  }
  
  .partner-item:hover {
    transform: translateY(-5px);
  }
  
  .partner-item img {
    max-width: 100%;
    height: auto;
    filter: grayscale(100%);
    transition: filter 0.3s ease;
  }
  
  .partner-item:hover img {
    filter: grayscale(0%);
  }

  .partner-item .overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
  }
  
  .partner-item .description {
    color: white;
    text-align: center;
    padding: 1rem;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.3s ease;
  }
  
  .partner-item:hover .overlay {
    opacity: 1;
  }
  
  .partner-item:hover .description {
    transform: translateY(0);
    opacity: 1;
  }
  
  @media (max-width: 768px) {
    .partners-grid {
      grid-template-columns: repeat(2, 1fr);
    }
  }

/* 響應式設計 */
@media (max-width: 768px) {
    .product-img {
        width: 200px;
        max-height: 100% auto;
        object-fit: cover;
    }

    .product-img-w {
        width: 400px;
        max-height: 100% auto;
        object-fit: cover;
    }

    .section {
        padding: 2rem 0;
    }
    
    .container {
        padding: 0 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
}

.footer {
    background-color: var(--primary-color);
    color: white;
    padding: 4rem 0 0 0;
    margin-top: 4rem;
}

.footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
}

.footer-section h3 {
    color: var(--accent-color);
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.footer-section ul {
    list-style: none;
    padding: 0;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul li i {
    margin-right: 10px;
    color: var(--accent-color);
}

.footer-section a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer-section a:hover {
    color: var(--accent-color);
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-links a {
    font-size: 1.5rem;
    color: white;
    transition: color 0.3s ease;
}

.social-links a:hover {
    color: var(--accent-color);
}

.footer-bottom {
    margin-top: 3rem;
    padding: 1.5rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.9rem;
}

.center-btn {
    text-align: center;
}

.read-btn {
    display: inline-block;
    padding: 12px 32px;
    background: linear-gradient(90deg, #d4b895 0%, #e7cfa7 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: bold;
    border: none;
    border-radius: 30px;
    box-shadow: 0 4px 16px rgba(212, 184, 149, 0.15);
    text-decoration: none;
    transition: background 0.3s, transform 0.2s, box-shadow 0.3s;
    letter-spacing: 2px;
    margin-top: 20px;
}

.read-btn:hover {
    background: linear-gradient(90deg, #e7cfa7 0%, #d4b895 100%);
    color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 8px 24px rgba(212, 184, 149, 0.25);
}

/* 響應式設計 */
@media (max-width: 768px) {
    .footer {
        padding: 2rem 0 0 0;
    }
    
    .footer-container {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .footer-section ul li i {
        margin-right: 5px;
    }
}

.ad-carousel {
    position: relative;
    max-width: 1200px;
    margin: 2rem auto;
    overflow: hidden;
    aspect-ratio: 1 / 1; /* 可以根據需要調整比例 */
}

.carousel-container {
    display: flex;
    transition: transform 0.5s ease-in-out;
    height: 100%; /* 確保容器填滿高度 */
}

.carousel-slide {
    min-width: 100%;
    height: 100%; /* 確保每個 slide 填滿高度 */
}

.carousel-slide img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 保持圖片比例並填滿容器 */
    object-position: center; /* 圖片置中 */
}

/* 響應式設計 */
@media (max-width: 768px) {
    .ad-carousel {
        height: 200px; /* 手機版降低高度 */
    }
}

/* 可選：較大螢幕的設定 */
@media (min-width: 1200px) {
    .ad-carousel {
        height: 400px; /* 大螢幕增加高度 */
    }
}

.carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.6);
    color: white;
    padding: 1rem 1.2rem;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    font-size: 1.2rem;
    z-index: 10; /* 確保按鈕在最上層 */
    transition: all 0.3s ease;
}

.carousel-btn:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: translateY(-50%) scale(1.1);
}

.carousel-btn.prev {
    left: 20px;
}

.carousel-btn.next {
    right: 20px;
}

/* 導航點樣式 */
.carousel-dots {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    z-index: 10;
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
}

.dot.active {
    background: white;
    transform: scale(1.2);
}

/* 響應式調整 */
@media (max-width: 768px) {
    .carousel-btn {
        padding: 0.8rem 1rem;
        font-size: 1rem;
    }
    
    .carousel-btn.prev {
        left: 10px;
    }
    
    .carousel-btn.next {
        right: 10px;
    }
}

.typewriter {
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid #333;
    width: 0;
    animation: 
        typing 2s steps(9) forwards,
        blink 0.8s steps(1) infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 9em }
}

@keyframes blink {
    50% { border-color: transparent }
}

/* 確保標題容器寬度合適 */
.hero h1 {
    display: inline-block;
    margin: 0 auto;
    font-size: 2.5rem;
    color: #333;
}

/* 響應式調整 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    @keyframes typing {
        from { width: 0 }
        to { width: 9em } /* 手機版可能需要微調 */
    }
}

.product-dialog {
    border: none;
    border-radius: 8px;
    padding: 20px;
}

.close-button{
    background-color: var(--accent-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
}

.close-button:hover {
    background-color: #c8a06e;
}

/* Gallery Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    overflow: auto;
    perspective: 1000px; /* 添加透視效果 */
}

.modal-content {
    background-color: #fefefe;
    margin: 5% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 1200px;
    position: relative;
    z-index: 1000;
}

.close {
    position: absolute;
    right: 20px;
    top: 10px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    z-index: 1001;
}

.book-container {
    position: relative;
    width: 100%;
    height: 500px;
    perspective: 1200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.book {
    position: relative;
    width: 800px;
    height: 400px;
    transform-style: preserve-3d;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.page {
    position: absolute;
    width: 50%;
    height: 100%;
    background: linear-gradient(135deg, #fafafa 0%, #f0f0f0 100%);
    border: 1px solid #ddd;
    transform-style: preserve-3d;
    backface-visibility: hidden;
}

.left-page {
    left: 0;
    border-right: 2px solid #ccc;
    border-radius: 8px 0 0 8px;
    box-shadow: inset -5px 0 10px rgba(0, 0, 0, 0.1);
}

.right-page {
    right: 0;
    border-left: 2px solid #ccc;
    border-radius: 0 8px 8px 0;
    box-shadow: inset 5px 0 10px rgba(0, 0, 0, 0.1);
}

.flip-page {
    right: 0;
    transform-origin: left center;
    transition: transform 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 10;
    border-radius: 0 8px 8px 0;
    display: none; /* 初始隱藏 */
}

.flip-page.flipping {
    transform: rotateY(-180deg);
}

.page-content {
    width: 100%;
    height: 100%;
    padding: 20px;
    box-sizing: border-box;
    position: absolute;
    backface-visibility: hidden;
}

.page-content.back {
    transform: rotateY(180deg);
}

.page-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 4px;
    background: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: opacity 0.3s ease; /* 添加淡入淡出過渡效果 */
}

/* 書本中縫陰影 */
.book::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 4px;
    background: linear-gradient(to right, 
        rgba(0, 0, 0, 0.2) 0%, 
        rgba(0, 0, 0, 0.1) 50%, 
        rgba(0, 0, 0, 0.2) 100%);
    transform: translateX(-50%);
    z-index: 20;
    border-radius: 2px;
}

/* 翻頁動畫 */
@keyframes flipNext {
    0% { transform: rotateY(0deg); }
    50% { 
        transform: rotateY(-90deg) translateZ(20px);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    }
    100% { transform: rotateY(-180deg); }
}

@keyframes flipPrev {
    0% { transform: rotateY(-180deg); }
    50% { 
        transform: rotateY(-90deg) translateZ(20px);
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    }
    100% { transform: rotateY(0deg); }
}

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

.gallery-nav button {
    padding: 12px 24px;
    border: 2px solid #d4b895;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f6f0 0%, #e8e4d8 100%);
    color: var(--primary-color);
    cursor: pointer;
    font-weight: bold;
    font-size: 14px;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.gallery-nav button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.5s;
}

.gallery-nav button:hover::before {
    left: 100%;
}

.gallery-nav button:hover {
    background: linear-gradient(135deg, #d4b895 0%, #c8a06e 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

.gallery-nav button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: #e0e0e0;
}

.gallery-nav button:disabled:hover {
    background: #e0e0e0;
    color: #999;
    transform: none;
}

.page-indicator {
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    color: var(--primary-color);
    font-weight: bold;
}

.current-pages {
    color: var(--accent-color);
}

/* DM Button Styles */
.dm-button {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background-color: #E1306C;
    color: white;
    border: none;
    border-radius: 25px;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    z-index: 100;
}

.dm-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.dm-button i {
    font-size: 20px;
}

/* 翻書效果增強樣式 */
.gallery-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        135deg, 
        rgba(255, 255, 255, 0.1) 0%, 
        transparent 25%, 
        transparent 75%, 
        rgba(0, 0, 0, 0.05) 100%
    );
    pointer-events: none;
    border-radius: 8px;
}

/* 書本陰影效果 */
.gallery-container::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 10%;
    right: 10%;
    height: 20px;
    background: radial-gradient(ellipse, rgba(0, 0, 0, 0.3) 0%, transparent 70%);
    border-radius: 50%;
    z-index: 1;
}

/* 響應式設計調整 */
@media (max-width: 768px) {
    .book-container {
        height: 350px;
    }
    
    .book {
        width: 90vw;
        max-width: 600px;
        height: 300px;
    }
    
    .page-content {
        padding: 10px;
    }
    
    .gallery-nav button {
        padding: 10px 16px;
        font-size: 12px;
    }
    
    .modal-content {
        width: 95%;
        margin: 2% auto;
        padding: 15px;
    }
    
    .page-indicator {
        font-size: 12px;
        margin-top: 10px;
    }
}

@media (max-width: 480px) {
    .book {
        width: 95vw;
        height: 250px;
    }
    
    .book-container {
        height: 300px;
    }
    
    .page-content {
        padding: 8px;
    }
}