/* Home.css — v6.x.5e
   LINE LIFF 新首頁:hero greeting + 互動搜尋列 + 地圖卡片(取代原本 3 個 card / tile) + 公告
   v6.x.5e 重大重組:掃碼充電 / 地圖 tile / 紀錄 tile → 1 個大塊 map card + 篩選 sheet
   tokens 從 v6x5.css 來 */

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--type-display);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
    font-size: 14px;
    line-height: 1.5;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    min-height: 100vh;
    padding-bottom: calc(var(--tab-height) + 24px + env(safe-area-inset-bottom));
}

/* ==========================================================
   Hero image (LINE GO 參考)
   右半裁切(貓頭鷹+充電樁+車),底部 mask 漸層 fade 進 --bg
   標題絕對定位疊在圖底
   ========================================================== */
.hero_img_wrap {
    margin: 0 0 2px;
    position: relative;
    overflow: hidden;
}

.hero_img {
    display: block;
    width: 100%;
    height: clamp(140px, 36vw, 220px);
    object-fit: cover;
    object-position: center center;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
}

.hero_title {
    position: absolute;
    left: 20px;
    right: 20px;
    bottom: 18px;
    margin: 0;
    font-size: 26px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.25;
    color: var(--ink);
    z-index: 2;
}

/* ==========================================================
   v6.x.5e — 互動搜尋列 (top-left, tap 開 sheet)
   視覺像 iOS search input 但不接文字輸入
   ========================================================== */
.search_bar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 12px 16px 0;
    padding: 12px 14px;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-pill);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    width: calc(100% - 32px);
    text-align: left;
    font: inherit;
    color: var(--ink-soft);
    -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out);
}

.search_bar:active {
    transform: scale(0.99);
    box-shadow: var(--shadow-md);
}

.search_bar:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.search_bar_icon {
    flex: 0 0 auto;
    width: 20px;
    height: 20px;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search_bar_icon svg {
    width: 100%;
    height: 100%;
}

.search_bar_text {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-soft);
    letter-spacing: 0.01em;
}

.search_bar_arrow {
    flex: 0 0 auto;
    color: var(--ink-soft);
    font-size: 14px;
    line-height: 1;
    font-family: var(--type-mono);
    transition: transform 0.18s var(--ease-out);
}

.search_bar:hover .search_bar_arrow {
    transform: translateY(2px);
}

/* ==========================================================
   v6.x.5e — 地圖卡片 (取代 scan_cta + tile_grid)
   ========================================================== */
.map_card {
    margin: 12px 16px 0;
    background: var(--card);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.map_card_preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #e8e9eb;
    overflow: hidden;
}

.map_card_img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: opacity 0.3s var(--ease-out);
}

/* <img> 元素預設隱藏,有 src 才 fade-in (避免 broken image icon 閃一下) */
img.map_card_img:not([src]),
img.map_card_img[src=""] {
    opacity: 0;
}

.map_card_locate {
    position: absolute;
    top: 10px;
    left: 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 8px;
    background: rgba(255, 255, 255, 0.92);
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-mid);
    letter-spacing: 0.01em;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(20, 30, 22, 0.08);
}

.map_card_locate_dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--info);
    box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.18);
    animation: locatePulse 1.6s ease-in-out infinite;
}

@keyframes locatePulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.18); }
    50%      { box-shadow: 0 0 0 5px rgba(59, 125, 221, 0.06); }
}

.map_card_type_badge {
    position: absolute;
    top: 10px;
    right: 10px;
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(31, 157, 62, 0.32);
}

.map_card_body {
    padding: 14px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.map_card_eyebrow {
    font-size: 10px;
    font-weight: 800;
    color: var(--brand);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1.2;
}

.map_card_name {
    font-size: 17px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.3;
    margin-top: 2px;
}

.map_card_address {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.45;
    letter-spacing: 0.01em;
    margin-bottom: 8px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.map_card_cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    background: var(--brand);
    color: #fff;
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.02em;
    text-decoration: none;
    margin-top: 4px;
    box-shadow: 0 4px 12px rgba(31, 157, 62, 0.22);
    transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
    align-self: flex-start;
}

.map_card_cta svg {
    width: 14px;
    height: 14px;
}

.map_card_cta:active {
    transform: scale(0.97);
    box-shadow: 0 2px 6px rgba(31, 157, 62, 0.18);
}

.map_card_cta:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

/* ==========================================================
   News / announcements (保留 v6.x.5)
   ========================================================== */
.news_section {
    margin: 18px 16px 0;
}

.section_head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 12px;
    padding: 0 4px;
}

.section_head .label {
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.section_head .more {
    font-size: 12px;
    color: var(--ink-soft);
    text-decoration: none;
    font-weight: 600;
    -webkit-tap-highlight-color: transparent;
}

.section_head .more:hover { color: var(--brand); }

.news_list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.news_card {
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px solid var(--line-soft);
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    text-decoration: none;
    color: var(--ink);
    box-shadow: var(--shadow-sm);
    transition: border-color 0.12s var(--ease-out), transform 0.1s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.news_card:active { transform: scale(0.99); }

.news_card:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.news_top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.news_tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.04em;
    background: var(--brand-tint);
    color: var(--brand-deep);
    text-transform: uppercase;
}

.news_tag.tag_info {
    background: #e8f1ff;
    color: #1d4ea8;
}

.news_tag.tag_warn {
    background: #fff4dc;
    color: #8a5a00;
}

.news_date {
    font-size: 11px;
    color: var(--ink-soft);
    font-family: var(--type-mono);
    font-feature-settings: "tnum" 1;
    font-variant-numeric: tabular-nums;
}

.news_title {
    font-size: 14px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
    line-height: 1.45;
}

.news_preview {
    font-size: 12px;
    color: var(--ink-soft);
    line-height: 1.55;
}

/* ==========================================================
   Empty news state
   ========================================================== */
.news_empty {
    text-align: center;
    padding: 32px 20px;
    background: var(--card);
    border-radius: var(--radius-md);
    border: 1px dashed var(--line);
    color: var(--ink-soft);
    font-size: 12px;
}

.news_empty svg {
    width: 36px;
    height: 36px;
    color: var(--ink-soft);
    margin-bottom: 10px;
    opacity: 0.5;
}

/* ==========================================================
   v6.x.5e — 底部 sheet 篩選器
   ========================================================== */
.sheet_backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 22, 17, 0.45);
    z-index: 99;
    opacity: 0;
    transition: opacity 0.24s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.sheet_backdrop.is_open {
    opacity: 1;
}

.sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: var(--card);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 32px rgba(20, 30, 22, 0.18);
    padding: 8px 0 max(16px, env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.28s var(--ease-out);
    max-height: 80vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.sheet.is_open {
    transform: translateY(0);
}

.sheet_grab {
    width: 36px;
    height: 4px;
    background: var(--line);
    border-radius: 999px;
    margin: 0 auto 4px;
}

.sheet_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 8px;
    border-bottom: 1px solid var(--line-soft);
}

.sheet_title {
    margin: 0;
    font-size: 16px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: -0.01em;
}

.sheet_close {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg);
    color: var(--ink-mid);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s var(--ease-out);
}

.sheet_close:active { background: var(--line); }

.sheet_close svg {
    width: 18px;
    height: 18px;
}

.sheet_body {
    padding: 8px 20px 4px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.sheet_group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sheet_label {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
}

.sheet_label_main {
    font-size: 13px;
    font-weight: 800;
    color: var(--ink);
    letter-spacing: 0.01em;
}

.sheet_label_sub {
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-faint);
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.chip_row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chip {
    flex: 1 1 0;
    min-width: 0;
    padding: 10px 8px;
    background: var(--bg);
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-mid);
    cursor: pointer;
    text-align: center;
    letter-spacing: 0.01em;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.15s var(--ease-out), color 0.15s var(--ease-out), border-color 0.15s var(--ease-out);
    white-space: nowrap;
}

.chip:active { background: var(--line); }

.chip.is_active {
    background: var(--brand-tint);
    color: var(--brand-deep);
    border-color: var(--brand);
}

.chip.is_active:active { background: var(--brand-tint); }

.chip:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.sheet_foot {
    display: flex;
    gap: 10px;
    padding: 14px 20px 4px;
    border-top: 1px solid var(--line-soft);
    margin-top: 12px;
}

.sheet_btn_clear,
.sheet_btn_confirm {
    flex: 1;
    padding: 12px 16px;
    border: none;
    border-radius: var(--radius-pill);
    font: inherit;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.02em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.1s var(--ease-out), background 0.12s var(--ease-out);
}

.sheet_btn_clear {
    background: var(--bg);
    color: var(--ink-mid);
}

.sheet_btn_clear:active { background: var(--line); transform: scale(0.98); }

.sheet_btn_confirm {
    background: var(--brand);
    color: #fff;
    box-shadow: 0 4px 12px rgba(31, 157, 62, 0.28);
}

.sheet_btn_confirm svg {
    width: 14px;
    height: 14px;
}

.sheet_btn_confirm:active {
    transform: scale(0.98);
    box-shadow: 0 2px 6px rgba(31, 157, 62, 0.18);
}

/* ==========================================================
   Reduced motion
   ========================================================== */
@media (prefers-reduced-motion: reduce) {
    .search_bar,
    .map_card_cta,
    .news_card,
    .chip,
    .sheet_btn_clear,
    .sheet_btn_confirm {
        transition: none !important;
    }
    .map_card_locate_dot { animation: none; }
}

@media (max-width: 360px) {
    .hero_title { font-size: 22px; left: 16px; right: 16px; bottom: 14px; }
    .scan_cta { padding: 16px 14px; }
    .tile { padding: 14px 12px; }
}
