/* ============================================================
   assets/css/gallery.css
   ============================================================ */

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
  touch-action: none;
}

#viewer { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ── STAGE ── */
#photo-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.photo-img {
  position: absolute; max-width: 100%; max-height: 100%; object-fit: contain;
  transition: opacity 0.4s ease, transform 0.4s ease;
  will-change: opacity, transform;
}
.photo-img.entering-right { transform: translateX(60px);  opacity: 0; }
.photo-img.entering-left  { transform: translateX(-60px); opacity: 0; }
.photo-img.leaving-right  { transform: translateX(-60px); opacity: 0; pointer-events: none; }
.photo-img.leaving-left   { transform: translateX(60px);  opacity: 0; pointer-events: none; }
.photo-img.visible        { transform: translateX(0);     opacity: 1; }

#stage-spinner {
  position: absolute; width: 32px; height: 32px;
  border: 2px solid var(--line); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 0.9s linear infinite; display: none;
}
#stage-spinner.active { display: block; }

/* ── UI OVERLAY ── */
#ui-overlay { position: absolute; inset: 0; pointer-events: none; transition: opacity var(--ui-anim); }
#ui-overlay.hidden { opacity: 0; }
#ui-overlay > * { pointer-events: auto; }

/* ── TOPBAR ── */
#topbar {
  position: absolute; top: 0; left: 0; right: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.75) 0%, transparent 100%);
  display: flex; align-items: center;
  padding: 18px 24px 40px; gap: 16px;
}
.topbar-logo {
  font-family: 'Cormorant Garamond', serif; font-size: 18px; font-weight: 300;
  color: var(--text); letter-spacing: 0.08em; text-decoration: none;
}
.topbar-logo span { color: var(--accent); font-style: italic; }
#topbar-tag {
  font-size: 9px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-dim); padding: 3px 10px;
}
#topbar-counter { font-size: 9px; letter-spacing: 0.15em; color: var(--text-faint); margin-left: auto; }

.icon-btn {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; color: var(--text-dim);
  cursor: pointer; font-size: 15px; flex-shrink: 0;
  transition: color var(--ui-anim), border-color var(--ui-anim), background var(--ui-anim);
}
.icon-btn:hover  { color: var(--text); border-color: var(--line); background: rgba(255,255,255,0.04); }
.icon-btn.active { color: var(--accent); border-color: var(--accent-dim); }

/* ── NAV ARROWS ── */
.nav-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 52px; height: 52px; background: none; border: 1px solid transparent;
  color: rgba(255,255,255,0.35); font-size: 22px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; z-index: 2;
  transition: color var(--ui-anim), border-color var(--ui-anim), background var(--ui-anim);
}
.nav-arrow:hover { color: var(--text); border-color: var(--line); background: rgba(0,0,0,0.4); }
.nav-arrow:disabled { opacity: 0.15; cursor: default; }
#btn-prev { left: 16px; }
#btn-next { right: 16px; }

/* ── BOTTOMBAR ── */
#bottombar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, transparent 100%);
  padding-top: 60px;
}
#photo-info { padding: 0 24px 12px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
#photo-title {
  font-family: 'Cormorant Garamond', serif; font-size: clamp(18px, 3vw, 28px);
  font-weight: 300; letter-spacing: 0.04em; color: var(--text); line-height: 1.1; margin-bottom: 4px;
}
#photo-tags-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.tag-pill {
  font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-dim); padding: 2px 8px;
  cursor: pointer; transition: background var(--ui-anim); text-decoration: none;
}
.tag-pill:hover { background: rgba(200,169,110,0.12); }
.info-right { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }

/* ── THUMB BAR ── */
#thumb-bar-wrap {
  border-top: 1px solid var(--line); background: rgba(0,0,0,0.6);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
  transition: max-height 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
  max-height: 100px;
}
#thumb-bar-wrap.collapsed { max-height: 0; opacity: 0; pointer-events: none; }
#thumb-bar {
  display: flex; gap: 3px; padding: 8px;
  overflow-x: auto; scrollbar-width: thin; scrollbar-color: var(--accent-dim) transparent;
  -webkit-overflow-scrolling: touch;
}
#thumb-bar::-webkit-scrollbar       { height: 2px; }
#thumb-bar::-webkit-scrollbar-track { background: transparent; }
#thumb-bar::-webkit-scrollbar-thumb { background: var(--accent-dim); }
.thumb-item {
  flex-shrink: 0; width: 72px; height: 72px; cursor: pointer;
  position: relative; overflow: hidden; border: 1px solid transparent;
  transition: border-color var(--ui-anim), transform var(--ui-anim);
}
.thumb-item img     { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb-item.active  { border-color: var(--accent); }
.thumb-item:hover   { transform: scale(1.04); }
.thumb-item.active:hover { transform: none; }

/* ── EXIF PANEL ── */
#exif-panel {
  position: absolute; bottom: 0; left: 0;
  width: min(380px, 100vw);
  background: rgba(0,0,0,0.88); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.4,0,0.2,1);
  z-index: 10; pointer-events: auto;
}
#exif-panel.open { transform: translateY(0); }
#exif-panel-header {
  padding: 14px 18px 10px; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}
.exif-panel-title { font-size: 9px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--accent); }
#exif-panel-body  { padding: 0; max-height: 60vh; overflow-y: auto; }
.exif-row   { display: grid; grid-template-columns: 110px 1fr; border-bottom: 1px solid var(--line); }
.exif-key   { padding: 9px 14px; font-size: 8px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-faint); border-right: 1px solid var(--line); display: flex; align-items: center; }
.exif-val   { padding: 9px 14px; font-size: 11px; color: var(--text); letter-spacing: 0.04em; }
.exif-val a { color: var(--accent); text-decoration: none; }
.exif-val a:hover { text-decoration: underline; }
.exif-empty { padding: 24px 18px; font-size: 11px; color: var(--text-faint); letter-spacing: 0.08em; }

/* ── TAG CHOOSER ── */
#tag-chooser {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  z-index: 20; transform: translateY(-20px); opacity: 0; pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
#tag-chooser.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
.tag-chooser-title {
  font-family: 'Cormorant Garamond', serif; font-size: 28px; font-weight: 300;
  letter-spacing: 0.08em; color: var(--text); margin-bottom: 36px;
}
.tag-chooser-grid { display: flex; flex-wrap: wrap; gap: 10px; max-width: 560px; justify-content: center; padding: 0 24px; }
.tag-chooser-item {
  padding: 11px 22px; border: 1px solid var(--line); color: var(--text-dim);
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer;
  transition: all var(--ui-anim); display: flex; align-items: center; gap: 10px;
}
.tag-chooser-item:hover,
.tag-chooser-item.active { border-color: var(--accent); color: var(--accent); background: rgba(200,169,110,0.08); }
.tag-chooser-count { font-size: 8px; color: var(--text-faint); }
.tag-chooser-item.active .tag-chooser-count { color: var(--accent-dim); }
.tag-chooser-all  { margin-top: 10px; width: 100%; display: flex; justify-content: center; }
#tag-chooser-close { position: absolute; top: 24px; right: 24px; }

/* ── KEYBOARD HINT ── */
#keyboard-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-size: 8px; letter-spacing: 0.18em; color: var(--text-faint);
  white-space: nowrap; pointer-events: none;
  opacity: 1; transition: opacity 2s ease;
}
#keyboard-hint.hidden { opacity: 0; }

/* ── EMPTY ── */
#empty-state { display: none; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: var(--text-dim); }
#empty-state.show { display: flex; }
.empty-icon { font-size: 48px; opacity: 0.2; }
.empty-text { font-family: 'Cormorant Garamond', serif; font-size: 22px; font-weight: 300; letter-spacing: 0.06em; }
.empty-sub  { font-size: 10px; letter-spacing: 0.15em; color: var(--text-faint); }

/* ── RESPONSIVE ── */
@media (max-width: 600px) {
  #btn-prev { left: 6px; }
  #btn-next { right: 6px; }
  .nav-arrow { width: 40px; height: 40px; font-size: 18px; }
  #photo-info { flex-direction: column; align-items: flex-start; gap: 8px; }
  .thumb-item { width: 56px; height: 56px; }
}
