:root {
    --rust: #b44b2c;
    --paper: #fbf8f1;
    --line: #e1d8cc;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* log 425：文章下方上一篇/下一篇用到，app.css 沒有預編譯這兩個。 */
.text-right { text-align: right; }
.pt-6 { padding-top: 1.5rem; }

/* log 439：名片分類改單行、逗號分隔、不換行，不分螢幕寬度一律套用
   （438 原本手機單行/桌機徽章分開處理，使用者要求全面統一改單行）。 */
.tag-line { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* log 387：字級優化用到幾個 app.css 沒有預編譯的響應式字級 class（沒有即時 Tailwind 建置，
   app.css 是靜態編譯檔），比照 log354/log362 的作法直接補上對應 CSS，數值對齊 Tailwind 預設字級。 */
@media (min-width: 768px) {
    .md\:text-2xl { font-size: 1.5rem; line-height: 2rem; }
    .md\:text-lg { font-size: 1.125rem; line-height: 1.75rem; }
    .md\:text-base { font-size: 1rem; line-height: 1.5rem; }
    .md\:text-sm { font-size: .875rem; line-height: 1.25rem; }
}

@media (min-width: 1024px) {
    .lg\:text-6xl { font-size: 3.75rem; line-height: 1; }
    /* log 388：手機版廠商名片加寬用到的桌機還原 class，app.css 沒有預編譯。 */
    .lg\:p-5 { padding: 1.25rem; }
    /* log 419：文章詳細頁右側選單版面，app.css 沒有預編譯這個任意值 grid-template-columns。 */
    .lg\:grid-cols-\[1fr_300px\] { grid-template-columns: 1fr 300px; }
}

/* log 390：手機版浮動按鈕改窄，app.css 沒有預編譯 w-[80px] / sm:w-[120px] 這個組合。 */
.w-\[80px\] { width: 80px; }
@media (min-width: 640px) {
    .sm\:w-\[120px\] { width: 120px; }
}

body {
    margin: 0;
    background: var(--paper);
    color: #29251f;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif
}

button {
    cursor: pointer;
}

img {
    display: block;
    max-width: 100%;
}

select,
input,
textarea {
    width        : 100%;
    border       : 1px solid #ddd2c3;
    border-radius: .5rem;
    background   : #fff;
    padding      : .85rem 1rem;
    outline      : none
}

/* 搜尋區自訂下拉箭頭 */
.search-box select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding-right: 1.6rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M0 0 L5 6 L10 0' stroke='%23b44b2c' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.6rem center;
    background-size: 12px;
    /* 左右留足內距：右側容納自訂箭頭，文字不被切 */
    padding-left: 0.9rem;
    padding-right: 2rem;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--rust);
    box-shadow: 0 0 0 3px #b44b2c1a;
}

/* 名錄搜尋列（/design /vendors /shops）下拉：關掉原生箭頭改自繪，內距固定，文字不被截 */
.directory-search-form select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    padding: 0 2.1rem 0 0.85rem;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M0 0 L5 6 L10 0' stroke='%23b44b2c' fill='none' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 12px;
    text-overflow: ellipsis;
}

.page {
    width: min(1400px, calc(100% - 40px));
    margin: auto
}

.hero,
.article-hero {
    position           : relative;
    background-size    : cover;
    background-position: center
}

/* develop11 (R3)：hero 背景圖改本機 mock；正式各縣市自訂 */
.hero {
    background-image: url('/images/hero.jpg')
}

.article-hero {
    background-image: url('/images/article-hero.jpg')
}

.soft-hero {
    background   : linear-gradient(100deg, #f5eee2, #fffaf2 58%, #d3b996);
    border-bottom: 1px solid #dfd2c0
}

/* fix-01：名錄列表 list / map 檢視切換（對齊原稿 vendors.html [data-view] 作法） */
[data-view-container][data-view="list"] [data-map-panel] {
    display: none;
}

/* list 檢視：容器淺底 + 內距（對齊原稿 setView('list') 加 bg-[#f8f5f0] px-4 pt-6 pb-28） */
[data-view-container][data-view="list"] {
    background: #f8f5f0;
    padding: 1.5rem 1rem 7rem;
}

[data-view-container][data-view="list"] [data-list-panel] {
    position: static;
    visibility: visible;
    pointer-events: auto;
    transform: none;
    max-height: none;
    overflow: visible;
    border-right-width: 0;
    border-radius: 0;
    box-shadow: none;
}

/* list 檢視：結果 2 欄格線（對齊原稿 resultsGrid = 'grid gap-4 md:grid-cols-2 xl:gap-5'） */
[data-view-container][data-view="list"] [data-results-grid] {
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(0, 1fr);
}

[data-view-container][data-view="list"] [data-results-grid] > nav,
[data-view-container][data-view="list"] [data-results-grid] > p {
    grid-column: 1 / -1;
}

@media (min-width: 768px) {
    [data-view-container][data-view="list"] [data-results-grid] {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* map 檢視（對齊原稿 design.html setView('map')）
   桌機：保留 <main> 的 lg:flex 30/70 分割 —— 左側 [data-list-panel] lg:w-[30%] 側欄（含結果卡、
   「找到 N 筆」），右側 #mainMap lg:flex-1 全高地圖；推薦輪播隱藏。
   手機：地圖鋪滿，[data-list-panel] 為隱藏的底部抽屜（皆由元素自身的 Tailwind class 處理，
   template.css 不再覆寫，避免把桌機側欄也一起藏掉）。 */
[data-view-container][data-view="map"] [data-ad-carousel] {
    display: none;
}

@media (max-width: 1023px) {
    [data-view-container][data-view="map"] {
        height: calc(100dvh - 72px);
        overflow: hidden;
    }
}

.leaflet-container {
    z-index: 1;
}

@media (min-width: 640px) {
    [data-view-container][data-view="list"] {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 1024px) {
    [data-view-container][data-view="list"] {
        display: block;
        height: auto;
        overflow: visible;
        padding: 1.5rem 2rem;
    }

    [data-view-container][data-view="list"] [data-list-panel] {
        width: 100%;
        max-width: 1500px;
        margin-inline: auto;
    }
}

@media (min-width: 1280px) {
    [data-view-container][data-view="list"] [data-results-grid] {
        gap: 1.25rem;
    }
}

.nav-link {
    border-bottom: 2px solid transparent;
    padding      : 24px 0
}

.nav-link.active {
    color       : var(--rust);
    border-color: var(--rust)
}

.btn {
    display        : inline-flex;
    align-items    : center;
    justify-content: center;
    border-radius  : .5rem;
    background     : var(--rust);
    padding        : .5rem 1.6rem;
    color          : #fff;
    font-weight    : 700
}

.btn:hover {
    background: #963b24
}

/* 聯絡表單驗證碼（純文字圖形，免外部服務） */
.captcha-code {
    display       : inline-block;
    user-select   : none;
    -webkit-user-select: none;
    padding       : .5rem 1.1rem;
    border        : 1px solid #ded2c3;
    border-radius : .45rem;
    background    : repeating-linear-gradient(45deg, #f4ede2, #f4ede2 6px, #efe6d7 6px, #efe6d7 12px);
    font-family   : "Courier New", ui-monospace, monospace;
    font-size     : 1.55rem;
    font-weight   : 700;
    letter-spacing: .45rem;
    color         : #7a4a34;
    text-shadow   : 1px 1px 0 #fff;
    line-height   : 1.2
}

.section-title {
    font-family: serif;
    font-size  : 1.75rem;
    font-weight: 700
}

.search-box {
    display      : grid;
    max-width    : 1250px;
    margin       : auto;
    gap          : .75rem;
    border-radius: .8rem;
    background   : #fff;
    padding      : 1rem;
    box-shadow   : 0 12px 35px #33221125
}

.search-zone {
    border-bottom: 1px solid #e8dfd3;
    background   : #fffaf5;
    padding      : 1rem
}

.card {
    overflow     : hidden;
    border       : 1px solid var(--line);
    border-radius: .6rem;
    background   : #fff;
    box-shadow   : 0 5px 18px #4a38280a;
    transition: transform .2s ease, box-shadow .2s ease;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 25px #4a382817
}

.card img {
    width: 100%;
    height: 210px;
    object-fit: cover;
}

/* 卡片文字高度限制：標題一行、描述三行 */
.card h3 {
    white-space  : nowrap;
    overflow     : hidden;
    text-overflow: ellipsis;
}

.card .p-4 p:nth-of-type(2),
.card p.description,
.card p:nth-of-type(2) {
    display           : -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    overflow          : hidden;
    line-height       : 1.25;
    max-height        : calc(1.25em * 3);
}

.filter {
    white-space  : nowrap;
    border       : 1px solid #ded2c3;
    border-radius: .45rem;
    background   : #fff;
    padding      : .5rem 0.8rem;
    cursor       : pointer;
    transition   : background .15s, color .15s, border-color .15s
}

.filter:hover {
    border-color: #ad462d;
    color       : #ad462d
}

/* fix-02：原稿 style.css 未定義 .filter.active 視覺，補上與站點主色一致的選中態 */
.filter.active {
    background   : #ad462d;
    border-color : #ad462d;
    color        : #fff
}

.tag {
    border-radius: 99px;
    background   : #f3ede3;
    padding      : .25rem .55rem;
    font-size    : .75rem
}

.float-btn {
    display      : grid;
    height       : 64px;
    width        : 64px;
    place-items  : center;
    border-radius: 50%;
    color        : #fff;
    box-shadow   : 0 5px 15px #0002;
    font-size    : 1.3rem
}

.float-btn small {
    font-size : .75rem;
    margin-top: -10px
}

.panel {
    border       : 1px solid #e1d5c5;
    border-radius: .8rem;
    background   : #fff;
    padding      : 2rem
}

.map-frame {
    position: absolute;
    inset   : 0;
    width   : 100%;
    height  : 100%;
    border  : 0;
    opacity : .76
}

@media (min-width: 768px) {
    /* 4 欄對應：行政區 / 行業別 / 關鍵字 / 按鈕。
       按鈕改 auto（不再吃 2fr）；前兩欄給足下限寬，長字（如「設計相關行業別」）不被截斷 */
    .search-box {
        grid-template-columns: minmax(160px, 1fr) minmax(190px, 1.1fr) minmax(150px, 1.4fr) auto
    }

    .card img {
        height: 265px;
    }
}

@media (min-width: 1024px) {
    .search-box {
        grid-template-columns: minmax(190px, 1fr) minmax(220px, 1.1fr) minmax(220px, 1.6fr) auto
    }
}

@media (max-width: 767px) {
    .page {
        width: calc(100% - 28px)
    }

    .hero h1,
    .article-hero h1,
    .soft-hero h1 {
        font-size: 2.6rem
    }

    .hero>div {
        min-height: 620px
    }

    .float-btn {
        height: 54px;
        width : 54px
    }

    .section-title {
        font-size: 1.45rem
    }
}

.leaflet-container a.leaflet-popup-close-button {
    top: 2px !important;
    right: 5px !important;
}
