h1, h2 {
    margin: 0;
}

body{
    display: grid;
    grid-template-rows: 400px;
    background-color: #1f1a17;
    grid-auto-rows: 400px;
}

.shelf {
    display: grid;
    grid-template-columns: 1fr 8fr 1fr;
    grid-template-rows: 1fr 8fr 1fr;
}

.book-row {
    grid-column: 2 / 3;
    grid-row: 2 / 3;
    display: grid;
    grid-template-columns: 100px;
    grid-auto-flow: column;
    grid-auto-columns: 100px;
    gap: 3px;
    height: 320px;
    align-items: end;
}

.ledge {
    background: linear-gradient(to bottom, #6b4226 0%, #5a3d24 40%, #3a2814 100%);
    height: 30px;
    grid-column: 1 / 4;
    grid-row: 3 / 4;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
}

.book {
    display: grid;
    grid-template-columns: 1fr 5fr 17px;
    grid-template-rows: 1fr 0.5fr 7fr 0.5fr 1fr;
    box-shadow: 
        2px 4px 6px rgba(0, 0, 0, 0.4),
        -2px 0 4px rgba(0, 0, 0, 0.5) inset;
    z-index: 1;
    height: 320px;
    cursor: pointer;
}

.book:hover {
    box-shadow: 3px 8px 10px rgba(0, 0, 0, 0.5);
}

.bookmark {
    font-size: 18px;
    text-shadow: 0 0 2px rgba(0, 0, 0, 0.7), 0 0 2px rgba(0, 0, 0, 0.7);
}

.info {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    container-type: inline-size;
    padding-inline: 5px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.book h1 {
    font-weight: 600;
    font-family: Georgia, 'Times New Roman', Times, serif;
    text-align: center;
    cursor: pointer;
}

.book h2 {
    font-weight: 400;
    font-family: Georgia, 'Times New Roman', Times, serif;
    text-align: center;
    cursor: pointer;
}

.book-end {
    box-shadow: 
        2px 4px 6px rgba(0, 0, 0, 0.4),
        -2px 0 4px rgba(0, 0, 0, 0.5) inset;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 312.5px;
    width: 100px;
    border: dashed, rgba(243, 230, 216, 0.3);
    background-color: rgba(255,255,255,0.03);
}

.book-end:hover {
    background-color: rgba(255,255,255,0.08);
    border: dashed, rgba(243, 230, 216, 0.8);
}

.book-end > button {
    border: 0;
    border-radius: 50px;
    background-color: rgba(255,255,255,0.03);
    color: rgba(243, 230, 216, 0.3);
    font-size: 25px;
    height: 50px;
    width: 50px;
}

.book-end > button:hover {
    background-color: rgba(255,255,255,0.08);
    color: rgba(243, 230, 216, 0.8);
}

.book-end:hover > button {
  background-color: rgba(255,255,255,0.08);
  color: rgba(243, 230, 216, 0.8);
}

dialog {
  background-color: #f0e6d2;
  background: radial-gradient(ellipse at center, #f5ead3 0%, #e8d9b8 100%);
  border: 2px solid #8a611c;
  border-radius: 2px;
  font-family: Georgia, 'Times New Roman', Times, serif;
  color: #3a2a0c;
  padding: 24px 28px;
  min-width: 260px;
}

dialog h1 {
  letter-spacing: 1px;
  text-transform: uppercase;
  border-bottom: 1px solid #8a611c;
  padding-bottom: 6px;
  margin-bottom: 12px;
}

dialog p {
  margin: 4px 0;
}

dialog::backdrop {
  background-color: rgba(31, 26, 23, 0.7);
}

dialog button {
  background: none;
  border: none;
  font-family: inherit;
  color: #8a611c;
  text-decoration: underline;
  cursor: pointer;
}

dialog hr {
  border: none;
  border-top: 1px solid rgba(138, 97, 28, 0.3);
  margin: 8px 0;
}

#remove-book-btn {
  color: #7a3327;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dialog-actions {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
}

dialog button {
  text-decoration: none;
}

dialog button:hover {
  text-decoration: underline;
}

.toggle-pill-detail,
.toggle-pill-new {
    height: 30px;
    border-radius: 20px;
    background-color: #8a611c;
    display: flex;
    align-items: center;
    width: 60px;
}

.toggle-pill-detail button,
.toggle-pill-new button {
    background-color: #6b4226;
    height: 20px;
    width: 20px;
    border-radius: 20px;
    margin: 5px;
}

.toggle-pill-detail:focus-within,
.toggle-pill-new:focus-within {
  outline: 2px solid #8a611c;
  outline-offset: 2px;
}

.toggle-pill-detail button:focus-visible,
.toggle-pill-new button:focus-visible {
  outline: 2px solid #f3e6d8;
  outline-offset: 2px;
}

.toggle-pill-detail.is-read,
.toggle-pill-new.is-read {
  background-color: #4a6b3a; 
}

.toggle-pill-detail.is-read button,
.toggle-pill-new.is-read button {
  margin-left: auto; 
}

dialog[open] {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

dialog input {
  background-color: #fdf8ee;
  border: 1px solid #8a611c;
  border-radius: 2px;
  font-family: inherit;
  color: #3a2a0c;
  padding: 4px 8px;
}

dialog input:focus-visible {
  outline: 2px solid #8a611c;
  outline-offset: 2px;
}

dialog:focus-visible {
  outline: 2px solid #8a611c;
  outline-offset: 4px;
}

#add-book-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

dialog button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}