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

* {
  margin: 0;
}

/*----- REMOVE BLUE HIGHLIGHT ON TOUCH -----*/
*:hover,
*:focus,
*:focus-visible,
*:active {
  -webkit-tap-highlight-color: transparent;
  -ms-touch-action: manipulation;
  touch-action: manipulation;
}

:root {
  --shelf-height: 300px;
  --work-sans: "Work Sans", sans-serif;
  --cardo: "Cardo", serif;

  --white: #F0EBE7;
  --bg: #030402;
  --green: #8fb46a;
  --peach: #F8977A;
}

::selection {
  color: #100c0b;
  background-color: rgba(248, 153, 124, 0.8);
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--cardo);
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  font-optical-sizing: auto;
  background-color: var(--bg);
  background-image: url("images/floral-pattern-dark-green.jpg");
  background-repeat: repeat;
  /* transition: background-color 150ms; */
  -webkit-font-smoothing: antialiased;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
}

/* clears the ‘X’ from search input in Chrome */
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-results-button,
input[type="search"]::-webkit-search-results-decoration {
  display: none;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}


h1,
h2,
h3,
h4 {
  margin-bottom: 0.5em;
  font-weight: 400;
  line-height: 1.25em;
}

h1 {
  font-size: 2.625rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.375rem;
}

h4 {
  font-size: 1.125rem;
}

p {
  margin-bottom: 1.5em;
}

@media (prefers-reduced-motion: no-preference) {
  :has(:target) {
    scroll-behavior: smooth;
  }
}

.to-top-button {
  display: flex;
  align-items: center;
  justify-content: center;
  position: fixed;
  bottom: 0.5rem;
  right: 0.5rem;
  width: 3rem;
  height: 3rem;
  border: 0px solid transparent;
  border-radius: 3rem;
  background-color: var(--white);
  opacity: 0.5;
  transition: 150ms;
  z-index: 50;
}

.to-top-button svg {
  fill: var(--bg);
  width: 1.5rem;
  height: auto;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  margin-inline: auto;
  max-width: 1200px;
}

nav {
  padding: 2rem;
  width: 100%;
}

.esoterica-icon {
  fill: var(--white);
  width: auto;
  height: 2rem;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.push {
  margin-left: auto;
}

.nav-links a {
  text-decoration: none;
  opacity: 0.6;
  transition: 150ms;
}

.nav-links a:focus-visible {
  opacity: 1;
  outline: 2px solid var(--white);
}

.nav-icon {
  fill: var(--white);
  width: auto;
  height: 1.5rem;
  border-radius: 0.125rem;
  outline: solid 2px transparent;
  transition: 150ms;
}

.patreon {
  height: 1.25rem;
}

.title {
  font-family: var(--cardo);
  font-weight: 400;
  font-style: normal;
  color: var(--white);
  text-align: center;
  text-transform: uppercase;
}

.title span {
  font-style: italic;
  line-height: 2em;
  letter-spacing: 0.125em;
}

.title h1 {
  margin: 0rem;
  font-size: clamp(2.25rem, 1.125rem + 6vw, 4.5rem);
  line-height: 1em;
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 2rem;
  position: relative;
  margin-inline: auto;
  max-width: 1200px;
  min-height: 100vh;
}


.loader {
  position: absolute;
  margin-inline: auto;
  opacity: 0.5;
  transition: 150ms;
}

.loader svg {
  fill: var(--white);
}

#search-results {
  width: 100%;
}

.bookcase-section {
  width: 100%;
  transition: 150ms;
  background-color: var(--bg);
}




/*---------- SEARCH STYLES START ----------*/

.search {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  max-width: 18rem;
  width: 100%;
}

#search-form {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
}

#submit-button {
  padding: 0.5rem;
  left: 0;
  transform: translateX(0.5em);
}

#clear-button {
  padding: 0.5rem;
  right: 0;
  transform: translateX(-0.5em);
}

.search-button {
  position: absolute;
  margin: 0;
  border: 0px solid transparent;
  border-radius: 3rem;
  background: rgba(239, 234, 230, 0.0);
  transition: 150ms;
}

.search-button:focus-visible {
  outline: 2px solid var(--white);
}

.search-button svg {
  width: 1.25rem;
  height: auto;
  fill: var(--white);
}

#search-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  position: relative;
}

.search-label {
  display: flex;
  position: relative;
  align-items: center;
}

#search-input {
  padding: 0.75rem 3rem 0.75rem 3rem;
  font-family: var(--work-sans);
  color: var(--white);
  border: 0px solid transparent;
  border-radius: 3rem;
  outline: 1px solid transparent;
  background-color: #1c1e1a;
  opacity: 1;
  transition: 150ms;
}

#search-input:focus-visible {
  border: 0px solid transparent;
  outline: 1px solid var(--white);
  background-color: #292b26;
  opacity: 1;
}

#search-suggestions {
  position: absolute;
  top: calc(100% + 0.325rem);
  padding: 0rem;
  width: 100%;
  max-height: calc(12rem);
  font-family: var(--work-sans);
  color: var(--white);
  list-style: none;
  border: 0px solid transparent;
  border-radius: 1rem;
  background-color: #1c1e1a;
  overflow-y: auto;
  z-index: 10;
}

.suggestion {
  padding: 0.5rem 1rem;
  width: 100%;
  text-align: left;
  color: var(--white);
  border: none;
  border-radius: 0rem;
  background-color: #1c1e1a;
  transition: 150ms;
}

.suggestion:focus-visible {
  border: 0px solid transparent;
  outline: 0px solid transparent;
  background-color: #292b26;
}

#search-suggestions li:first-child .suggestion {
  border-radius: 0.375rem 0.375rem 0rem 0rem;
}

#search-suggestions li:last-child .suggestion {
  border-radius: 0rem 0rem 0.375rem 0.375rem;
}

.highlight {
  color: var(--peach);
}

.search-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 0.75rem;
  font-family: var(--work-sans);
  font-size: 0.875rem;
  line-height: 1.2em;
  color: #6f1f06;
  border-radius: 0.325rem;
  background-color: #f9ac94;
}

/*---------- SEARCH STYLES END ----------*/




/*---------- BOOKCASE STYLES START ----------*/

.bookcase-wrapper {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  grid-auto-rows: var(--shelf-height);
  gap: 0rem;
  padding: 0rem 2rem;
  position: relative;
  width: 100%;
  background-color: var(--bg);
  background-image: url("images/shelf.jpg");
  background-repeat: repeat;
  background-size: var(--shelf-height);
}

.bookcase-wrapper::before {
  pointer-events: none;
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  background-image: url("images/wood-texture-left-side-1080.jpg");
  background-position: left;
  background-repeat: repeat-y;
  background-size: auto var(--shelf-height);
  z-index: 10;
}

.bookcase-wrapper::after {
  pointer-events: none;
  content: "";
  display: block;
  position: absolute;
  top: 0;
  right: 0;
  width: 100%;
  height: 100%;
  background-color: transparent;
  background-image: url("images/wood-texture-right-side-1080.jpg");
  background-position: right;
  background-repeat: repeat-y;
  background-size: auto var(--shelf-height);
  z-index: 10;
}

/*----- BOOKCASE HEADER -----*/

.bookcase-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 1rem;
  width: 100%;
  min-height: calc(var(--shelf-height) / 3);
  height: auto;

  font-size: 1rem;
  line-height: 1.3em;
  text-transform: uppercase;

  background-color: var(--bg);
  background-image: url("images/bookcase-section-header-no-bevel.jpg");
  background-repeat: repeat;
  background-size: auto calc(var(--shelf-height) / 3);
}

.bookcase-header::before {
  pointer-events: none;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
  background: rgba(106, 29, 0, 0.0);
  background: linear-gradient(0deg, rgba(106, 29, 0, 1) 0%, rgba(106, 29, 0, 0) 3%);
  z-index: 1;
}

.bookcase-header::after {
  pointer-events: none;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: overlay;
  background: rgba(255, 255, 255, 0.0);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.25) 0%, rgba(255, 255, 255, 0) 3%);
  z-index: 1;
}

/*----- BOOKCASE LABEL -----*/

.bookcase-label {
  --mask: radial-gradient(12px at 12px 12px, #0000 98%, #000) -12px -12px;
  -webkit-mask: var(--mask);
  mask: var(--mask);

  display: block;
  margin: 0rem;
  padding: 1rem 2rem;
  font-weight: 700;
  text-align: center;
  color: #b7a395;
  background: rgb(30, 23, 21);
  background: linear-gradient(145deg, rgba(30, 23, 21, 1) 0%, rgba(16, 12, 11, 1) 100%);
}

.bookcase-label::after {
  pointer-events: none;
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;

  --mask: radial-gradient(12px at 12px 12px, #0000 98%, #000) -12px -12px;
  -webkit-mask: var(--mask);
  mask: var(--mask);

  background-image: url("images/broken_noise_darker.jpg");
  background-repeat: repeat;
}

/*---------- BOOKCASE STYLES END ----------*/




/*---------- BOOK STYLES START ----------*/

.book-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding: 1rem 1rem 0rem 1rem;
  margin-bottom: calc(var(--shelf-height) / 12);
  overflow: clip;
}

/*----- BOOK -----*/

.book {
  position: relative;
  aspect-ratio: 2 / 3;
  height: 100%;

  font-size: 1.375rem;
  line-height: 1.2em;
  color: var(--white);

  /* border-radius: 0.125rem; */
  background-image: url("images/blank-book-cover.jpg");
  background-size: cover;
  background-color: #100c0b;
  transition: 150ms ease-in-out;
}

.book::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: multiply;
  border-radius: 0.25rem;
  background: rgba(0, 0, 0, 0.0);
  background: linear-gradient(90deg, rgba(0, 0, 0, 1) 0%, rgba(0, 0, 0, 0) 5%);
  z-index: 1;
}

.book::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  border-radius: 0.25rem;
  background-image: url("images/worn-book-texture.jpg");
  background-size: cover;
  z-index: 2;
}

.book:hover {
  transform: translateY(-0.5rem);
}

.book:focus-visible {
  outline: 2px solid var(--white);
}

.book:hover .book-info {
  visibility: visible;
  opacity: 1;
}

.book:focus-visible .book-info,
.book:focus-within .book-info {
  visibility: visible;
  opacity: 1;
}

/*----- BOOK COVER -----*/

.book-cover {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0.25rem;
  box-shadow: 0px -4px 6px 6px rgba(0, 0, 0, 0.5);
}

/*----- BOOK INFORMATION -----*/

.book-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  position: absolute;
  padding: 1rem;
  top: 0;
  left: 0;
  width: 100%;
  color: var(--white);
  height: 100%;
  border-radius: 0.25rem;
  backdrop-filter: blur(3px);
  background-color: rgba(0, 0, 0, 0.75);

  visibility: hidden;
  opacity: 0;
  z-index: 10;
  transition: 150ms;
}

.book-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;

  font-size: 1.375rem;
  line-height: 1.25em;

  overflow: hidden;
}

.book-author {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;

  font-family: var(--work-sans);
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-size: 0.75rem;
  line-height: 1.2em;
  letter-spacing: 0.025em;
  color: var(--peach);
}

.purchase-button {
  align-self: start;
  margin-top: auto;
  font-family: var(--work-sans);
  font-optical-sizing: auto;
  font-size: 0.875rem;
  font-weight: 400;
  font-style: normal;
  color: var(--peach);
  transition: 150ms;
}

.purchase-button:focus-visible {
  color: var(--white);
  outline: 2px solid var(--white);
}

/*---------- BOOKCASE STYLES END ----------*/




/*---------- FOOTER STYLES START ----------*/

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  margin-inline: auto;
  max-width: 1200px;
}

.esoterica-footer-logo {
  fill: var(--white);
  width: 12rem;
  height: auto;
}

/*---------- FOOTER STYLES END ----------*/




/*---------- VISIBILITY STYLES START ----------*/

.hidden {
  visibility: hidden;
  opacity: 0;
}

.none {
  display: none;
}

/*---------- VISIBILITY STYLES END ----------*/




/*---------- HOVER STYLES START ----------*/

@media (hover: hover) {

  .to-top-button:hover {
    cursor: pointer;
    opacity: 0.75;
  }

  .nav-links a:hover {
    opacity: 1;
  }

  .search-button:hover {
    cursor: pointer;
    background: rgba(239, 234, 230, 0.1);
  }

  .suggestion:hover {
    cursor: pointer;
    background-color: #292b26;
  }

  .purchase-button:hover {
    cursor: pointer;
    color: var(--white);
  }

}

/*---------- HOVER STYLES END ----------*/




/*---------- ANIMATION STYLES START ----------*/

.spin {
  animation-name: spin;
  animation-duration: 1000ms;
  animation-iteration-count: infinite;
  animation-timing-function: linear;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }

  to {
    transform: rotate(360deg);
  }
}

/*---------- ANIMATION STYLES END ----------*/




/*---------- MEDIA QUERY STYLES START ----------*/

@media (max-width: 600px) {

  .bookcase-wrapper {
    --shelf-height: 224px;
    grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
    padding: 0rem 1.5rem;
  }

  .book-title {
    -webkit-line-clamp: 4;
    font-size: 1rem;
    line-height: 1.25em;
  }

}

/*---------- MEDIA QUERY STYLES END ----------*/