/* =====================================================================
 * LOGG 國家重力基準站 - 全站樣式
 * 設計方向：政府/學術風 · 深藍主色 · 卡片區塊 · RWD
 * ===================================================================== */

:root {
    --color-primary: #1e3a5f;          /* 深藍 */
    --color-primary-dark: #122544;     /* 更深 */
    --color-primary-light: #2c4f7c;    /* 較淺 */
    --color-accent: #e8a635;           /* 學術橘黃（重點色） */
    --color-accent-light: #f7d68a;
    --color-bg: #f4f6fa;               /* 全站底色 */
    --color-bg-card: #ffffff;
    --color-text: #1f2933;
    --color-text-muted: #5b6776;
    --color-border: #d8dde6;
    --color-link: #1e5fa8;
    --color-success: #2e7d4f;
    --color-warning: #c77a16;
    --color-danger: #b8392b;
    --color-chart-line: #c43838;       /* 圖表線色，沿用舊版紅色 */

    --shadow-card: 0 2px 8px rgba(30, 58, 95, 0.08);
    --shadow-card-hover: 0 4px 16px rgba(30, 58, 95, 0.14);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;

    --font-zh: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
    --font-en: "Inter", "Helvetica Neue", Arial, sans-serif;

    --header-height: 72px;
    --topbar-height: 36px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--font-zh);
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.7;
    font-size: 15px;
}

a {
    color: var(--color-link);
    text-decoration: none;
    transition: color 0.15s ease;
}
a:hover { color: var(--color-primary); text-decoration: underline; }

img { max-width: 100%; height: auto; vertical-align: middle; }

/* ---------- Topbar ---------- */
.topbar {
    background: var(--color-primary-dark);
    color: #cbd6e6;
    height: var(--topbar-height);
    font-size: 13px;
    display: flex;
    align-items: center;
}
.topbar-inner {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.topbar a { color: #cbd6e6; }
.topbar a:hover { color: #fff; text-decoration: none; }
.topbar .lang-switch {
    border: 1px solid #4a6485;
    padding: 2px 10px;
    border-radius: 3px;
    font-size: 12px;
}

/* ---------- Header ---------- */
.site-header {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-primary-light) 100%);
    color: #fff;
    height: var(--header-height);
    box-shadow: var(--shadow-card);
    position: relative;
    z-index: 100;
}
.site-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.site-logo {
    color: #fff;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    flex-shrink: 0;
    max-width: 240px;
}
.site-logo:hover { color: #fff; text-decoration: none; }
.site-logo .name {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
    white-space: nowrap;
}
.site-logo .subtitle {
    font-size: 11px;
    opacity: 0.85;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 主選單（桌機） */
.main-nav {
    display: flex;
    gap: 0;
    flex-wrap: nowrap;
    height: 100%;
    align-items: center;
}
.main-nav > .nav-item {
    position: relative;
    height: 100%;
    display: flex;
    align-items: center;
}
.main-nav > .nav-item > a {
    display: flex;
    align-items: center;
    height: 100%;
    padding: 0 12px;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
    transition: background 0.2s;
    white-space: nowrap;
}
.main-nav > .nav-item > a:hover,
.main-nav > .nav-item.active > a {
    background: rgba(255, 255, 255, 0.12);
    text-decoration: none;
}
.main-nav .submenu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: #fff;
    min-width: 200px;
    box-shadow: var(--shadow-card-hover);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    overflow: hidden;
    border-top: 3px solid var(--color-accent);
}
.main-nav .nav-item:hover .submenu { display: block; }
.main-nav .submenu a {
    display: block;
    padding: 12px 20px;
    color: var(--color-text);
    border-bottom: 1px solid var(--color-border);
    font-size: 14px;
    white-space: nowrap;
}
.main-nav .submenu a:last-child { border-bottom: none; }
.main-nav .submenu a:hover {
    background: var(--color-bg);
    color: var(--color-primary);
    text-decoration: none;
    padding-left: 24px;
}

/* 漢堡選單（手機） */
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.4);
    color: #fff;
    width: 40px; height: 40px;
    border-radius: 4px;
    cursor: pointer;
}
.menu-toggle::before {
    content: "☰";
    font-size: 20px;
}

/* ---------- Hero / Banner ---------- */
.page-hero {
    background: linear-gradient(120deg, #1e3a5f 0%, #2c4f7c 50%, #4a6da3 100%);
    color: #fff;
    padding: 50px 20px 60px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.page-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><circle cx='60' cy='60' r='50' stroke='rgba(255,255,255,0.06)' stroke-width='1' fill='none'/><circle cx='60' cy='60' r='30' stroke='rgba(255,255,255,0.05)' stroke-width='1' fill='none'/></svg>") repeat;
    opacity: 0.6;
}
.page-hero > * { position: relative; z-index: 1; }
.page-hero h1 {
    margin: 0 0 8px;
    font-size: 30px;
    font-weight: 600;
    letter-spacing: 1px;
}
.page-hero .subtitle {
    margin: 0;
    opacity: 0.9;
    font-size: 15px;
}

/* ---------- 麵包屑 ---------- */
.breadcrumb {
    background: #fff;
    border-bottom: 1px solid var(--color-border);
    padding: 10px 0;
    font-size: 13px;
    color: var(--color-text-muted);
}
.breadcrumb-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}
.breadcrumb a { color: var(--color-text-muted); }
.breadcrumb .sep { margin: 0 8px; color: #c0c8d4; }
.breadcrumb .current { color: var(--color-primary); font-weight: 500; }

/* ---------- 主內容容器 ---------- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}
.container-narrow {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px 20px 60px;
}

/* ---------- 卡片 ---------- */
.card {
    background: var(--color-bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-card-hover); }
.card-title {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 600;
    color: var(--color-primary);
    border-left: 4px solid var(--color-accent);
    padding-left: 12px;
}
.card-title.with-icon {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 內含區塊標題 */
.section-title {
    font-size: 18px;
    color: var(--color-primary);
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--color-accent);
    display: inline-block;
}

/* ---------- 表單元件 ---------- */
.form-group { margin-bottom: 18px; }
.form-label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: var(--color-primary);
    font-size: 14px;
}
.form-control {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    transition: border 0.15s, box-shadow 0.15s;
}
.form-control:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}
select.form-control {
    cursor: pointer;
    background: #fff;
}
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
.form-row .form-control { width: auto; }
.form-row .text-label { color: var(--color-text-muted); font-size: 14px; }
.form-check {
    display: inline-flex;
    align-items: center;
    margin-right: 16px;
    cursor: pointer;
}
.form-check input { margin-right: 6px; transform: scale(1.1); }

/* 按鈕 */
.btn {
    display: inline-block;
    padding: 8px 22px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #fff !important;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.6;
}
.btn:hover {
    background: var(--color-primary-dark);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(30,58,95,0.3);
}
.btn-secondary {
    background: #fff;
    color: var(--color-primary) !important;
    border: 1px solid var(--color-border);
}
.btn-secondary:hover { background: var(--color-bg); color: var(--color-primary) !important; }
.btn-accent {
    background: var(--color-accent);
}
.btn-accent:hover { background: #ce8e1e; }

/* ---------- Grid 簡單方格 ---------- */
.grid {
    display: grid;
    gap: 20px;
}
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.grid.sidebar-layout { grid-template-columns: 250px 1fr; }

/* ---------- 表格 ---------- */
.table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border-radius: var(--radius-md);
    overflow: hidden;
}
.table th, .table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--color-border);
}
.table th {
    background: var(--color-bg);
    color: var(--color-primary);
    font-weight: 600;
    font-size: 14px;
}
.table tbody tr:hover { background: #fbfcfe; }

/* ---------- 訊息提示 ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-info    { background: #e7f0fa; color: #1c4f86; border-left: 4px solid #1c4f86; }
.alert-warning { background: #fdf3e0; color: #8c5510; border-left: 4px solid #c77a16; }
.alert-danger  { background: #fbe7e3; color: #7a261c; border-left: 4px solid #b8392b; }
.alert-success { background: #e3f3eb; color: #1d573a; border-left: 4px solid #2e7d4f; }

/* ---------- 標籤 ---------- */
.badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-success { background: #e3f3eb; color: #1d573a; }
.badge-warning { background: #fdf3e0; color: #8c5510; }
.badge-danger  { background: #fbe7e3; color: #7a261c; }
.badge-muted   { background: #eef1f6; color: #5b6776; }

/* ---------- 圖表容器 ---------- */
.chart-container {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 20px;
}
.chart-title {
    text-align: center;
    color: var(--color-primary);
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 8px;
    padding: 8px 0;
    background: linear-gradient(180deg, #f0f4fa 0%, #fff 100%);
    border-radius: var(--radius-sm);
}
.echart {
    width: 100%;
    height: 320px;
}

/* ---------- Footer ---------- */
.site-footer {
    background: var(--color-primary-dark);
    color: #c5d0e2;
    padding: 40px 0 0;
    margin-top: 60px;
    font-size: 14px;
}
.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
}
.footer-col h4 {
    color: #fff;
    font-size: 16px;
    margin: 0 0 12px;
    border-bottom: 2px solid var(--color-accent);
    padding-bottom: 6px;
    display: inline-block;
}
.footer-col p, .footer-col li {
    margin: 4px 0;
    line-height: 1.8;
}
.footer-col ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-col a {
    color: #c5d0e2;
}
.footer-col a:hover {
    color: var(--color-accent-light);
    text-decoration: none;
}
.footer-bottom {
    margin-top: 40px;
    padding: 14px 20px;
    background: rgba(0,0,0,0.2);
    text-align: center;
    color: #8497b3;
    font-size: 13px;
}

/* ---------- 工具類 ---------- */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-muted  { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-accent { color: var(--color-accent); }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

/* ---------- RWD ---------- */
@media (max-width: 992px) {
    .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
    .footer-inner { grid-template-columns: 1fr 1fr; }
    .grid.sidebar-layout { grid-template-columns: 1fr; }
}

/* 中型寬度就改用漢堡選單，避免主選單擠壓斷字 */
@media (max-width: 1100px) {
    .menu-toggle { display: inline-block; }
    .main-nav {
        display: none;
        position: absolute;
        top: var(--header-height);
        right: 0;
        background: var(--color-primary-dark);
        width: 100%;
        flex-direction: column;
        padding: 8px 0;
        align-items: stretch;
        height: auto;
    }
    .main-nav.open { display: flex; }
    .main-nav > .nav-item {
        height: auto;
        display: block;
    }
    .main-nav > .nav-item > a {
        height: auto;
        line-height: 44px;
        padding: 0 24px;
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }
    .main-nav .submenu {
        position: static;
        background: rgba(0,0,0,0.2);
        box-shadow: none;
        border-top: none;
        border-radius: 0;
    }
    .main-nav .nav-item:hover .submenu { display: none; }
    .main-nav .nav-item.open .submenu { display: block; }
    .main-nav .submenu a {
        padding-left: 40px;
        color: #c5d0e2;
        border-bottom: 1px solid rgba(255,255,255,0.05);
    }
    .main-nav .submenu a:hover { background: rgba(0,0,0,0.2); color: #fff; padding-left: 44px; }
}

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

    .site-logo .name { font-size: 18px; }
    .site-logo .subtitle { display: none; }

    .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }

    .footer-inner { grid-template-columns: 1fr; gap: 24px; }

    .topbar-inner { font-size: 12px; }

    .page-hero { padding: 30px 16px 36px; }
    .page-hero h1 { font-size: 22px; }

    .container, .container-narrow { padding: 20px 16px 40px; }
    .card { padding: 16px; }

    .form-row { flex-direction: column; align-items: stretch; }
    .form-row .form-control { width: 100%; }

    .echart { height: 260px; }
}


/* =================================================================
 * Benefits 圖片區塊（對應 R19.5、R19.6、R19.7）
 * ================================================================= */
.benefits-gallery {
    display: grid;
    grid-template-columns: repeat(2, minmax(360px, 1fr));
    gap: 16px;
    margin-top: 16px;
}
.benefits-gallery-item {
    margin: 0;
    background: var(--color-bg);
    border-radius: 6px;
    padding: 8px;
    text-align: center;
}
.benefits-gallery-item--failed {
    display: none;
}
.benefits-gallery-item .lightbox-trigger {
    display: block;
    cursor: zoom-in;
    border-radius: 4px;
    transition: box-shadow .15s, transform .15s;
}
.benefits-gallery-item .lightbox-trigger:hover,
.benefits-gallery-item .lightbox-trigger:focus {
    box-shadow: 0 4px 16px rgba(0, 0, 0, .18);
    transform: translateY(-1px);
    outline: 2px solid var(--color-accent, #1f6feb);
    outline-offset: 2px;
}
.benefits-gallery-item img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    display: block;
    margin: 0 auto;
}

/* RWD：平板（768 ~ 1023px）每列 2 欄、最小寬度 320px */
@media (max-width: 1023px) {
    .benefits-gallery {
        grid-template-columns: repeat(2, minmax(320px, 1fr));
    }
}
/* RWD：手機（≤ 767px）單欄、最小寬度 280px */
@media (max-width: 767px) {
    .benefits-gallery {
        grid-template-columns: minmax(280px, 1fr);
    }
}

/* =================================================================
 * Lightbox（對應 R19.1 ~ R19.4、R19.8、R19.10）
 * ================================================================= */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, .82);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
}
.lightbox-overlay.is-open {
    opacity: 1;
    pointer-events: auto;
}
.lightbox-stage {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.lightbox-image {
    max-width: 90vw;
    max-height: 80vh;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, .5);
    background: #fff;
}
.lightbox-caption {
    margin-top: 12px;
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 90vw;
    line-height: 1.5;
}
.lightbox-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, .55);
    color: #fff;
    border: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}
.lightbox-btn:hover,
.lightbox-btn:focus {
    background: rgba(0, 0, 0, .8);
    outline: 2px solid #fff;
    outline-offset: 2px;
}
.lightbox-btn--prev { left: -56px; }
.lightbox-btn--next { right: -56px; }
.lightbox-btn--close {
    top: -48px;
    right: 0;
    transform: none;
}
.lightbox-btn[hidden] { display: none; }

/* RWD：手機/平板按鈕貼齊圖片內側、避免溢出 viewport */
@media (max-width: 1023px) {
    .lightbox-btn--prev { left: 8px; }
    .lightbox-btn--next { right: 8px; }
    .lightbox-btn--close { top: 8px; right: 8px; }
}

.lightbox-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}


/* ---------- Cookie 提示條（assets/js/cookie_notice.js） ---------- */
.cookie-notice {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 58, 95, 0.96);
    color: #fff;
    z-index: 9000;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: cookieNoticeSlideUp .35s ease-out;
}
.cookie-notice--leaving {
    animation: cookieNoticeSlideDown .25s ease-in forwards;
}
@keyframes cookieNoticeSlideUp {
    from { transform: translateY(100%); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
@keyframes cookieNoticeSlideDown {
    from { transform: translateY(0);    opacity: 1; }
    to   { transform: translateY(100%); opacity: 0; }
}
.cookie-notice-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}
.cookie-notice-msg {
    flex: 1;
    margin: 0;
    font-size: 13px;
    line-height: 1.6;
    min-width: 280px;
}
.cookie-notice-link {
    color: #ffd089;
    text-decoration: underline;
    margin-left: 4px;
}
.cookie-notice-link:hover { color: #ffe6b9; }
.cookie-notice-btn {
    background: #c77a16;
    color: #fff;
    border: 0;
    border-radius: 4px;
    padding: 8px 18px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
}
.cookie-notice-btn:hover { background: #a86413; }
.cookie-notice-btn:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (max-width: 600px) {
    .cookie-notice-inner { padding: 10px 14px; }
    .cookie-notice-msg { font-size: 12px; }
    .cookie-notice-btn { padding: 6px 14px; font-size: 12px; width: 100%; }
}
