html {
    scrollbar-gutter: stable
}

.bg-books {
    width: 100%
}

.bg-books__filters {
    margin-bottom: 32px
}

.bg-books__filters-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px
}

.bg-books__field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600
}

.bg-books__field select {
    width: 100%;
    min-height: 44px;
    padding: 10px 44px 10px 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    background: #fff;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='9' viewBox='0 0 14 9'%3E%3Cpath d='M1.5 1.5L7 7L12.5 1.5' fill='none' stroke='%23374151' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 14px 9px;
    -webkit-appearance: none;
       -moz-appearance: none;
            appearance: none;
    font: inherit
}

.bg-books__field select:hover {
    cursor: pointer
}

.bg-books__status {
    min-height: 24px;
    margin-bottom: 16px
}

.bg-books__summary {
    margin-bottom: 20px;
    font-weight: 600
}

.bg-books__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px
}

.bg-book-card {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    min-width: 0;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    height: 100%;
	box-shadow: 0 4px 8px rgba(0,0,0,.05)
}

.bg-book-card__media {
    flex: 0 0 auto;
    align-self: stretch;
    width: -moz-fit-content;
    width: fit-content;
    max-width: 42%;
    min-width: 0;
    background-color: #fff;
    display: flex;
    align-items: stretch;
    justify-content: flex-start
}

.bg-book-card__image {
    display: block;
    width: auto;
    height: 100%;
    max-width: 100%;
    -o-object-fit: contain;
       object-fit: contain;
    -o-object-position: left top;
       object-position: left top
}

.bg-book-card__image--placeholder {
    flex-shrink: 0;
    width: 100%;
    min-width: clamp(160px, 26vw, 260px);
    height: 100%;
    min-height: clamp(260px, 36vw, 380px);
    background: #ececec
}

.bg-book-card__content {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-width: 0;
    padding: 20px 24px
}

.bg-book-card__title {
    margin: 0 0 1rem !important;
    font-size: 1.4rem;
    line-height: 1.3;
    overflow-wrap: anywhere
}

.bg-book-card__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto !important
}

.bg-button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 6px;
    text-decoration: none;
    text-align: center;
    font: inherit;
    font-weight: 600;
    line-height: 1.2;
    transition: .2s ease;
    box-sizing: border-box
}

.bg-button.bg-button--secondary {
	border: 2px solid #111827;
	background: transparent !important;
	color: #111827
}

.bg-button.bg-button--secondary:hover {
	color: #111827;
	border-color: #ffc857;
	background-color: #ffc857 !important
}

.bg-button.bg-button--primary {
  position: relative;
  overflow: hidden;
  color: #ffc857;
  background-color: #111827;
  text-decoration: none;
  transition: color .2s ease;
  z-index: 1
}

.bg-button.bg-button--primary::before,
.bg-button.bg-button--primary::after {
  content: '';
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  background-color: #ffc857;
  z-index: -1;
  transition: width .2s ease
}

.bg-button.bg-button--primary::before { left: 0 }
.bg-button.bg-button--primary::after  { right: 0 }

.bg-button.bg-button--primary:hover::before,
.bg-button.bg-button--primary:hover::after {
  width: 50%
}

.bg-button.bg-button--primary:hover {
  color: #111827
}


.bg-button[disabled] {
    opacity: .55;
    cursor: not-allowed
}

.bg-books__pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 32px
}

.bg-books__pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid #d0d7de;
    border-radius: 6px;
    text-decoration: none;
    color: #111827;
    background: #fff
}

.bg-books__pagination .page-numbers.current {
    background: #111827;
    color: #fff;
    border-color: #111827
}

.bg-books__pagination .page-numbers.current:hover {
	cursor: not-allowed
}

.bg-books__pagination .page-numbers:not(.current):hover {
	color: #111827;
  	border-color: #ffc857;
  	background-color: #ffc857
}

.bg-books__empty {
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fafafa
}

.bg-book-modal[hidden] {
    display: none !important
}

.bg-book-modal {
    position: fixed;
    inset: 0;
    z-index: 2147483647;
    display: grid;
    place-items: center;
    padding: 16px
}

.bg-book-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .75)
}

.bg-book-modal__dialog {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    width: min(960px, 100%);
    max-height: calc(100vh - 32px);
    margin: 0;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .2);
    overflow: hidden
}

.bg-book-modal__body {
    padding: 24px;
    overflow-y: auto
}

.bg-book-modal__close {
    position: absolute;
    top: 12px;
    right: 24px;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border: 0;
	border: 2px solid #111827;
    border-radius: 6px;
    background-color: #fff;
    color: #111827;
    cursor: pointer;
    font-size: 1.5rem;
	padding: 8px 14px;
    line-height: 1;
    transition: .2s ease
}

.bg-book-modal__close:active,
.bg-book-modal__close:focus,
.bg-book-modal__close:hover {
    background-color: #111827 !important;
	color: #ffc857 !important
}


.bg-book-modal__header {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 24px;
    align-items: start;
    margin-bottom: 24px;
    padding-right: 48px
}

.bg-book-modal__thumb {
    width: 100%
}

.bg-book-modal__image {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
    -o-object-fit: cover;
       object-fit: cover
}

.bg-book-modal__image--placeholder {
    aspect-ratio: 4 / 5;
    width: 100%;
    background: #ececec;
    border-radius: 10px
}

.bg-book-modal__heading {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    min-height: 100%;
    gap: 16px
}

.bg-book-modal__title {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.2
}

.bg-book-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
    width: min(320px, 100%)
}

.bg-book-modal__actions .bg-button {
    width: 100%
}

.bg-book-modal__excerpt {
    margin: 2rem 0;
    padding: 1rem 0 1.5rem;
    border-top: 1px solid #cdcdcd;
    border-bottom: 1px solid #cdcdcd
}

.bg-book-modal__excerpt p {
    margin: 0 0 12px
}

.bg-book-modal__excerpt p:last-child {
    margin-bottom: 0
}

.bg-book-modal__gallery {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px
}

.bg-book-modal__gallery-item {
    display: block;
    border-radius: 0;
    overflow: visible
}

.bg-book-modal__gallery-image {
    display: block;
    width: 100%;
    height: 220px;
    border-radius: 0 !important;
    -o-object-fit: cover;
       object-fit: cover
}

html.bg-modal-open,
body.bg-modal-open {
    overflow: hidden
}

.screen-reader-text {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important
}

@media (max-width: 1024px) {
    .bg-books__filters-grid,
    .bg-books__grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .bg-book-modal__gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }
}

@media (max-width: 1024px) and (min-width: 640px) {
    .bg-book-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: auto auto;
        gap: 16px;
        align-items: stretch
    }

    .bg-book-card__media {
        grid-column: 1;
        grid-row: 1;
        width: 100%;
        max-width: none;
        min-width: 0;
        min-height: 0;
        align-self: stretch;
        padding: 20px 0 0 24px;
        box-sizing: border-box;
        display: flex;
        align-items: stretch;
        justify-content: flex-start
    }

    .bg-book-card__content {
        display: contents
    }

    .bg-book-card__title {
        grid-column: 2;
        grid-row: 1;
        align-self: start;
        margin: 0 !important;
        padding: 20px 24px 20px 0;
        min-width: 0
    }

    .bg-book-card__actions {
        grid-column: 1 / -1;
        grid-row: 2;
        margin-top: 0 !important;
        padding: 0 24px 24px;
        flex-direction: column;
        align-items: stretch
    }

    .bg-book-card__actions .bg-button {
        width: 100%
    }

    .bg-book-card__image--placeholder {
        min-height: 200px
    }
}

@media (max-width: 767px) {
    .bg-books__filters-grid,
    .bg-books__grid,
    .bg-book-modal__header,
    .bg-book-modal__gallery {
        grid-template-columns: 1fr
    }

    .bg-book-modal__dialog {
        width: 100%;
        max-height: calc(100vh - 20px);
        margin: 0
    }

    .bg-book-modal__body {
        padding: 18px
    }

    .bg-book-modal__header {
        gap: 16px;
        padding-right: 40px
    }
	
	.bg-book-modal__image {
		max-height: 480px;
  		width: auto
	}

    .bg-book-modal__gallery-image {
        height: auto
    }

    .bg-book-modal__title {
        font-size: 1.4rem
    }
	
	.bg-book-modal__close {
		right: 12px
	}
}

@media (max-width: 639px) {
    .bg-book-card {
        flex-direction: column;
        align-items: stretch
    }

    .bg-book-card__media {
        max-width: none;
        width: 100%;
        height: clamp(211px, 58vw, 312px);
        aspect-ratio: auto;
        display: flex;
        align-items: center;
        justify-content: center
    }

    .bg-book-card__image {
        width: auto;
        max-width: 100%;
        height: 100%;
        margin: 0 auto;
        -o-object-fit: contain;
           object-fit: contain;
        -o-object-position: center center;
           object-position: center center
    }

    .bg-book-card__image--placeholder {
        width: 100%;
        height: 100%;
        min-height: 0
    }

    .bg-book-card__content {
        padding: 16px 18px 18px
    }

    .bg-book-card__title {
        font-size: 1.2rem;
        margin-bottom: 0.875rem !important
    }

    .bg-book-card__actions {
        gap: 8px
    }

    .bg-book-card__actions .bg-button {
        width: 100%
    }
}

@media (max-width: 480px) {
    .bg-books__grid {
        gap: 16px
    }

    .bg-book-card__content {
        padding: 14px 16px 16px
    }

    .bg-book-card__title {
        font-size: 1.1rem
    }
}