@import url('https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;700&display=swap');
@import './ui.scss';
@import './pages.scss';

$small: 800px;

.wrapper {
  max-width: 1140px;
  margin-right: auto;
  margin-left: auto;
  padding-right: 1rem;
  padding-left: 1rem;
}

*,
*:before,
*:after {
  box-sizing: border-box;
}

a {
  text-decoration: none;
  color: #222;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: #242121;
  font-family: 'Roboto', sans-serif;
}

textarea {
  font-family: 'Roboto', sans-serif;
}

main {
  height: max-content;
}

.sr-only {
  position: absolute;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  width: 1px;
  height: 1px;
  padding: 0;
  border: 0;
}

.button {
  min-width: 120px;
  padding: .5rem 1rem;
  text-align: center;
  color: #fff;
  border-radius: 5px;
  background-color: #2fa0f6;

  appearance: none;

  svg {
    display: inline-block;
    width: 24px;
    height: 24px;
    vertical-align: middle;

    fill: #fff;
  }

  span {
    display: none;

    @media (min-width: 600px) {
      display: initial;
    }
  }
}

.button--icon {
  min-width: initial;
  padding: .5rem;
}

.brand {
  font-size: 20px;
  font-weight: bold;
}

.site-header {
  position: relative;
  background-color: #292828;
}

.site-header__start {
  display: flex;
  align-items: center;

  a {
    color: #fff;
  }
}

.site-header__end {
  display: flex;
  align-items: center;
}

.site-header__wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  height: 6rem;

  @media (min-width: $small) {
    padding-top: 0;
    padding-bottom: 0;
  }
}

.nav__wrapper {
  @media (min-width: $small) {
    display: flex;
  }

  @media (max-width: $small - 1) {
    position: absolute;
    z-index: -1;
    top: 100%;
    right: 0;
    left: 0;
    visibility: hidden;
    transition: transform .3s ease-out, opacity .3s ease-out;
    transform: translateY(-100%);
    opacity: 0;
    background-color: #373737;

    &.active {
      visibility: visible;
      transform: translateY(0);
      opacity: 1;
      z-index: 1
    }
  }
}

.nav__item {
  &:not(:last-child) {
    margin-right: .5rem;
  }

  a {
    display: grid;
    place-items: center;
    gap: .5rem;
    padding: 1rem;
    border-left: 4px solid transparent;

    @media (min-width: $small) {
      text-align: center;
      border-bottom: 4px solid transparent;
      border-left: 0;
    }

    img {
      width: 2.5rem;
      height: 2.5rem;
    }

    span {
      color: #fff;
    }
  }

  svg {
    display: inline-block;
    width: 28px;
    height: 28px;
    margin-right: 1rem;
    vertical-align: middle;
    color: #fff;

    @media (min-width: $small) {
      display: block;
      margin: 0 auto .5rem;
    }
  }

  &:hover {
    a {
      @media (min-width: $small) {
        border-bottom-color: #fff;
      }
    }
  }

  &.active {
    a {
      border-left-color: #fff;

      @media (min-width: $small) {
        border-bottom-color: #fff;
      }
    }
  }

  .avatar-wrapper {
    display: none;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    overflow: hidden;
    transition: .3s;

    &:hover {
      transform: scale(6);
      overflow: visible;

      img {
        transform: translate(-50%, 50%);
        border-radius: 50%;
      }
    }
  }

  .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: .3s;
  }
}

.nav__toggle {
  display: none;

  @media (max-width: $small - 1) {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: block;
  }
}

.main-page {
  transition: .5s;
}

main {
  margin: 2rem 0;
}

.recently {
  display: flex;
  gap: 2rem;
  padding: 2rem 4rem 4rem;
}

.card {
  position: relative;
  display: flex;
  width: 50%;
  border-radius: 5px;

  &__image {
    position: absolute;
    top: -1rem;
    left: -1rem;
    flex-shrink: 0;
    max-width: 13rem;
    height: 20rem;
    transform: rotate(-3deg);
  }

  &__empty {
    flex-shrink: 0;
    width: 200px;
  }

  &__info {
    display: flex;
    gap: 1rem;
    flex-direction: column;
    padding: 2rem 1rem;
  }

  label {
    position: absolute;
    bottom: 2rem;
    right: 2rem;

    .heart {
      display:inline-block;
      width: 2rem; 
      aspect-ratio: 1;
      clip-path: polygon(-41% 0,50% 91%, 141% 0);
      border-image: radial-gradient(#fff 69%,#0000 70%) 84.5% fill/100%;
      opacity: .2;
      cursor: pointer;
    }
    
    input:checked ~ .heart {
      border-image: radial-gradient(#fff 69%,#0000 70%) 84.5% fill/100%;
      opacity: .8;
    }
  }

  h3,
  p {
    display: -webkit-box !important;
    overflow: hidden;
    -webkit-box-orient: vertical;
    white-space: normal;

    -webkit-line-clamp: 5;
  }

  h3 {
    height: 4rem;
    color: #fff;
    font-size: 2rem;
    font-weight: 700;

    -webkit-line-clamp: 2;
  }

  &__desc {
    min-height: 3rem;
    color: #d2d2d2;
    font-size: .75rem;

    -webkit-line-clamp: 5;
  }

  &__genre {
    text-align: center;
    color: #e2e2e2;
    font-size: .75rem;
    font-weight: 300;
  }

  button {
    margin: 0 auto;
    padding: 8px 16px;
    cursor: pointer;
    color: #fff;
    border: 1px solid #fff;
    background: transparent;
    font-size: 1rem;
    font-weight: 300;

    appearance: none;

    &:hover {
      opacity: .5;
    }

    &:active {
      opacity: 1;
    }

    &:focus {
      outline: 3px solid #fff;
      outline-offset: -2px;
    }
  }

  &_green {
    background: rgba(113, 197, 244, .38);
    box-shadow: 0 6px 4px rgba(0, 0, 0, .25);
  }

  &_pink {
    background: rgba(171, 113, 244, .38);
    box-shadow: 0 6px 4px rgba(0, 0, 0, .25);
  }
}

.search {
  .filter {
    width: 30%;
    margin-right: 2rem;
    padding: 2rem;
    border: 1px solid #393939;
    border-radius: 5px;
    background: #232222;

    &__inputs {
      display: flex;
      gap: 1rem;
      flex-direction: column;
    }

    h4 {
      position: relative;
      margin-bottom: 1rem;
      color: #fff;
      font-size: 1.25rem;
      font-weight: 700;

      &::after {
        position: absolute;
        bottom: -5px;
        left: 0;
        width: 50px;
        height: 2px;
        content: '';
        background-color: #fff;
      }
    }

    label {
      cursor: pointer;
      color: #fff;
      font-size: 1rem;
    }

  }

  .books {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    width: 70%;
  }

  .book {
    width: 200px;
    height: 300px;
    cursor: pointer;
    transition: .3s;

    &:hover {
      transform: scale(1.05);
      box-shadow: 0 5px 30px 0 rgba(255, 255, 255, .5);
    }
  }
}

footer {
  height: 6rem;
  margin-top: auto;
  background: #292828;
}

.overlay {
  position: fixed;
  display: none;
  place-items: center;
  inset: 0;
  width: 100%;
  height: 100%;
  background: #000;
}

.modal {
  position: relative;
  display: none;
  flex-direction: column;
  padding: 2rem;
  width: 22rem;
  background: #242121;
  z-index: 2;
  border-radius: 4rem;

  input {
    @include field;
    @include input;
  }

  input:not(:last-of-type) {
    margin-bottom: 1rem;
  }

  &__buttons {
    display: flex;
    justify-content: space-around;
    margin-top: 2rem;
  }
}

.modal-profile {
  div {
    display: flex;

    button {
      margin-right: 1rem;
      flex-shrink: 0;
    }
  }
}