.vocab-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  isolation: isolate;
  & > .vocab-img-container {
    max-width: 80px;
    display: flex;
    flex-direction: row-reverse;
    z-index: -1;
    position: relative;
    & .vocab-img {
      display: block;
      right: 0;
      max-height: 100px;
      max-width: 150px;
      height: auto;
      object-fit: cover;
      cursor: zoom-in;
      background: white;
    }
    & .magnify {
      pointer-events: none;
      width: 20px;
      position: absolute;
      bottom: 0;
      right: 0;
      padding: 3px;
      box-sizing: border-box;
      opacity: 50%;
      transition: opacity .1s;
    }
  }
  & > .vocab-content-container {
    background: linear-gradient(to left, transparent, var(--theme-10) 30px);
    padding-right: 20px;
    height: 100%;
    display: grid;
    align-content: center;
    & > p {
      margin-bottom: 0;
    }
    & > h2 a.external-open {
      translate: 0 2px;
      width: 20px;
      display: inline-block;
      aspect-ratio: 1;
      -webkit-mask-size: cover;
      mask-size: cover;
      background-color: var(--theme);
      -webkit-mask-image: url("/icons/external_link.svg");
      mask-image: url("/icons/external_link.svg");
      &:hover {
        background-color: var(--accent);
      }
    }
  }
}

@media (pointer: fine) and (hover: hover) {
  .vocab-img-container:hover .magnify {
    opacity: 100%
  }
  .flashcard-controls {
    & button:not([disabled]):hover {
      background-color: rgb(240, 240, 240);
      & img {
        opacity: 1;
      }
    }
  }
}

.flashcard-block {
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  perspective: 3000px;
  box-sizing: border-box;
}

.page-wrapper:has(.flashcard-block.fullscreen) {
  overflow: hidden;
}

.flashcard-block.fullscreen {
  position: absolute;
  padding-inline: max(15px, calc(50% - var(--main-width) / 2));
  z-index: 1;
  inset: 0;
  border-radius: 0;
  transition: none;
}

@media (min-width: 1200px) {
  .flashcard-block.fullscreen {
    border-left: none;
  }
}

.flashcard {
  position: relative;
  min-height: 0;
  aspect-ratio: 16/9;
  display: grid;
  place-items: center;
  transition: transform .3s cubic-bezier(0.7, 0, 0.3, 1);
  transform-style: preserve-3d;
  border-radius: 10px;
  outline-offset: 2px;
}

.flashcard-front,
.flashcard-back {
  position: absolute;
  height: 100%;
  aspect-ratio: 16/9;
  border-radius: 10px;
  background: white;
  box-shadow: 0 0 15px -5px black;
  cursor: pointer;
  display: grid;
  place-items: center;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  box-sizing: border-box;
  user-select: none;
  backface-visibility: hidden;
  & * {
    box-sizing: border-box;
    text-align: center;
  }
}

.flashcard-front {
  transform: rotateX(180deg);
  padding: 50px;
  & h2 {
    font-size: 50px;
  }
}

.flashcard-back {
  & p {
    padding: 50px;
    margin: 0;
    font-size: 25px;
  }
  & img {
    padding: 20px;
    cursor: zoom-in;
    max-width: 100%;
    max-height: 100%;
  }
}

.flashcard.front {
  transform: rotateX(-180deg);
}

.flashcard-controls {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  justify-content: space-evenly;
  & > div {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  & .right {
    justify-content: end;
  }

  & .progress {
    color: #646464;
    font-weight: bold;
    margin: 0;
  }
  
  & .active {
    filter: invert(.75);
  }
}

.flashcard-controls button {
  user-select: none;
  border: none;
  width: 35px;
  aspect-ratio: 1;
  border-radius: 100px;
  background-color: white;
  box-shadow: 0 0 10px -4px black;
  cursor: pointer;
  transition: all .2s ease-in-out;
  display: grid;
  place-items: center;
  & img {
    opacity: 75%;
    transition: all .1s ease-in-out;
    width: 85%;
    display: block;
    pointer-events: none;
  }
  &:not([disabled]):active {
    background-color: rgb(220, 220, 220);
    & img {
      opacity: 1;
    }
  }
  &[disabled] {
    filter: invert(.75);
    cursor: not-allowed;
  }
}

@media (max-width: 500px) {
  .flashcard-controls {
    & > div {
      gap: 2vw;
    }
    & button {
      width: calc(35px + (5vw - 25px));
    }
  }
  .flashcard-block.flashcard-block {
    padding: 3vw;
  }
}

@media (max-width: 900px) {
  .flashcard-front {
    padding: calc(1vw * 50/9);
    & h2 {
      font-size: calc(50px + (1vw * 50/9 - 50px) * 0.75)
    }
  }
  .flashcard-back {
    & p {
      padding: calc(50px + (1vw * 50/9 - 50px) * 1.5);
      font-size: calc(25px + (1vw * 25/9 - 25px) * 0.8)
    }
    & img {
      padding: calc(1vw * 20/9)
    }
  }
}