/*
 * =================================
 *  Visual Upgrade — FOCAXIS v2
 * =================================
 *  獨立覆蓋檔：不修改原有核心樣式，以 override 方式升級視覺
 *
 *  色彩系統：
 *    主色暖橘  #F18A2D
 *    次色金    #C68B36
 *    深炭灰    #0F1720
 *    卡片白    #FBFBFB
 */

/* =========================================
   0. CSS Custom Properties (Design Tokens)
   ========================================= */
:root {
    --color-primary: #F18A2D;
    --color-primary-dark: #d87a24;
    --color-secondary: #C68B36;
    --color-text: #0F1720;
    --color-card: #FBFBFB;
    --color-text-muted: #5a6270;
    --surface-page: linear-gradient(180deg, #f7f3ed 0%, #fcfbf8 220px, #f6f4ef 100%);
    --surface-panel: rgba(255, 252, 247, 0.92);
    --surface-border: rgba(190, 140, 79, 0.14);
    --surface-shadow: 0 24px 54px rgba(15, 23, 40, 0.08), 0 6px 18px rgba(15, 23, 40, 0.05);
    --font-heading: 'Poppins', 'Montserrat', 'Inter', system-ui, -apple-system, sans-serif;
    --font-body: 'Inter', 'Noto Sans TC', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* =========================================
   1. Global Typography Upgrade
   ========================================= */
html,
body {
    font-family: var(--font-body);
    color: var(--color-text);
}

body:not(.map-hud-page) {
    background: var(--surface-page);
}

.landing-container {
    font-family: var(--font-body);
    color: var(--color-text);
}

body:not(.map-hud-page) .landing-container {
    position: relative;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
}

/* =========================================
   2. Hero Section — 漸層遮罩升級
   ========================================= */
.hero-section {
    /* 配合淺灰白色系：改為白/淺灰漸層遮罩，讓整體視覺更輕盈 */
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.6), rgba(255, 255, 255, 0.95)),
        url('/images/hero-home.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: scroll;

    /* 微偏下：padding-top 拉高讓主視覺居下 */
    padding: 0 20px;
    padding-top: 10vh;
    justify-content: flex-end;
    padding-bottom: 8vh;
    position: relative;
}

body:not(.map-hud-page) .hero-section::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(10, 18, 32, 0.18) 0%, rgba(10, 18, 32, 0.08) 10%, rgba(10, 18, 32, 0.52) 100%),
        linear-gradient(180deg, rgba(247, 243, 237, 0.06) 0, rgba(247, 243, 237, 0) 120px);
    pointer-events: none;
}

body:not(.map-hud-page) .hero-content {
    position: relative;
    z-index: 1;
}

.hero-section h1 {
    /* clamp 字級：在小螢幕到大螢幕之間流暢縮放 */
    font-size: clamp(1.8rem, 5vw + 0.5rem, 3.8rem);
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: -0.02em;
    color: var(--color-text);
    /* 淺色背景改為深色字 */

    /* 移除漸層文字效果 */
    background: none;
    -webkit-background-clip: unset;
    background-clip: unset;
    -webkit-text-fill-color: var(--color-text);
    text-shadow: 0 2px 15px rgba(255, 255, 255, 0.8), 0 1px 3px rgba(255, 255, 255, 0.5);
    /* 淺色外發光確保邊緣清晰 */
    margin-bottom: 16px;
    max-width: 700px;
}

.hero-subtitle {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    color: var(--color-text-muted);
    /* 淺色背景改用較深的次要灰字 */
    text-shadow: 0 1px 5px rgba(255, 255, 255, 0.8);
    margin-bottom: 36px;
    letter-spacing: 0.02em;
    line-height: 1.7;
}

body:not(.map-hud-page) .hero-section h1 {
    color: #f7efe5;
    text-shadow: 0 20px 34px rgba(8, 12, 20, 0.35);
}

body:not(.map-hud-page) .hero-subtitle {
    color: rgba(247, 239, 229, 0.88);
    text-shadow: 0 10px 24px rgba(8, 12, 20, 0.28);
}

/* =========================================
   3. CTA Button — 互動強化
   ========================================= */
.cta-button {
    background-color: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: 28px;
    min-height: 54px;
    padding: 14px 36px;
    font-size: 1.1rem;
    font-weight: 600;
    font-family: var(--font-heading);
    cursor: pointer;
    box-shadow:
        0 4px 16px rgba(241, 138, 45, 0.35),
        0 1px 3px rgba(0, 0, 0, 0.12);
    transition:
        transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
        box-shadow 0.18s ease,
        background-color 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    letter-spacing: 0.02em;
}

.cta-button:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 28px rgba(241, 138, 45, 0.45),
        0 2px 6px rgba(0, 0, 0, 0.15);
    background-color: var(--color-primary-dark);
}

/* Active / 按下縮放效果 */
.cta-button:active {
    transform: scale(0.95);
    box-shadow: 0 2px 8px rgba(241, 138, 45, 0.3);
    transition-duration: 0.08s;
}

.cta-button span.material-symbols-outlined {
    font-size: 1.3rem;
}

/* =========================================
   4. Feature Section — 色彩統一
   ========================================= */
.feature-section h2 {
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 700;
}

.feature-description {
    color: var(--color-text-muted);
    font-family: var(--font-body);
}

.feature-card {
    background: var(--color-card);
    border-radius: 12px;
    padding: 28px;
    box-shadow:
        0 2px 12px rgba(0, 0, 0, 0.04),
        0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-bottom: 3px solid transparent;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
    border-bottom-color: var(--color-primary);
    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.08),
        0 2px 6px rgba(0, 0, 0, 0.06);
}

.feature-card .material-symbols-outlined {
    color: var(--color-primary);
    font-size: 2.2rem;
    /* 圓形半透明背景 */
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(241, 138, 45, 0.1);
    margin-bottom: 16px;
}

.feature-card h3 {
    color: var(--color-text);
    font-family: var(--font-heading);
    font-weight: 600;
}

.feature-card p {
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* =========================================
   5. FAQ Section — 色彩統一
   ========================================= */
.faq-section h2 {
    color: var(--color-primary);
    font-family: var(--font-heading);
    font-weight: 700;
}

.faq-question {
    color: var(--color-text);
    font-family: var(--font-body);
}

.faq-question:hover {
    color: var(--color-primary);
}

.faq-answer {
    color: var(--color-text-muted);
}

.faq-item {
    border-bottom: 1px solid rgba(15, 23, 32, 0.08);
}


/* =========================================
   7. Map Card (Measurement Modal) — 白卡升級
   ========================================= */
#measurement-modal-content {
    background: var(--color-card);
    border-radius: 12px;
    box-shadow:
        0 12px 48px rgba(0, 0, 0, 0.15),
        0 4px 12px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

/* 桌機 Map 容器 hover 微放大 (已根據需求移除) */
/* 地圖上的工具 icon 統一：圓形半透明黑底白線 */
.custom-map-button {
    background-color: rgba(30, 30, 30, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.custom-map-button:hover {
    background-color: rgba(50, 50, 50, 0.85);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    transform: scale(1.05);
}

.custom-map-button .app-icon {
    color: rgba(255, 255, 255, 0.9);
}

.custom-map-button:hover .app-icon {
    color: #fff;
}

/* =========================================
   7b. 地圖按鈕 ID 統一覆蓋
   各模組用 ID 選擇器 specificity 較高，此處用相同層級強制覆蓋，
   讓所有地圖控制按鈕外觀一致為「圓形半透明毛玻璃」。
   ========================================= */

/* 定義共用的毛玻璃按鈕標準樣式 */
#date-picker-button,
#focal-length-button,
#sensor-size-wrapper,
#layers-button,
#custom-measurement-button {
    background-color: rgba(30, 30, 30, 0.75) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
    border-radius: 50% !important;
    box-shadow:
        0 2px 8px rgba(0, 0, 0, 0.25),
        0 0 0 0.5px rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    transition: background-color 0.2s ease,
        box-shadow 0.2s ease,
        transform 0.2s ease !important;
}

/* Hover 效果 */
#date-picker-button:hover,
#focal-length-button:hover,
#sensor-size-wrapper:hover,
#layers-button:hover,
#custom-measurement-button:hover {
    background-color: rgba(55, 55, 55, 0.88) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.38) !important;
    transform: scale(1.05);
}

/* 按鈕內的 Icon 顏色統一 */
#date-picker-button .app-icon,
#focal-length-button .app-icon,
#sensor-size-button .app-icon,
#layers-button .app-icon,
#custom-measurement-button .app-icon {
    color: rgba(255, 255, 255, 0.92) !important;
}

/* 展開膠囊面板（背景與邊框一致化） */
#date-picker-editable-text,
#focal-length-editable-text,
#sensor-size-options-container,
#layers-expandable-menu {
    background-color: rgba(28, 28, 28, 0.88) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

/* 展開膠囊的外圈邊框 */
#date-picker-display,
#focal-length-display,
.sensor-content-wrapper,
#layers-options-wrapper {
    border-color: rgba(255, 255, 255, 0.12) !important;
}

/* =========================================
   8. 漢堡選單 Modal (Mobile) — 毛玻璃風格
   ========================================= */
@media screen and (max-width: 768px) {
    #horizontal-nav-bar:not(.site-nav-shell) {
        background: rgba(10, 10, 10, 0.44);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }

    /* Menu 文字行距 */
    #horizontal-nav-bar:not(.site-nav-shell) #nav-items-container .nav-item {
        line-height: 1.8;
        font-family: var(--font-heading);
        font-weight: 300;
        letter-spacing: 1.5px;
    }

    /* Menu 開啟 slide-in 與淡入動畫 */
    #horizontal-nav-bar:not(.site-nav-shell) {
        transition:
            transform 0.5s cubic-bezier(0.16, 1, 0.3, 1),
            opacity 0.35s ease;
    }

    #horizontal-nav-bar:not(.site-nav-shell).visible:not(.mobile-collapsed) {
        animation: menuSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    }

    /* 關閉按鈕移至下方 */
    #mobile-nav-close-btn {
        position: relative;
        top: auto;
        right: auto;
        margin-top: 20px;
        width: 52px;
        height: 52px;
        min-height: 52px;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.18);
        z-index: 2950;
        box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
    }

    #mobile-nav-close-btn:active {
        transform: scale(0.88);
        background: rgba(255, 255, 255, 0.2);
    }

    #mobile-nav-close-btn span {
        font-size: 28px;
        color: rgba(255, 255, 255, 0.9);
    }
}

/* Menu slide-in 動畫 */
@keyframes menuSlideIn {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }

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

/* =========================================
   9. Navigation Bar — 色彩統一 (Desktop)
   ========================================= */
#horizontal-nav-bar:not(.site-nav-shell) .nav-item:hover,
#horizontal-nav-bar:not(.site-nav-shell) .nav-item.active {
    color: var(--color-primary);
}

#horizontal-nav-bar:not(.site-nav-shell) .nav-item.active::after {
    background-color: var(--color-primary);
}

#horizontal-nav-bar:not(.site-nav-shell) .dropdown-content .lang-btn:hover {
    background: #fff8f3;
    color: var(--color-primary);
}

#horizontal-nav-bar:not(.site-nav-shell) .dropdown-content .lang-btn.active {
    background: #fff0e6;
    color: var(--color-primary-dark);
}

/* =========================================
   10. Settings Modal — 色彩統一
   ========================================= */
#settings-modal {
    font-family: var(--font-body);
    color: var(--color-text);
}

.settings-section-title {
    font-family: var(--font-heading);
    color: var(--color-text);
}

/* =========================================
   11. Footer — 微調
   ========================================= */
.landing-container>footer {
    color: var(--color-text-muted);
    font-family: var(--font-body);
    font-size: 0.85rem;
}

/* =========================================
   12. 桌面版 Responsive 調整
   ========================================= */
@media (min-width: 1024px) {
    .hero-section h1 {
        font-size: clamp(2.5rem, 4vw + 1rem, 4rem);
    }

    .feature-section h2,
    .faq-section h2 {
        font-family: var(--font-heading);
        font-weight: 700;
    }
}

/* =========================================
   13. 平滑滾動
   ========================================= */
html {
    scroll-behavior: smooth;
}

/* =========================================
   14. 選取文字高亮色
   ========================================= */
::selection {
    background: rgba(241, 138, 45, 0.25);
    color: var(--color-text);
}

/* =========================================
   15. 動態載入效果 (Scroll Animations)
   ========================================= */
.animate-on-scroll {
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    will-change: opacity, transform;
}

.animate-on-scroll.is-visible {
    opacity: 1;
    transform: translateY(0);
}

/* 為了讓卡片有依序出現的效果，可以設定延遲 */
.feature-card.animate-on-scroll {
    transition-duration: 0.6s;
}

.feature-card.animate-on-scroll:nth-child(2) {
    transition-delay: 0.1s;
}

.feature-card.animate-on-scroll:nth-child(3) {
    transition-delay: 0.2s;
}

.feature-card.animate-on-scroll:nth-child(4) {
    transition-delay: 0.3s;
}

body:not(.map-hud-page) #page-content,
body:not(.map-hud-page) #article-viewer-container {
    position: relative;
    z-index: 1;
}

body.content-page #page-content,
body.content-page #article-viewer-container {
    max-width: 1120px;
    margin-top: 132px;
    padding-left: 32px;
    padding-right: 32px;
}

body.content-page .blog-wrapper {
    max-width: 860px;
    margin-left: auto;
    margin-right: auto;
}

body:not(.map-hud-page) .blog-wrapper {
    background: var(--surface-panel);
    border: 1px solid var(--surface-border);
    box-shadow: var(--surface-shadow);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

body:not(.map-hud-page) .markdown-body h1,
body:not(.map-hud-page) #pane-news.markdown-body h1,
body:not(.map-hud-page) .article-content h1 {
    color: #162133;
    border-left-color: var(--color-primary);
}
