/* ── Viewer page ── */
#page-viewer {
  display: none;
  flex-direction: column;
  height: 100vh;
  padding-top: var(--nav-h);
  overflow: hidden;
}
#page-viewer.active { display: flex; }

.viewer-iframe-wrap { flex: 1; min-height: 0; position: relative; background: #000; }
.viewer-iframe-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: none; display: block; }

/* Hide footer & lock scroll when viewing */
body.viewing footer   { display: none; }
body.viewing          { overflow: hidden; }

/* ── Floating trigger button ── */
#switcher-btn {
  display: none;
  position: fixed; bottom: 1.5rem; left: 1.5rem; z-index: 300;
  background: linear-gradient(135deg, var(--gold), #a8722e);
  color: #000; border: none;
  font-family: 'Inter', sans-serif; font-size: 0.8rem; font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.7rem 1.6rem; border-radius: 30px; cursor: pointer;
  box-shadow: 0 4px 24px rgba(201,168,76,0.5);
  transition: bottom 0.35s cubic-bezier(0.4,0,0.2,1), transform 0.2s, opacity 0.2s;
  white-space: nowrap;
}
#switcher-btn:hover { transform: translateY(-2px); opacity: 0.92; }
body.viewing #switcher-btn { display: block; }

/* ── Share button + menu ── */
#share-wrap {
  display: none;
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 300;
}
body.viewing #share-wrap { display: block; }

#share-btn {
  background: rgba(20,20,20,0.75); backdrop-filter: blur(8px);
  border: 1px solid var(--border); color: var(--text-muted);
  font-family: 'Inter', sans-serif; font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 0.6rem 1.2rem; border-radius: 30px; cursor: pointer;
  transition: border-color 0.2s, color 0.2s, transform 0.2s;
  white-space: nowrap; width: 100%;
}
#share-btn:hover { border-color: var(--gold); color: var(--gold); transform: translateY(-2px); }

#share-menu {
  display: none;
  position: absolute; bottom: calc(100% + 0.6rem); right: 0;
  background: var(--dark2); border: 1px solid var(--border);
  border-radius: 10px; padding: 0.4rem;
  min-width: 160px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: shareMenuIn 0.15s ease;
}
#share-menu.open { display: block; }
@keyframes shareMenuIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.share-option {
  display: flex; align-items: center; gap: 0.6rem;
  width: 100%; background: none; border: none;
  color: var(--text-muted); font-family: 'Inter', sans-serif;
  font-size: 0.8rem; font-weight: 500;
  padding: 0.55rem 0.75rem; border-radius: 6px;
  cursor: pointer; text-align: left; white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}
.share-option:hover { background: var(--dark3); color: var(--text); }

.share-divider {
  height: 1px; background: var(--border); margin: 0.3rem 0.4rem;
}

/* ── Switcher overlay ── */
#switcher-overlay {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 400;
  pointer-events: none;
}
#switcher-scrim { display: none; } /* no dim */

#switcher-panel {
  pointer-events: all;
  background: var(--dark2);
  border-top: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  height: 38vh; min-height: 260px;
  overflow: hidden;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.35s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
}
#switcher-overlay.open #switcher-panel {
  transform: translateY(0);
  opacity: 1;
}

/* Panel header */
.sp-header {
  display: flex; align-items: center; gap: 1rem;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sp-title {
  font-family: 'Playfair Display', serif; font-size: 0.95rem;
  color: var(--text); flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Collection pills */
.sp-pills {
  display: flex; gap: 0.5rem; padding: 0.6rem 1.25rem;
  border-bottom: 1px solid var(--border);
  overflow-x: auto; flex-shrink: 0; scrollbar-width: none;
}
.sp-pills::-webkit-scrollbar { display: none; }
.sp-pill {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-family: 'Inter', sans-serif; font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.07em; text-transform: uppercase;
  padding: 0.3rem 0.9rem; border-radius: 20px;
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  display: flex; align-items: center; gap: 0.4rem;
  transition: all 0.2s;
}
.sp-pill.active { color: #000; font-weight: 700; }
.sp-pill-dot { width: 7px; height: 7px; border-radius: 50%; }

/* Card strip */
.sp-cards {
  display: flex; align-items: center; gap: 0.5rem;
  flex: 1; min-height: 0; padding: 0.75rem;
}
.sp-prev, .sp-next {
  background: none; border: 1px solid var(--border); color: var(--text-muted);
  font-size: 1.3rem; width: 32px; height: 32px; min-width: 32px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all 0.2s;
}
.sp-prev:hover, .sp-next:hover { border-color: var(--gold); color: var(--gold); }
.sp-prev:disabled, .sp-next:disabled { opacity: 0.2; cursor: default; }

.sp-grid {
  display: flex; gap: 0.6rem; flex: 1;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.sp-grid::-webkit-scrollbar { display: none; }

/* Cards */
.sp-card {
  flex: 0 0 auto;
  background: var(--dark3); border: 2px solid transparent; border-radius: 8px;
  overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}
.sp-card:hover { transform: translateY(-2px); }
.sp-card.current { opacity: 0.4; cursor: default; pointer-events: none; }

.sp-card-img {
  position: relative; overflow: hidden;
  background: var(--dark4); flex-shrink: 0;
}
.sp-card-img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.sp-card-icon { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.6rem; }

.sp-card-label { padding: 0.4rem 0.5rem; background: var(--dark2); flex-shrink: 0; min-height: 44px; }
.sp-card-tag  { font-size: 0.55rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 600; margin-bottom: 0.15rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-card-name { font-size: 0.75rem; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }

@media (max-width: 768px) {
  #switcher-panel { height: 45vh; }
}