/* ============================================================
   NBC 113th Annual Convention Gallery — Stylesheet
   Fonts: Playfair Display (headings) + DM Sans (body)
   Theme: Deep Burgundy · Gold · Near-Black
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;600;700&family=DM+Sans:wght@300;400;500;600&display=swap');

/* ── Custom Properties ─────────────────────────────────────── */
:root {audio-bar-inner
  --burgundy:      #273171;
  --burgundy-dk:   #181F47;
  --burgundy-lt:   #3A4594;
  --gold:          #C4963A;
  --gold-lt:       #E0B85A;
  --gold-dim:      #7A5A1E;

  --bg:            #0E0E0E;
  --surface:       #161616;
  --surface2:      #1F1F1F;
  --surface3:      #2A2A2A;
  --border:        rgba(255,255,255,0.07);
  --border-gold:   rgba(196,150,58,0.25);

  --text:          #F2EDE8;
  --text-muted:    #9A948E;
  --text-faint:    #5A5450;

  --sidebar-w:     280px;
  --header-h:      56px;
  --transition:    0.25s ease;
  --radius:        8px;
  --radius-lg:     14px;

  --font-display:  'Playfair Display', Georgia, serif;
  --font-body:     'DM Sans', system-ui, sans-serif;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  /* Use min-height instead of height to avoid mobile browser chrome clipping */
  min-height: 100vh;
  min-height: 100dvh;
  /* overflow:hidden on body breaks mobile scroll in some browsers — moved to #nbc-app */
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
ul, ol { list-style: none; }

/* ── Layout ────────────────────────────────────────────────── */
#nbc-app {
  display: flex;
  height: 100vh;
  height: 100dvh;          /* modern mobile browsers respect dynamic viewport height */
  width: 100vw;
  overflow: hidden;        /* scroll happens inside #nbc-main; moved from body */
  position: relative;
}

/* ── Sidebar ───────────────────────────────────────────────── */
#nbc-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  z-index: 100;
  transition: transform var(--transition);
  /* Ensure sidebar doesn't shrink on desktop */
  flex-shrink: 0;
}

/* Gold accent line on right edge */
#nbc-sidebar::after {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 2px; height: 100%;
  background: linear-gradient(to bottom, transparent, var(--gold-dim), transparent);
}

/* ── Sidebar Brand ──────────────────────────── */
.sidebar-brand {
  padding: 24px 20px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.sidebar-brand img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.brand-text h1 {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--gold-lt);
  letter-spacing: 0.01em;
}

.brand-text p {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 2px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* ── Convention badge ───────────────────────── */
.convention-badge {
  margin: 12px 16px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(39,49,113,0.3), rgba(24,31,71,0.2));
  border: 1px solid var(--border-gold);
  border-radius: var(--radius);
  flex-shrink: 0;
}

.convention-badge .badge-year {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gold);
  line-height: 1;
}

.convention-badge .badge-title {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 3px;
}

.convention-badge .badge-loc {
  font-size: 0.72rem;
  color: var(--text);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.convention-badge .badge-loc i {
  color: var(--burgundy-lt);
  font-size: 0.65rem;
}

/* ── Sidebar Navigation ─────────────────────── */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  /* Allow proper scroll on iOS — critical fix */
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 10px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}

.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* Special item (Night of Wonders) */
.special-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  margin: 4px 10px;
  border-radius: var(--radius);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--gold-lt);
  background: linear-gradient(90deg, rgba(196,150,58,0.08), transparent);
  border: 1px solid rgba(196,150,58,0.18);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  /* Proper touch target size */
  min-height: 44px;
}

.special-link:hover, .special-link.active {
  background: linear-gradient(90deg, rgba(196,150,58,0.2), rgba(196,150,58,0.06));
  color: var(--gold);
  border-color: rgba(196,150,58,0.4);
}

.special-link .special-icon {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(196,150,58,0.15);
  border-radius: 50%;
  font-size: 0.65rem;
  color: var(--gold);
  flex-shrink: 0;
}

.special-note {
  font-size: 0.6rem;
  color: var(--text-faint);
  display: block;
  margin-left: 32px;
  margin-bottom: 4px;
  padding: 0 10px;
  font-style: italic;
}

.nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 16px;
}

.nav-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  padding: 8px 20px 4px;
}

/* Day toggle button */
.day-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 12px);
  padding: 9px 16px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  border-radius: var(--radius);
  margin: 1px 6px;
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  text-align: left;
  /* Proper touch target */
  min-height: 44px;
}

.day-toggle:hover {
  background: var(--surface2);
  color: var(--text);
}

.day-toggle.has-active-child {
  color: var(--gold-lt);
}

.day-icon {
  width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface3);
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: var(--font-display);
}

.day-toggle.has-active-child .day-icon {
  background: var(--burgundy-dk);
  color: var(--gold-lt);
}

.day-label { flex: 1; }

.toggle-icon {
  font-size: 0.65rem;
  color: var(--text-faint);
  transition: transform 0.2s ease;
  flex-shrink: 0;
}

.toggle-icon.rotated { transform: rotate(180deg); }

/* Submenu */
.day-submenu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.session-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px 7px 44px;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-radius: var(--radius);
  margin: 1px 6px;
  width: calc(100% - 12px);
  transition: background var(--transition), color var(--transition);
  cursor: pointer;
  position: relative;
  /* Adequate touch target */
  min-height: 40px;
}

.session-link::before {
  content: '';
  position: absolute;
  left: 30px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--surface3);
  transition: background var(--transition);
}

.session-link:hover {
  background: var(--surface2);
  color: var(--text);
}

.session-link:hover::before { background: var(--text-muted); }

.session-link.active {
  color: var(--gold);
  background: rgba(39,49,113,0.2);
  border-right: 2px solid var(--burgundy-lt);
}

.session-link.active::before { background: var(--gold); }

/* ── Sidebar Footer ─────────────────────────── */
.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.sidebar-social a {
  width: 34px; height: 34px;      /* slightly larger for touch */
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--surface2);
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.sidebar-social a:hover { transform: translateY(-2px); }
.sidebar-social a.yt:hover  { background: #ff0000; color: #fff; }
.sidebar-social a.fb:hover  { background: #1877f2; color: #fff; }
.sidebar-social a.ig:hover  { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%,#d6249f 60%,#285AEB 90%); color: #fff; }
.sidebar-social a.x:hover   { background: #000; color: #fff; border: 1px solid #333; }
.sidebar-social a.tt:hover  { background: #010101; color: #fff; }

.sidebar-copy {
  text-align: center;
  font-size: 0.62rem;
  color: var(--text-faint);
}

.sidebar-copy a { color: var(--gold-dim); transition: color var(--transition); }
.sidebar-copy a:hover { color: var(--gold); }

/* ── Main Content ──────────────────────────────────────────── */
#nbc-main {
  flex: 1;
  min-width: 0;               /* prevents flex child from overflowing */
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--surface3) transparent;
}

#nbc-main::-webkit-scrollbar { width: 6px; }
#nbc-main::-webkit-scrollbar-track { background: transparent; }
#nbc-main::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 4px; }

/* ── Mobile Header ─────────────────────────────────────────── */
#mobile-header {
  display: none;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 90;
  flex-shrink: 0;
}

#mobile-header img {
  width: 32px; height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

#mobile-header .mobile-title {
  flex: 1;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold-lt);
  /* Prevent long title from overflowing */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Hamburger */
#nav-toggle {
  width: 44px; height: 44px;   /* proper touch target */
  display: flex; flex-direction: column;
  justify-content: center;
  align-items: center; gap: 5px;
  background: var(--surface2);
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
}

#nav-toggle span {
  display: block;
  width: 18px; height: 2px;
  background: var(--text-muted);
  border-radius: 2px;
  transition: all 0.25s ease;
  transform-origin: center;
}

#nav-toggle.open span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
#nav-toggle.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
#nav-toggle.open span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* Overlay */
#sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;               /* above main content, below sidebar (200) */
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

#sidebar-overlay.visible { display: block; }

/* ── Scroll Progress Bar ───────────────────────────────────── */
#scroll-progress {
  position: sticky;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--burgundy), var(--gold));
  z-index: 200;
  transition: width 0.1s linear;
  flex-shrink: 0;
}

/* ── Gallery Wrapper ───────────────────────────────────────── */
#gallery-content {
  flex: 1;
  padding: 32px 28px 48px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* ── Gallery Header ─────────────────────────── */
.gallery-header {
  margin-bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  padding-bottom: 20px;
}

.gallery-header-left {
  min-width: 0;               /* allow text to shrink and truncate */
  flex: 1;
}

.gallery-header-left .pre-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--burgundy-lt);
  margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
  /* Wrap gracefully on small screens */
  flex-wrap: wrap;
  line-height: 1.5;
}

.gallery-header-left .pre-label::after {
  content: '';
  flex: 1;
  max-width: 40px;
  height: 1px;
  background: var(--burgundy-lt);
}

.gallery-header-left h2 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  /* Prevent overflow */
  word-break: break-word;
  overflow-wrap: anywhere;
}

.gallery-header-right {
  flex-shrink: 0;
}

.gallery-header-right #image-count {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: var(--surface2);
  padding: 5px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  white-space: nowrap;
}

/* ── Gallery Grid ───────────────────────────── */
#gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  min-height: 200px;
}

/* ── Gallery Item ───────────────────────────── */
.gallery-item {
  background: var(--surface2);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  opacity: 0;
  transform: translateY(16px);
}

.gallery-item.animate-in {
  transition: opacity 0.35s ease, transform 0.35s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.gallery-item.animate-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Only apply hover transforms on non-touch devices */
@media (hover: hover) {
  .gallery-item:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(0,0,0,0.4);
    border-color: var(--border-gold);
  }
}

/* Thumbnail link */
.gallery-thumb {
  display: block;
  position: relative;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--surface3);
}

.gallery-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

@media (hover: hover) {
  .gallery-item:hover .gallery-thumb img {
    transform: scale(1.05);
  }
}

/* Hover overlay */
.thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.25s ease;
}

@media (hover: hover) {
  .gallery-item:hover .thumb-overlay {
    background: rgba(0,0,0,0.35);
  }
}

/* Always show zoom icon on touch devices */
@media (hover: none) {
  .thumb-overlay {
    background: rgba(0,0,0,0.15);
  }
}

.zoom-icon {
  width: 40px; height: 40px;
  background: rgba(255,255,255,0.15);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  transform: scale(0.7);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

@media (hover: hover) {
  .gallery-item:hover .zoom-icon {
    opacity: 1;
    transform: scale(1);
  }
}

/* Show zoom icon on touch devices */
@media (hover: none) {
  .zoom-icon {
    opacity: 1;
    transform: scale(1);
    background: rgba(0,0,0,0.3);
  }
}

/* Item footer */
.item-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-top: 1px solid var(--border);
}

.item-name {
  flex: 1;
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

/* ── View / Expand button (replaces download) ── */
.btn-view {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface3);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), transform var(--transition);
}

.btn-view:hover {
  background: var(--burgundy);
  color: #fff;
  transform: scale(1.1);
}

/* ── Skeleton Screens ───────────────────────── */
.gallery-item.skeleton {
  opacity: 1;
  transform: none;
  pointer-events: none;
}

.skeleton-img {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--surface3);
  border-radius: 0;
}

.skeleton-line {
  height: 10px;
  background: var(--surface3);
  border-radius: 100px;
  flex: 1;
}

.skeleton-btn {
  width: 28px; height: 28px;
  background: var(--surface3);
  border-radius: 6px;
  flex-shrink: 0;
}

@keyframes shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}

.shimmer {
  background: linear-gradient(
    90deg,
    var(--surface3)    0%,
    var(--surface2)   40%,
    var(--surface3)  100%
  );
  background-size: 800px 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

/* ── Empty State ────────────────────────────── */
#gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
}

#gallery-empty.hidden { display: none; }

#gallery-empty .empty-icon {
  font-size: 2.5rem;
  color: var(--text-faint);
  margin-bottom: 14px;
}

#gallery-empty p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ── Error State ────────────────────────────── */
#gallery-error {
  margin: 20px 0;
  padding: 16px 20px;
  background: rgba(39,49,113,0.15);
  border: 1px solid rgba(39,49,113,0.4);
  border-radius: var(--radius);
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

#gallery-error.hidden { display: none; }

#gallery-error .error-icon {
  color: var(--burgundy-lt);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 2px;
}

#gallery-error h4 {
  font-size: 0.9rem;
  color: var(--text);
  margin-bottom: 4px;
}

#gallery-error #error-message {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Pagination ─────────────────────────────── */
#gallery-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-top: 36px;
  flex-wrap: wrap;
  /* Allow pagination to breathe on small screens */
  padding: 0 4px;
}

.page-btn {
  min-width: 36px;
  height: 36px;
  padding: 0 8px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: var(--font-body);
  transition: background var(--transition), color var(--transition), border-color var(--transition), transform var(--transition);
  /* Touch target */
  min-height: 36px;
}

.page-btn:hover:not(.disabled):not(.active) {
  background: var(--surface3);
  color: var(--text);
  border-color: var(--border-gold);
  transform: translateY(-1px);
}

.page-btn.active {
  background: var(--burgundy);
  border-color: var(--burgundy-lt);
  color: #fff;
  font-weight: 600;
  cursor: default;
}

.page-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.page-ellipsis {
  color: var(--text-faint);
  padding: 0 2px;
  font-size: 0.82rem;
}

/* ── Footer ────────────────────────────────── */
#gallery-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px 20px;
  text-align: center;
  flex-shrink: 0;
}

.footer-logo-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.footer-logo-row img {
  width: 36px; height: 36px;
  object-fit: contain;
  flex-shrink: 0;
}

.footer-logo-row h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--gold-lt);
}

.footer-logo-row h3 span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 400;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.footer-social {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 14px 0;
  flex-wrap: wrap;
}

.footer-social a {
  width: 36px; height: 36px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  transition: all var(--transition);
}

.footer-social a:hover { transform: translateY(-2px); }
.footer-social a.yt:hover  { background: #ff0000; color: #fff; border-color: transparent; }
.footer-social a.fb:hover  { background: #1877f2; color: #fff; border-color: transparent; }
.footer-social a.ig:hover  { background: #e1306c; color: #fff; border-color: transparent; }
.footer-social a.x:hover   { background: #111;    color: #fff; border-color: #444; }
.footer-social a.tt:hover  { background: #010101; color: #fff; border-color: transparent; }

.footer-copy {
  font-size: 0.7rem;
  color: var(--text-faint);
  line-height: 1.7;
}

.footer-copy a { color: var(--gold-dim); transition: color var(--transition); }
.footer-copy a:hover { color: var(--gold); }

/* ── Back-to-top ────────────────────────────── */
#back-to-top {
  position: fixed;
  bottom: 20px; right: 16px;
  width: 44px; height: 44px;   /* meets minimum 44px touch target */
  background: var(--burgundy);
  border: 1px solid var(--burgundy-lt);
  border-radius: 50%;
  color: #fff;
  font-size: 0.8rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  opacity: 0; visibility: hidden;
  transform: translateY(10px);
  transition: all var(--transition);
  z-index: 80;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

#back-to-top.visible {
  opacity: 1; visibility: visible;
  transform: translateY(0);
}

#back-to-top:hover {
  background: var(--burgundy-lt);
  transform: translateY(-2px);
}

/* ── Fancybox overrides ─────────────────────── */
.fancybox__container {
  --fancybox-bg: rgba(0,0,0,0.96);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE BREAKPOINTS
   ───────────────────────────────────────────────────────────── */

/* ── Large tablets / small laptops ─────────── */
@media (max-width: 1100px) {
  #gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Tablets ────────────────────────────────── */
@media (max-width: 900px) {
  #gallery-grid { grid-template-columns: repeat(2, 1fr); }

  #gallery-content { padding: 24px 20px 40px; }
}

/* ── Mobile breakpoint (sidebar becomes a drawer) ── */
@media (max-width: 700px) {
  /* Show mobile header */
  #mobile-header { display: flex; }
  
  /* Switch app shell to vertical stack */
  #nbc-app {
    flex-direction: column;
  }

  /* Sidebar becomes a fixed off-canvas drawer */
  #nbc-sidebar {
    position: fixed;          /* pulls it OUT of flex flow entirely */
    left: 0;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: min(var(--sidebar-w), 85vw);
    min-width: unset;         /* ← critical: overrides the desktop min-width */
    z-index: 200;
    transform: translateX(-110%);
    will-change: transform;
    box-shadow: none;
  }

  #nbc-sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,0.6);
  }

  /* Main takes full width since sidebar is out of flow */
  #nbc-main {
    flex: 1;
    width: 100%;
    height: calc(100vh - var(--header-h));
    height: calc(100dvh - var(--header-h));
    margin-left: 0;
  }

  /* Gallery content padding */
  #gallery-content { padding: 16px 14px 40px; }

  /* Gallery header: stack on very limited widths */
  .gallery-header {
    margin-bottom: 20px;
    padding-bottom: 16px;
    gap: 8px;
  }

  .gallery-header-left h2 { font-size: 1.25rem; }

  .gallery-header-left .pre-label {
    font-size: 0.6rem;
    letter-spacing: 0.08em;
  }

  /* 2-column grid on mobile */
  #gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  /* Pagination: smaller buttons on mobile */
  .page-btn {
    min-width: 32px;
    height: 34px;
    font-size: 0.78rem;
  }

  /* Back-to-top: move up above potential browser chrome */
  #back-to-top {
    bottom: env(safe-area-inset-bottom, 16px);
    bottom: max(16px, env(safe-area-inset-bottom));
    right: 14px;
  }

  /* Footer adjustments */
  #gallery-footer { padding: 20px 14px; }
}

/* ── Small phones (≤ 480px) ─────────────────── */
@media (max-width: 480px) {
  :root {
    --header-h: 52px;
  }

  #gallery-content { padding: 14px 12px 36px; }

  /* Gallery header: force stack */
  .gallery-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .gallery-header-left h2 { font-size: 1.1rem; }

  /* Image count pill: align to left when stacked */
  .gallery-header-right { align-self: flex-start; }

  /* Still 2 columns at 480 if space allows */
  #gallery-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  /* Mobile title: shorter */
  #mobile-header .mobile-title { font-size: 0.78rem; }

  /* Pagination: tighter */
  #gallery-pagination { gap: 4px; }
  .page-btn { min-width: 30px; height: 32px; font-size: 0.75rem; padding: 0 6px; }

  .footer-copy { font-size: 0.65rem; }
}

/* ── Extra-small phones (≤ 380px) ──────────── */
@media (max-width: 380px) {
  #gallery-grid {
    grid-template-columns: 1fr;     /* single column on the smallest phones */
    gap: 8px;
  }

  .gallery-header-left h2 { font-size: 1rem; }

  /* Brand text truncation inside narrow drawer */
  .brand-text h1 { font-size: 0.78rem; }
  .brand-text p  { font-size: 0.62rem; }
}

/* ── Safe-area insets (notched phones, iPhone) ── */
@supports (padding: env(safe-area-inset-left)) {
  #mobile-header {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  #nbc-sidebar {
    padding-bottom: env(safe-area-inset-bottom);
  }

  #gallery-content {
    padding-left: max(14px, env(safe-area-inset-left));
    padding-right: max(14px, env(safe-area-inset-right));
  }
}

/* ── Print ──────────────────────────────────── */
@media print {
  #nbc-sidebar, #mobile-header, #back-to-top { display: none !important; }
  #nbc-main { height: auto; overflow: visible; }
  #nbc-app  { height: auto; overflow: visible; }
  body { overflow: visible; }
  #gallery-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ── Content Protection ────────────────────────────────────── */

/* Prevent image selection and long-press save on all devices */
#gallery-grid img,
.fancybox__image {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-touch-callout: none;   /* iOS long-press save sheet */
  pointer-events: none;          /* blocks right-click and touch-hold on images */
}

/* Re-enable pointer events on the anchor wrapper so clicks/taps still open lightbox */
.gallery-thumb {
  pointer-events: auto;
}

/* Disable text/element selection across the whole gallery */
#nbc-app {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
}

/* Watermark overlay — visible only in print / OS screenshot (some environments) */
#gallery-grid::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 60px,
    rgba(39,49,113,0.04) 60px,
    rgba(39,49,113,0.04) 120px
  );
  z-index: 9999;
  display: none;
}

/* ── Permanent lightbox watermark ─────────────────────────────────────────── */
/*
   Injected into <body> by injectLightboxWatermark() when Fancybox opens.
   z-index sits above the image layer but below Fancybox toolbar (99999+).
*/
#fb-watermark {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99990;
  /*opacity: 0.2;*/
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='160'%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='Georgia%2Cserif' font-size='13' fill='%23ffffff' opacity='0.25' transform='rotate(-25 210 80)'%3ENBC 113th Annual Convention 2026%3C%2Ftext%3E%3C%2Fsvg%3E");
  background-repeat: repeat;
}

/* ── Thumbnail grid watermark (always-on) ──────────────────────────────────── */
/*
   .gallery-thumb is already position:relative, so ::after sits over the image.
   pointer-events:none lets clicks pass through to the anchor.
*/
.gallery-thumb::after {
  content: 'NBC 2026';
  position: absolute;
  bottom: 7px;
  right: 9px;
  font-size: 0.5rem;
  font-family: var(--font-body);
  font-weight: 500;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.95);
  pointer-events: none;
  z-index: 3;
  white-space: nowrap;
}

@media print {
  /* Black-out the entire gallery on print/PDF */
  #gallery-grid,
  #gallery-content,
  .fancybox__container {
    filter: blur(20px) brightness(0.1) !important;
  }
  #gallery-grid::after {
    display: block;
  }
}

/* ── Audio Slideshow Bar ────────────────────────────────────────────────── */
#nbc-audio-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 99999;
  background: linear-gradient(135deg, var(--burgundy-dk) 0%, var(--burgundy) 100%);
  border-top: 1px solid var(--border-gold);
  padding: 10px 20px;
  box-shadow: 0 -6px 28px rgba(0,0,0,0.55);
  transition: transform 0.35s cubic-bezier(.4,0,.2,1), opacity 0.35s ease;
}

#nbc-audio-bar.nbc-audio-hidden {
  transform: translateY(110%);
  opacity: 0;
  pointer-events: none;
}

/* Nudge main content up when bar is visible so footer isn't hidden */
#nbc-audio-bar:not(.nbc-audio-hidden) ~ * #nbc-main,
body:has(#nbc-audio-bar:not(.nbc-audio-hidden)) #nbc-main {
  padding-bottom: 68px;
}

.audio-bar-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 900px;
  margin: 0 auto;
  flex-wrap: wrap;
}

.audio-bar-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold-lt);
  white-space: nowrap;
  margin-right: 4px;
}

.audio-bar-icon {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(196,150,58,0.2);
  border-radius: 50%;
  color: var(--gold);
  font-size: 0.7rem;
  animation: audio-pulse 2s ease-in-out infinite;
}

@keyframes audio-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(196,150,58,0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(196,150,58,0); }
}

.audio-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  flex-shrink: 0;
}

.audio-btn--sm {
  width: 32px; height: 32px;
  font-size: 0.78rem;
}

.audio-btn--ghost {
  background: transparent;
  border-color: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.5);
}

.audio-btn:hover { background: rgba(255,255,255,0.22); transform: scale(1.1); }
.audio-btn.is-playing {
  background: var(--gold);
  border-color: var(--gold-lt);
  color: var(--burgundy-dk);
}

.audio-volume-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.volume-track { display: flex; align-items: center; }

#audio-bar-volume {
  -webkit-appearance: none;
  appearance: none;
  width: 88px;
  height: 3px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  accent-color: var(--gold);
}

#audio-bar-volume::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--gold-lt);
  box-shadow: 0 0 4px rgba(196,150,58,0.5);
}

#audio-bar-volume::-moz-range-thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid var(--gold-lt);
}

.audio-speed-group {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.audio-speed-label {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.5);
  white-space: nowrap;
}

#audio-bar-speed {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  color: #fff;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-family: var(--font-body);
  cursor: pointer;
  outline: none;
}

#audio-bar-speed option { background: var(--burgundy-dk); color: #fff; }

/* Slideshow button in Fancybox toolbar */
.nbc-slideshow-btn.is-playing { color: var(--gold, #C4963A) !important; }

/* ── Screenshot Protection ──────────────────────────────────────────────── */

/* Watermark overlay — invisible normally, revealed on print */
#gallery-screenshot-guard {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99998;
  opacity: 0;
  transition: opacity 0.08s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='320' height='140'%3E%3Ctext x='50%25' y='50%25' dominant-baseline='middle' text-anchor='middle' font-family='Georgia%2Cserif' font-size='13' fill='%23ffffff' opacity='0.9' transform='rotate(-28 160 70)'%3ENBC 113th Annual Convention 2026%3C/text%3E%3C/svg%3E");
  background-repeat: repeat;
}

/* Blur + reveal watermark when window loses focus while lightbox is open */
#gallery-screenshot-guard.guard-active { opacity: 0.85; }

/* On print / PDF export — full blackout */
@media print {
  #gallery-grid,
  #gallery-content,
  .fancybox__container {
    filter: blur(20px) brightness(0.05) !important;
  }
  #gallery-screenshot-guard {
    opacity: 1 !important;
    background-color: rgba(0,0,0,0.95) !important;
  }
  #nbc-audio-bar { display: none !important; }
}

/* Mobile audio bar: compact layout */
@media (max-width: 600px) {
  .audio-bar-label { display: none; }
  .audio-speed-group { margin-left: 0; }
  #audio-bar-volume { width: 64px; }
  #nbc-audio-bar { padding: 8px 14px; }
}