/* ============================================================
   Painter.HK 線上畫展 — 共用樣式（響應式）
   ============================================================ */
:root {
  --bg: #F7F7F8;
  --card-bg: #FFFFFF;
  --text: #16181C;
  --text-secondary: #6A7077;
  --accent: #2B3A4A;
  --accent-2: #41586E;
  --border: #E6E8EB;
  --shadow: 0 2px 10px rgba(0,0,0,.06);
  --radius: 12px;
  --container: 1120px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang HK", "Microsoft JhengHei", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { font-family: inherit; }
[hidden] { display: none !important; }

/* 手機／觸控：移除 300ms 點擊延遲與雙擊放大，避免點了沒反應 */
.painter-chip, .work, .all-view-card, .back-link, .viewer-back, .viewer-close,
.notice-toggle, .swap-btn, .swap-arrow, .swap-dot, .viewer-strip img, .nav-link {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- 頁首 ---------- */
.header { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.header-inner { max-width: var(--container); margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: flex; flex-direction: column; line-height: 1.2; }
.logo-main { font-size: 20px; font-weight: 800; letter-spacing: .4px; color: var(--accent); }
.logo-sub { font-size: 11px; color: var(--text-secondary); letter-spacing: .5px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav-link { font-size: 13px; color: var(--text-secondary); padding: 8px 10px; border-radius: 8px; font-weight: 500; }
.nav-link:hover { background: #f0f1f3; color: var(--text); }
.nav-link.active { color: var(--accent); font-weight: 700; }

/* ---------- 主內容 ---------- */
.main { max-width: var(--container); margin: 0 auto; padding: 22px 16px 70px; }
.page-title { font-size: 22px; font-weight: 800; margin: 4px 0 8px; letter-spacing: .3px; }
.page-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 18px; }

/* ---------- 首頁 swap 輪播區塊 ---------- */
.swap {
  position: relative;
  height: 300px;
  margin-bottom: 30px;
  border-radius: 16px;
  overflow: hidden;
  background: #e8eaee;
  box-shadow: var(--shadow);
}
.swap-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .6s ease, visibility .6s; }
.swap-slide.active { opacity: 1; visibility: visible; z-index: 1; }
.swap-img { width: 100%; height: 100%; object-fit: cover; transition: opacity .22s ease; }
.swap-badge { position: absolute; top: 14px; right: 16px; z-index: 2; font-size: 11.5px; letter-spacing: .4px; padding: 4px 10px; border-radius: 999px; background: rgba(0,0,0,.42); color: #fff; backdrop-filter: blur(2px); }
.swap-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.18) 55%, rgba(0,0,0,.02));
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: 0 25px 10px; color: #fff;
}
.swap-title { font-size: clamp(18px, 4vw, 22px); font-weight: 800; letter-spacing: .3px; text-shadow: 0 1px 4px rgba(0,0,0,.3); }
.swap-desc { margin-top: 6px; font-size: 14px; opacity: .94; max-width: 660px; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.swap-meta { margin-top: 6px; font-size: 12px; opacity: .82; letter-spacing: .4px; }
.swap-btn { display: inline-flex; align-items: center; gap: 6px; margin-top: 14px; padding: 10px 18px; background: #fff; color: #16181c; border-radius: 9px; font-size: 13px; font-weight: 700; box-shadow: 0 2px 10px rgba(0,0,0,.18); width: max-content;}
.swap-btn:hover { transform: translateY(-1px); }
.swap-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 38px; height: 38px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.2); color: #fff; font-size: 20px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(0.5x); line-height: 1;
}
.swap-arrow.prev { left: 12px; }
.swap-arrow.next { right: 12px; }
.swap-dots { position: absolute; bottom: 14px; right: 16px; display: flex; gap: 7px; z-index: 3; }
.swap-dot { width: 9px; height: 9px; border-radius: 50%; border: none; background: rgba(255,255,255,.45); cursor: pointer; padding: 0; }
.swap-dot.active { background: #fff; }

/* ---------- 首頁畫冊網格 ---------- */
.exhibitions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
@media (min-width: 768px) { .exhibitions-grid { grid-template-columns: repeat(3, 1fr); gap: 18px; } }
.exhibition-card { background: var(--card-bg); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); transition: transform .18s ease, box-shadow .18s ease; border: 1px solid var(--border); }
.exhibition-card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,.1); }
.exhibition-img { width: 100%; height: 168px; object-fit: cover; background: #eef0f2; transition: opacity .22s ease; }
.exhibition-info { padding: 12px 14px 14px; }
.exhibition-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.exhibition-date { font-size: 12px; color: var(--text-secondary); }
.exhibition-count { font-size: 12px; color: var(--accent); margin-top: 2px; font-weight: 600; }

/* ---------- 缺圖提示（主頁頂端 / 畫冊頁） ---------- */
.notice { border: 1px solid #EBCB90; background: #FFF8E9; color: #6B4A00; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 22px; }
.notice-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.notice-icon { width: 20px; height: 20px; border-radius: 50%; background: #E8A33D; color: #fff; font-size: 13px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.notice-count { font-size: 12px; background: #fff; border: 1px solid #EBCB90; border-radius: 999px; padding: 1px 8px; }
.notice-toggle { margin-left: auto; border: 1px solid #E8A33D; background: #fff; color: #8A5B00; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 8px; cursor: pointer; }
.notice-toggle:hover { background: #FFF1D6; }
.notice-text { margin-top: 8px; font-size: 13px; line-height: 1.75; }
.notice-body { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #EBCB90; }
.notice-list { list-style: none; margin-top: 10px; display: grid; gap: 6px; }
.notice ul { list-style: none; }
.notice-group + .notice-group { margin-top: 12px; }
.notice-group-title { font-size: 13.5px; font-weight: 700; margin-bottom: 6px; }
.notice-slug { margin-left: 6px; font-size: 11.5px; font-weight: 400; background: #FFF1D6; border-radius: 6px; padding: 1px 6px; }
.notice li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 0; }
.notice li b { font-weight: 700; }
.notice-artist { color: #8A5B00; }
.notice code { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 11.5px; background: #fff; border: 1px solid #EBCB90; border-radius: 6px; padding: 1px 6px; }
.notice-tag { font-size: 11.5px; background: #E8A33D; color: #fff; border-radius: 6px; padding: 1px 7px; }
.notice-inline { margin-bottom: 26px; }

/* ---------- gallery.php 畫冊頁 ---------- */
.back-link { display: inline-block; font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; padding: 6px 0; }
.back-link:hover { color: var(--accent); }
.event-header { margin-bottom: 22px; }
.event-title { font-size: 24px; font-weight: 800; letter-spacing: .3px; }
.event-meta { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }
.event-desc { margin-top: 10px; font-size: 14px; color: #3c4147; max-width: 820px; }

/* 全部展示大按鈕 */
.all-view-card {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  color: #fff; border-radius: 14px; padding: 18px 22px; margin-bottom: 30px;
  border: none; width: 100%; text-align: left; cursor: pointer;
  box-shadow: 0 6px 20px rgba(192,51,23,.35);
transition: transform .25s cubic-bezier(.25,.8,.25,1);
}
.all-view-card:hover { transform: translateY(-2px); }
.all-view-body .t { font-size: 18px; font-weight: 800; }
.all-view-body .s { font-size: 13px; opacity: .85; margin-top: 3px; }
.all-view-icon { font-size: 26px; flex-shrink: 0; }

/* 畫家區塊 */
.section-title { font-size: 17px; font-weight: 800; margin: 0 0 14px; display: flex; align-items: center; gap: 8px; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* 畫家卡：只有小圓圈圖、名字、作品數目；卡片縮小，一行可放多位畫家 */
.painter-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(166px, 1fr)); gap: 10px; margin-bottom: 28px; }
.painter-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px 8px 9px; text-align: left; font: inherit; color: inherit; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); cursor: pointer; transition: transform .15s, border-color .15s; }
.painter-chip:hover { transform: translateY(-2px); border-color: var(--accent-2); }
.painter-chip:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.painter-avatar { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; flex-shrink: 0; background: #eef0f2; border: 1px solid var(--border); }
.painter-meta { display: flex; flex-direction: column; min-width: 0; }
.painter-name { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.painter-sub { font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }

/* 作品列表：由上而下全部展示（點圖片才開大圖） */
.works-head { margin-bottom: 18px; }
.works-title { font-size: 20px; font-weight: 800; letter-spacing: .3px; }
.works-meta { font-size: 12.5px; color: var(--text-secondary); margin-top: 3px; }
.works-panel + .works-panel { margin-top: 34px; }
.works-panel-title { font-size: 16px; font-weight: 800; margin: 0 0 14px; padding-left: 10px; border-left: 4px solid var(--accent); }
.works-panel-sub { font-size: 12px; font-weight: 400; color: var(--text-secondary); margin-left: 8px; }
#worksPanels.single .works-panel-title { display: none; }
.works-list { display: grid; grid-template-columns: 1fr; gap: 24px; }
.work { display: block; width: 100%; max-width: 780px; margin: 0 auto; padding: 0; border: none; background: none; font: inherit; color: inherit; text-align: center; cursor: zoom-in; }
.work:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.work-img { width: 100%; height: auto; border-radius: 10px; background: #eef0f2; border: 1px solid var(--border); box-shadow: var(--shadow); transition: transform .18s, box-shadow .18s; }
.work:hover .work-img { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.work-cap { display: block; margin-top: 9px; }
.work-title { display: block; font-size: 14px; font-weight: 500; }
.work-meta { display: block; font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.work-hint { display: block; font-size: 11.5px; color: #9aa1a9; margin-top: 4px; }
.work-warn { display: inline-block; margin-top: 6px; font-size: 11.5px; color: #8A5B00; background: #FFF8E9; border: 1px solid #EBCB90; border-radius: 6px; padding: 1px 8px; }

/* ---------- 大圖檢視器 ---------- */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(10,12,14,.97); color: #fff; display: none; flex-direction: column; }
.viewer.open { display: flex; }
.viewer-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; flex: 0 0 auto; }
.viewer-label { flex: 1 1 auto; text-align: center; font-size: 13px; color: #cfd3d8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-back { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; border: 1px solid rgba(255,255,255,.25); border-radius: 999px; background: rgba(255,255,255,.1); color: #fff; font-size: 12.5px; cursor: pointer; flex-shrink: 0; }
.viewer-back:hover { background: rgba(255,255,255,.24); }
.viewer-close { width: 34px; height: 34px; border: none; border-radius: 50%; background: rgba(255,255,255,.14); color: #fff; font-size: 15px; cursor: pointer; flex-shrink: 0; }
.viewer-close:hover { background: rgba(255,255,255,.3); }
.viewer-stage { flex: 1 1 auto; position: relative; min-height: 0; display: block; overflow: hidden; overscroll-behavior: contain; }
/* 預設（整張）：整張照片等比縮放、置中完整顯示於畫面內，不裁切、免捲動 */
.viewer-img { position: absolute; inset: 0; margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; padding: 0; cursor: zoom-in; }
/* 點圖片放大（全屏填滿）：照片左右填滿畫面；比畫面高時由頂部開始並可上下捲動 */
.viewer-stage.zoom { overflow-y: auto; overflow-x: hidden; }
.viewer-stage.zoom .viewer-img { position: static; inset: auto; margin: 0 auto; width: 100%; height: auto; max-width: none; max-height: none; cursor: zoom-out; }
.viewer-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 46px; height: 46px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.14); color: #fff; font-size: 24px;
  cursor: pointer; display: flex; align-items: center; justify-content: center; line-height: 1;
}
.viewer-arrow.prev { left: 10px; }
.viewer-arrow.next { right: 10px; }
/* 大圖佔滿全屏寬度後，左右箭頭隱藏（改用底部小圖、鍵盤 ← → 或左右滑動切換）；如需恢復，刪除本行 */
.viewer-arrow { display: none; }
.viewer-caption { flex: 0 0 auto; padding: 10px 18px 12px; text-align: center; }
.viewer-caption .v-title { font-size: 15px; font-weight: 700; letter-spacing: .3px; }
.viewer-caption .v-meta { margin-top: 4px; font-size: 12.5px; color: #b9bec6; }
.viewer-caption .v-desc { margin-top: 6px; font-size: 13px; color: #e6e8eb; max-width: 720px; margin-left: auto; margin-right: auto; line-height: 1.6; }
.viewer-bottom { flex: 0 0 auto; padding: 8px 14px 16px; border-top: 1px solid rgba(255,255,255,.12); }
.viewer-counter { text-align: center; font-size: 13px; color: #cfd3d8; margin-bottom: 10px; }
.viewer-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.viewer-strip img { width: 62px; height: 46px; object-fit: cover; border-radius: 6px; opacity: .55; cursor: pointer; flex-shrink: 0; border: 2px solid transparent; }
.viewer-strip img.active { opacity: 1; border-color: #fff; }

/* ---------- 頁尾 ---------- */
.footer { border-top: 1px solid var(--border); background: #fff; margin-top: 30px; }
.footer-inner { max-width: var(--container); margin: 0 auto; padding: 26px 16px 30px; text-align: center; font-size: 12.5px; color: var(--text-secondary); }
.footer-links { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; margin-bottom: 12px; }
.footer-links a { color: var(--text-secondary); }
.footer-links a:hover { color: var(--accent); }
.footer-brand { font-weight: 800; font-size: 14px; color: var(--accent); letter-spacing: .4px; }
.footer-note { line-height: 1.7; margin-bottom: 8px; max-width: 760px; margin-left: auto; margin-right: auto; }
.footer-copy { letter-spacing: .3px; }

/* ---------- 免責聲明頁 ---------- */
.disclaimer-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 26px 24px; max-width: 900px; margin: 0 auto; }
.disclaimer-card h1 { font-size: 24px; margin-bottom: 6px; }
.disclaimer-card .lead { font-size: 13px; color: var(--text-secondary); margin-bottom: 22px; }
.disclaimer-card h2 { font-size: 16px; margin: 24px 0 10px; padding-left: 10px; border-left: 4px solid var(--accent); }
.disclaimer-card p, .disclaimer-card li { font-size: 14px; line-height: 1.8; color: #33383e; }
.disclaimer-card ul { padding-left: 20px; }
.disclaimer-card li { margin-bottom: 8px; }
.disclaimer-contact { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); font-size: 13.5px; }

/* ---------- 手機等細螢幕 ---------- */
@media (max-width: 767px) {
  .swap { height: 240px; }
  .swap-title { font-size: 18px; }
  .swap-desc { font-size: 12.5px; }
  .swap-btn { padding: 8px 14px; font-size: 12.5px; }
  .swap-arrow { width: 32px; height: 32px; font-size: 17px; }
  .swap-dots { bottom: 10px; right: 10px; }
  .all-view-card { padding: 15px 16px; }
  .all-view-body .t { font-size: 16px; }
  .viewer-arrow { width: 38px; height: 38px; font-size: 20px; }
  .viewer-img { padding: 0; }
  .viewer-strip img { width: 54px; height: 40px; }
  .painter-grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); }
  .works-list { gap: 20px; }
  .work { max-width: 100%; }
  .disclaimer-card { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .swap-slide { transition: none; }
}
