/* ===================================
   Design Enhancements - 設計增強
   增加設計感、質感與專業感
   =================================== */

/* 全域背景裝飾 */
body {
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: -50%;
    right: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.03) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

body::after {
    content: '';
    position: fixed;
    bottom: -30%;
    left: -10%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(201, 169, 97, 0.02) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
}

/* 區塊標題增強 */
.section-title {
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 2px;
    background: var(--gold);
}

/* 區塊副標題裝飾 */
.section-subtitle {
    position: relative;
    display: inline-block;
    padding: 0 1rem;
}

.section-subtitle::before,
.section-subtitle::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 30px;
    height: 1px;
    background: var(--gold);
}

.section-subtitle::before {
    left: -35px;
}

.section-subtitle::after {
    right: -35px;
}

/* Hero 區塊增強 - 柔和的漸層效果 */
.hero-overlay {
    background: linear-gradient(
        140deg,
        rgba(10,10,10,0.80) 0%,
        rgba(18,18,18,0.75) 25%,
        rgba(22,22,22,0.72) 50%,
        rgba(18,18,18,0.75) 75%,
        rgba(10,10,10,0.78) 100%
    ) !important;
}

.hero-content {
    z-index: 2;
}

/* 頁面標題背景 - 柔和的漸層效果 */
.page-header-overlay {
    background: linear-gradient(
        140deg,
        rgba(10,10,10,0.75) 0%,
        rgba(18,18,18,0.70) 25%,
        rgba(22,22,22,0.68) 50%,
        rgba(18,18,18,0.70) 75%,
        rgba(10,10,10,0.73) 100%
    ) !important;
}

/* 頁面標題底部柔和漸層 */
.page-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 150px;
    background: linear-gradient(
        to top,
        rgba(248, 246, 240, 1) 0%,
        rgba(248, 246, 240, 0.95) 10%,
        rgba(248, 246, 240, 0.85) 20%,
        rgba(248, 246, 240, 0.65) 35%,
        rgba(248, 246, 240, 0.45) 50%,
        rgba(248, 246, 240, 0.25) 65%,
        rgba(248, 246, 240, 0.12) 80%,
        rgba(248, 246, 240, 0.05) 90%,
        rgba(248, 246, 240, 0) 100%
    );
    z-index: 2;
    pointer-events: none;
}

.page-header-content {
    z-index: 3;
}

/* 卡片懸浮效果增強 */
.feature-card,
.service-card,
.partner-card,
.team-card,
.partner-detail-card {
    will-change: transform;
}

/* 按鈕增強效果 */
.btn {
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* 導航欄陰影增強 */
.navbar {
    box-shadow: 0 2px 20px rgba(10, 10, 10, 0.1);
}

/* Footer 裝飾線 - 簡化 */
.footer {
    position: relative;
}

/* 圖片容器增強 */
.content-image,
.team-image,
.partner-detail-image {
    overflow: hidden;
}

.content-image img,
.team-image img,
.partner-detail-image img {
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.content-image:hover img,
.team-card:hover .team-image img,
.partner-detail-card:hover .partner-detail-image img {
    transform: scale(1.08);
}

/* Icon 動畫效果 */
.feature-icon,
.service-icon,
.partner-icon,
.info-icon i {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.feature-card:hover .feature-icon,
.service-card:hover .service-icon {
    transform: scale(1.1) rotate(5deg);
}

/* 數字統計動畫 */
.stat-number {
    position: relative;
    display: inline-block;
}

.stat-number::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background: var(--gold);
    transition: width 0.3s ease;
}

.stat-box:hover .stat-number::after {
    width: 80%;
}

/* 時間軸裝飾 */
.timeline-year {
    position: relative;
    display: inline-block;
}

.timeline-year::after {
    content: '';
    position: absolute;
    right: -25px;
    top: 50%;
    width: 15px;
    height: 15px;
    background: var(--gold);
    border-radius: 50%;
    border: 3px solid var(--white);
    transform: translateY(-50%);
    box-shadow: 0 0 0 3px var(--cream);
}

/* 流程步驟編號增強 */
.step-number {
    position: relative;
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.3);
}

.step-number::before {
    content: '';
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
}

.process-step:hover .step-number::before {
    opacity: 0.2;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        opacity: 0.2;
    }
    50% {
        transform: scale(1.1);
        opacity: 0.1;
    }
}

/* 關係企業圖表增強 */
.partner-logo-circle {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 連接線動畫 */
.connection-lines line {
    stroke-dasharray: 1000;
    stroke-dashoffset: 1000;
    animation: drawLine 2s ease-in-out forwards;
}

@keyframes drawLine {
    to {
        stroke-dashoffset: 0;
    }
}

/* 表單輸入增強 */
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    box-shadow: 0 0 0 3px rgba(201, 169, 97, 0.1);
}

/* 社交連結動畫 */
.social-link {
    overflow: hidden;
}

.social-link i {
    transition: transform 0.3s ease;
}

.social-link:hover i {
    transform: scale(1.2) rotate(360deg);
}

/* 返回頂部按鈕增強 */
.back-to-top {
    box-shadow: 0 4px 15px rgba(201, 169, 97, 0.4);
}

.back-to-top::before {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--gold);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.3s;
}

.back-to-top:hover::before {
    opacity: 0.3;
    animation: pulse 1s infinite;
}

/* 載入動畫（可選） */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.feature-card,
.service-card,
.team-card,
.partner-card {
    animation: fadeInUp 0.6s ease-out;
}

.feature-card:nth-child(2) { animation-delay: 0.1s; }
.feature-card:nth-child(3) { animation-delay: 0.2s; }

/* 文字選取顏色 */
::selection {
    background: var(--gold);
    color: var(--black);
}

::-moz-selection {
    background: var(--gold);
    color: var(--black);
}

/* 滾動條樣式 */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--cream);
}

::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dark);
}

/* 區塊分隔線裝飾 */
.section {
    position: relative;
}

.section:not(:last-child)::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 1px;
    background: linear-gradient(to right, transparent, var(--gold), transparent);
}

/* CTA 區塊增強 - 柔和的漸層效果 */
.cta-overlay {
    background: linear-gradient(
        140deg,
        rgba(10,10,10,0.86) 0%,
        rgba(18,18,18,0.82) 25%,
        rgba(22,22,22,0.80) 50%,
        rgba(18,18,18,0.82) 75%,
        rgba(10,10,10,0.85) 100%
    ) !important;
}

/* 響應式優化 */
@media (max-width: 768px) {
    body::before,
    body::after {
        width: 300px;
        height: 300px;
    }

    .section-subtitle::before,
    .section-subtitle::after {
        display: none;
    }
}

/* =====================================================================
   多語系字級協調 + RWD 防裁切／防貼邊（中／英／越通用，未來語言自動適用）
   置於 enhancements.css 末段，載入順序最後 → 覆蓋各頁 page css。
   解法核心：
   1) Hero/標題字級下限調小，越南／英文長字在手機少斷行、不過大；
   2) Hero 改 min-height 並預留導覽列高度，內容過高時自然延展、不被固定列裁切；
   3) 內頁標題列補左右留白，副標不再貼邊；
   4) 全面 overflow-wrap/break-word，未來任何長字語系都不溢出。
   ===================================================================== */
:root {
    --nav-h: 78px; /* 桌機／平板固定導覽列實際高度，供 hero / 內頁標題對齊（避免縫隙或重疊）*/
}

/* ≤480px 時 main.css 把 .nav-container padding 由 0.7rem 加大為 1rem，
   導覽列高度 78→88px，對應加大預留高度（481px 以上維持 78px）*/
@media (max-width: 480px) {
    :root {
        --nav-h: 88px;
    }
}

/* logo 副標一律單行：避免窄橫向（約 1025–1100px）或長字語系把導覽列撐高 */
.logo-sub {
    white-space: nowrap;
}

/* ---- 首頁 Hero：避免長字語系把標題撐高被導覽列裁切，且整體不過大 ---- */
.hero {
    height: auto;
    min-height: 100svh;
    padding-top: calc(var(--nav-h) + 1rem);
    padding-bottom: 2.5rem;
}

.hero-title {
    /* 桌機再下修一級：上限 4rem→3.4rem，斜率 3vw→2.6vw */
    font-size: clamp(1.7rem, 1rem + 2.6vw, 3.4rem);
    line-height: 1.2;
    /* 只在必要時換行於「字與字之間」，不從字中硬切（避免越南文單字被切斷）；
       text-wrap: balance 讓各行長度平均，斷行更自然 */
    overflow-wrap: break-word;
    text-wrap: balance;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 0.6rem + 1.1vw, 1.3rem);
    overflow-wrap: break-word;
}

/* 越南文 hero 標題：桌機（非漢堡選單）讓 <br> 分隔的兩段各自不換行，
   像中文一樣穩定兩行；字級上限收到能容下最長那段（約 33 字）的大小 */
@media (min-width: 1025px) {
    html[lang="vi"] .hero-title {
        font-size: clamp(2.2rem, 1.2rem + 1.6vw, 3rem);
        white-space: nowrap;
    }
}

/* ---- 內頁標題列：補左右留白（副標不再貼邊）＋字級協調 ---- */
.page-header {
    margin-top: var(--nav-h); /* 標題列起點落在導覽列下方，避免被固定列壓住 */
}

.page-header-content {
    width: 100%;
    max-width: 960px;
    margin-left: auto;
    margin-right: auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

.page-header-content h1 {
    /* 統一各頁標題為金色（about 原繼承白色，與其他頁不一致）*/
    color: var(--gold);
    font-size: clamp(1.85rem, 1rem + 3.2vw, 3.5rem);
    line-height: 1.25;
    /* 同 hero：不從字中硬切，避免越南文單字被切斷 */
    overflow-wrap: break-word;
    text-wrap: balance;
}

.page-header-content p {
    font-size: clamp(0.95rem, 0.6rem + 1vw, 1.2rem);
    line-height: 1.6;
    overflow-wrap: break-word;
}

/* ---- 手機進一步收斂，確保三語都不過大、不被裁 ---- */
@media (max-width: 480px) {
    .hero-title {
        /* 手機再下修一級，與全域一致縮小 */
        font-size: clamp(1.6rem, 6vw, 2.3rem);
    }

    .hero-subtitle {
        font-size: clamp(0.88rem, 3.4vw, 1.1rem);
    }

    .page-header-content {
        padding-left: 1.1rem;
        padding-right: 1.1rem;
    }

    .page-header-content h1 {
        font-size: clamp(1.6rem, 6vw, 2.3rem);
    }
}

/* =====================================================================
   平板導覽列（769–1024px）改用漢堡抽屜
   原本 ≤768 才收合，但越南文／英文選單較長，在 769–1024 會於項目內斷行、
   把固定導覽列撐高甚至壓住內容。此處將抽屜模式延伸到 1024px，
   三語一致、未來語言也安全。JS 斷點(main.js MOBILE_NAV_MAX)須同步為 1024。
   ===================================================================== */
@media (min-width: 769px) and (max-width: 1024px) {
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        flex-direction: column;
        background: rgba(10, 10, 10, 0.98);
        width: 100%;
        padding: 0 2rem;
        gap: 0;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.35s ease, padding 0.35s ease;
    }

    .nav-menu > li {
        width: 100%;
        border-bottom: 1px solid rgba(201, 169, 97, 0.2);
    }

    .nav-link {
        padding: 1rem 0;
        width: 100%;
        justify-content: space-between;
    }

    .nav-link::after {
        display: none;
    }

    .lang-switcher > .nav-link {
        justify-content: flex-start;
    }

    .lang-switcher > .nav-link .dropdown-icon {
        margin-left: auto;
    }

    .dropdown-menu {
        position: static;
        transform: none;
        margin: 0;
        padding: 0;
        border: none;
        border-radius: 0;
        background: transparent;
        min-width: 0;
        opacity: 1;
        visibility: visible;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .nav-menu > li.dropdown-active .dropdown-menu {
        max-height: 400px;
    }

    .dropdown-menu::before {
        display: none;
    }

    .dropdown-item {
        padding: 0.85rem 1rem 0.85rem 2rem;
        border-left: none;
        background: rgba(201, 169, 97, 0.05);
    }

    .nav-menu.active {
        max-height: calc(100dvh - 64px);
        padding: 2rem;
        overflow-y: auto;
    }

    .mobile-toggle {
        display: flex;
    }
}

/* ---- 筆電橫向選單（1025–1439px）縮字級＋不換行：越南文／英文長選單單行容納 ---- */
@media (min-width: 1025px) and (max-width: 1439px) {
    .nav-menu {
        gap: 1.3rem;
    }

    .nav-link {
        font-size: 0.85rem;
        white-space: nowrap;
    }
}
