/* === 全站基本設定 === */
html, body {
  background: #f5f5f5;
  font-family: sans-serif;
  padding-bottom: 70px;
  overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }

/* === 展覽卡片區塊 === */
.event-card {
  max-height: 60vh;
  overflow-y: auto;
  visibility: hidden;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .3s ease, transform .3s ease, visibility .3s ease;
  width: 90%;
  max-width: 700px;
  margin: -80px auto 20px;
  position: relative;
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  min-height: 300px;
  pointer-events: none;
  background: #111;
  /* border-radius: 8px; */
  padding: 1rem;
}
.event-card.active {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.event-card.hidden { display: none !important; }

/* 資訊卡關閉按鈕（新舊 class 皆支援） */
.event-card-close {
  position: absolute;
  top: 8px; right: 8px;
  width: 32px; height: 32px;
  border: none;
  background: #fff; color: #000;
  font-size: 18px; line-height: 32px; text-align: center;
  cursor: pointer; z-index: 20;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
  transition: transform .15s ease, background .2s ease;
  /* border-radius: 50%; */
}
.event-card-close:hover { transform: scale(1.05); }
.event-card-close:active { transform: scale(0.95); }

#mainImage {
  width: 100%; height: auto; max-height: 240px;
  object-fit: cover; display: block;
  /* border-radius: 6px; */
}

/* === 展覽資訊文字區塊 === */
.event-info {
  border: 1px solid #ddd;
  /* border-radius: 6px; */
  padding: 15px; margin-top: 10px; background: #fff;
}
.event-info h2 { margin: 0; font-size: 20px; font-weight: 700; }
.event-info p { margin: 5px 0; font-size: 14px; color: #333; }
.tags { color: #888; font-size: 12px; }

/* === 按鈕通用（只管 event-card 內的 .actions） === */
.actions button {
  background: none; border: none; font-size: 14px; cursor: pointer; color: #555;
}
.actions button:hover { color: #000; background: #ddd; }

/* ===== Zoom Dialog ===== */
.artwork-zoom-dialog {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  background: rgba(0,0,0,.92);
  backdrop-filter: blur(2px);
  display: flex; justify-content: center; align-items: center;
  z-index: 2147483647; /* 確保永遠在最上層 */
  overflow: hidden; overscroll-behavior: none;
  padding: 0; border: none;
}
.artwork-zoom-dialog::backdrop {
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(2px);
}
.artwork-zoom-dialog[open] { animation: fadeIn .2s ease-in-out; }
.artwork-zoom-dialog:not([open]) { display: none !important; }

.zoom-content {
  position: relative;
  width: 90vw; height: 90vh;
  max-width: 90vw; max-height: 90vh;
  display: flex; justify-content: center; align-items: center;
  background: #000; padding: 0;
}
.artwork-zoom-dialog img {
  max-width: 100%; max-height: 100%;
  /* border-radius: 8px; */
  box-shadow: 0 0 15px rgba(0,0,0,.5);
}

/* Zoom 關閉鍵（新舊 selector 皆支援：#zoomCloseX、.zoom-close-button） */
#zoomCloseX,
.zoom-close-button {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; font-size: 20px;
  background: #fff; color: #000; border: none; cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.3); z-index: 10002;
  /* border-radius: 50%; */
}

/* 主要容器（加入 4.5% 側邊留白） */
#zoomWrapper {
  width: 90vw; height: 90vh;
  display: flex; justify-content: center; align-items: center;
  background: #000; overflow: hidden; box-sizing: border-box;
  padding-inline: 4.5vw;   /* ← 左右各 4.5% 留白 */
  touch-action: none;
}

/* 被 Panzoom 控制的圖片 */
#zoomWrapper img,
#zoomWrapper #zoomedImage {
  display: block; max-width: none; max-height: none;
  width: auto; height: auto;
  user-select: none; -webkit-user-drag: none;
  touch-action: none; cursor: grab;
}
#zoomWrapper img.is-panning { cursor: grabbing; }

/* 修正可能出現的「小黑點」：重置列表與按鈕的預設 marker / 外觀 */
.zoom-controls, .zoom-controls * { list-style: none; }
.zoom-controls::marker, .zoom-controls *::marker { content: ""; }
.zoom-controls button { -webkit-appearance: none; appearance: none; }

/* 工具列 */
.zoom-controls {
  position: absolute; left: 50%; bottom: 20px; transform: translateX(-50%);
  display: flex; gap: 10px;
  background: rgba(0,0,0,.5);
  padding: 6px 12px;
  /* border-radius: 6px; */
  z-index: 10010;
}
.zoom-controls button {
  background: #fff; border: none; padding: 0; margin: 0;
  width: 40px; height: 40px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; cursor: pointer;
  outline: none;
  /* border-radius: 4px; */
}
.zoom-controls button:hover { background: #eee; }
.zoom-controls button i { pointer-events: none; font-size: 18px; }

/* 作品資訊卡（置於控制列上方） */
.zoom-meta{
  position: absolute; left: 50%; transform: translateX(-50%);
  bottom: 84px; /* 高於控制列 */
  background: rgba(255,255,255,.96); color: #111;
  /* border-radius: 8px; */
  padding: 10px 12px; max-width: calc(90vw - 32px);
  box-shadow: 0 4px 10px rgba(0,0,0,.2);
  font-size: 14px; line-height: 1.4; z-index: 10005;
}
.zoom-meta p{ margin:4px 0; }
.zoom-meta .actions{
  display:flex; gap:8px; margin-top:6px;
  border-top:1px solid #e6e6e6; padding-top:8px;
}
.zoom-meta .actions .action-button{
  flex:1; background:none; border:none; cursor:pointer; padding:6px 10px;
  /* border-radius:6px; */
}
.zoom-meta .actions .action-button:hover{ background:#f3f4f6; }

@media (min-width: 768px){
  .zoom-meta{ right:20px; left:auto; transform:none; max-width:420px; }
}

/* === 上方輪播區 === */
.carousel-wrapper {
  width: 100vw; display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 30px; margin-bottom: 14px;
}
.carousel-content {
  width: 100vw; height: 240px; display: flex; align-items: center; justify-content: center;
  overflow: hidden; background: #eee;
  /* border-radius: 6px; */
}
.carousel-content img { width: 100%; height: 100%; object-fit: cover; display: block; }
.carousel-prev, .carousel-next {
  font-size: 2rem; background: none; border: none; cursor: pointer; color: #555;
}
.carousel-prev:hover, .carousel-next:hover { color: #000; }

/* 上方 Banner 的小橫槓切換 */
.top-pager {
  display: flex; gap: 8px; align-items: center; justify-content: center;
  padding: 4px 0 12px; background: transparent;
}
.top-pager .pager-dot,
#topPager .pager-dot{
  width: 28px; height: 4px;
  /* border-radius: 3px; */
  background: #cfcfcf; cursor: pointer;
  transition: transform .18s ease, background .2s ease; outline: none;
}
.top-pager .pager-dot:hover,
#topPager .pager-dot:hover { transform: scaleY(1.25); }
.top-pager .pager-dot:focus-visible,
#topPager .pager-dot:focus-visible { box-shadow: 0 0 0 3px rgba(0,0,0,.15); }
.top-pager .pager-dot.active,
#topPager .pager-dot.active { background:#111; transform: scaleY(1.5); }

/* 單張圖片上下切換按鈕（event-card 內） */
.carousel-single-wrapper { position: relative; display: flex; justify-content: center; align-items: center; }
.carousel-single-wrapper img { width: 100%; height: auto; display: block; /* border-radius: 8px; */ }
.single-prev, .single-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(0,0,0,.5); color: #fff; border: none;
  font-size: 1.5rem; width: 32px; height: 32px; cursor: pointer; z-index: 5;
  /* border-radius: 50%; */
}
.single-prev:hover, .single-next:hover { background: rgba(0,0,0,.8); }
.single-prev { left: 10px; } .single-next { right: 10px; }

/* 縮圖區 */
.overview-scroll-wrapper { overflow-x: auto; white-space: nowrap; padding: 1rem; background:#fff; }
.overview-scroll-inner { display: flex; gap: 3%; }
.overview-img {
  width: 30.3%; aspect-ratio: 1 / 1; object-fit: cover; flex-shrink: 0; cursor: pointer;
  background: #f0f0f0; transition: transform .2s ease;
  /* border-radius: .5rem; */
}
.overview-img:hover { transform: scale(1.05); }

/* 分頁切換（展覽 / 藝文單位） */
.tab-switch {
  z-index: 20; position: relative;
  display: flex; justify-content: start; gap: 1.5rem;
  padding: 1rem 1rem .5rem; font-size: 1.2rem; font-weight: 500; background: #fff;
}
.tab { cursor: pointer; color: #666; position: relative; }
.tab.active { color: #000; }
.tab.active::after {
  content: ''; position: absolute; left: 0; bottom: -4px; width: 100%; height: 2px; background: #000;
}

/* 讓 topPager 就算沒有 class 也能置中、寬度撐滿 */
#topPager, .top-pager{
  display:flex; align-items:center; justify-content:center;
  gap:8px; width:100%; max-width:100vw; margin:6px auto 0; padding:0 16px 12px; box-sizing:border-box;
}

/* === 小螢幕調整 === */
@media (max-width:768px){
  .single-prev, .single-next { width: 28px; height: 28px; font-size: 1.2rem; }
  #map { position: relative; height: 55vh; z-index: 0; }
  .event-card {
    margin-top: -100px; padding: 15px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,.2);
    width: 90%; max-width: 700px; margin-left: auto; margin-right: auto; position: relative;
    /* border-radius: 10px; */
  }
  .carousel-content { height: 200px; /* border-radius: 0; */ }
  .top-pager { gap: 6px; padding: 2px 0 10px; }
  .top-pager .pager-dot, #topPager .pager-dot { width: 24px; height: 4px; }
  #topPager, .top-pager{ gap:6px; padding:2px 16px 10px; }
}

/* === 作品資訊彈窗 === */
.artwork-detail-dialog {
  border: none; padding: 0; width: min(92vw, 760px); max-height: 92vh; overflow: hidden; background: #fff;
  /* border-radius: 12px; */
}
.artwork-detail-dialog::backdrop { background: rgba(0,0,0,.6); }
.detail-wrap { position: relative; display: flex; flex-direction: column; max-height: 92vh; }

/* 詳情關閉鈕（新舊 class 皆支援：.detail-close-x 與 .detail-close） */
.detail-close-x,
.detail-close {
  position: absolute; top: 8px; right: 8px; width: 32px; height: 32px;
  border: none; background: #000; color: #fff; font-size: 18px; line-height: 32px;
  cursor: pointer; z-index: 2; opacity: .9;
  /* border-radius: 50%; */
}

.detail-image { background: #111; display: flex; justify-content: center; align-items: center; max-height: 70vh; }
.detail-image img { width: 100%; height: auto; object-fit: contain; display: block; }

.detail-meta { background: #fff; padding: 14px 16px 16px; }
.detail-meta h3 { margin: 0 0 6px; font-size: 18px; }
.detail-meta p { margin: 4px 0; color: #333; font-size: 14px; }
.detail-meta .actions {
  display: flex; gap: 8px; margin-top: 8px; border-top: 1px solid #e6e6e6; padding-top: 8px;
}
.detail-meta .actions .action-button {
  flex: 1; background: none; border: none; padding: 8px 10px; cursor: pointer;
  /* border-radius: 8px; */
}
.detail-meta .actions .action-button:hover { background: #f3f4f6; }

/* Google Map 自訂按鈕 */
.custom-map-control-button {
  background: #fff; border: none; outline: none; width: 46px; height: 46px;
  margin: 10px; box-shadow: 0 2px 6px rgba(0,0,0,.3); cursor: pointer;
  font-size: 20px; line-height: 46px; text-align: center;
  /* border-radius: 50%; */
  -webkit-tap-highlight-color: transparent;
}
.custom-map-control-button:hover { background: #f0f0f0; }
.custom-map-control-button i { pointer-events: none; }
@media (max-width: 768px){ .custom-map-control-button{ margin: 12px; } }

/* 輔助文字（螢幕閱讀器專用） */
.sr-only{
  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;
}

/* 動畫與無動畫偏好 */
@keyframes fadeIn { from { opacity: 0; transform: scale(.98);} to { opacity: 1; transform: scale(1);} }
@media (prefers-reduced-motion: reduce) {
  .artwork-zoom-dialog[open] { animation: none; }
  .event-card { transition: none; }
}

/* 放大層一定蓋最上面，禁止底層 fixed 元素搶 z-index */
.bottom-nav, .tab-switch, .top-pager, .event-card{ z-index: auto; }

/* 任何浮在 dialog 上方的小元件都不要顯示；自身可點 */
.artwork-zoom-dialog * { pointer-events: auto; }
body:has(.artwork-zoom-dialog[open]) .top-pager,
body:has(.artwork-zoom-dialog[open]) .bottom-nav { pointer-events: none; }

/* ── Tabs：改成純文字＋底線風格（無邊框、無背景） ── */
.tab-switch{
  z-index:20; position:relative;
  display:flex; gap:1.25rem; align-items:center;
  padding:1rem 1rem .25rem; background:#fff;
}

/* 重置 button 預設外觀，做成像 <span> 一樣的「文字」 */
.tab-switch .tab{
  -webkit-appearance:none; appearance:none;
  background:transparent; border:0; margin:0;
  padding:.25rem 0; /* 只保留上下間距 */
  font:inherit; line-height:1.1; cursor:pointer;
  color:#777; position:relative;
  outline:none; transition:color .18s ease;
}

/* 底線（預設隱形，hover 有淡淡預覽） */
.tab-switch .tab::after{
  content:""; position:absolute; left:0; right:0; bottom:-6px;
  height:2px; background:currentColor;
  transform:scaleX(0.35); transform-origin:left;
  opacity:0; transition:transform .18s ease, opacity .18s ease;
}

/* hover/鍵盤聚焦：顏色變深、底線顯示 */
.tab-switch .tab:hover{ color:#111; }
.tab-switch .tab:focus-visible{ color:#111; }
.tab-switch .tab:hover::after,
.tab-switch .tab:focus-visible::after{
  opacity:.7; transform:scaleX(1);
}

/* 啟用中的 tab：深色文字＋實心底線 */
.tab-switch .tab.active{
  color:#111; font-weight:600;
}
.tab-switch .tab.active::after{
  opacity:1; transform:scaleX(1);
}

/* 小螢幕微調底線距離與間距 */
@media (max-width:768px){
  .tab-switch{ gap:1rem; padding:12px 14px 6px; }
  .tab-switch .tab::after{ bottom:-4px; }
}

/* 修 Firefox 內邊距 */
.tab-switch .tab::-moz-focus-inner{ border:0; padding:0; }

/* === 修正：資訊卡關閉 X（黑底＋白色 X，縮小、層級提高） === */
.event-card {
  z-index: 10001 !important; /* 確保蓋過地圖泡泡 */
}

.event-card .event-card-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  line-height: 26px;
  font-size: 16px;
  background: #000;     /* 黑底 */
  color: #fff;          /* 白色 X */
  border: none;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  z-index: 10002;
  cursor: pointer;
  pointer-events: auto;
  opacity: .95;
  transition: transform .15s ease, opacity .2s ease;
}

.event-card .event-card-close:hover {
  transform: scale(1.05);
  opacity: 1;
}

.event-card .event-card-close:active {
  transform: scale(.92);
  opacity: .9;
}

@media (max-width: 768px) {
  .event-card .event-card-close {
    width: 22px;
    height: 22px;
    line-height: 22px;
    font-size: 14px;
    top: 6px;
    right: 6px;
  }
}
/* index_artworks.css  —  乾淨版卡片與展開態 */

:root{
  --card-bg:#fff;
  --card-border:#e6e6e6;
  --shadow:0 8px 24px rgba(0,0,0,.12);
  /* --radius:14px; */
}

/* 區塊外框 */
.artworks-section{
  background:#f5f5f5;
  padding:12px 12px 24px;
}

/* 直向排列：一組接一組 */
.artworks-grid{
  display:flex;
  flex-direction:column;
  gap:16px;
}

/* 一組 = 左一大右兩小 */
.artwork-group{
  display:grid;
  grid-template-columns: 2fr 1fr;
  grid-auto-rows: 180px;
  gap:12px;
}

/* 縮圖卡片（方形、俐落） */
.artwork-item{
  position:relative;
  /* border-radius:var(--radius); */
  overflow:hidden;
  background:#f1f1f1;
  cursor:pointer;
  transition:transform .18s ease, box-shadow .18s ease;
}
.artwork-item:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow);
}
.artwork-item img{
  width:100%;
  height:100%;
  object-fit:cover; /* 縮圖以裁切呈現，視覺整齊 */
  display:block;
}

/* 大小塊 */
.artwork-item.large{ grid-row: span 2; min-height:360px; }
.artwork-item.small{ min-height:180px; }

/* 展開態：變成「卡片」而不是撐破 layout */
.artwork-item.expanded-mode{
  grid-column: 1 / -1;          /* 佔滿一整組寬 */
  display:grid;
  grid-template-columns: 1fr;   /* 手機直向：上下排 */
  gap:14px;
  background:var(--card-bg);
  border:1px solid var(--card-border);
  box-shadow:var(--shadow);
  padding:12px;
}

/* 展開態的圖片區：固定 4:3，不跳動、不變形 */
.expanded-image-wrapper{
  background:#0f0f10;
  /* border-radius:12px; */
  display:flex;
  align-items:center;
  justify-content:center;
  aspect-ratio: 4 / 3;          /* 先保留空間再載圖，避免版面跳動 */
  overflow:hidden;
}
.expanded-image{
  width:100%;
  height:100%;
  object-fit:contain;           /* 展開態改用等比完整顯示 */
}

/* 作品資訊 */
.artwork-info{
  padding:6px 4px 0;
  color:#222;
}
.artwork-info p{ margin:4px 0; }
.artwork-info p:first-child{
  font-size:16px;
  font-weight:700;
}

/* 操作列 */
.artwork-actions{
  display:flex;
  gap:8px;
  border-top:1px solid var(--card-border);
  padding-top:8px;
}
.artwork-actions .action-button{
  flex:1;
  background:none;
  border:none;
  cursor:pointer;
  padding:8px 10px;
  /* border-radius:8px; */
}
.artwork-actions .action-button:hover{
  background:#f3f4f6;
}

/* 展開態的關閉鈕（白色圓形漂浮） */
.artwork-item .close-button{
  position:absolute;
  top:10px;
  right:10px;
  width:28px;
  height:28px;
  /* border-radius:50%; */
  border:none;
  background:#fff;
  box-shadow:0 2px 6px rgba(0,0,0,.2);
  font-size:18px;
  line-height:1;
  cursor:pointer;
  z-index:5;
}

/* 平板 / 桌機：展開態改為左右雙欄（左圖右文） */
@media (min-width: 768px){
  .artwork-group{
    grid-template-columns: 3fr 2fr;
    grid-auto-rows: 220px;
  }
  .artwork-item.large{ min-height:440px; }

  .artwork-item.expanded-mode{
    grid-template-columns: 55% 45%;
    align-items:stretch;
  }
  .expanded-image-wrapper{
    aspect-ratio:auto;          /* 讓左欄自適應拉高 */
    min-height:360px;
  }
}

/* 心形變紅 */
.favorite-artwork.active i,
.favorite-expo.active i{
  color:#e11d48;
}
