/* @author: Grace Sturman
   ============================================================================
   TABLE OF CONTENTS (Jack's Quick Reference Guide)
   ============================================================================
   1. CSS VARIABLES: Change main website colors, fonts here
   2. BILINGUAL LOGIC: Controls EN/ZH language switching
   3. HEADER, LOGO & MAIN NAV: Change logo size, top banner spacing, and main navigation bar here
   4. LAYOUT & CONTENT: Controls main boxes, hero banners and tour cards in tours.html
   5. BREADCRUMBS: Controls the 'Home > Tours > Asia' horizontal navigation bar under the main navigation menu
   6. FOOTER: Controls footer layout and colors
   7. MOBILE RESPONSIVE: Rules that ONLY apply to cell phones
   ============================================================================ */

/* =========================================
   1. CSS VARIABLES & BASE RESET
========================================= */
:root {
    --primary-accent: #d32f2f; /* Red Button Color */
    --top-banner-bg: #00235D;  /* Updated to match the logo's slate blue */
    --main-nav-bg: #F5EEE6;    /* beige color of the background of the main-nav bar */
    --nav-list-button-bg:  #EAE1D8; /* Dark beige background for the main-nav bar buttons */
    --nav-list-button-on_hover-bg: #e8e8e8; /* Slightly darker background on hover */
    --nav-list-text: #606060;  /* Text color of the items in the main-nav bar: Home, Tours, Visa, and the "EN | 中文" laguage toggle button text. */
    --nav-list-text-hover: #000000; /* Black text color of the items in the main-nav bar, when hover over it or when the tab is pressed (the corresponding page is active) */
    --bg-color: #f4f6f8;       /* Light Gray Background */
    --text-color: #333;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 80vh;
}

main { flex: 1; }

/* =========================================
   2. BILINGUAL TOGGLE LOGIC
========================================= */
body.lang-en .lang-zh { display: none; }
body.lang-zh .lang-en { display: none; }

/* =========================================
   3. HEADER & NAVIGATION STYLES
========================================= */
.top-banner {
    display: flex; justify-content: flex-start; align-items: center;
    padding: 15px 2%; 
    background-color: var(--top-banner-bg); 
    border-bottom: none; 
    position: relative;
}
.logo-container {
    display: flex; align-items: center; text-decoration: none;
}
.logo-img {
    max-height: 45px; 
    width: auto;
    transition: 0.3s;
}
.est-badge {
    font-size: 0.8rem; color: #ccc; margin-left: 10px; font-weight: bold; align-items:bottom;
}

/* =========================================
   GENERIC ACTION BUTTONS (Shrunk down)
========================================= */
.action-btn {
    background-color: var(--primary-accent); 
    color: white; 
    border: none; 
    padding: 6px 12px ;
    border-radius: 4px;
    cursor: pointer; 
    font-size: 1.2rem; 
    font-weight: bold;
    text-decoration: none;
    transition: background 0.3s;
}

.action-btn:hover { 
    filter: brightness(0.85); /* Darkens the button slightly on hover */
}

/* ===========================================================
   LANGUAGE TOGGLE BUTTON (Specific to Header / Top Banner)
=============================================================== */
.lang-toggle-btn {
    background-color: #fff; 
    color: var(--text-color); 
    border: none; 
    padding: 4px 8px; /* Nice and compact */
    border-radius: 2px;
    cursor: pointer; 
    margin-left: 30px;
    font-size: 0.85rem; /* Smaller text size to match */
    white-space: nowrap; 
    transition: background 0.3s;
}

.lang-toggle-btn:hover { 
    background-color: #f0f0f0; 
}

/* Language Toggle Text States */
.toggle-en, .toggle-zh {
    color: var(--nav-list-text); /* Use the same text color of the main-nav list items */
    font-weight: normal;
    transition: color 0.3s, font-weight 0.3s;
}

body.lang-en .toggle-en {
    color: #000000;
    font-weight: bold;
}

body.lang-zh .toggle-zh {
    color: #000000;
    font-weight: bold;
}

.contact-container {
    display: flex; align-items: center; gap: 20px; margin-left: 30px;
}
.phone-block a {
    display: flex; align-items: center; gap: 5px;
    text-decoration: none; color: #fff; font-weight: bold; font-size: 1rem;
}
.phone-icon { color: var(--primary-accent); display: flex; align-items: center; transition: 0.3s; }

.wechat-qr-banner {
    height: 60px; width: 60px; border-radius: 4px; box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.main-nav {
    display: flex; /* Changed from block to flex for better alignment control */
    align-items: flex-end; /* Forces the nav-list to sit at the absolute bottom */
    background-color: var(--main-nav-bg);
    padding: 0; 
    position: sticky; top: 0; z-index: 100;
    box-sizing: border-box;
    border-top: none; 
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); 
    min-height: 30px; /* Adds a little height to the beige bar so you can see the tabs sitting at the bottom */
}

.nav-list {
    list-style: none; display: flex; 
    justify-content: flex-start; 
    gap: 5px; 
    margin: 0; 
    padding: 12px 12px 0 0; /* 12px top, 12px right, 0 bottom, 0 left */
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; 
    width: 100%; /* Ensures the list stretches across the flex container */
}

.nav-list::-webkit-scrollbar {
    display: none;
}


/* Transforms the text links into clickable tabs/buttons */
.nav-list a {
    display: block; 
    background-color: var(--nav-list-button-bg); 
    color: var(--nav-list-text); 
    text-decoration: none; 
    font-weight: bold; 
    font-size: 1.05rem; 
    padding: 5px 12px;
    border: none; 
    border-radius: 0; 
    transition: all 0.2s ease-in-out;
}

/* The button hover and click effect */
.nav-list a:hover, 
.nav-list a:active { 
    color: var(--nav-list-text-hover); 
  
}

/* The current page (active) effect */
.nav-list a.active { 
    color: var(--nav-list-text-hover); /* Keeps the text black so they know what page they are on */
    background-color: var(--bg-color); 
}



/* HAMBURGER MENU */
.hamburger {
    display: flex; 
    flex-direction: column; 
    cursor: pointer; 
    gap: 4px; 
    z-index: 1001;
    margin-right: 8px; 
}
.hamburger span {
    width: 22px; 
    height: 3px; 
    background-color: #fff; 
    transition: 0.3s;
    border-radius: 2px;
}

.mobile-menu {
    display: none; 
    position: absolute; 
    top: 100%; /* Forces the menu to start exactly at the bottom of the blue header */
    left: 0; 
    width: 75vw; /* Shrinks it so it only takes up 75% of the screen width */
    max-width: 320px; /* Caps the maximum width on tablets */
    background: #fff; 
    box-shadow: 4px 10px 20px rgba(0,0,0,0.4); /* Darker shadow to lift it off the page */
    flex-direction: column; 
    z-index: 9999; /* Extremely high layer order to guarantee it covers the beige tabs */
    border-top: 3px solid var(--primary-accent);
}
.mobile-menu.show { display: flex; }
.mobile-menu a {
    padding: 15px 5%; border-bottom: 1px solid #eee; text-decoration: none;
    color: #333; font-weight: bold;
}
.mobile-menu a.sub-item {
    padding-left: 10%; font-weight: normal; background: #f9f9f9; color: #555;
}
.mobile-menu a:hover { background: #f1f1f1; color: var(--primary-accent); }

/* MOBILE ACCORDION MENU Additions */
.mobile-menu-parent {
    display: flex; justify-content: space-between; align-items: center;
    border-bottom: 1px solid #eee;
}
.mobile-menu-parent a {
    border-bottom: none; /* Removes the double border */
    flex: 1;
}
.submenu-toggle {
    padding: 15px 25px; font-size: 1.1rem; color: #888; 
    cursor: pointer; transition: transform 0.3s;
    border-left: 1px solid #eee; background: #fafafa;
}
.submenu-toggle.open {
    transform: rotate(180deg); /* Flips the arrow upside down when open */
    color: var(--primary-accent);
}
.mobile-sub-group {
    display: none; flex-direction: column; 
    border-bottom: 1px solid #eee;
}
.mobile-sub-group.show {
    display: flex; /* Reveals the nested links */
}

/* =========================================
   4. LAYOUT & CONTENT STRUCTURE
========================================= */

h1 {
    font-size: 1.5rem; 
}

h2 {
    font-size: 1.3rem; 
}

h3 {
    font-size: 1rem; 
}

.section {
    padding: 40px 5% 10px 5%; /* Top, Right, Bottom, Left */
    padding-top: 0; 
    max-width: 1200px;
    margin: 0 auto;
}

.content-box {
    background: #fff;
    padding: 30px 5% 10px 5%; /* Top, Right, Bottom, Left */
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
    margin-bottom: 0px;
    overflow: hidden;
}

.content-box:last-child {
    margin-bottom: 0px;
}

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

/* Top area with an image, under the Breadcrumb menu in most pages */
.hero-banner { 
    height: 30vh; /* Dynamic height: takes up 40% of the screen height on desktop */
    min-height: 300px; /* Ensures it never gets too short */
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
}
.hero-banner::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4); z-index: 1;
}
.hero-banner div { position: relative; z-index: 2; color: white; padding: 0 20px; }

/* NEW: Ensures h1 is massive on desktop monitors */
.hero-banner h1 { 
    font-size: 3rem; 
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5); 
}
.hero-banner h2 { font-size: 3rem; text-shadow: 2px 2px 4px rgba(0,0,0,0.5); }

.slide-btn {
    background: var(--primary-accent); color: white; padding: 10px 20px;
    text-decoration: none; font-size: 1rem; font-weight: bold;
    border-radius: 2px; transition: 0.3s; display: inline-block;
}
.slide-btn:hover { background: #b71c1c; }

.nav-btn {
    position: absolute; top: 50%; transform: translateY(-50%);
    background: rgba(0,0,0,0.5); color: white; border: none;
    padding: 15px 20px; font-size: 2rem; cursor: pointer;
    z-index: 4; border-radius: 4px; transition: 0.3s;
}
.nav-btn:hover { background: rgba(0,0,0,0.8); }
.nav-btn.prev-btn { left: 20px; }
.nav-btn.next-btn { right: 20px; }

/* UTILITIES - HEADING SIZE SYNC */
/* Synchronizes font size for hero slider headings and main section headings */
.heading-size-sync {
    font-size: clamp(1.5rem, 5vw, 3rem); /* Fluid responsive font size */
}

/* Adds the shadow back ONLY to the hero slider text so it's readable over images */
.slide-content .heading-size-sync {
    text-shadow: 2px 2px 5px rgba(0,0,0,0.6);
}

/* TOUR CARDS */

/* GLOBAL TOUR GRID */
.tour-grid {
    display: grid; 
    grid-template-columns: repeat(3, 1fr); /* Creates 3 equal columns on desktop */
    gap: 25px; 
    margin-top: 30px;
}

/* Tour Grid Responsive Rules (For Tablets and Phones) */
@media (max-width: 900px) { 
    .tour-grid { grid-template-columns: repeat(2, 1fr); } /* 2 columns on tablets */
}
@media (max-width: 600px) { 
    .tour-grid { grid-template-columns: 1fr; } /* 1 column on cell phones */
}

/* 6-COLUMN GRID FOR POPULAR TOURS (电脑6个，手机2个) */
.tour-grid-6 {
    display: grid; 
    grid-template-columns: repeat(6, 1fr); /* 电脑端：一行 6 个 */
    gap: 15px; 
    margin-top: 30px;
}

/* 专门为一行6个的卡片调整图片高度和文字大小，防止变得太长太瘦 */
.tour-grid-6 .tour-card img {
    height: 120px; 
}
.tour-grid-6 .tour-card-body h3 {
    font-size: 0.95rem;
    padding: 10px 5px;
}

/* 响应式设置：平板和手机 */
@media (max-width: 900px) { 
    .tour-grid-6 { grid-template-columns: repeat(3, 1fr); } /* 平板：一行 3 个 */
}
@media (max-width: 600px) { 
    .tour-grid-6 { grid-template-columns: repeat(2, 1fr); } /* 手机端：一行 2 个 */
}

/* New 3-Column Grid for sections with 3 or fewer tours */
.tour-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    margin-top: 30px;
}

/* Make it responsive for smaller screens */
@media (max-width: 900px) {
    .tour-grid-3 {
        grid-template-columns: repeat(2, 1fr); /* 2 columns on tablets */
    }
}
@media (max-width: 600px) {
    .tour-grid-3 {
        grid-template-columns: 1fr; /* 1 column on cell phones */
    }
}

/* Ensure links inside cards don't get default blue underline and dynamic heights */
.tour-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;             /* Added for dynamic height */
    flex-direction: column;    /* Added for dynamic height */
    height: 100%;              /* Forces card to stretch to grid cell height */
}

.tour-card:hover {
    text-decoration: none;
    transform: translateY(-5px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.tour-card img { 
    width: 100%; /* Forces the image to never be wider than its column */
    height: 220px; /* Locks the height so all cards are perfectly even */
    object-fit: cover; /* Crops the image nicely without squishing or stretching it */
    display: block; /* Removes any weird spacing below the image */
}

.tour-card-body {
    padding: 15px 10px 10px 10px;
    text-align: center;
    display: flex; 
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    background: white;
    flex-grow: 1;              /* Pushes the bottom of the card down so all cards match the tallest one */
}

.tour-card-body h3 {
    color: var(--top-banner-bg); 
    font-size: 1.4rem;
    margin: 0;
    padding: 0;
    text-decoration: none;
}


/* For Popular Tours in tours.html, Styling for the extra rows in the small tour cards */
.tour-grid-details {
    font-weight: normal; 
    font-size: 0.9rem;
    line-height: 1.3;
    margin-top: 4px;
    text-align: center;
    color: var(--top-banner-bg);
}

/* ===========================================================
   Standardize image heights for 3-column tour grids
   =========================================================== */
.tour-grid-3 .tour-card img {
    height: 200px; /* Lock the height for all English tour images */
    object-fit: cover; /* Ensures images are cropped nicely and not squished */
}

#founder-img {
    float: right; 
    margin-left: 20px; 
    margin-bottom: 20px; 
    width: 300px; 
    border-radius: 8px; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

@media (max-width: 600px) {
    #founder-img {
        float: none; /* Stops the text wrapping on mobile */
        display: block;
        margin: 0 auto 20px auto; /* Centers the image */
        width: 100%; /* Lets it shrink to fit the phone screen */
        max-width: 300px;
    }
}

/* =========================================
   5. IFRAME & BREADCRUMBS
========================================= */
.breadcrumb-nav {
    padding: 10px 12px; 
    background-color: var(--bg-color);
    font-size: 0.8rem;
    border-bottom: 1px solid #ddd;
    width: 100%;
    z-index: 10;
    position: relative;
    text-align: left;
    box-sizing: border-box;
    white-space: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.breadcrumb-nav::-webkit-scrollbar {
    display: none;
}
.breadcrumb-nav a {
    color: #555; /* Use grey color for parent links */
    text-decoration: none;
    transition: color 0.2s;
}
.breadcrumb-nav a:hover { text-decoration: underline; }

#iframe-view { 
    display: none; 
    flex: 1; 
    flex-direction: column; 
    width: 100%; 
    max-width: 1400px; 
    margin: 0 auto; 
    background: #fff; 
    height: 85vh; 
    min-height: 500px;
}
#main-iframe {
    height: 100%;
    width: 100%;
    border: none;
}

/* =========================================
   6. FOOTER STYLES
========================================= */
footer {
    background-color: var(--top-banner-bg); /* The same deep blue that's used in the top-banner */
    color: #ccc;
    padding: 50px 5% 20px;
    margin-top: 40px;
}
.footer-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(250px, 1fr));
    gap: 40px;
    max-width: 1200px;
    margin: 0 auto;
    margin-top: 0;
}
.footer-col h4 {
    color: #fff; margin-bottom: 20px; font-size: 1.2rem;
    border-bottom: 2px solid var(--primary-accent);
    padding-bottom: 10px; display: inline-block;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 12px; }
.footer-col a { color: #ccc; text-decoration: none; transition: 0.3s; }
.footer-col a:hover { color: #fff; }
.qr-code {
    width: 80px; height: 80px; border-radius: 4px;
}
.footer-bottom {
    text-align: center; padding-top: 30px; margin-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1); /* Softened border line */
    font-size: 0.9rem;
}

/* =========================================
   7. RESPONSIVE DESIGN (MOBILE)
========================================= */
@media (max-width: 850px) {
    /* Hide non-essential header items to save space */
    .contact-container .wechat-qr-banner { display: none; }
    .est-badge { display: none; } 
    
    .logo-img { max-height: 55px; max-width: 55vw; object-fit: contain; } 
    .hamburger { display: flex; margin-right: 8px; } 
    .phone-icon { transform: scale(1); margin-left: 5px; }

    .lang-toggle-btn {
    padding: 4px 4px; /* Reduce the left and right padding */
    border-radius: 2px;
    cursor: pointer; 
    margin-left: 10px;
    font-size: 0.8rem; /* Smaller text size */

    }

    .top-banner { justify-content: space-between; }
    .contact-container { margin-left: 0; }
    
    /* MOBILE NAV */
    .main-nav {   
        padding: 0;   
        padding-left: 0 !important;
      
    } 
    .nav-list { 
        gap: 5px; 
        justify-content: flex-start; 
        padding: 12px 0 0 12 !important; /* Drops the inner left/right padding so tabs stay flush left */
        padding-inline-start: 0 !important;
        margin-left: 0 !important;
    } 
    .nav-list a { 
        font-size: 0.95rem; 
        padding: 6px 10px; /* Slightly shrinks the touch area so more tabs fit on screen */
    }

    /* Removes the inner left padding specifically from the very first tab (Home) */
   .nav-list li:first-child a {
   
    margin-left: 0 !important;
    border-radius: 0 4px 4px 0 !important; /* Squares off the left edge so it looks flush */
    }
   
   
    
    /* Content Stacking */
    .grid-2 { grid-template-columns: 1fr; }
    
    /* Scales the banner and text down for mobile screens */
    .hero-banner { height: 240px; min-height: 240px; }
    .hero-banner h1 { font-size: 1.8rem; }
    
    .section { padding: 0px 0px 5px 0; } /* Top, Right, Bottom, Left */

    /* Reduce tour card heading size on mobile to make cards shorter */
    .tour-card-body h3 { font-size: 1.1rem !important; }

    /* Tightens up the footer spacing on mobile */
    footer { padding: 30px 5% 20px; margin-top: 20px; }
    
    /* Tightens up the footer spacing and stacks columns on mobile */
    footer { padding: 30px 5% 20px; margin-top: 20px; }
    .footer-grid { 
        grid-template-columns: 1fr; /* Forces the 3 columns to stack into 1 on phones */
        gap: 25px; 
    }
}

@media (max-width: 768px) {
    /* Hero Slider Adjustments */
    .hero-slider { height: 26vh; min-height: 180px; } 
    .slide-content h1 { font-size: 1.5rem; } 
    .slide-btn { padding: 8px 20px; font-size: 1rem; }
    .nav-btn { padding: 8px 14px; font-size: 1.2rem; }
    
    /* Mobile override for synchronized headings */
    .heading-size-sync { font-size: 1.5rem; }
}

@media (max-width: 600px) {
    /* Extreme Mobile Adjustments */
    .contact-container .phone-text { display: none; }
    .phone-icon { transform: scale(1); margin-left: 5px; }
    
    .action-btn { 
        padding: 6px 8px; 
        font-size: 1rem; 
        margin-left: 10px; 
        min-width: auto; 
        letter-spacing: -0.5px; 
    }

}