/* Project 3 - Book Inventory */

:root {
  --paper: #ede3cd;
  --cream: #f8f3e8;
  --text: #1e2622;
  --gray: #5b6259;
  --green: #1f4a3a;
  --dark-green: #15362a;
  --gold: #b5892e;
  --light-gold: #e3c06a;
  --red: #7b2e2e;
  --line: #d8cbae;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Source Sans 3", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background-color: var(--paper);
}

/* header */

.header {
  background-color: var(--dark-green);
  color: var(--cream);
  padding: 40px 24px 70px;
}

.shelf {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  max-width: 1072px;
  height: 84px;
  margin: 0 auto 36px;
  border-bottom: 8px solid #3b2a1e;
}

.spine {
  width: 26px;
  height: 60px;
  border-radius: 2px 2px 0 0;
  background-color: #3a7a5c;
  box-shadow: inset -4px 0 0 rgba(0, 0, 0, 0.2);
}

.spine:nth-child(1) {
  background-color: var(--light-gold);
  height: 74px;
  width: 34px;
}

.spine:nth-child(2) {
  background-color: var(--red);
  height: 66px;
}

.spine:nth-child(3) {
  background-color: var(--red);
  height: 54px;
  width: 20px;
}

.spine:nth-child(4) {
  height: 70px;
  width: 32px;
}

.spine:nth-child(5) {
  height: 58px;
}

.spine:nth-child(6) {
  height: 50px;
  width: 18px;
}

.spine:nth-child(7) {
  height: 64px;
  width: 28px;
}

.shelf-name,
h1,
.intro,
.summary {
  max-width: 1072px;
  margin-left: auto;
  margin-right: auto;
}

.shelf-name {
  margin-top: 0;
  margin-bottom: 6px;
  font-family: "Fraunces", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  color: var(--light-gold);
}

h1 {
  margin-top: 0;
  margin-bottom: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 64px;
  line-height: 1;
}

.intro {
  margin-top: 20px;
  margin-bottom: 0;
  padding-right: 30%;
  font-size: 19px;
  color: #ddd6c6;
}

.summary {
  display: block;
  margin-top: 24px;
  margin-bottom: 0;
  font-size: 15px;
  color: var(--light-gold);
}

.summary::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 8px;
  border-radius: 50%;
  background-color: var(--light-gold);
}

/* table */

main {
  max-width: 1120px;
  margin: -24px auto 0;
  padding: 0 24px 24px;
}

.table-container {
  overflow-x: auto;
  background-color: var(--cream);
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  box-shadow: 0 6px 16px rgba(59, 42, 30, 0.15);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  padding: 16px 18px 12px;
  text-align: left;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  color: var(--green);
  border-bottom: 2px solid var(--green);
}

th:nth-child(1) {
  width: 46%;
}

th:nth-child(2) {
  width: 16%;
}

th:nth-child(3) {
  width: 14%;
}

th:nth-child(4) {
  width: 12%;
}

th:nth-child(5) {
  width: 12%;
}

td {
  padding: 20px 18px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

tbody tr:last-child td {
  border-bottom: none;
}

/* row colors by status (needed for the fcc tests) */

tr[class="read"] {
  background-image: linear-gradient(90deg, rgba(31, 74, 58, 0.1), rgba(31, 74, 58, 0) 60%);
}

tr[class="to-read"] {
  background-image: linear-gradient(90deg, rgba(123, 46, 46, 0.09), rgba(123, 46, 46, 0) 60%);
}

tr[class="in-progress"] {
  background-image: linear-gradient(90deg, rgba(181, 137, 46, 0.2), rgba(181, 137, 46, 0) 60%);
}

/* book info inside the title cell */

.book-title {
  margin: 0 0 8px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 21px;
  line-height: 1.2;
}

.details {
  margin: 0 0 10px;
  font-size: 14px;
}

.details span {
  margin: 0 14px 4px 0;
  padding-left: 8px;
  border-left: 2px solid var(--gold);
}

.details b {
  color: var(--gray);
}

.pitch {
  max-width: 54ch;
  margin: 0;
  font-size: 15px;
  color: var(--gray);
}

/* status badge and rating dots */

span {
  display: inline-block;
}

span[class="status"],
span[class^="rate"] {
  height: 1.9em;
  width: 7em;
  padding: 0 0.6em;
}

span[class="status"] {
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.75em;
  text-align: center;
  white-space: nowrap;
}

tr[class="to-read"] span[class="status"] {
  border: 1px solid var(--red);
  background-image: linear-gradient(rgba(123, 46, 46, 0.05), rgba(123, 46, 46, 0.14));
  color: var(--red);
}

tr[class="read"] span[class="status"] {
  border: 1px solid var(--green);
  background-image: linear-gradient(#2c614c, var(--green));
  color: var(--cream);
}

tr[class="in-progress"] span[class="status"] {
  border: 1px solid #a3781f;
  background-image: linear-gradient(#ecd07f, #d9b14f);
  color: #3d2c07;
}

span[class^="rate"] {
  width: 5.2em;
  padding: 0;
  line-height: 1.9em;
  white-space: nowrap;
}

span[class^="rate"] > span {
  border: 1px solid var(--gold);
  border-radius: 50%;
  margin: 0 0.18em;
  height: 1.15em;
  width: 1.15em;
  background-color: var(--cream);
  vertical-align: middle;
}

span[class~="one"] :first-child {
  background-image: linear-gradient(var(--light-gold), var(--gold));
}

span[class~="two"] :nth-child(1),
span[class~="two"] :nth-child(2) {
  background-image: linear-gradient(var(--light-gold), var(--gold));
}

span[class~="three"] span {
  background-image: linear-gradient(var(--light-gold), var(--gold));
}

.table-note {
  margin: 12px 4px 0;
  font-size: 14px;
  color: var(--gray);
}

/* reflection */

.reflection {
  max-width: 68ch;
  margin: 64px 0 24px;
}

.reflection h2 {
  margin: 0 0 16px;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 600;
  font-size: 32px;
  line-height: 1.1;
  color: var(--green);
}

.reflection p {
  margin: 0 0 18px;
  font-size: 17px;
  line-height: 1.65;
}

/* footer */

.footer {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px 40px;
  border-top: 1px solid var(--line);
  font-size: 14px;
  color: var(--gray);
}

.footer p {
  margin: 0;
}

/* phones: turn each row into a card */

@media (max-width: 760px) {
  .header {
    padding: 28px 16px 60px;
  }

  .shelf {
    margin-bottom: 28px;
  }

  h1 {
    font-size: 42px;
  }

  .intro {
    padding-right: 0;
    font-size: 17px;
  }

  main {
    padding: 0 16px 16px;
  }

  .footer {
    padding-left: 16px;
    padding-right: 16px;
  }

  .table-container {
    overflow: visible;
    background: none;
    border: none;
    box-shadow: none;
  }

  thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tr {
    margin-bottom: 16px;
    background-color: var(--cream);
    border: 1px solid var(--line);
    border-top: 4px solid var(--gold);
  }

  td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
  }

  td:first-child {
    padding-top: 18px;
  }

  td:last-child {
    border-bottom: none;
    padding-bottom: 18px;
  }

  /* show the column name since the header row is hidden */
  td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray);
  }

  .book-title {
    font-size: 19px;
  }

  .reflection {
    margin-top: 40px;
  }
}
