/* =========================================
   1. 頂部導覽與子選單 (Header & Nav)
   ========================================= */
.menu-container {
    z-index: 4000 !important;
}

header {
    min-height: 100px !important;
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    padding: 0;
    position: sticky;
    top: 0;
    z-index: 1001;
    border-bottom: 1px solid rgba(210, 193, 165, 0.3);
}

.category-nav {
    width: auto;
    padding-left: 120px;
    box-sizing: border-box;
}

.main-tabs {
    display: flex;
    justify-content: flex-start;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: 60px;
}

.tab-item {
    position: relative;
    color: #5C4033;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    padding: 10px 0;
    transition: all 0.3s ease;
}

.tab-item::after {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 0;
    width: 0;
    height: 2px;
    background-color: #cec161eb;
    transition: width 0.3s ease;
}

.tab-item:hover {
    color: #a02828;
    transform: translateY(-2px);
}

.tab-item:hover::after {
    width: 100%;
}

.submenu {
    display: none;
    position: absolute;
    top: 90%;
    left: 0;
    background: #fdfaf5;
    border: 1px solid #D2C1A5;
    min-width: 240px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    list-style: none;
    padding: 10px 0;
    z-index: 3000;
    border-radius: 2px;
}

.submenu li {
    padding: 12px 20px;
    color: #5C4033;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.submenu li:hover {
    background-color: #F5F1E6;
    color: #a02828;
    padding-left: 25px;
}

.tab-item.has-submenu:hover .submenu {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

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

/* =========================================
   2. 照片與內容主框架 (Main Layout)
   ========================================= */
#photos-flex-container {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    width: 95%;
    max-width: 1600px;
    margin: 50px auto;
    gap: 60px;
}

.photos-img-frame {
    flex: 1.5;
    background: #fdfaf5;
    padding: 20px;
    border: 1px solid #D2C1A5;
    box-shadow: 10px 10px 0px #D2C1A5, 20px 20px 40px rgba(0, 0, 0, 0.1);
}

.photos-text-frame {
    position: relative;
    flex: 0.8;
    background: radial-gradient(circle, #FDFBF7 0%, #F5F1E6 100%);
    padding: 45px 40px;
    border: 1px solid #D2C1A5;
    border-radius: 2px;
    min-height: 480px;
    box-shadow: 5px 5px 25px rgba(0, 0, 0, 0.05);
    line-height: 1.8;
    padding-bottom: 80px;
}

/* =========================================
   3. 內容與排版細節 (Typography & Content)
   ========================================= */
.slider-group,
.note-content {
    display: none;
}

.slider-group.active,
.note-content.active {
    display: block;
}

.note-content h2 {
    color: #5C4033;
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 3px;
    margin-bottom: 10px;
    border-bottom: none !important;
    position: relative;
}

.note-content h3 {
    font-family: "Kaiti", "STKaiti", "標楷體", serif;
    color: #8A7B63;
    font-size: 1.1rem;
    font-weight: 500;
    font-style: italic;
    letter-spacing: 1px;
    margin: 0;
    position: absolute;
    bottom: 30px;
    right: 40px;
    width: max-content;
    max-width: 85%;
    text-align: left;
    line-height: 1.6;
}

.note-content h3+h3 {
    bottom: 10px;
}

.note-content p {
    color: #6B4F31;
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
    text-align: justify;
    letter-spacing: 0.5px;
}

.note-content strong {
    color: #a02828;
    font-weight: 700;
}

.inner-line {
    border: 0;
    height: 1px;
    background: linear-gradient(to right, #D2C1A5 0%, rgba(210, 193, 165, 0.3) 80%, transparent 100%);
    margin: 20px 0 30px 0;
}

/* =========================================
   4. 互動元件 (Tabs, Slider, Lightbox)
   ========================================= */
.activity-tabs {
    list-style: none;
    padding: 0;
    margin-bottom: 20px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.tab-btn {
    background-color: #E8DCC4;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
    color: #5C4033;
    border: 1px solid #D2C1A5;
}

.tab-btn.active {
    background-color: #FFD700;
    border-color: #B48C00;
}

.carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    background-color: #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
}

.slider-container {
    display: flex;
    overflow-x: hidden;
    scroll-behavior: smooth;
    width: 100%;
    scroll-snap-type: x mandatory;
}

.item {
    flex: 0 0 100%;
    width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
}

.item img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: contain;
    display: block;
}

.prev,
.next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 15px;
    cursor: pointer;
    z-index: 10;
    font-size: 18px;
    transition: 0.3s;
}

.prev {
    left: 0;
    border-radius: 0 5px 5px 0;
}

.next {
    right: 0;
    border-radius: 5px 0 0 5px;
}

.prev:hover,
.next:hover {
    background: rgba(243, 156, 18, 0.8);
}

.slider-note {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 10px;
    color: #8a7b63;
}

/* Lightbox 樣式保持原樣 */
.lightbox {
    display: none;
    position: fixed;
    z-index: 9000;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95);
    cursor: default;
    align-items: center;
    justify-content: center;
}

.lightbox-content {
    max-width: 90%;
    max-height: 80%;
    width: auto;
    height: auto;
    object-fit: contain;
    border: 3px solid #f0efd3;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.3);
    border-radius: 4px;
    animation: zoomIn 0.3s ease;
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.1);
    color: white;
    border: 1px solid rgba(255, 215, 0, 0.3);
    padding: 20px 15px;
    cursor: pointer;
    font-size: 30px;
    transition: 0.3s;
    user-select: none;
}

.lightbox-prev {
    left: 20px;
    border-radius: 0 5px 5px 0;
}

.lightbox-next {
    right: 20px;
    border-radius: 5px 0 0 5px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(243, 156, 18, 0.5);
    color: #FFD700;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
}

@keyframes zoomIn {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* =========================================
   過渡斷點 - 平板與分割視窗 (Tablet & Split-Screen)
   ========================================= */
@media (max-width: 1200px) {

    /* 1. 導覽列文字稍微縮小，避免擠在一起 */
    .main-tabs {
        gap: 30px;
    }

    .tab-item {
        font-size: 1.15rem;
    }

    /* 2. 提早觸發上下排列 */
    #photos-flex-container {
        flex-direction: column;
        align-items: center;
        gap: 40px;
    }

    .photos-img-frame,
    .photos-text-frame {
        width: 90%;
        flex: none;
        min-height: auto;
    }
}

/* =========================================
   5. 響應式設計 - 手機板 (Mobile)
   ========================================= */
@media (max-width: 768px) {
    header {
        min-height: 100px !important;
        align-items: flex-end !important;
        padding-bottom: 8px;
        overflow: visible !important;
    }

    .category-nav {
        padding-left: 0 !important;
        width: 100%;
        display: flex;
        justify-content: center;
        overflow: visible !important;
    }

    .main-tabs {
        cursor: pointer !important;
        font-size: 0.95rem !important;
        flex-wrap: nowrap !important;
        padding: 10px 15px 10px 50px !important;
        justify-content: flex-start !important;
        gap: 12px !important;
        overflow: visible !important;
    }

    .tab-item {
        cursor: pointer !important;
        -webkit-user-select: none !important;
        -webkit-tap-highlight-color: transparent !important;
        font-size: 0.95rem !important;
        font-weight: 700;
        letter-spacing: 1px !important;
        padding: 5px 2px;
        white-space: nowrap;
    }

    .tab-item::after {
        display: none !important;
        content: none !important;
    }

    .submenu {
        position: absolute !important;
        top: 100% !important;
        left: 50% !important;
        animation: fadeInMobile 0.25s ease-out forwards !important;
        max-width: 85vw !important;
        min-width: 150px !important;
        border-radius: 4px !important;
    }

    @keyframes fadeInMobile {
        from {
            opacity: 0;
            transform: translate(-50%, -10px);
        }

        to {
            opacity: 1;
            transform: translate(-50%, 0);
        }
    }

    .submenu li {
        padding: 12px 15px !important;
        font-size: 0.9rem !important;
    }

    .submenu li:last-child {
        border-bottom: none;
    }

    #photos-flex-container {
        flex-direction: column;
        align-items: center;
        gap: 30px;
        margin: 20px auto !important;
    }

    .note-content h2 {
        font-size: 1.4rem !important;
        letter-spacing: 2px !important;
        margin-bottom: 8px !important;
    }

    .note-content p {
        font-size: 0.95rem !important;
        margin-bottom: 1rem !important;
        line-height: 1.6 !important;
    }

    .photos-img-frame {
        width: 95% !important;
        flex: none !important;
        box-sizing: border-box !important;

        padding: 30px 20px 15px 20px !important;
        min-height: auto !important;
    }

    .photos-text-frame {
        width: 95% !important;
        flex: none !important;
        box-sizing: border-box !important;

        padding: 30px 20px 60px 20px !important;
        min-height: auto !important;
    }

    .item img {
        height: auto !important;
    }

    .note-content h3 {
        top: 20px;
        position: relative !important;
        bottom: auto !important;
        right: auto !important;
        font-size: 0.9rem !important;
        text-align: right !important;
        margin-top: 20px !important;
        display: block;
        width: max-content;
        max-width: 85%;
        line-height: 1.2 !important;
    }

    .note-content h3+h3 {
        margin-top: 3px !important;
        bottom: auto !important;
    }
}

/* =========================================
   6. 響應式設計 - 超寬螢幕 (Ultra-Wide / 2K)
   ========================================= */
@media (min-width: 1921px) {
    header {
        min-height: 115px !important; 
    }

    .category-nav {
        padding-left: 230px !important; 
    }

    #photos-flex-container {
        max-width: 2000px;
        gap: 80px;
    }

    .photos-text-frame {
        padding: 60px 60px 120px 60px !important;
    }

    .note-content p {
        font-size: 1.50rem;
        line-height: 1.9;
    }

    .note-content h3 {
        font-size: 1.35rem;
        right: 10px;
        bottom: 30px;
        width: max-content;
        max-width: 85%;
    }

    .tab-item {
        font-size: 2rem;
    }

    .submenu li {
        font-size: 1.40rem;
    }

    .submenu {
        min-width: 250px !important;
    }

    .note-content h2 {
        font-size: 2.4rem;
        margin-bottom: 20px;
    }
}

/* =========================================
   7. 響應式設計 - 4K 超高解析度 (2561px+)
   ========================================= */
@media (min-width: 2561px) {
    header {
        min-height: 200px !important; 
    }

    .category-nav {
        padding-left: 330px !important; 
    }

    #photos-flex-container {
        max-width: 2500px;
        gap: 120px;
    }

    .photos-text-frame {
        padding: 80px 80px 150px 80px !important;
    }

    .note-content p {
        font-size: 1.85rem;
        line-height: 2.1;
    }

    .note-content h3 {
        font-size: 1.7rem;
        right: 20px;
        bottom: 45px;        
        width: max-content;
        max-width: 85%;
    }

    .tab-item {
        font-size: 2.5rem;
    }

    .submenu li {
        font-size: 1.75rem;
        padding: 25px 35px;
    }

    .submenu {
        min-width: 350px !important;
    }

    .note-content h2 {
        font-size: 3rem;
        margin-bottom: 30px;
    }
}