html, body {
  margin: 0; padding: 0; height: 100%; width: 100%;
  background: var(--background-color, #f5f5f5);
  overflow: hidden;
}
#slider-container {
  position: relative;
  width: 100vw;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100svh;
  height: 100vh;
  padding-left: var(--spread-horizontal-margin);
  padding-right: var(--spread-horizontal-margin);
  box-sizing: border-box;
  /* height will be set by JS */
}
#slidebook {
  display: flex;
  height: 85vh;
  transition: transform 0.4s cubic-bezier(.77,0,.18,1);
  will-change: transform;
}
#slidebook.no-animate {
  transition: none !important;
}
.slide {
  height: 85vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.image-wrapper {
  position: absolute;
  left: 0; top: 0;
  will-change: transform;
  transform-origin: top left;
  /* No transition by default; only on zoom */
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.image-wrapper.zoom-anim {
  transition: transform 0.25s cubic-bezier(.77,0,.18,1);
}
.slide img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  cursor: zoom-in;
  /* Remove transition for transform to avoid weird animation on zoom */
  user-select: none;
  touch-action: none;
  position: absolute;
  left: 0; top: 0;
  z-index: 1;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  -moz-user-select: none;
  -ms-user-select: none;
}
.slide img.zoomed {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  cursor: zoom-out;
}
.slide img.dragging {
  cursor: grabbing !important;
}
.nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: var(--navbar-color, #333);
  color: var(--navbar-icon-color, #fff);
  border: none;
  border-radius: 12px;
  width: 36px;
  height: 56px;
  font-size: 22px;
  cursor: pointer;
  z-index: 100;
  outline: none;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  text-align: center;
  line-height: 0; /* Ensure no extra vertical space */
}
#prevBtn, #nextBtn {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
body:not(.hide-sidebuttons) #prevBtn,
body:not(.hide-sidebuttons) #nextBtn {
  opacity: 1;
  pointer-events: auto;
}
#prevBtn {
  left: 0;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
  border-top-right-radius: 12px;
  border-bottom-right-radius: 12px;
}
#nextBtn {
  right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
  border-top-left-radius: 12px;
  border-bottom-left-radius: 12px;
}
.nav-btn svg {
  display: block;
  margin: 0 auto;
  width: 24px;
  height: 24px;
  color: var(--navbar-icon-color, #fff);
  fill: currentColor;
  stroke: currentColor;
}
.link-overlay {
  position: absolute;
  cursor: pointer;
  z-index: 3;
  opacity: 0; /* Hide by default */
  pointer-events: auto;
}
/* Show overlays if .show-links is set on body */
body.show-links .link-overlay {
  opacity: 1;
}
/* Show on hover/focus/tap (always) */
.link-overlay:hover,
.link-overlay:focus,
.link-overlay:active,
.link-overlay:focus-visible {
  opacity: 1;
}
body:not(.show-links) .link-overlay {
  opacity: 0;
}
@media (hover: hover) and (pointer: fine) {
  body:not(.show-links) .link-overlay:hover {
    opacity: 1;
  }
}
.video-overlay {
  position: absolute;
  z-index: 4;
  background: #000;
  pointer-events: auto;
  overflow: hidden;
}
.video-overlay iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.nav-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 100;
  background: var(--navbar-color, #333);
  padding: 8px;
  justify-content: center;
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
  touch-action: manipulation;
}
.nav-button {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  touch-action: manipulation;
}
.nav-button:hover {
  background: rgba(255, 255, 255, 0.1);
}
.nav-button svg {
  width: 20px;
  height: 20px;
  color: var(--navbar-icon-color, #fff);
  fill: currentColor;
}
body.hide-navbar .nav-bar { display: none !important; }
body.hide-thumbnail-btn #toggleThumbnails { display: none !important; }
body.hide-search-btn #search { display: none !important; }
body.hide-fullscreen-btn #fullscreenToggle { display: none !important; }
/* Search styles */
.search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  display: none;
}
.search-overlay.active {
  display: block;
}
.search-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1000;
  display: none;
  width: min(400px, calc(100% - 40px));
  transition: all 0.3s ease;
}
.search-container.active {
  display: block;
}
.search-container.has-results {
  top: 50%;
  transform: translate(-50%, -50%);
  margin-top: -5vh;
}
.search-box-container {
  background: white;
  display: flex;
  align-items: center;
  height: 50px;
}
.search-box {
  flex: 1;
  padding: 0 15px;
  border: none;
  background: none;
  color: #333;
  font-size: 16px;
  outline: none;
  height: 50px;
  line-height: 50px;
  font-family: 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, 'Liberation Sans', sans-serif;
}
.search-box::placeholder {
  color: rgba(0, 0, 0, 0.4);
}
.search-close {
  width: 50px;
  height: 50px;
  display: none;
  color: #333;
  cursor: pointer;
  font-size: 24px;
  background: none;
  border: none;
  transition: background-color 0.2s;
  padding: 0;
}
.search-close:hover {
  background-color: rgba(0, 0, 0, 0.1);
}
.search-close.active {
  display: flex;
  align-items: center;
  justify-content: center;
}
.search-results {
  background: white;
  margin-top: 5px;
  width: 100%;
  max-height: 45vh;
  overflow-y: auto;
  display: none;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}
.search-results.active {
  display: block;
}
.search-result {
  display: flex;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: background-color 0.2s;
}
.search-result:hover {
  background: rgba(0, 0, 0, 0.05);
}
.search-result img {
  width: 60px;
  height: 60px;
  object-fit: cover;
  margin-right: 15px;
  border-radius: 4px;
}
.search-result-text {
  color: #333;
  font-size: 14px;
  flex: 1;
}
.search-result-text strong {
  color: #000;
  font-size: 16px;
  font-weight: 600;
}
.spinner {
  border: 4px solid #ccc; /* light gray */
  border-top: 4px solid #888; /* darker gray for the spinner effect */
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 1s linear infinite;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  background: none;
  box-shadow: none;
}
@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg);}
  100% { transform: translate(-50%, -50%) rotate(360deg);}
}
/* --- Thumbnail Sidebar Styles --- */
.thumbnail-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  width: 340px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  z-index: 1200;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(0,0,0.2,1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.thumbnail-sidebar.active {
  transform: translateX(0);
}
.thumbnail-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 16px 20px 8px 20px;
  background: #fff;
}
.thumbnail-sidebar-close {
  background: none;
  border: none;
  font-size: 24px;
  color: #888;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.2s;
}
.thumbnail-sidebar-close:hover {
  color: #222;
}
.thumbnail-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 10px 6px 30px 10px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.thumbnail-row {
  display: flex;
  flex-direction: row;
  justify-content: center;
  gap: 0;
  align-items: stretch;
  width: 100%;
}
.thumbnail-row.single-thumb-row {
  justify-content: center;
}
.thumbnail-row .thumbnail-item {
  max-width: 125px;
  width: 100%;
  height: auto;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
.thumbnail-row.single-thumb-row .thumbnail-item {
  max-width: 125px;
}
.thumbnail-item {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 6px;
  padding: 4px;
  transition: background 0.18s;
  flex-direction: column;
}
.thumbnail-img {
  width: 100%;
  height: auto;
  object-fit: contain;
  border-radius: 4px;
  display: block;
  margin-bottom: 6px;
}
.thumbnail-page-label {
  font-size: 14px;
  color: #444;
  text-align: center;
  width: 100%;
  margin: 0;
  padding: 0 0 2px 0;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  user-select: none;
}
@media (max-width: 500px) {
  .thumbnail-sidebar {
    width: 98vw;
    max-width: 98vw;
  }
  .thumbnail-img {
    width: 100%;
    height: 140px;
  }
  .thumbnail-list {
    gap: 8px 4px;
    padding-bottom: 90px;
    scroll-padding-bottom: 80px;
  }
}
.hidden-slide { visibility: hidden !important; }
.spread-wrapper {
  display: flex;
}
.spread-image-container:nth-child(2) {
  margin-left: -1px !important;
}
.spread-wrapper.zoomed {
  cursor: zoom-out;
}
.spread-wrapper.zoomed img {
  cursor: zoom-out !important;
}
.page-shadow {
  box-shadow: 0 8px 32px 0 rgba(0,0,0,0.10), 0 1.5px 6px 0 rgba(0,0,0,0.06);
}
@media (max-width: 900px) {
  .nav-btn {
    width: 42px;
    height: 62px;
    font-size: 22px;
  }
  .nav-btn svg {
    width: 28px;
    height: 28px;
    margin: 0 auto;
    display: block;
  }
}