/* Navbar name: max 25 chars with ellipsis (inline-block required for max-width) */
.text-truncate-25ch {
  max-width: 25ch;
  min-width: 0; /* allow shrink inside flex (nav-link) */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* Card hover effects */
.card.active:hover h4 {
  color: var(--casals-secondary-800) !important;
  text-decoration: underline;
}
.card.active:hover p {
  text-decoration: underline;
}
.card.active:hover .card-img-top {
  transform: translate(-5px, -5px) scale(1.1);
  transition: transform 0.3s ease;
}

.card .card-img-top {
  transition: transform 0.3s ease;
}

.card.active:hover span.border {
  border-color: #999 !important;
  transition: border-color 0.3s ease;
}

.card span.border {
  transition: border-color 0.3s ease;
}

/* Card badge spans on one line (supports multiple spans per card); reserve height when empty */
.card-badges {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  height: 2rem;
}

/* Limit h4 text in cards to 36 characters with ellipsis (multi-line) */
.card h4 {
  width: 100%;
  max-width: 36ch;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
  word-break: break-word;
}
/* Limit h4 text in cards to 36 characters with ellipsis (multi-line); reserve space for 3 lines */
.card p,
.card ol {
  width: 100%;
  max-width: 70ch;
  display: -webkit-box !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  overflow: hidden;
  text-overflow: ellipsis;
  word-wrap: break-word;
  word-break: break-word;
  min-height: 4.5em;
}

/* Book card hover effects */
.book-card {
  transition:
    background-color 0.3s ease,
    border-color 0.3s ease;
  box-shadow: -2px 2px 6px 0px #00000040 !important;
}

.book-card img {
  box-shadow: -2px 3px 8px 0px #0000004d !important;
}

.book-card:hover {
  color: var(--casals-primary-text-800);
  background-color: var(--casals-primary-800) !important;
  border-color: var(--casals-primary-800) !important;
  cursor: pointer;
}

.book-card:hover h6 {
  color: var(--casals-primary-text-800) !important;
  text-decoration: underline;
  transition:
    color 0.3s ease,
    text-decoration 0.3s ease;
}

.book-card:hover p {
  color: var(--casals-primary-text-800) !important;
  transition: color 0.3s ease;
}

.book-card h6 {
  transition:
    color 0.3s ease,
    text-decoration 0.3s ease;
}

.book-card p {
  transition: color 0.3s ease;
}

.book-card img {
  transition: transform 0.3s ease;
}

.book-card:hover img {
  transform: scale(1.25);
}
.btn-credits-container {
  padding: 1px;
  color: var(--casals-primary-text-800);
  background-color: var(--casals-primary-800);
}
.btn-credits {
  border-width: 1px !important;
  border-color: transparent !important;
}
.btn-credits:hover {
  color: var(--casals-primary-text-200);
  background-color: var(--casals-primary-200) !important;
  border-color: var(--casals-primary-800) !important;
  text-decoration: underline;
}
.credits-panel {
  width: 500px;
  max-width: min(4580px, calc(100vw - 2rem));
  max-height: 80vh;
  z-index: 50;
  opacity: 0;
  top: 130px !important;
  left: calc(50% - 330px) !important;
  display: none !important;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
}
.credits-panel p {
  font-size: 14px;
  font-weight: 300;
  text-align: start;
}
body.credits-panel-open .credits-panel {
  opacity: 1;
  display: block !important;
  visibility: visible;
  pointer-events: auto;
}

.credits-panel-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  font-size: 1.5rem;
  line-height: 1;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.credits-panel-close:hover {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.credits-footer-btn:hover {
  background-color: rgba(255, 255, 255, 0.1);
  border-color: #fff;
  color: #fff;
}

.credits-footer-btn:focus svg,
.credits-footer-btn:focus path,
.credits-footer-btn:focus-visible svg,
.credits-footer-btn:focus-visible path {
  fill: #000 !important;
}

/* Register button hover */
.btn-register:hover {
  background-color: transparent !important;
  color: var(--casals-grey-50) !important;
  text-decoration: underline;
  border-color: var(--casals-cyan-500) !important;
  border-width: 1px !important;
}

/* Login button hover */
.btn-login:hover {
  background-color: var(--casals-cyan-500) !important;
  color: var(--casals-black) !important;
  text-decoration: underline;
  border-color: transparent !important;
}
.btn-solicitar:hover {
  background-color: var(--casals-cyan-500) !important;
  color: var(--casals-white) !important;
  text-decoration: underline;
  border-color: transparent !important;
}

/* Access Banner Girl hover effects */
.access-banner-girl {
  transition: transform 0.2s ease;
  transform-origin: bottom center;
}

.access-banner:hover .access-banner-girl {
  transform: rotate(-5deg);
}
/* Credits overlay: shadows main content when credits panel is open */
.credits-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  background-color: rgba(0, 0, 0, 0.45);
  transition: opacity 0.2s ease;
}

/* Book cover: hide scrollbar (WebKit + Firefox) */
#book-cover-container::-webkit-scrollbar {
  height: 0;
}
#book-cover-container {
  top: 132px;
  scrollbar-width: none;
}

/* Credits panel: only vertical scrollbar visible (no horizontal) */
#credits-panel .scrollable-container {
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--casals-primary-900) transparent;
  color-scheme: dark; /* Safari: use dark context so scrollbar styling applies correctly */
}
#credits-panel .scrollable-container::-webkit-scrollbar {
  width: 6px;
  height: 0;
  -webkit-appearance: none;
  appearance: none;
}
#credits-panel .scrollable-container::-webkit-scrollbar-track {
  background: transparent;
}
#credits-panel .scrollable-container::-webkit-scrollbar-thumb {
  color: var(--casals-primary-text-900);
  background-color: var(--casals-primary-900);
  border: 1px solid transparent;
  border-radius: 10px;
  background-clip: padding-box;
}
#credits-panel .scrollable-container::-webkit-scrollbar-thumb:hover {
  color: var(--casals-primary-text-900);
  background-color: var(--casals-primary-900);
}
#credits-panel .scrollable-container::-webkit-scrollbar-corner {
  background: transparent;
}
/* Draggable modal */
.modal-draggable {
  z-index: 1502;
}
.modal-draggable .modal-dialog-draggable {
  position: fixed;
  margin: 0;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  min-height: 0; /* override .modal-dialog-centered */
  height: fit-content; /* shrink to content */
}
.modal-draggable .modal-dialog-draggable .modal-content {
  height: fit-content;
}
.modal-draggable .modal-drag-handle {
  cursor: move;
  user-select: none;
}
.modal-draggable .modal-drag-handle .btn-close {
  cursor: pointer;
}
.modal-backdrop {
  z-index: 1501;
}

.book-card:focus {
  outline: none;
}
.book-card:focus-visible,
.book-card:focus {
  color: var(--casals-primary-text-800);
  background-color: var(--casals-primary-800) !important;
  border-color: var(--casals-primary-800) !important;
  cursor: pointer;
}
.book-card:focus-visible h6,
.book-card:focus h6 {
  color: var(--casals-primary-text-800) !important;
  text-decoration: underline;
}
.book-card:focus-visible p,
.book-card:focus p {
  color: var(--casals-primary-text-800) !important;
}
.book-card:focus-visible img,
.book-card:focus img {
  transform: scale(1.25);
}
.index-llibre-titol {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.index-llibre-titol h2 {
  margin-bottom: 24px;
}
.index-llibre-titol a {
  color: var(--casals-grey-700);
  text-decoration: none;
  cursor: pointer;
  line-height: 21px;
  margin-bottom: 24px;
}
#iframe_ld2026{
  height: calc(100vh - 133px);
  width: 100%;
}
.toast-visor2026-position {
  top: 60px;
  right: 12px;
}
@media (max-width: 991.98px) {
  .card {
    min-height: 165px;
  }
  .card-img-top {
    height: 61px;
    min-width: 80px !important;
  }
  body.credits-panel-open .credits-panel {
    top: 150px !important;
    left: calc(50% - 250px) !important;
  }
  .index-llibre-titol {
    flex-direction: column;
    align-items: start;
  }
  .index-llibre-titol h2 {
    margin-bottom: 16px;
  }
  .index-llibre-titol a {
    margin-bottom: 24px;
  }
}
@media (min-width: 992px) {
  .fs-lg-6 {
    font-size: 0.8rem !important;
  }
  #book-cover-container {
    max-height: calc(100dvh - 150px);
  }
}
@media (min-width: 992px) and (max-width: 1399px) {
  body.credits-panel-open .credits-panel {
    left: calc(50% - 260px) !important;
  }
}