/* ============================================================
   嘉義高中管樂社 照片集 — 樣式
   設計語言沿用官網（cysh.band）：暖白紙質底 × 銅金點綴 × 明體標題
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
:root {
  /* 與官網一致的色票 */
  --bg: #faf8f3;
  --bg-soft: #f2eee4;
  --bg-card: #ffffff;
  --ink: #2b2721;
  --ink-dim: #6f6757;
  --gold: #a07c31;
  --gold-soft: #c8a45c;
  --line: #e6dfd0;
  --dark: #17140f;

  --serif: "Noto Serif TC", serif;
  --sans: "Noto Sans TC", sans-serif;
  --latin: "Cormorant Garamond", "Noto Serif TC", serif;

  --ease: cubic-bezier(.22,.61,.36,1);
  --fast: .22s;
  --shadow-sm: 0 1px 2px rgba(43,39,33,.05), 0 4px 12px rgba(43,39,33,.05);
  --shadow-md: 0 2px 4px rgba(43,39,33,.06), 0 12px 32px rgba(43,39,33,.10);

  --topbar-h: 54px;
  --bottomnav-h: calc(56px + env(safe-area-inset-bottom, 0px));
}
html { scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  background: var(--bg); color: var(--ink);
  padding-top: var(--topbar-h);
  -webkit-font-smoothing: antialiased;
}
img { display: block; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
button { font-family: inherit; }
::selection { background: rgba(200,164,92,.3); }

.mobile-only { display: none; }
@media (max-width: 767px) {
  .mobile-only { display: flex; }
  .desktop-only { display: none !important; }
  body { padding-bottom: var(--bottomnav-h); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}

/* ============ 頂部列 ============ */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  background: rgba(250,248,243,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line); height: var(--topbar-h);
  box-shadow: 0 4px 24px rgba(43,39,33,.05);
}
.topbar-inner {
  max-width: 1500px; margin: 0 auto; height: 100%;
  display: flex; align-items: center; gap: 10px; padding: 0 14px;
}
#siteTitle {
  font-family: var(--serif); font-weight: 900; font-size: 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer;
  letter-spacing: .02em;
}
#siteTitle .latin {
  font-family: var(--latin); font-weight: 600; font-size: 13px;
  color: var(--gold); margin-left: 8px; letter-spacing: .18em;
}
#desktopNav { margin-left: auto; display: flex; gap: 4px; }
#desktopNav a {
  padding: 7px 16px; border-radius: 999px; font-size: 15px; color: var(--ink-dim);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
#desktopNav a.active { background: rgba(160,124,49,.12); color: var(--gold); font-weight: 700; }
#desktopNav a:hover { background: var(--bg-soft); color: var(--ink); }
.icon-btn {
  border: 0; background: transparent; cursor: pointer;
  width: 40px; height: 40px; border-radius: 50%; color: inherit;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
  transition: background var(--fast) var(--ease);
}
.icon-btn:hover { background: rgba(43,39,33,.07); }
/* 全站統一的 SVG 圖示樣式 */
.ico-svg {
  width: 22px; height: 22px; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
#i-play path { fill: currentColor; stroke: none; }

/* ============ 底部導覽（手機） ============ */
#bottomNav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(250,248,243,.94); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  height: var(--bottomnav-h); padding-bottom: env(safe-area-inset-bottom, 0px);
}
#bottomNav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; color: var(--ink-dim); height: 56px;
  transition: color var(--fast) var(--ease);
}
#bottomNav a .ico-svg { width: 21px; height: 21px; }
#bottomNav a.active { color: var(--gold); font-weight: 700; }

/* ============ 縮放切換 ============ */
#zoomBar { position: sticky; top: var(--topbar-h); z-index: 40; display: flex; justify-content: center; padding: 10px 0 2px; pointer-events: none; }
.seg {
  display: inline-flex; background: var(--bg-soft); border-radius: 999px; padding: 3px; gap: 2px;
  pointer-events: auto; box-shadow: var(--shadow-sm); border: 1px solid var(--line);
}
.seg button {
  border: 0; background: transparent; padding: 6px 20px; border-radius: 999px;
  font-size: 14px; color: var(--ink-dim); cursor: pointer;
  transition: all var(--fast) var(--ease);
}
.seg button.active { background: var(--bg-card); color: var(--gold); font-weight: 700; box-shadow: var(--shadow-sm); }

/* ============ 內容區 ============ */
#content { max-width: 1500px; margin: 0 auto; padding: 4px 8px 40px; }
/* 檢視切換時的淡入（不阻擋操作，只是視覺柔化） */
#content.fade-in { animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#loading { text-align: center; color: var(--ink-dim); padding: 30px 0; font-size: 14px; }
.spin {
  width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; margin: 0 auto 8px; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 區段（黏著標題 + 照片牆） */
.section-header {
  position: sticky; top: var(--topbar-h); z-index: 30;
  background: rgba(250,248,243,.94); backdrop-filter: blur(8px);
  padding: 12px 6px 8px; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
}
.section-header .sec-date { font-family: var(--serif); font-size: 16px; font-weight: 900; }
.section-header .sec-title { font-size: 14px; color: var(--ink-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.section-header .sec-count { font-size: 12px; color: var(--ink-dim); }
.badge-review { font-size: 11px; color: #8a6414; background: rgba(200,164,92,.18); padding: 2px 8px; border-radius: 999px; }

/* 照片牆（左右切齊的等高排版，排版由 JS 計算） */
.pgrid { }
.prow { display: flex; }
.prow .ph {
  position: relative; overflow: hidden; cursor: pointer; margin: 2px; border-radius: 4px;
  background: var(--bg-soft);
}
.prow .ph img {
  width: 100%; height: 100%; object-fit: cover; opacity: 0;
  transition: opacity .3s var(--ease), transform .25s var(--ease);
}
.prow .ph img.ok { opacity: 1; }
.prow .ph:hover img { transform: scale(1.03); }

/* ============ 相簿卡片 ============ */
.year-header { font-family: var(--serif); font-size: 22px; font-weight: 900; padding: 24px 6px 10px; }
.year-header::after { content: ""; display: block; width: 44px; height: 3px; background: linear-gradient(90deg, var(--gold-soft), var(--gold)); border-radius: 2px; margin-top: 6px; }
.album-grid {
  display: grid; gap: 16px; padding: 0 4px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
@media (min-width: 768px) { .album-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); } }
.album-card { cursor: pointer; }
.album-card .cover {
  aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--bg-soft);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.album-card:hover .cover { box-shadow: var(--shadow-md); transform: translateY(-3px); }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; }
.album-card .a-title { font-size: 14px; font-weight: 700; margin-top: 8px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.album-card .a-meta { font-size: 12px; color: var(--ink-dim); margin-top: 2px; }

/* ============ 人物 ============ */
.people-grid {
  display: grid; gap: 20px 10px; padding: 18px 4px;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
}
@media (min-width: 768px) { .people-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); } }
.person-card { text-align: center; cursor: pointer; }
.person-card .face {
  width: 84px; height: 84px; border-radius: 50%; overflow: hidden; margin: 0 auto;
  background: var(--bg-soft); border: 2px solid var(--line);
  transition: border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.person-card:hover .face { border-color: var(--gold-soft); transform: translateY(-3px); box-shadow: var(--shadow-md); }
.person-card .face img { width: 100%; height: 100%; object-fit: cover; }
.person-card .p-name { font-size: 14px; font-weight: 700; margin-top: 7px; }
.person-card .p-count { font-size: 12px; color: var(--ink-dim); }

/* ============ 子頁標頭 ============ */
#subHeader { max-width: 1500px; margin: 0 auto; padding: 16px 14px 0; }
.sub-title { font-family: var(--serif); font-size: 22px; font-weight: 900; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sub-meta { font-size: 13px; color: var(--ink-dim); margin-top: 4px; }
.sub-avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold-soft); }

/* ============ 搜尋 ============ */
.search-wrap { padding: 14px 6px 4px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--line); border-radius: 14px; padding: 11px 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.search-box:focus-within { border-color: var(--gold-soft); box-shadow: 0 0 0 3px rgba(200,164,92,.22), var(--shadow-sm); }
.search-box input {
  flex: 1; border: 0; background: transparent; font-size: 16px; outline: none; color: var(--ink);
  font-family: var(--sans);
}
.search-hint { font-size: 12px; color: var(--ink-dim); padding: 10px 4px; line-height: 1.7; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 2px; }
.chip {
  border: 1px solid var(--line); background: var(--bg-card); border-radius: 999px;
  padding: 6px 14px; font-size: 13px; cursor: pointer; color: var(--ink);
  transition: all var(--fast) var(--ease);
}
.chip:hover { background: rgba(160,124,49,.1); border-color: var(--gold-soft); color: var(--gold); }

/* ============ 年份捲動條 ============ */
#scrubber {
  position: fixed; right: 0; top: calc(var(--topbar-h) + 40px); bottom: 90px; z-index: 45;
  width: 44px; touch-action: none;
}
@media (max-width: 767px) { #scrubber { bottom: calc(var(--bottomnav-h) + 20px); } }
#scrubberTrack { position: absolute; inset: 0 4px 0 auto; width: 36px; }
/* 可見的軌道線，提示這裡可以拖曳 */
#scrubberTrack::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 15px; width: 2px;
  background: var(--line); border-radius: 1px;
}
.scrub-year {
  position: absolute; right: 2px; font-size: 10px; color: var(--ink-dim);
  background: rgba(250,248,243,.95); border: 1px solid var(--line); border-radius: 6px; padding: 1px 5px;
  user-select: none; font-family: var(--latin); font-weight: 600;
}
/* 捲動時顯示的「目前年份」指示 */
#scrubIndicator {
  position: absolute; right: 38px; transform: translateY(-50%);
  background: var(--bg-card); border: 1px solid var(--gold-soft); color: var(--gold);
  font-family: var(--latin); font-weight: 600; font-size: 13px;
  padding: 3px 12px; border-radius: 999px; box-shadow: var(--shadow-sm);
  pointer-events: none; white-space: nowrap;
  transition: opacity .35s var(--ease); opacity: 1;
}
#scrubIndicator.fading { opacity: 0; }
#scrubberBubble {
  position: absolute; right: 46px; transform: translateY(-50%);
  background: var(--gold); color: #fff; font-size: 15px; font-weight: 700;
  padding: 6px 14px; border-radius: 10px; white-space: nowrap;
  box-shadow: var(--shadow-md); font-family: var(--latin);
}

/* ============ 燈箱 ============ */
#lightbox {
  position: fixed; inset: 0; z-index: 100; background: rgba(15,13,10,.97);
  display: flex; flex-direction: row; /* 電腦版：照片區 + 右側資訊欄 */
  animation: lbIn .22s var(--ease);
}
#lbMain { flex: 1; position: relative; display: flex; min-width: 0; }
.lb-swipe-hint {
  position: absolute; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); left: 50%;
  transform: translateX(-50%);
  color: rgba(255,255,255,.55); font-size: 12px; pointer-events: none;
  animation: hintFade 5s forwards;
}
@keyframes hintFade { 0%,70% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@keyframes lbIn { from { opacity: 0; } to { opacity: 1; } }
/* 照片過場：雙圖層交叉淡化。新照片（.show）淡入時舊照片還在底下，
   看不到黑色空檔；幻燈片模式（.kb）加上緩慢輕微放大 */
.lb-photo {
  position: absolute; inset: 0; margin: auto;
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  opacity: 0; transition: opacity .35s var(--ease);
  user-select: none; -webkit-user-drag: none;
}
.lb-photo.show { opacity: 1; }
.lb-photo.kb { animation: kenburns 4.4s linear .1s forwards; transform-origin: 50% 50%; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.045); } }
#lbTop {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: center; gap: 4px; padding: 6px 8px;
  padding-top: max(6px, env(safe-area-inset-top, 0px));
  background: linear-gradient(rgba(0,0,0,.65), transparent); color: #fff;
}
#lbTop .icon-btn { color: #fff; font-size: 18px; }
#lbTop .icon-btn:hover { background: rgba(255,255,255,.15); }
#lbCounter { font-size: 13px; opacity: .85; margin-left: 4px; font-family: var(--latin); }
.lb-spacer { flex: 1; }
#lbStage {
  flex: 1; display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; position: relative;
}
.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  border: 0; background: rgba(0,0,0,.35); color: #fff;
  width: 52px; height: 52px; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--fast) var(--ease);
}
.lb-arrow .ico-svg { width: 26px; height: 26px; stroke-width: 2.2; }
.lb-arrow:hover { background: rgba(160,124,49,.75); }
#lbPrev { left: 14px; } #lbNext { right: 14px; }
/* 資訊欄：手機＝底部上滑面板；電腦＝右側固定欄（照 Google Photos 的做法） */
#lbPanel {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 6;
  background: rgba(23,20,15,.94); backdrop-filter: blur(10px); color: #ece5d8;
  padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
  max-height: 55%; overflow-y: auto; border-radius: 16px 16px 0 0;
  font-size: 14px; line-height: 1.8;
  animation: panelIn .25s var(--ease);
}
@keyframes panelIn { from { transform: translateY(30%); opacity: 0; } to { transform: none; opacity: 1; } }
@media (min-width: 768px) {
  #lbPanel {
    position: static; width: 360px; max-height: none; height: 100%;
    border-radius: 0; border-left: 1px solid rgba(255,255,255,.1);
    padding: 60px 22px 22px; flex: 0 0 360px;
    animation: panelInSide .25s var(--ease);
  }
  @keyframes panelInSide { from { margin-right: -80px; opacity: 0; } to { margin-right: 0; opacity: 1; } }
}
/* 手機面板頂部的拖曳提示橫條 */
#lbPanel::before {
  content: ""; display: block; width: 40px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,.3); margin: 0 auto 12px;
}
@media (min-width: 768px) { #lbPanel::before { display: none; } }
#lbPanel h3 { font-size: 12px; color: var(--gold-soft); margin: 12px 0 4px; font-weight: 700; letter-spacing: .08em; }
#lbPanel .cap { font-size: 15px; font-family: var(--serif); }
#lbPanel .tag-chip, #lbPanel .pp-chip {
  display: inline-block; background: rgba(255,255,255,.1); border-radius: 999px;
  padding: 3px 12px; margin: 3px 4px 0 0; font-size: 13px; cursor: pointer;
  transition: background var(--fast) var(--ease);
}
#lbPanel .tag-chip:hover, #lbPanel .pp-chip:hover { background: rgba(200,164,92,.35); }
#lbPanel .pp-chip {
  background: rgba(160,124,49,.4);
  display: inline-flex; align-items: center; gap: 7px;
  padding: 3px 12px 3px 4px;
}
#lbPanel .pp-chip .pp-face {
  width: 26px; height: 26px; border-radius: 50%; object-fit: cover;
  border: 1px solid rgba(255,255,255,.25); display: block;
}
#lbPanel a.alb-link { color: var(--gold-soft); }
#lbToast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%); z-index: 7;
  background: rgba(250,248,243,.97); color: var(--ink); font-size: 14px;
  padding: 8px 18px; border-radius: 999px; box-shadow: var(--shadow-md);
}

/* 空狀態 */
.empty { text-align: center; color: var(--ink-dim); padding: 60px 20px; font-size: 15px; line-height: 2; }
.empty .big { font-size: 40px; }
