/* odd5 左欄（P6）— 在 odd5 不是側欄，是 hero 下方的整寬章節；內容是後台「版面配置 → 側邊欄位區塊」
   畫法由後台的資料決定，不看區塊順序、也不看區塊名稱：
   ・圖片連結（li.img）        → 圖卡：圖在上、說明文字在圖下（產品）
   ・文字連結（li.fake）       → 文字卡：連結名稱大字、說明文字第二行（顧問與講師）
   ・區塊勾了「項目輪播」      → 整排等速往左流動（客戶牆）；暫停鍵是系統輸出的那一顆
   odd5.js 做的事：圖包進 .Oddi_LinkImgFrame、說明文字複製成 .Oddi_LinkCaption／.Oddi_LinkNote、
   流動的區塊掛 data-flow 並把清單包進 .Oddi_FlowViewport。JS 跑之前（或沒跑）的樣子這裡也顧到：
   圖卡照樣是圖卡，勾了輪播的先排成不動的幾排
   RWD：mobile first */

/* ---------- 基底＝手機 ---------- */
@media only screen and (min-width: 0) {
    div.mainLeft_odd div.linkBlock_odd {
        float: left;
        width: 100%;
    }

    /* 後台「已加入的項目」的類型標記會跟著存進內容，前台用不到 */
    div.mainLeft_odd ul.linkBlockContent_odd > li > a.icon,
    div.mainLeft_odd ul.linkBlockContent_odd > li > label[data-mark] {
        display: none;
    }

    div.mainLeft_odd ul.linkBlockContent_odd {
        float: left;
        width: 100%;
        margin: 0;
        padding: 0;
    }

    div.mainLeft_odd ul.linkBlockContent_odd > li {
        margin: 0;
        padding: 0;
    }

    /* ======== 圖卡與文字卡（沒勾項目輪播的區塊）======== */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) {
        display: grid;
        grid-template-columns: 1fr;
        gap: 2.4em;
    }

    /* ---- 圖卡：畫廊式，圖片本身就是形狀；項目變多就往下長，平板起第一項 2×2 當主打 ---- */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href] {
        display: block;
        color: #0F2D3E;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href]:hover,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href]:focus {
        color: #0E6E98;
    }

    /* 圖框：產品圖常自帶白框，白底上沒有陰影會跟頁面融成一片 */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) span.Oddi_LinkImgFrame,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href] > img {
        display: block;
        width: 100%;
        aspect-ratio: 16 / 10;
        overflow: hidden;
        border-radius: .9em;
        background: #F4FAFD;
        box-shadow: 0 .5em 1.8em rgba(15, 45, 62, .1);
        object-fit: cover;
        transition: box-shadow 300ms;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href]:hover span.Oddi_LinkImgFrame {
        box-shadow: 0 .8em 2.4em rgba(15, 45, 62, .16);
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) span.Oddi_LinkImgFrame img {
        display: block;
        width: 100%;
        height: 100%;
        object-fit: cover;
        transition: transform 400ms;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img > a[href]:hover span.Oddi_LinkImgFrame img {
        transform: scale(1.03);
    }

    /* 圖下標題＝說明文字；沒填說明文字就不佔位 */
    div.mainLeft_odd span.Oddi_LinkCaption {
        display: block;
        padding: 1em 0 0;
        font-size: 1.05em;
        font-weight: 700;
        line-height: 1.5;
    }

    div.mainLeft_odd span.Oddi_LinkCaption:empty {
        display: none;
    }

    /* ---- 文字卡：字就是設計。上面一條墨色線、連結名稱大字、說明文字第二行；滑過線變品牌藍、箭頭往右 ---- */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href] {
        box-sizing: border-box;
        position: relative;
        display: block;
        height: 100%;
        padding: 1.5em 2.6em 1.6em 0;
        border-top: 2px solid #0F2D3E;
        color: #0F2D3E;
        font-size: 1.45em;
        font-weight: 700;
        line-height: 1.35;
        transition: border-color 200ms, color 200ms;
    }

    /* 右上角的箭頭是裝飾：斜線後面的空字串讓報讀不念它（不支援那個寫法的瀏覽器用前一行） */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href]::after {
        content: "\2192";
        content: "\2192" / "";
        position: absolute;
        top: 1.5em;
        right: .3em;
        font-weight: 400;
        color: #5B6B76;
        transition: transform 200ms, color 200ms;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href]:hover,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href]:focus {
        border-top-color: #29ABE2;
        color: #0E6E98;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href]:hover::after,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.fake > a[href]:focus::after {
        transform: translateX(.25em);
        color: #0E6E98;
    }

    div.mainLeft_odd span.Oddi_LinkNote {
        display: block;
        margin-top: .7em;
        font-size: .69em;
        font-weight: 400;
        line-height: 1.8;
        color: #5B6B76;
    }

    /* ======== 客戶牆（勾了項目輪播的區塊）：一排 logo 等速往左流動 ======== */
    /* 標題在左、暫停鍵在右，流動的那一排在下面 */
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        column-gap: 1em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] div.linkBlockTitle_odd {
        grid-column: 1;
        grid-row: 1;
        float: none;
        width: auto;
    }

    /* 共用樣式把暫停鍵疊在輪播底部、滑過才出現；這裡常駐放在標題右邊（共用檔比板檔晚載，靠選擇器權重蓋過） */
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] div.linkBlockPlayControler {
        grid-column: 2;
        grid-row: 1;
        align-self: end;
        position: static;
        margin-bottom: 2em;
        transform: none;
        opacity: 1;
        pointer-events: auto;
    }

    div.mainLeft_odd div.linkBlockBlock_odd button.linkBlockPlayPause {
        padding: .45em 1.1em;
        border: 1px solid #0F2D3E;
        border-radius: 2em;
        background: #FFFFFF;
        color: #0F2D3E;
        font-size: .85em;
        line-height: 1.4;
        transition: border-color 200ms, color 200ms;
    }

    div.mainLeft_odd div.linkBlockBlock_odd button.linkBlockPlayPause .linkBlockPlayPauseBtn-icon {
        margin-right: .4em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd button.linkBlockPlayPause:hover,
    div.mainLeft_odd div.linkBlockBlock_odd button.linkBlockPlayPause:focus {
        border-color: #0E6E98;
        background: #FFFFFF;
        color: #0E6E98;
    }

    div.mainLeft_odd div.Oddi_FlowViewport {
        grid-column: 1 / -1;
        grid-row: 2;
        overflow: hidden;
        -webkit-mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0), #000 7%, #000 93%, rgba(0, 0, 0, 0));
        mask-image: linear-gradient(90deg, rgba(0, 0, 0, 0), #000 7%, #000 93%, rgba(0, 0, 0, 0));
    }

    /* 一圈的距離與時間由 odd5.js 量好放進變數（一整份項目的寬度、每秒 50px） */
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd {
        display: flex;
        float: none;
        width: max-content;
        animation: Oddi_LinkFlow var(--oddi-flow-time, 70s) linear infinite;
    }

    /* 滑鼠移上去、鍵盤移進去，或按了暫停鍵：停住 */
    div.mainLeft_odd div.Oddi_FlowViewport:hover ul.linkBlockContent_odd,
    div.mainLeft_odd div.Oddi_FlowViewport:focus-within ul.linkBlockContent_odd,
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow-paused="1"] ul.linkBlockContent_odd {
        animation-play-state: paused;
    }

    /* JS 還沒接手（或沒跑）時：不流動，排成置中的幾排 */
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd > li,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] > li {
        flex: none;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 11.5em;
        height: 5em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd > li > a[href],
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] > li > a[href] {
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        padding: 0 1.4em;
        color: #0F2D3E;
        font-weight: 700;
        text-align: center;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] span.Oddi_LinkImgFrame {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd img,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] img {
        display: block;
        width: auto;
        height: auto;
        max-width: 100%;
        max-height: 2.9em;
        object-fit: contain;
    }

    /* 客戶牆只放 logo：說明文字留給報讀與搜尋引擎（圖片的替代文字），畫面上不另外顯示 */
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] span.Oddi_LinkCaption,
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] span.Oddi_LinkNote {
        display: none;
    }
}

@keyframes Oddi_LinkFlow {
    to {
        transform: translateX(var(--oddi-flow-shift, -50%));
    }
}

/* 關閉動態效果的使用者：不流動，接上去的重複項目收掉，排成置中的幾排；沒有東西在動就不需要暫停鍵 */
@media (prefers-reduced-motion: reduce) {
    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd {
        flex-wrap: wrap;
        justify-content: center;
        width: auto;
        animation: none;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd > li[data-flow-copy] {
        display: none;
    }

    div.mainLeft_odd div.Oddi_FlowViewport {
        -webkit-mask-image: none;
        mask-image: none;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] div.linkBlockPlayControler {
        display: none;
    }
}

/* ---------- 平板：卡片自適應欄數、圖卡第一項 2×2 ---------- */
@media only screen and (min-width: 701px) {
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) {
        grid-template-columns: repeat(auto-fill, minmax(15em, 1fr));
        gap: 2.6em 1.8em;
    }

    /* 文字卡的項目少（三、四個），平分整排寬度，不留空欄 */
    div.mainLeft_odd div.linkBlockBlock_odd[data-linkkind="text"]:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) {
        grid-template-columns: repeat(auto-fit, minmax(15em, 1fr));
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:first-child {
        grid-column: span 2;
        grid-row: span 2;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:first-child span.Oddi_LinkImgFrame,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:first-child > a[href] > img {
        aspect-ratio: 4 / 3;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:first-child span.Oddi_LinkCaption {
        font-size: 1.25em;
    }

    /* 圖卡只有一張時不留半邊空白：整排橫放，圖在左、標題放大在右；加到兩張以上就回到上面的網格 */
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:only-child {
        grid-column: 1 / -1;
        grid-row: auto;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:only-child > a[href] {
        display: grid;
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
        align-items: center;
        gap: 2.6em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:only-child span.Oddi_LinkImgFrame,
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:only-child > a[href] > img {
        aspect-ratio: 16 / 10;
    }

    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) > li.img:only-child span.Oddi_LinkCaption {
        padding: 0;
        font-size: 1.7em;
        line-height: 1.4;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] div.linkBlockPlayControler {
        margin-bottom: 2.5em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd > li,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] > li {
        width: 13.5em;
        height: 5.6em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd img,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] img {
        max-height: 3.3em;
    }
}

/* ---------- 桌機 ---------- */
@media only screen and (min-width: 1281px) {
    div.mainLeft_odd div.linkBlockBlock_odd:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) {
        grid-template-columns: repeat(auto-fill, minmax(17em, 1fr));
        gap: 3em 2.2em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-linkkind="text"]:not([data-flow]) ul.linkBlockContent_odd:not([data-carousel="1"]) {
        grid-template-columns: repeat(auto-fit, minmax(17em, 1fr));
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] div.linkBlockPlayControler {
        margin-bottom: 3em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd > li,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] > li {
        width: 15em;
        height: 6em;
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] ul.linkBlockContent_odd img,
    div.mainLeft_odd ul.linkBlockContent_odd[data-carousel="1"] img {
        max-height: 3.6em;
    }
}

/* ---- 側邊欄位區塊的「閱讀更多」（主線功能：系統設定打開、後台替這個區塊選了前往的頁面才會輸出，是區塊的最後一個子元素）
        清單下面靠右的一個文字連結，後面帶箭頭；流動列（客戶牆）的區塊是格線排版，讓它自己佔一整列 ---- */
@media only screen and (min-width: 0) {
    /* 上面的清單是浮動的，清除浮動時連結自己的 margin-top 會被吃掉；改用位移往下留出間距，再用 margin-bottom 把高度補回來 */
    div.mainLeft_odd div.linkBlockBlock_odd > a.readMore_odd {
        display: table;
        clear: both;
        position: relative;
        top: 1.8em;
        margin: 0 0 1.8em auto;
        font-size: .95em;
        color: #0E6E98;
    }

    div.mainLeft_odd div.linkBlockBlock_odd > a.readMore_odd::after {
        content: "\2192";
        display: inline-block;
        margin-left: .4em;
        transition: transform 200ms;
    }

    div.mainLeft_odd div.linkBlockBlock_odd > a.readMore_odd:hover,
    div.mainLeft_odd div.linkBlockBlock_odd > a.readMore_odd:focus {
        color: #0F2D3E;
    }

    div.mainLeft_odd div.linkBlockBlock_odd > a.readMore_odd:hover::after {
        transform: translateX(.2em);
    }

    div.mainLeft_odd div.linkBlockBlock_odd[data-flow] > a.readMore_odd {
        grid-column: 1 / -1;
        justify-self: end;
    }
}
