/* Product catalogue lightbox (used by pdf-lightbox.js) */

html.jb-lightbox-open {
  overflow: hidden;
  padding-right: var(--jb-scrollbar, 0px);
}

.jb-lightbox {
  position: fixed;
  inset: 0;
  width: min(60rem, calc(100vw - 3rem));
  height: calc(100vh - 3rem);
  height: calc(100dvh - 3rem);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 1.25rem;
  background: var(--color-paper, #faf7f2);
  color: #0a4a6b;
  box-shadow: 0 30px 80px rgb(4 28 40 / 0.45);
}

.jb-lightbox[open] {
  display: flex;
  flex-direction: column;
  animation: jb-lightbox-in 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.jb-lightbox::backdrop {
  background: rgb(4 28 40 / 0.65);
  backdrop-filter: blur(6px);
  animation: jb-lightbox-fade 0.25s ease-out;
}

.jb-lightbox.is-closing {
  animation: jb-lightbox-out 0.18s ease-in forwards;
}

.jb-lightbox.is-closing::backdrop {
  animation: jb-lightbox-fade 0.18s ease-in reverse forwards;
}

.jb-lightbox__bar {
  display: flex;
  flex: none;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.75rem 0.75rem 1.5rem;
  border-bottom: 1px solid rgb(10 74 107 / 0.14);
}

.jb-lightbox__title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.jb-lightbox__count {
  flex: none;
  margin-right: auto;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.75;
}

.jb-lightbox__pdf {
  display: inline-flex;
  flex: none;
  align-items: center;
  height: 2.75rem;
  padding: 0 1.125rem;
  border-radius: 999px;
  background: #d92e20;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.3s;
}

.jb-lightbox__close {
  display: grid;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border: 1px solid rgb(10 74 107 / 0.18);
  border-radius: 999px;
  background: #fff;
  color: inherit;
  cursor: pointer;
  transition: background-color 0.3s;
}

@media (hover: hover) {
  .jb-lightbox__pdf:hover { background: #b8261a; }
  .jb-lightbox__close:hover { background: #d5edf4; }
}

.jb-lightbox__pages {
  flex: 1;
  min-height: 0;
  padding: 1.25rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: #e3ecef;
}

.jb-lightbox__page {
  display: block;
  width: 100%;
  max-width: 52rem;
  height: auto;
  margin: 0 auto 1.25rem;
  border-radius: 0.5rem;
  background: #fff;
  box-shadow: 0 2px 14px rgb(4 28 40 / 0.12);
}

.jb-lightbox__page:last-child { margin-bottom: 0; }

.jb-lightbox :focus-visible {
  outline: 3px solid #0a4a6b;
  outline-offset: 2px;
}

.jb-lightbox__pages:focus-visible { outline-offset: -3px; }

/* Phones: use the whole screen */
@media (max-width: 39.99rem) {
  .jb-lightbox {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    border-radius: 0;
  }
  .jb-lightbox__bar { gap: 0.5rem; padding: 0.625rem 0.625rem 0.625rem 1rem; }
  .jb-lightbox__title { font-size: 1rem; }
  .jb-lightbox__pdf { padding: 0 0.875rem; }
  .jb-lightbox__pages { padding: 0.5rem; }
  .jb-lightbox__page { margin-bottom: 0.5rem; }
}

@keyframes jb-lightbox-in {
  from { opacity: 0; transform: translateY(1.5rem) scale(0.92); }
}

@keyframes jb-lightbox-out {
  to { opacity: 0; transform: scale(0.96); }
}

@keyframes jb-lightbox-fade {
  from { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .jb-lightbox,
  .jb-lightbox::backdrop { animation: none !important; }
}
