body {
    margin: 0;
    font-family: 'Segoe UI', sans-serif;
    background-color: #1e1e1e;
    color: #f0f0f0;
}

section {
    padding: 2em;
    max-width: 1200px;
    margin: 0 auto;
}

.portfolio-page section {
    padding-top: 150px;
}

section#contact {
    padding: 2em;
    max-width: 800px;
    margin-left: 100px;
    margin-right: auto;
    text-align: left;
    padding-left: 0;
    box-sizing: border-box;
}

footer {
    text-align: center;
    padding: 2em;
    background-color: #1e1e1e;
    font-size: 0.9em;
    color: #aaa;
}

.contact-icons {
    display: flex;
    gap: 30px;
    margin: 15px 0;
}

.icon-link {
    color: #f0f0f0;
    text-decoration: none;
    font-size: 2em;
}

.icon-link:hover {
    color: #ff0080;
}

.grid {
    max-width: 100%;
    margin: 0 auto; /* 移除 flexbox 相關屬性，讓 Masonry 自己處理排版和置中 */
    padding: 0;
}

.grid-item {
    max-width: 240px;
    margin-bottom: 16px;
    break-inside: avoid;
    opacity: 0; /* 預設隱藏圖片 */
    transition: opacity 0.5s ease-in-out; /* 淡入效果 */
}

.grid-item.visible {
    opacity: 1; /* 載入後顯示圖片 */
}

.grid-item img {
    width: 100%;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease;
}

.grid-item img:hover {
    transform: scale(1.03);
    cursor: pointer;
}

.lb-data .lb-caption {
    color: rgba(0, 0, 0, 0.073);
}

.hero-header {
    min-height: 350px;
    background-image: url('images/header-background.jpg');
    background-size: cover;
    background-position: 40% 52%;
    background-repeat: no-repeat;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    color: #fff;
    text-align: center;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    padding: 20px;
    box-sizing: border-box;
}

.hero-header h1 {
    margin: 0;
    font-size: clamp(1.8em, 4vw, 1.7em);
    position: relative;
    top: 20px;
    text-align: left;
    flex-shrink: 0;
    line-height: 1;
}

.hero-header nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: 100%;
    padding-right: 20px;
    box-sizing: border-box;
    padding-top: 10px;
    margin-top: 20px;
}

.hero-header nav a {
    color: white;
    text-decoration: none;
    font-weight: bold;
    padding: 10px;
    font-size: 1.2em;
    margin-left: clamp(10px, 2vw, 20px);
    margin-right: clamp(10px, 2vw, 20px);
    transition: color 0.3s ease;
    border-radius: 5px;
}

.hero-header nav a:hover {
    color: #00ffff;
}

.hero-text {
    margin-top: 125px;
    margin-bottom: 50px;
    font-size: clamp(1.2em, 2.5vw, 1.6em);
    line-height: 1.5;
    width: 80%;
    margin: 125px auto 50px;
    text-align: center;
    background: linear-gradient(to right, #00ffff, #ff0080);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

header {
    background-color: transparent;
}

.header-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
    background: linear-gradient(to bottom, #ffffff9e, #928c8c3e);
    position: absolute;
    padding: 0 20px;
    box-sizing: border-box;
    top: 0;
    left: 0;
    flex-wrap: wrap;
    z-index: 99;
}

.hero-header-plain {
    background-image: none;
    background-color: transparent;
    height: auto;
    min-height: 0;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox .lb-close {
    position: absolute;
    top: 0;
    right: 200px;
    z-index: 9999;
    cursor: pointer;
    width: 36px;
    height: 36px;
    background: url('images/close.png') no-repeat;
    background-size: contain;
}

.lightbox .lb-dataContainer {
    padding-top: 20px;
}

.lightbox .lb-data {
    padding: 0 10px;
}

.lightbox .lb-dataContainer .lb-number {
    margin-right: 40px;
}

.dropdown {
    position: relative;
    display: inline-block;
}

.dropbtn {
    color: black;
    text-decoration: none;
    font-weight: bold;
    padding: 8px 12px;
    border-radius: 5px;
    transition: background-color 0.3s ease, color 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
}

.dropbtn:hover {
    background-color: rgba(0, 0, 0, 0.1);
    color: #00ffff;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: rgba(66, 65, 65, 0.8);
    min-width: 160px;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
    z-index: 100;
    border-radius: 5px;
    left: 0;
    top: 100%;
}

.dropdown-content a {
    color: black;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
    transition: background-color 0.2s ease;
    border-radius: 5px;
}
/* 新增的子選單樣式 */
.dropdown-submenu {
  position: relative; /* 讓子選單相對於此容器定位 */
}

.dropdown-submenu .submenu-content {
  display: none; /* 預設隱藏子選單 */
  position: absolute; /* 絕對定位 */
  left: 100%; /* 將子選單放在主選單的右側 */
  top: 0;
  background-color: rgba(66, 65, 65, 0.9); /* 與主選單一致的背景色 */
  min-width: 160px;
  box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
  z-index: 101; /* 確保子選單在最上層 */
  border-radius: 5px;
}

.dropdown-submenu:hover .submenu-content {
  display: block; /* 滑鼠懸停時顯示子選單 */
}

.dropdown-submenu a {
  border-radius: 0;
}

/* 子選單連結的樣式 */
.submenu-content a {
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  text-align: left;
  transition: background-color 0.2s ease;
  color: white; /* 讓子選單的字體變成白色，與背景色對比 */
}

.submenu-content a:hover {
  background-color: #ddd;
  color: #00ffff;
}

/* 調整主下拉選單的樣式，讓「Sports」看起來像個父選項 */
.dropdown-content a {
  border-radius: 5px;
}

.dropdown-content a:hover {
    background-color: #ddd;
    color: #00ffff;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.hero-header nav a,
.hero-header nav .dropbtn {
    margin-left: 20px;
}

.hero-header nav .dropbtn {
    margin-left: 20px;
}

.dropbtn i {
    vertical-align: middle;
}

.hamburger-menu {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 1000;
    position: relative;
    width: 40px;
    height: 30px;
    flex-shrink: 0;
}

.hamburger-menu .bar {
    display: block;
    width: 100%;
    height: 3px;
    top: 20px;
    background-color: white;
    border-radius: 2px;
    margin: 6px 0;
    transition: all 0.3s ease;
}

.hamburger-menu.active .bar:nth-child(1) {
    transform: translateY(9px) rotate(45deg);
}

.hamburger-menu.active .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.active .bar:nth-child(3) {
    transform: translateY(-9px) rotate(-45deg);
}

.main-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    width: auto;
    padding-right: 20px;
    box-sizing: border-box;
}

body.no-scroll {
    overflow: hidden;
    height: 100vh;
}

/* 主要內容容器的樣式 */
.about-container {
    display: flex; /* 讓子元素（文字和圖片）並排顯示 */
    justify-content: center; /* 讓內容水平居中 */
    align-items: center; /* 讓內容垂直居中 */
    flex-wrap: wrap; /* 允許項目在小螢幕上換行 */
    padding: 50px 20px; /* 在內容周圍增加間距 */
    max-width: 1200px; /* 限制在大螢幕上的寬度 */
    margin: 0 auto; /* 讓容器在頁面中居中 */
    margin-top: 100px;
    /*flex-direction: row-reverse; */
}

/* 文字欄位的樣式 */
.about-text {
    flex: 1; /* 讓這個項目可以伸展並佔據空間 */
    padding-right: 40px; /* 在文字和圖片之間增加間距 */
    line-height: 1.6; /* 增加行距以提高可讀性 */
    font-size: 0.9em;
    max-width: 800px; /* 可選：限制文字區塊的寬度 */
    color: #ffffff;
    text-align: left; 
    
}

/* 圖片欄位的樣式 */
.about-image {
    flex: 1; /* 讓這個項目也可以伸展 */
    max-width: 600px; /* 限制圖片欄位的寬度 */
    text-align: center; /* 圖片居中顯示 */
}

/* 讓圖片本身具有響應式特性 */
.about-image img {
    max-width: 100%; /* 確保圖片不會超出其容器 */
    height: auto; /* 保持圖片的長寬比 */
    display: block; /* 移除圖片下方多餘的空間 */
}
@media screen and (max-width: 768px) {
    body {
        font-size: 15px;
    }

    body.no-scroll {
        overflow: hidden;
    }

    section {
        padding: 1.5em;
        margin: 0 15px;
    }

    section#contact {
        margin-left: 15px;
        padding-left: 15px;
    }

    .hero-header h1 {
        text-align: left;
        width: auto;
        font-size: clamp(1.8em, 5vw, 2.5em);
        margin: 0;
        flex-shrink: 0;
        line-height: 1;
        top: 0;
    }

    .hero-text {
        font-size: 1.5em;
        width: 90%;
        margin-top: 80px;
    }

    .hero-header {
        min-height: 250px;
    }

    .header-top-bar {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        position: fixed;
        background-color: rgba(0, 0, 0, 0.8);
        padding: 10px 15px;
        z-index: 1000;
        top: 0;
        left: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .header-overlay {
        display: flex;
        flex-direction: column;
        justify-content: center;
    }

    .hamburger-menu {
        display: block;
        margin-left: auto;
        color: white;
        top: -2vh;
    }

    .hero-header-plain .hamburger-menu .bar {
        background-color: white;
    }

    .hero-header .main-nav {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 0;
        right: -100%;
        width: 70%;
        height: 100vh;
        background-color: rgba(30, 30, 30, 0.95);
        box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
        transition: right 0.3s ease-out;
        z-index: 999;
        overflow-y: auto;
        justify-content: flex-start !important;
        align-items: center !important;
        padding-top: 0;
    }

    .hero-header .main-nav.active {
        right: 0;
    }

    .hero-header .main-nav a,
    .hero-header .main-nav .dropbtn {
        margin: 5px;
        padding: 15px;
        font-size: 1em;
        text-align: center;
        width: calc(100% - 40px);
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .hero-header .main-nav a:last-child,
    .hero-header .main-nav .dropdown:last-child .dropbtn {
        border-bottom: none;
    }

    .dropdown-content {
        position: static;
        background-color: rgba(66, 65, 65, 0.8);
        box-shadow: none;
        min-width: unset;
        width: 100%;
        border-radius: 0;
    }

    .dropdown-content a {
        padding: 10px 30px;
        text-align: center;
        font-size: 0.9em;
        border-bottom: 1px dashed rgba(255, 255, 255, 0.05);
    }

    .dropdown-content a:last-child {
        border-bottom: none;
    }

    .lightbox {
        background-color: rgba(0, 0, 0, 0.9);
    }

    .lightbox .lb-outerContainer {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: auto !important;
        height: auto !important;
    }

    .lightbox .lb-image {
        max-width: 95vw !important;
        max-height: 80vh !important;
        object-fit: contain;
        width: auto !important;
        height: auto !important;
    }

    .lightbox .lb-dataContainer {
        display: none;
    }

    .lightbox .lb-close {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 9999;
        width: 36px;
        height: 36px;
    }

    .grid {
        padding: 0 10px;
    }

    .grid-item {
        flex-basis: calc(100% - 20px);
        max-width: calc(100% - 20px);
        margin-right: 0;
        margin-bottom: 8px;
    }

    .hero-header-plain {
        background-image: none;
        background-color: transparent;
        height: auto;
        min-height: 0;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        position: relative;
    }

    body.portfolio-page .hamburger-menu {
        display: none;
    }

    body.portfolio-page .hero-header .main-nav {
        display: flex;
        flex-direction: row;
        justify-content: flex-end;
        align-items: center;
        width: auto;
        position: static;
        top: unset;
        right: unset;
        height: auto;
        background-color: transparent;
        box-shadow: none;
        transition: none;
        z-index: auto;
        overflow-y: visible;
    }

    body.portfolio-page .hero-header .main-nav a,
    body.portfolio-page .hero-header .main-nav .dropbtn {
        margin: 0px 0px;
        padding: 10px;
        font-size: 1em;
        text-align: center;
        width: auto;
        border-bottom: none;
    }

    body.portfolio-page .dropdown-content {
        position: absolute;
        top: 100%;
        left: 0;
    }

    body.portfolio-page section {
        padding-top: 160px;
    }
    .about-container {
        flex-direction: column; /* 將文字和圖片垂直堆疊 */
    }
    .about-text {
        padding-right: 0;
        margin-bottom: 30px; /* 在文字和圖片之間增加間距 */
        text-align: center;
    }
}

@media screen and (max-width: 480px) {
    body {
        font-size: 14px;
    }

    .main-nav {
        width: 80%;
    }

    .hero-header h1 {
        font-size: clamp(1.5em, 6vw, 2.2em);
    }

    .hero-text {
        font-size: 1em;
        width: 95%;
    }

    .grid-item {
        flex-basis: 100%;
        max-width: 100%;
        margin-right: 0;
    }

    .contact-icons {
        gap: 20px;
        justify-content: center;
    }
}

@media screen and (max-width: 1024px) and (min-width: 769px) {
    section {
        padding: 2em;
        margin: 0 25px;
    }

    section#contact {
        margin-left: 50px;
        padding-left: 30px;
    }

    .grid-item {
        flex-basis: calc(33.333% - 20px);
        max-width: calc(33.333% - 20px);
    }
}
@media screen and (min-width: 1700px) {
    /* 增加頁面主要容器的最大寬度，讓圖片排得更寬 */
    section {
        max-width: 2000px; /* 您可以根據需求調整這個值 */
    }

    /* 調整 grid 容器的邊距，減少兩側空白 */
    .grid {
        padding: 0 20px; /* 這裡設定了左右 10px 的內邊距 */
    }

    /* 確保 grid 項目在更大的容器中能正確顯示 */
    .grid-item {
        width: 100%;
        max-width: 350px;
        margin-bottom: 20px;
        
    }
    
}
/* 容器樣式：確保相對定位 */
.grid-item a {
  position: relative;
  display: block;
}

/* 覆蓋圖層樣式 */
.image-overlay {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  width: 100%;
  opacity: 0; /* 預設為透明 */
  transition: .5s ease;
  background-color: rgba(0, 0, 0, 0.7); /* 半透明黑色背景 */
  display: flex; /* 使用 Flexbox 讓文字置中 */
  justify-content: center;
  align-items: center;
  text-align: center;
  border-radius: 10px; /* 配合圖片的圓角 */
}

/* 滑鼠懸停時顯示覆蓋圖層 */
.grid-item a:hover .image-overlay {
  opacity: 1; /* 滑鼠移入時顯示 */
}

/* 文字樣式 */
.overlay-text {
  color: white;
  font-size: 1.2em;
  padding: 10px;
}