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

:root {
  font-size: 18px;

  --dark-header: #082032;
  --vibrant: #eca72c;
  --vibrant-hover: #ecc22c;
  --vibrant-lighter: #ffcb70;
  --font-light: #ddd;
  --bg-dark: #3c5467;
  --card-dark: #263140;
  --card-dark-hover: #334e71;
  --card-border-dark: #122630;
}

body {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;

  line-height: 1.5;

  font-family: "Merriweather", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  font-style: normal;
  font-variation-settings: "wdth" 100;
}

h1,
h2 {
  font-weight: unset;
}

button {
  border: none;
  box-shadow: none;
  font: inherit;

  cursor: grab;
}

.logo,
.book-title {
  font-family: "Limelight", sans-serif;
  font-weight: 500;
  font-style: normal;
}

.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  justify-items: center;

  padding: 1rem;

  background: var(--dark-header);
  color: var(--font-light);
  box-shadow: 0px 4px 10px 0px rgba(0, 0, 0, 0.7);
  z-index: 2;
}

.add-book-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  align-items: center;
  justify-content: center;
}

.add-book-section button {
  background: var(--vibrant);
  width: 150px;
  height: 30px;
  border-radius: 15px;
  border: 2px solid var(--vibrant-lighter);
}

.logo {
  display: flex;
  gap: 18px;
  letter-spacing: 1px;
  align-items: center;

  font-size: 1.5rem;
}

.logo-svg {
  height: 50px;
  width: 50px;
  fill: var(--font-light);
  position: relative;
  top: -4px;
}

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

.card-container {
  padding: 32px 64px;

  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

.card {
  background: var(--card-dark);
  color: var(--font-light);

  border-radius: 10px;
  border: 1px solid var(--dark-header);

  position: relative;

  box-shadow: 5px 5px 10px 0px rgba(0, 0, 0, 0.7);
}

.book-title {
  background: var(--vibrant);
  color: #111;
  border-radius: 9px 9px 0 0;
  padding: 4px 32px 4px 8px;

  font-size: 1.3rem;
}

.card p,
.card div {
  margin: 2px 0 6px;
}

.card label,
.card div {
  padding-left: 8px;
}

.card input[type="checkbox"] {
  width: 0.9em;
  height: 0.9em;
  border: 2px solid var(--font-light);
}

.card input[type="checkbox"]:checked::after {
  content: "";
  width: 5px;
  height: 12px;
  border-right: 3px solid var(--font-light);
  border-bottom: 3px solid var(--font-light);
  transform: rotate(45deg);
  display: block;

  position: relative;
  left: 3px;
  top: -3px;
}

.card label {
  cursor: help;
}

.author svg,
.pages svg {
  width: 1.3em;
  aspect-ratio: 1 / 1;
  position: relative;
  fill: var(--font-light);
  top: -1px;
  left: -4px;
}

.card div {
  display: flex;
  align-items: center;
}

.card span {
  padding-left: 1px;
}

.form-container {
  background: var(--card-dark);
  width: clamp(350px, 40%, 400px);
  padding: 36px 18px;

  border: 4px solid var(--card-border-dark);
  border-radius: 12px;

  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);

  color: var(--font-light);

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;

  z-index: 4;
}

.form-container.closed {
  display: none;
}

.form-container > * {
  width: 300px;
}

.form-cell {
  display: flex;
  flex-direction: column;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  padding-right: 36px;
}

input {
  appearance: none;
  -webkit-appearance: none;
  box-shadow: none;
  font: inherit;
  border: none;
}

input:focus {
  outline: none;
}

.book-form input[type="text"],
.book-form input[type="tel"] {
  padding: 6px 12px;
  border-radius: 18px;
  height: 36px;
}

.book-form input[type="tel"] {
  width: 150px;
}

#add-book {
  background: var(--vibrant);
  height: 36px;
  border-radius: 18px;
  border: 2px solid var(--vibrant-lighter);
}

.book-form label {
  padding-left: 6px;
  letter-spacing: 1px;
}

.book-form input[type="checkbox"] {
  width: 36px;
  height: 36px;
  border-radius: 18px;
  background-color: #fff;
}

.book-form input[type="checkbox"]:checked::after {
  content: "✔";
  font-size: 2.2rem;
  width: 28px;
  height: 28px;
  border-radius: 14px;
  display: block;
  color: var(--dark-header);
  position: relative;
  top: -12px;
  left: -1px;
}

.book-form input[type="checkbox"]:checked {
  border: 3px solid var(--vibrant);
}

.form-cell.checkbox {
  padding: 0;
  align-items: center;
}

.delete-book {
  background: none;
  width: 24px;
  height: 24px;

  position: absolute;
  top: 9px;
  right: 7px;
}

.close-form {
  background: var(--card-dark);
  fill: #fff;
  width: 36px;
  height: 36px;

  position: absolute;
  top: 9px;
  right: 9px;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 3;

  background: rgba(0, 0, 0, 0.65);
}

.card:hover {
  background: var(--card-dark-hover);
}

.card:hover > .book-title {
  background: var(--vibrant-hover);
}

#add-book:hover,
#call-book-form:hover {
  background: var(--vibrant-hover);
}

.book-form input:user-invalid {
  outline: 2px solid red;
}

.book-form input:focus {
  outline: 2px solid var(--vibrant-lighter);
}
