/* ─── CSS VARIABLES (mirrors reader.html exactly) ─── */
:root {
  --bg: #fcfcfc;
  --surface: #f3f3f0;
  --text: #1a1a1a;
  --text-muted: #737373;
  --border: #e4e4e0;
  --accent: #8b0000;
  --accent-soft: rgba(139, 0, 0, .08);
  --shadow: rgba(0, 0, 0, .06);
  --transition: .25s ease;
}

[data-theme="sepia"] {
  --bg: #f5efe3;
  --surface: #ede5d5;
  --text: #3b2a1a;
  --text-muted: #8a7060;
  --border: #d8cdb8;
  --accent: #7a4a1e;
  --accent-soft: rgba(122, 74, 30, .08);
  --shadow: rgba(0, 0, 0, .08);
}

[data-theme="dark"] {
  --bg: #141414;
  --surface: #1e1e1e;
  --text: #ddd8cc;
  --text-muted: #6e6e6e;
  --border: #2a2a2a;
  --accent: #c0392b;
  --accent-soft: rgba(192, 57, 43, .1);
  --shadow: rgba(0, 0, 0, .3);
}

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

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--transition), color var(--transition);
  min-height: 100vh;
}

/* ─── LAYOUT ─── */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 5rem 1.5rem 5rem;
}

/* ─── HEADER ─── */
header {
  margin-bottom: 5rem;
  text-align: center;
  position: relative;
}

h1 {
  font-family: Georgia, serif;
  font-size: 2.6rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--text);
  line-height: 1.2;
}

.subtitle {
  padding: 0 1.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ─── THEME TOGGLE ─── */
.theme-toggle {
  position: absolute;
  top: -25%;
  right: 0;
  display: flex;
  gap: 0.35rem;
}

.theme-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: border-color .2s, transform .2s;
}

.theme-dot:hover {
  transform: scale(1.2);
}

.theme-dot[data-t="light"] {
  background: #fcfcfc;
}

.theme-dot[data-t="sepia"] {
  background: #f5efe3;
}

.theme-dot[data-t="dark"] {
  background: #141414;
}

.theme-dot.active {
  border-color: var(--accent);
  border-width: 2px;
}

/* ─── CONTROLS ─── */
.controls {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-bottom: 4rem;
}

@media (min-width: 600px) {
  .controls {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-wrapper {
  flex-grow: 1;
}

input[type="text"] {
  width: 100%;
  padding: 0.75rem 0;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  font-size: 1rem;
  color: var(--text);
  transition: border-color var(--transition);
}

input[type="text"]:focus {
  outline: none;
  border-bottom-color: var(--text);
}

input[type="text"]::placeholder {
  color: var(--text-muted);
}

.action-wrapper {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.btn {
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.55rem 1.2rem;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--text);
  cursor: pointer;
  border-radius: 40px;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.btn:hover {
  border-color: var(--text);
}

.btn.active {
  background-color: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* ─── BOOK LIST ─── */
.book-list {
  display: flex;
  flex-direction: column;
  gap: 4rem;
}

.book-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.book-title {
  font-family: Georgia, serif;
  font-size: 2rem;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text);
}

.book-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.book-excerpt {
  font-family: Georgia, serif;
  font-size: 1.2rem;
  line-height: 1.8;
  color: var(--text-muted);
  font-style: italic;
  border-left: 2px solid var(--border);
  padding-left: 1.25rem;
  margin: 0.75rem 0;
  transition: border-color var(--transition);
}

.book-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-top: 0.25rem;
}

.link-read {
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
  padding-bottom: 2px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: color var(--transition), border-color var(--transition);
}

.link-read:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.btn-fav {
  background: none;
  border: none;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  transition: color var(--transition);
  padding: 0;
  font-family: inherit;
}

.btn-fav:hover {
  color: var(--text);
}

.btn-fav.favorited {
  color: var(--accent);
}

/* ─── DIVIDER between cards ─── */
.book-card+.book-card {
  padding-top: 4rem;
  border-top: 1px solid var(--border);
}

/* ─── PAGINATION ─── */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-size: 0.82rem;
  color: var(--text-muted);
  transition: border-color var(--transition);
}

.pagination button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 40px;
  padding: 0.5rem 1.1rem;
  cursor: pointer;
  color: var(--text);
  font-size: 0.8rem;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  transition: border-color var(--transition), opacity var(--transition);
}

.pagination button:hover:not(:disabled) {
  border-color: var(--text);
}

.pagination button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ─── EMPTY STATE ─── */
.empty-state {
  text-align: center;
  font-family: Georgia, serif;
  font-size: 1.2rem;
  color: var(--text-muted);
  font-style: italic;
  padding: 3rem 0;
}