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

html,
body {
  height: 100%;
  text-align: center;
}

body {
  font-family: "Karla", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  background: #f5f5f1;
  color: #222;
}

/* Page layout */
.page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem;
}

/* Header */
.header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.title {
  font-size: clamp(2.4rem, 3.6vw, 3rem);
  letter-spacing: 0.04em;
  font-weight: 500;
  text-align: center;
  font-family: "Karla", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

.subtitle {
  margin-top: 0.75rem;
  font-size: 1.14rem;
  color: #666;
}

/* Section headings */
h2,
.section-title {
  font-size: 1.92rem;
  font-weight: 500;
  color: #333;
  text-align: center;
  font-family: "Karla", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

h3 {
  font-size: 1.56rem;
  font-weight: 500;
  margin-top: 1.5rem;
  margin-bottom: 0.75rem;
  color: #333;
  text-align: center;
  font-family: "Karla", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

h4 {
  font-size: 1.32rem;
  font-weight: 500;
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  color: #444;
  text-align: center;
  font-family: "Karla", system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
}

/* Books grid */
.books-grid {
  display: grid;
  grid-template-columns: auto repeat(4, 1fr) auto;
  gap: 1.5rem;
  align-items: center; /* vertically center items in the row */
}

.books-controls {
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.books-button {
  padding: 0.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1px solid #d0cfc7;
  background: rgba(250, 250, 247, 0.9);
  color: #333;
  font-size: 1.32rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.books-button:hover:not(:disabled) {
  background: #f0efe7;
  border-color: #c3c2ba;
}

.books-button:disabled {
  opacity: 0.4;
  cursor: default;
}

.books-page-indicator {
  font-size: 0.96rem;
  color: #666;
}

/* Arrows now sit inline in the controls row, spaced like other controls */

/* Book card */
.book-card {
  background: #fafaf7;
  border-radius: 12px;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.75rem;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.02);
  height: 100%;
  min-width: 0;
  overflow: hidden;
  max-width: 400px;
  margin: 0 auto;
}

.book-cover-wrapper {
  width: 100%;
  aspect-ratio: 3 / 4;
  background: #e8e6df;
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  flex-shrink: 0;
}

.book-cover-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

#games .book-cover-wrapper {
  aspect-ratio: 1 / 1;
  align-items: center;
}

#games .book-cover-wrapper img {
  object-position: center;
}

#games .game-link {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 1.02rem;
  color: #666;
  text-decoration: none;
  transition: color 0.2s ease;
}

#games .game-link:hover {
  color: #333;
  text-decoration: underline;
}

.book-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  flex: 1;
}

.book-title {
  font-size: 1.14rem;
  font-weight: 500;
}

.book-author {
  font-size: 1.02rem;
  color: #777;
}

.book-year {
  font-size: 0.96rem;
  color: #aaa;
}

.book-rating-review {
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.book-rating {
  font-size: 1.02rem;
  color: #444;
}

.book-review {
  font-size: 0.96rem;
  color: #777;
  line-height: 1.4;
}

/* Footer */
.footer {
  margin-top: auto;
  margin-top: 3rem;
  font-size: 0.9rem;
  color: #999;
  text-align: center;
}

/* Responsive: single-column cards on small screens */
@media (max-width: 800px) {
  .books-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .book-card {
    max-width: 300px;
  }

  .books-grid .books-button {
    justify-self: center;
  }

  .books-mobile-arrows {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
  }
}

/* Dark mode (system preference) */
@media (prefers-color-scheme: dark) {
  body {
    background: #0f1115;
    color: #f5f5f5;
  }

  a {
    color: #3fd4ff;
  }

  a:visited {
    color: #22b3dd;
  }

  a:hover {
    color: #7fe4ff;
  }

  .page {
    box-shadow: none;
  }

  .title,
  h2,
  .section-title,
  h3,
  h4 {
    color: #f5f5f5;
  }

  .subtitle {
    color: #b3b8c3;
  }

  .book-card {
    background: #181b22;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  }

  .book-cover-wrapper {
    background: #262a33;
  }

  .book-author {
    color: #a0a7b6;
  }

  .book-year {
    color: #6f7480;
  }

  .book-rating {
    color: #f7c948;
  }

  .book-review {
    color: #ccd2e0;
  }

  .books-button {
    border-color: #3b4253;
    background: #20242f;
    color: #f5f5f5;
  }

  .books-button:hover:not(:disabled) {
    background: #2a3040;
    border-color: #4a5266;
  }

  .books-page-indicator {
    color: #9aa0b5;
  }

  #games .game-link {
    color: #3fd4ff;
  }

  #games .game-link:hover {
    color: #7fe4ff;
  }

  .footer {
    color: #6f7480;
  }
}


