/* Kathy's Book List — style.css
   Pairs with index.html (Inter + Lora are already loaded there). */

:root {
  --bg: #f7f4ee;
  --surface: #ffffff;
  --surface-alt: #faf7f1;
  --text: #2b2723;
  --text-muted: #6f675d;
  --heading: #3b2a1e;
  --accent: #8a4b2a;
  --accent-soft: #f1e4d8;
  --border: #e5dfd3;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.06), 0 8px 24px rgba(60, 40, 20, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #200000;
    --surface: #25211d;
    --surface-alt: #2a2621;
    --text: #ece6dc;
    --text-muted: #a69d90;
    --heading: #f3e9da;
    --accent: #e0a074;
    --accent-soft: #3a2d23;
    --border: #3a342d;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 3rem 1.5rem 4rem;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Headings ---------- */

h1 {
  max-width: 1400px;
  margin: 0 auto 0.25rem;
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.9rem, 4vw, 2.75rem);
  line-height: 1.2;
  color: var(--heading);
  letter-spacing: -0.01em;
}

h3 {
  max-width: 1400px;
  margin: 0 auto 1.75rem;
  font-family: "Lora", Georgia, serif;
  font-style: italic;
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--text-muted);
}

/* ---------- Table ---------- */

table {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 0.85rem 1.1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

/* Header row (the <th> cells sit in the first row) */
th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 1.00rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
  border-bottom: 2px solid var(--accent);
}

/* Rounded corners on the header row */
th:first-child {
  border-top-left-radius: 13px;
}
th:last-child {
  border-top-right-radius: 13px;
}

/* Zebra rows + hover */
tr:nth-child(even) td {
  background: var(--surface-alt);
}

tr:hover td {
  background: var(--accent-soft);
}

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

tr:last-child td:first-child {
  border-bottom-left-radius: 13px;
}
tr:last-child td:last-child {
  border-bottom-right-radius: 13px;
}

/* ---------- Columns ---------- */

/* Title */
th:nth-child(1),
td:nth-child(1) {
  width: 15%;
  min-width: 11rem;
}
td:nth-child(1) {
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  font-size: 1rem;
  color: var(--heading);
}

/* Author */
th:nth-child(2),
td:nth-child(2) {
  width: 14%;
  min-width: 10rem;
  color: var(--text);
}

/* Completed */
th:nth-child(3),
td:nth-child(3) {
  width: 8%;
  min-width: 7rem;
  white-space: nowrap;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* Notes + Quotes: long text, keep the line breaks from the source */
td:nth-child(4),
td:nth-child(5) {
  white-space: pre-line;
  font-size: 0.875rem;
  line-height: 1.65;
}

th:nth-child(4),
td:nth-child(4) {
  width: 31%;
  min-width: 16rem;
}

th:nth-child(5),
td:nth-child(5) {
  width: 32%;
  min-width: 16rem;
  color: var(--text-muted);
  font-family: "Lora", Georgia, serif;
  font-style: italic;
  border-left: 3px solid transparent;
}

/* Only show the quote accent bar when there is a quote */
td:nth-child(5):not(:empty) {
  border-left-color: var(--accent-soft);
}

/* Empty cells stay quiet */
td:empty {
  padding-top: 0;
  padding-bottom: 0;
}

/* ---------- Smaller screens ---------- */

@media (max-width: 900px) {
  body {
    padding: 2rem 0.75rem 3rem;
  }

  /* Let the table scroll sideways instead of squashing the columns */
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th,
  td {
    padding: 0.7rem 0.85rem;
  }
}

@media print {
  body {
    background: #fff;
    color: #000;
    padding: 0;
  }
  table {
    box-shadow: none;
    border-radius: 0;
  }
  th {
    position: static;
  }
  tr:hover td {
    background: inherit;
  }
}

/* ---------- Quotes notepad (used by quotes.js) ---------- */

.quote-btn {
  font: inherit;
  font-family: "Inter", system-ui, sans-serif;
  font-style: normal;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}
.quote-btn:hover,
.quote-btn:focus-visible {
  background: var(--accent);
  color: var(--surface);
}

.quote-full {
  display: none;
}

.notepad {
  width: min(560px, 92vw);
  max-height: 85vh;
  padding: 0;
  border: none;
  border-radius: 4px 4px 10px 10px;
  background: #fff9c9;
  color: #2b2723;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  flex-direction: column;
}
.notepad[open] {
  display: flex;
}
.notepad::backdrop {
  background: rgba(20, 10, 5, 0.55);
}

/* the binding strip across the top */
.notepad-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.9rem;
  background: #b8452f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.notepad-close {
  font-size: 1.5rem;
  line-height: 1;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 0.25rem;
}

.notepad-title {
  padding: 0.9rem 1.5rem 0.4rem 3.5rem;
  font-family: "Lora", Georgia, serif;
  font-weight: 600;
  font-size: 1.15rem;
  border-bottom: 2px solid rgba(184, 69, 47, 0.5);
  background: #fff9c9;
}

/* ruled paper with a red margin line */
.notepad-body {
  overflow-y: auto;
  padding: 0.4rem 1.5rem 1.5rem 3.5rem;
  font-family: "Lora", Georgia, serif;
  font-style: italic;
  font-size: 1rem;
  line-height: 1.8rem;
  background-color: #fff9c9;
  background-image:
    linear-gradient(to right, transparent 2.6rem, rgba(200, 60, 50, 0.55) 2.6rem,
      rgba(200, 60, 50, 0.55) calc(2.6rem + 1px), transparent calc(2.6rem + 1px)),
    repeating-linear-gradient(to bottom, transparent 0, transparent calc(1.8rem - 1px),
      rgba(70, 110, 170, 0.28) calc(1.8rem - 1px), rgba(70, 110, 170, 0.28) 1.8rem);
  background-attachment: local;
}
.notepad-body p {
  margin: 0 0 1.8rem;
}

@media print {
  .quote-btn { display: none; }
  .quote-full { display: inline; }
}
