﻿/* 全站基礎設定：平滑捲動、頁面邊界、預設文字。 */
html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
}

body,
table {
    color: #666666;
    font-family: "Microsoft JhengHei", "微軟正黑體", Arial, sans-serif;
    font-size: clamp(16px, 4vw, 20px);
    line-height: 1.6;
}

/* 手機版中央內容直接占滿整個畫面，不顯示左右分類底色。 */
/* 網站中央內容容器：控制最大寬度、留白與白色背景。 */
.webcontent {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0 10px;
    box-sizing: border-box;
    background-color: #FFFFFF;
}

/* 頁首區域：排列網站標誌與九個主分類導覽。 */
/* padding: 上方 左右兩邊 下方 */
.site-header {
    display: flex;
    align-items: center;
    width: auto;
    gap: 8px;
    margin: 0 -10px;
    padding: 5px 8px 3px;
    box-sizing: border-box;
    border-bottom: 1px solid #DEDEDE;
    background: linear-gradient(160deg, #E2E8FF 0%, #FFFFFF 50%, #EDEFFF 100%);
    box-shadow: 0 3px 8px rgba(90, 55, 25, 0.08);
}

/* 網站標誌：固定佔頁首左側約五分之一寬度。 */
.site-logo {
    flex: 0 0 20%;
    display: block;
    min-width: 0;
    text-decoration: none;
}

.site-logo:hover,
.site-logo:visited {
    text-decoration: none;
}

.site-logo img {
    display: block;
    width: 100%;
    height: auto;
}

/* 主分類導覽：使用五欄網格排列，第二列自動換行。 */
.site-nav {
    flex: 1 1 auto;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    column-gap: 3px;
    row-gap: 0px;
    margin-top: 4px;
    align-items: center;
}

/* 主分類單一選項：控制字體、間距與置中方式。 */
/* font-size: clamp(最小字體, 自動縮放值, 最大字體); */
.site-nav-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    padding: 2px 0 6px;
    box-sizing: border-box;
    color: #555555;
    font-size: clamp(11px, 3.2vw, 13px);
    font-weight: 600;
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    text-decoration: none;
}

/* 主分類連結狀態：一般、滑入、按下與目前分類提示。 */
.site-nav-link,
.site-nav-link:visited {
    color: #555555;
    text-decoration: none;
}

.site-nav-link:active,
.site-nav-link:hover {
    color: #327BC1;
    text-decoration: none;
}

.site-nav-link::after,
.site-nav-current::after {
    content: "";
    position: absolute;
    left: 15%;
    right: 15%;
    bottom: 2px;
    border-radius: 999px;
}

.site-nav-link::after {
    height: 2px;
    background-color: transparent;
}

.site-nav-link:active::after,
.site-nav-link:focus-visible::after {
    background-color: #327BC1;
}

.site-nav-current {
    color: #444444;
    cursor: default;
}

.site-nav-current::after {
    height: 4px;
    background-color: #FFAA66;
}

.site-nav-link:focus-visible,
.site-logo:focus-visible {
    outline: 2px solid #3F9EFF;
    outline-offset: 1px;
}

/* 網站主要內容區：保留上下空間，底部避開固定導覽列。 */
.site-main {
    padding: 12px 0 72px;
}
/* 全站一般文字連結：設定顏色、滑入及鍵盤焦點。 */

a {
    color: #3C63B4;
    text-decoration: none;
}

a:visited {
    color: #3C63B4;
}

a:active,
a:hover {
    color: #3F9EFF;
}

a:focus-visible {
    outline: 2px solid #3F9EFF;
    outline-offset: 2px;
}

/* 表單元件：讓輸入框、選單與文字區塊沿用網站字體。 */
input[type="text"],
select,
textarea {
    display: inline-block;
    max-width: 100%;
    margin: 4px 0;
    padding: 10px;
    border: 1px solid #CCCCCC;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
    font-size: 16px;
}
/* 全站圖片基本限制：圖片不超過容器寬度並維持比例。 */

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

/* 回到頂端按鈕：固定在畫面右下角，捲動後才顯示。 */
.back-to-top {
    display: none;
    position: fixed;
    right: 12px;
    bottom: 12px;
    z-index: 99;
    padding: 6px 9px;
    border: 2px solid #AAAAAA;
    border-radius: 10px;
    background-color: #CCCCCC;
    color: #666666;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    text-align: center;
    cursor: pointer;
}

.back-to-top:active {
    background-color: #DDDDDD;
    color: #333333;
}

.back-to-top:focus-visible {
    outline: 3px solid #555555;
    outline-offset: 2px;
}

@media (max-width: 360px) {
    .webcontent {
        padding-right: 8px;
        padding-left: 8px;
    }

    .site-header {
        gap: 5px;
        margin-right: -8px;
        margin-left: -8px;
        padding-right: 8px;
        padding-left: 8px;
    }

    .site-logo {
        flex-basis: 19%;
    }

}

/* ==========================================================
   Page.asp 詳細頁
   ========================================================== */
/* Page.asp 詳細頁外層。 */
.page-detail {
    margin: 0;
}

/* 詳細頁標題列：顯示分類名稱、分隔符號與頁面標題。 */
.page-title-line {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 5px;
    margin: 0;
    padding: 0 0 12px;
}

.page-class-link {
    flex: 0 0 auto;
    font-size: 14px;
    white-space: nowrap;
}

.page-title-separator {
    flex: 0 0 auto;
    color: #999999;
}

.page-title {
    flex: 1 1 auto;
    min-width: 0;
    margin: 0;
    color: #ABABAB;
    font-size: clamp(14px, 6.4vw, 18px);
    font-weight: 700;
    line-height: 1;
}

/* 詳細頁 Content：保留後台輸入的原始 HTML 排版。 */
.page-content {
    margin: 0;
    padding: 0;
}

/* 圖片必須成為 block，否則 inline 圖片會保留文字基線空隙。 */
.page-content img,
.page-content picture {
    display: block;
    height: auto;
    margin: 0;
    padding: 0;
    border: 0;
    vertical-align: top;
}

/* 手機版 webcontent 左右各 10px，圖片往外延伸回螢幕邊緣。 */
.page-content > img {
    display: block;
    width: calc(100% + 20px) !important;
    max-width: none;
    height: auto;
    margin: 0 -10px 0 -10px;
}

.page-content > picture,
.page-content > .page-image-block {
    display: block;
    width: calc(100% + 20px);
    max-width: none;
    margin: 0 -10px;
}

.page-content > picture > img,
.page-content > .page-image-block img {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
}

.page-content .page-image-block {
    padding: 0;
    border: 0;
}

.page-content img + br,
.page-content picture + br,
.page-content .page-image-block + br {
    display: none;
}

.page-content p:empty,
.page-content div:empty {
    display: none;
}

/* 詳細頁底部固定導覽：上一篇、下拉選單、下一篇與回頂端。 */
.page-fixed-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    width: 100%;
    border-top: 1px solid rgba(180, 180, 180, 0.65);
    background: rgba(255, 255, 255, 0.90);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.06);
    -webkit-backdrop-filter: blur(7px);
    backdrop-filter: blur(7px);
}

/* 固定導覽內部網格：控制四個操作區塊的寬度。 */
.page-fixed-nav-inner {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px 42px;
    align-items: center;
    gap: 2px;
    height: 46px;
    padding: 0 5px;
    box-sizing: border-box;
}

/* 固定導覽按鈕：控制箭頭與回頂端按鈕外觀。 */
.page-nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 34px;
    margin: 0 auto;
    padding: 0;
    border: 0;
    border-radius: 17px;
    background: transparent;
    color: #4F4F4F;
    font-family: inherit;
    font-size: 27px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
}

.page-nav-button:visited {
    color: #4F4F4F;
}

.page-nav-button:active {
    background-color: rgba(245, 122, 31, 0.12);
    color: #F57A1F;
}

.page-nav-disabled {
    color: #C7C7C7;
    cursor: default;
}

/* 固定導覽下拉選單：切換同一分類的其他頁面。 */
.page-nav-select-wrap {
    display: block;
    min-width: 0;
    margin: 0;
}

.page-nav-select {
    display: block;
    width: 100%;
    height: 32px;
    margin: 0;
    padding: 2px 28px 2px 9px;
    border: 1px solid #D6D6D6;
    border-radius: 16px;
    box-sizing: border-box;
    background-color: rgba(255, 255, 255, 0.92);
    color: #555555;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.15;
}

.page-nav-top {
    font-size: 20px;
}

/* 無障礙隱藏文字：畫面不顯示，但螢幕閱讀器仍可讀取。 */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}


@media (max-width: 360px) {
    .page-content > img {
        width: calc(100% + 16px) !important;
        margin-right: -8px;
        margin-left: -8px;
    }

    .page-content > picture,
    .page-content > .page-image-block {
        width: calc(100% + 16px);
        margin-right: -8px;
        margin-left: -8px;
    }

    .page-fixed-nav-inner {
        grid-template-columns: 38px minmax(0, 1fr) 38px 38px;
        padding-right: 3px;
        padding-left: 3px;
    }

    .page-nav-button {
        width: 32px;
    }
}

/* ==========================================================
   Page.asp 主圖與 Description
   手機版主圖仍占約一半寬度，Description 自動文繞圖。
   最外層不畫框，只有正方形主圖本身有淡灰色邊框。
   ========================================================== */

/* 主圖與簡介的外層：使用 clearfix 包住左浮動的主圖。 */
.page-hero {
    display: block;
    width: 100%;
    margin: 0 0 18px;
    box-sizing: border-box;
}

.page-hero::after {
    content: "";
    display: block;
    clear: both;
}

/* 主圖輪播整組：包含正方形圖片框與框下方的圓點。 */
.page-hero-gallery-wrap {
    float: left;
    width: 50%;
    margin: 0 12px 8px 0;
    box-sizing: border-box;
}

/* 主圖正方形灰框：只包住圖片與左右切換箭頭。 */
.page-hero-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border: 1px solid #DCDCDC;
    border-radius: 12px;
    box-sizing: border-box;
    background-color: #F7F7F7;
}

/* 主圖舞台：讓每張圖完整覆蓋同一個正方形位置。 */
.page-hero-stage {
    position: relative;
    width: 100%;
    height: 100%;
}

/* 輪播圖片：預設隱藏，啟用中的圖片才顯示。 */
.page-hero-slide {
    display: none;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: contain;
    background-color: #F7F7F7;
}

.page-hero-slide.is-active {
    display: block;
}

/* Description 純文字：後台換行自動轉成 br。 */
.page-hero-description {
    color: #5B5B5B;
    font-size: 16px;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

/* 左右切換箭頭：只有兩張以上主圖時才由 Page.asp 輸出。 */
.page-hero-arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    transform: translateY(-50%);
    background-color: rgba(255, 255, 255, 0.88);
    color: #555555;
    font-family: inherit;
    font-size: 27px;
    line-height: 29px;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.16);
}

.page-hero-arrow:active {
    background-color: #FFFFFF;
    color: #F57A1F;
}

.page-hero-arrow:focus-visible,
.page-hero-dot:focus-visible {
    outline: 2px solid #3F9EFF;
    outline-offset: 1px;
}

.page-hero-prev {
    left: 6px;
}

.page-hero-next {
    right: 6px;
}

/* 圖片選擇圓點：放在正方形灰框下方，只有多張主圖才顯示。 */
.page-hero-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    min-height: 10px;
    margin: 7px 0 0;
}

.page-hero-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 1px solid #999999;
    border-radius: 50%;
    background-color: #FFFFFF;
    cursor: pointer;
}

.page-hero-dot.is-active {
    border-color: #F57A1F;
    background-color: #F57A1F;
}

/* 360px 以下窄螢幕：縮小內距、字體與箭頭。 */
@media (max-width: 360px) {
    .page-hero-gallery-wrap {
        margin-right: 9px;
    }

    .page-hero-description {
        font-size: 15px;
        line-height: 1.5;
    }

    .page-hero-arrow {
        width: 28px;
        height: 28px;
        font-size: 24px;
        line-height: 25px;
    }
}

/* ==========================================================
   List.asp 分類列表
   手機版固定每列兩張正方形主圖。
   ========================================================== */
/* List.asp 分類列表外層與分類標題。 */
.list-page {
    margin: 0;
}

.list-title {
    margin: 0;
    padding: 0 0 14px;
    color: #4A4A4A;
    font-size: clamp(18px, 6.4vw, 24px);
    font-weight: 700;
    line-height: 1.25;
}

/* 分類卡片網格：固定每一列顯示兩個正方形入口圖。 */
.list-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 10px;
    width: 100%;
}

/* 單一分類卡片：包含正方形圖片與頁面標題。 */
.list-card {
    min-width: 0;
    margin: 0;
}

.list-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.list-card-link:visited,
.list-card-link:active,
.list-card-link:hover {
    color: inherit;
    text-decoration: none;
}

.list-card-media {
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background-color: #F5F3F1;
}

.list-card-image {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.list-card-image-missing {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: #999999;
    font-size: 13px;
}

.list-card-title {
    margin: 7px 0 0;
    color: #327BC1;
    font-size: clamp(15px, 4vw, 18px);
    font-weight: 700;
    line-height: 1.35;
}

.list-empty {
    padding: 24px 0;
}

/* 分類分頁器：上一頁、頁碼、下一頁。 */
.list-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin: 24px 0 0;
}

.list-page-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 7px;
    border: 1px solid #D7D7D7;
    border-radius: 16px;
    box-sizing: border-box;
    background-color: #FFFFFF;
    color: #555555;
    font-size: 14px;
    text-decoration: none;
}

.list-page-current {
    border-color: #F57A1F;
    background-color: #F57A1F;
    color: #FFFFFF;
}

.list-page-disabled {
    color: #BBBBBB;
}

.list-page-ellipsis {
    color: #888888;
}

@media (max-width: 360px) {
    .list-grid {
        gap: 14px 8px;
    }

    .list-card-title {
        font-size: 14px;
    }
}

/* ==========================================================
   Content 多張照片輪播
   Content 只需使用 .content-carousel 與 .js-content-carousel。
   圓點沿用主圖輪播樣式，由 Page.asp 自動產生。
   ========================================================== */
.content-carousel {
    display: block;
    width: 100%;
    margin: 1em 0;
    box-sizing: border-box;
}

.content-carousel-stage {
    position: relative;
    width: 100%;
    overflow: hidden;
    border: 1px solid #DCDCDC;
    border-radius: 12px;
    box-sizing: border-box;
    background-color: #F7F7F7;
    touch-action: pan-y;
}

.page-content .content-carousel-stage > img {
    display: none;
    width: 100%;
    max-width: none;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
}

.page-content .content-carousel-stage > img.is-active {
    display: block;
}

/* Content 輪播雙張模式：加入 content-carousel-double 即可同時顯示兩張等比例照片。 */
.content-carousel-double .content-carousel-track {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    width: 100%;
    transition: transform 0.4s ease;
    will-change: transform;
}

.page-content .content-carousel-double .content-carousel-track > img {
    display: block;
    flex: 0 0 calc(50% - 5px);
    width: calc(50% - 5px);
    max-width: none;
    height: auto;
    margin: 0;
    border: 0;
    border-radius: 0;
}

