main {
  padding-top: 20px;
}

/*  GRID VIEW START */

.books-grid {
  width: 100%;
  display: grid;
  margin: 32px 0 0 0;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px 40px;
}

.book-item {
  width: 100%;

}

.book-item .image-wrap {
  padding-top: calc(229 / 152 * 100%);
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid transparent;
  -webkit-transition: border 200ms ease;
  transition: border 200ms ease;
}


.book-item .image-wrap .overlay {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.9);
  color: var(--primary-color);
  padding: 12px;
  opacity: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  -webkit-transition: opacity 200ms ease;
  transition: opacity 200ms ease;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;      /* IE 10 and IE 11 */
  user-select: none;
}

.book-item .image-wrap:hover{
  border: 1px solid var(--primary-color);
}

.book-item .image-wrap:hover .overlay {
  opacity: 100%;
}

.book-item .image-wrap .overlay .title {
  font-weight: 600;
  margin-bottom: 4px;

  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  overflow: hidden;
}

.book-item .image-wrap .overlay .author,
.book-item .image-wrap .overlay .readmore {
  font-size: 14px;
}

.book-item img {
  position: absolute;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 5;

  width: 100%;
  height: 100%;
  -o-object-fit: cover;
  object-fit: cover;

  -webkit-touch-callout: none; /* iOS Safari */
  user-select: none;
  -webkit-user-select: none;
  pointer-events: none;
}

.book-item .book-stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.book-item .book-stats button {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  margin-right: 4px;
  display: flex;
  align-items: center;
  user-select: none;
  -webkit-user-select: none;
  outline: 0;
  -webkit-tap-highlight-color: transparent;
}

.book-item .book-stats span {
  font-size: 14px;
  color: #3d3d4d;
}

.book-item .book-stats button svg {
  height: 16px;
  fill: #9e9ea7;
}
.book-item .book-stats button:hover svg {
  height: 16px;
  fill: var(--primary-color);
}

.book-item .book-stats .book-stats-likes {
  display: flex;
  align-items: center;
}

/*  GRID VIEW END */

/*  LIST VIEW START */

.books-grid.list-view {
  width: 100%;
  display: block;
}

.books-grid.list-view .book-item {
  width: 100%;
  display: flex;
  flex-direction: row;
  margin-bottom: 28px;
}

.books-grid.list-view .book-item .image-wrap {
  padding: 0;
  width: 110px;
  margin-right: 20px;
  display: block;
  position: static;
  height: fit-content;
}

.books-grid.list-view .book-item img {
  display: block;
  position: static;
  height: auto;
  width: 100%;
  object-fit: fill;
}

.books-grid.list-view .book-item .image-wrap {
  border: 0;
}

.books-grid .list-view-book-info {
  display: none;
  flex: 1;
  margin-right: 28px;
}

.books-grid.list-view .list-view-book-info {
  display: block;
}

.books-grid.list-view .book-item .image-wrap .overlay {
  display: none;
}

.books-grid.list-view .list-view-book-info .title {
  font-weight: 600;
  margin: 16px 0 12px 0;
}

.books-grid.list-view .list-view-book-info .title a {
  outline: 0;
  text-decoration: none;
  color: inherit;
}

.books-grid.list-view .list-view-book-info .author {
  font-size: 14px;
  color: #3d3d4d;
  margin: 0 0 24px 0;
}

.books-grid.list-view .book-item .book-stats {
  width: 100px;
  justify-content: end;
}
.books-grid.list-view .book-item .book-stats .book-stats-likes {
  display: flex;
  flex-direction: row;
  justify-content: center;
  width: 140px;
  border: 2px solid #eaecf0;
  border-radius: 8px;
  padding: 9px 12px;
  cursor: pointer;
  transition-property: border;
  transition-duration: .3s;
  transition-timing-function: cubic-bezier(.4, 0, .2, 1);
  user-select: none;
  -webkit-user-select: none;
  outline: 0;
  -webkit-tap-highlight-color: transparent;
}

.books-grid.list-view .book-item.like .book-stats .book-stats-likes {
  border: 2px solid var(--primary-color);
}

.books-grid.list-view .book-item .book-stats .book-stats-likes:hover {
  border: 2px solid var(--primary-color);
}

.books-grid.list-view .book-item .book-stats button:hover svg {
  fill: #9e9ea7;
}

.books-grid .book-item.like .book-stats button svg {
  fill: var(--primary-color);
}

.books-grid.list-view .list-view-book-info .book-stats-date {
  margin: 0;
  font-size: 12px;
  color: #3d3d4d;
}

.books-grid.list-view .book-item .book-stats .book-stats-date { 
  display: none;
}

/*  LIST VIEW END */

/* FILTERS START */

.filters {
  display: flex;
  flex-direction: row;
  gap: 12px;
  margin-top: 40px;
  flex-wrap: wrap;
}

.dropdown {
  display: inline-block;
  position: relative;
  overflow: visible;
  font-size: 14px;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;      /* IE 10 and Edge */
  user-select: none; 
  -webkit-tap-highlight-color: transparent;
}

.dropdown .dropdown-btn {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  width: 180px;
  border: 1px solid #b1b1b1;
  border-radius: 8px;
  padding: 0 14px;
  cursor: pointer;
  gap: 8px;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;      /* IE 10 and Edge */
  user-select: none; 
  -webkit-tap-highlight-color: transparent;
}

.dropdown .dropdown-btn svg {
  width: 14px;
  transition-property: transform;
  transition-duration: .2s;
  transition-timing-function: cubic-bezier(.4, 0, .2, 1);
}

.dropdown.open .dropdown-btn svg {
  transform: rotate(180deg);
}

.dropdown .dropdown-btn:hover svg {
  opacity: 85%;
}

.dropdown .dropdown-options {
  display: none;
}

.dropdown.open .dropdown-options {
  display: block;
}

.dropdown .dropdown-options {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  background-color: #fff;
  border: 1px solid #b1b1b1;
  border-radius: 8px;
  padding: 8px;
  z-index: 52;
  min-width: 180px;
}

.dropdown .dropdown-options ul {
  padding: 0;
  margin: 0;
  list-style: none;
}

.dropdown .dropdown-options ul li {
  display: block;
  border-radius: 4px;
  padding: 8px 12px;
  cursor: pointer;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;      /* IE 10 and Edge */
  user-select: none; 
}

.dropdown .dropdown-options ul li:hover {
  background-color: #e7e8e9;
}

.dropdown .dropdown-options ul li.active {
  background-color: #e7e8e9;
}

.dropdown .dropdown-options .sub-options {
  margin-left: 12px;
  /* background-color: #f6f6f6; */
  border-radius: 4px;
  display: none;
}

.dropdown .dropdown-options .sub-options.open {
  display: block;
}

.tag-search-wrap {
  flex: 1;
  max-width: 320px;
  display: flex;
  flex-direction: row; 
  align-items: center; 
  height: 40px;
  border: 1px solid #dadce0;
  outline: 0;
  border-radius: 8px;
  overflow: hidden;
  -webkit-transition: outline 100ms linear;
  transition: outline 100ms linear;
}


.tag-search-wrap input {
  padding: 0 8px 0 18px;
  font-size: 14px;
  outline: 0;
  border: 0;
  display: block;
  flex: 1;
}

.tag-search-wrap .search-btn {
 -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  height: 36px;
  width: 36px;
  border-radius: 50%;
  margin-right: 6px;
  /* background-color: var(--primary-color); */
  display: flex;
  align-items: center;
  justify-content: center;
}

.tag-search-wrap .search-btn:hover {
  opacity: 85%;
}

.tag-search-wrap .search-btn svg {
  height: 28px;
  width: 28px;
}

.view-switch {
  margin-left: auto;
  display: flex;
  flex-direction: row;
  width: 80px;
  height: 40px;
  border: 1px solid #b1b1b1;
  border-radius: 8px;
  overflow: hidden;
}

.view-switch > div {
  flex: 1;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none;      /* IE 10 and Edge */
  user-select: none; 
  -webkit-tap-highlight-color: transparent;
}

.view-switch > div.active {
  background-color: #e4e5e5;
}

.view-switch svg {
  height: 14px;
}

.tag-search-result {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  width: 100%;
  max-width: 100%;
  background-color: #fff;
  border: 1px solid #dadce0;
  border-radius: 8px;
  z-index: 53;
  overflow: hidden;
}

.tag-search-wrap.focused .search-result.open {
  display: block;
}

/* FILTERS END */

/* TAG SEARCH */
.ts-wrapper {
  flex: 1;
  width: 100%;
}

.ts-dropdown,
.ts-dropdown .optgroup-header,
.ts-control > input {
  font-family: "Mona Sans", Helvetica, sans-serif !important;
  font-size: 14px!important;
  color: #0d0c20!important;
}

.ts-dropdown .optgroup-header {
  padding: 6px 12px;
  font-weight: 600;
}

.ts-dropdown .no-results {
  padding: 6px 12px;
}

.ts-dropdown [data-selectable].option {
  padding: 6px 20px;
}

.ts-wrapper.multi .ts-control > div {
  background-color: #e4e5e5;
  border-radius: 6px;
}
.ts-control {
  border: 1px solid #b1b1b1;
  outline: 0;
  border-radius: 8px;
  min-height: 40px;
  height: auto;
  padding: 8px 12px;
}

.ts-dropdown {
  z-index: 99;
  border: 1px solid #b1b1b1;
}
/* END TAG SEARCH */

.book-item .tags a {
    color: #0d0c20;
    text-decoration: underline;
    text-decoration-color: var(--primary-color);
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    margin-right: 12px;
    line-height: 32px;
}

@media (max-width: 870px) {
  .book-item .image-wrap .overlay .title {
    font-size: 14px;
  }
}

@media (max-width:810px) {
    p.intro {
        width: 100%;
    }
}

@media (max-width:740px) {
    .books-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 30px 40px;
    }
}

@media (max-width:600px) {

  .books-grid .list-view-book-info {
    margin-right: 20px;
  }

  .books-grid.list-view .book-item .book-stats {
    width: 80px;
    height: 136px;
    margin: 0;
  }

  .books-grid.list-view .book-item .book-stats .book-stats-likes {
    width: 100%;
    justify-content: center;
  }

  .books-grid.list-view .list-view-book-info .title {
    font-size: 14px;
  }

  .books-grid.list-view .list-view-book-info .author {
    font-size: 12px;
  }

  .books-grid.list-view .book-item .image-wrap {
    width: 100px;
  }

  .books-grid.list-view .list-view-book-info .title {
    margin: 10px 0 8px 0;
  }

  .books-grid.list-view .book-item .image-wrap {
    margin-right: 16px;
  }

  .books-grid.list-view .book-item .book-stats {
    width: 68px;
  }

  .books-grid.list-view .book-item .book-stats span {
    font-size: 12px;
  }

  .books-grid.list-view .book-item .book-stats button svg {
    height: 14px;
  }

  .books-grid.list-view .book-item .book-stats .book-stats-likes{
    padding: 8px 10px;
  }

    .books-grid {
        gap: 26px 32px;
    }

    .filters {
      margin-top: 32px;
    }

  .book-item .book-stats span {
    font-size: 12px;
  }

  #sort-by {
    order: 1;
  }
  .tag-search-wrap,
  .ts-wrapper {
    order: 3;
    flex: 0 0 100%;
    width: 100%;
    max-width: 100%;
  }

  .view-switch {
    order: 2;
  }

  .book-item .tags a {
    font-size: 14px;
  }

  .books-grid.list-view .list-view-book-info .author {
      margin: 0 0 16px 0;
  }
}

@media (max-width:550px) {
  .books-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 20px 30px;
  }

  .book-item .book-stats {
    margin-top: 8px;
  }

  p.intro {
    font-size: 15px;
  }

  .book-item .tags a { 
    line-height: 30px;
  }
}

@media (max-width:420px) {
  .books-grid.list-view .book-item .image-wrap {
    width: 90px;
  }

  .books-grid.list-view .list-view-book-info .title {
    margin: 8px 0 8px 0;
  }

  .books-grid.list-view .book-item .image-wrap {
    margin-right: 16px;
  }

  .books-grid {
    gap: 20px 24px;
  }
}