@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@300;400;500;600;700;900&display=swap");

:root {
  --clr-dark: #202020;
  --clr-primary: #516beb;
  --clr-yellow: #faff00;
}

/* reset */
*,
*::before,
*::after {
  box-sizing: inherit;
  margin: 0;
  padding: 0;
}

html {
  box-sizing: border-box;
}

/* general */
body {
  font-family: "Nunito", sans-serif;
}

.text-primary {
  color: var(--clr-primary);
}

.text-dark {
  color: var(--clr-dark);
}

.text-yellow {
  color: var(--clr-yellow);
}

.text-white {
  color: #fff;
}

.text-underline {
  text-decoration: underline;
}

.bg-dark {
  background-color: var(--clr-dark);
}

.bg-primary {
  background-color: var(--clr-primary);
}

.bg-yellow {
  background-color: var(--clr-yellow);
}

.container {
  width: 80%;
  margin: 0 auto;
  padding: 1em 0;
}

.overlay {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 1;
  background-color: rgba(0, 0, 0, 0.5);
}

img {
  width: 100%;
}

a {
  color: var(--clr-yellow);
}

.hidden {
  transform: translateY(-200%);
}

select {
  padding: 0.5em 1em;
  background-color: white;
  border: none;
  border-radius: 0.25rem;
}

/* 
  ==========
  Pagination
  ==========
*/
.pagination-component {
  display: grid;
  gap: 1em;
}

.pages-container {
  position: relative;
  width: 100%;
  pointer-events: none;
}

.page {
  position: absolute;
  opacity: 0;
  transition: opacity 150ms ease-in-out;
}

.page.current {
  opacity: 1;
}

.pagination-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
}

.pagination-controls button {
  padding: 0.5em 1.5em;
  background-color: white;
  border: none;
  border-radius: 0.25rem;
}

/* 
  ==============
  Loading Circle
  ==============
*/
@keyframes spinner {
  0% {
    transform: rotate(0deg);
  }

  100% {
    transform: rotate(360deg);
  }
}

.loading-circle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  animation: spinner 1s infinite ease-in-out;
  font-size: 2rem;
  margin: 1em 0;
}

.hidden-loading-circle {
  display: none;
}

/* 
  ======
  Header
  ======
*/
header {
  box-shadow: 0px 4px 18px rgba(0, 0, 0, 1);
}

header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1em;
}

#search-form {
  flex-basis: 300px;
}

#search-bar-container {
  position: relative;
}

#search-bar {
  padding: 1em 1.5em 1em 1em;
  border-radius: 0.25em;
  border: none;
  width: 100%;
}

#search-icon {
  position: absolute;
  right: 0.45em;
  top: 33%;
  color: var(--clr-dark);
}

.logo {
  font-size: 3rem;
}

@media (max-width: 768px) {
  header .container {
    flex-direction: column;
    align-items: stretch;
  }

  #search-form {
    flex: 1;
  }

  .logo {
    font-size: 2rem;
  }
}

/* 
  ====
  Main
  ====
*/
main {
  overflow: hidden;
  min-height: 100vh;
}

.subheading {
  color: white;
  font-size: 2rem;
  font-weight: lighter;
  margin-bottom: 1em;
  display: flex;
  justify-content: space-between;
}

@media (max-width: 576px) {
  .subheading {
    flex-direction: column;
    gap: 0.25em;
  }
}

/* 
  =======
  Results
  =======
*/
.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1em;
}

.result-poster {
  border-radius: 0.25rem;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.15);
}

/* to prevent hidden pages from blocking pagination control buttons */
.page .result-poster {
  pointer-events: none;
}

.page.current .result-poster {
  pointer-events: all;
}
/* to prevent hidden pages from blocking pagination control buttons */

.result-title {
  font-weight: lighter;
}

/* 
  ======
  Popout
  ======
*/
.result-popout-container {
  position: fixed;
  width: 100%;
  height: 100vh;
  top: 0;
  left: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 150ms ease-in-out;
}

.result-popout {
  z-index: 2;
  width: 50%;
  display: grid;
  grid-template-columns: auto 1fr;
  padding: 1em;
  border-radius: 0.25rem;
  gap: 1em;
}

@media (max-width: 768px) {
  .result-popout {
    width: 90%;
  }
}

@media (max-width: 576px) {
  .result-popout .result-overview {
    font-size: 0.8rem;
  }
}

.result-popout .result-poster {
  max-width: 250px;
}

.result-info {
  display: flex;
  flex-direction: column;
}

.result-overview {
  margin: 0.8em 0;
}

.genres {
  list-style-type: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25em;
}

#search-results-section {
  display: none;
}

@media (max-width: 507px) {
  .result-popout {
    width: auto;
    grid-template-columns: 250px;
  }
}
