:root[data-theme="light"] {
  --text: rgb(4, 3, 22);
  --background: rgb(251, 251, 254);
  --primary: rgb(47, 39, 206);
  --secondary: rgb(221, 219, 255);
  --accent: rgb(68, 61, 255);
}
:root[data-theme="dark"] {
  --text: rgb(234, 233, 252);
  --background: rgb(1, 1, 4);
  --primary: rgb(58, 49, 216);
  --secondary: rgb(2, 0, 36);
  --accent: rgb(6, 0, 194);
}

:root {
  --header-height: 80px;
  --font-stack: "Lucida Sans", "Lucida Sans Regular", "Lucida Grande",
    "Lucida Sans Unicode", Geneva, Verdana, sans-serif;
  --brownish: rgb(249, 235, 178);
  --blueish: rgb(69, 170, 184);
  --soft-red: #f47174;
}

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

body {
  background-color: var(--background);
  height: 100%;
  color: var(--text);
  font-family: var(--font-stack);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2rem;
}

header {
  height: var(--header-height);
  width: 100%;
  background-color: var(--accent);
  display: flex;
  padding-left: 16px;
  padding-right: 16px;
  align-items: center;
  justify-content: space-between;
}
header > h1 {
  font-size: 3rem;
}

.toggle-div {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--text);
  border-radius: 10px;
  cursor: pointer;
}
.toggle-div i {
  font-size: 2rem;
  color: var(--text);
  transition: all 1s;
}
.toggle-div i:hover{
    transform: rotateZ(50deg) scale(1.2);
  }

main {
  width: 80%;
  min-height: 80%;
  height: calc(100% - var(--header-height));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  grid-auto-rows: 350px;
  justify-items: center;
  gap: 20px;
  position: relative;
}

button.add-book-button {
  position: fixed;
  z-index: 1;
  bottom: 40px;
  right: 40px;
  background-color: var(--blueish);
  color: inherit;
  border: none;
  padding: 1rem 2rem;
  box-shadow: 4px 4px 6px;
  cursor: pointer;
  font-weight: bold;
  font-size: 1rem;
}

.book {
  width: 250px;
  height: 350px;
  background-color: rgb(57, 109, 142);
  line-height: 1.8;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 10px;
  color: inherit;
}
.book h3 {
  font-size: 1.2rem;
}
.book button:first-of-type {
  margin-bottom: 4px;
}

.book button {
  cursor: pointer;
  height: 50px;
  width: 100%;
  font-weight: bold;
  color: var(--text);
  background-color: var(--blueish);
  border: none;
}

.book button.delete {
  background-color: var(--soft-red);
}

.book img {
  height: 40%;
}

dialog:open {
  margin: auto;
  width: min(350px, 100%);
  background-color: rgb(221, 219, 255);
  height: 400px;
  padding: 1rem;
  padding-bottom: 0;
  border: none;
  position: relative;

  & button.close {
    position: absolute;
    padding: 0.4rem 1rem;
    top: 0;
    right: 0;
    background-color: #db1f22;
    color: #fff;
    font-size: 1.4rem;
    font-weight: 900;
    border: none;
    cursor: pointer;
  }
}

dialog:open form {
  width: 100%;
  height: 86%;
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  justify-content: space-between;

  .inputs {
    gap: 10px;
    display: flex;
    flex-direction: column;
  }

  .button button {
    width: 100%;
    height: 50px;
    border: none;
    cursor: pointer;
    background-color: var(--accent);
    font-weight: bold;
    font-size: 1rem;
    text-align: center;
    color: var(--text);
  }
  div {
    width: 100%;
  }

  div.check {
    display: flex;
    justify-content: space-between;
    align-items: end;
    padding: 0.4rem inherit;
  }
  input {
    outline: none;
    height: 30px;
    width: 100%;
    padding-left: 0.6rem;
  }
  input[type="checkbox"] {
    width: 10%;
  }
}

dialog:open::backdrop {
  background-color: rgb(0 0 0 / 50%);
}

section.stats {
  width: 90%;
  height: 60px;
  background-color: var(--secondary);
  display: flex;
  justify-content: space-around;
  border-radius: 46px;
  position: sticky;
  top: 10px;
  z-index: 3;
  align-items: center;
  div {
    text-align: center;
  }
}

@keyframes circle-in {
  from { clip-path: circle(0% at top right); }
  to { clip-path: circle(210% at bottom left); }
}

::view-transition-new(root) {
  animation: circle-in 1s;
}
::view-transition-old(root) {
  animation-delay: 1s;
}
@keyframes move-in {
  from { translate: 0 -100%; }
  to { translate: 0  0; }
}