/* RESIDUE — reading edition. Extends anima's site style.css. */

.container { max-width: 680px; }

/* ---- Front matter ---- */

.book-header { margin-bottom: 3rem; }
.book-header h1 { letter-spacing: 0.3em; margin-bottom: 0.75rem; }
.book-header .subtitle { font-size: 1rem; font-style: normal; color: var(--muted); }

.draft-note {
  margin-bottom: 2.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-size: 0.92rem;
  color: var(--muted);
}
.draft-note strong { color: var(--fg); }

/* ---- Table of contents ---- */

.toc { margin-bottom: 3rem; }

.toc-entry {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  padding: 0.7rem 0.25rem;
  border-bottom: 1px solid var(--border);
  color: var(--fg);
}
.toc-entry:last-child { border-bottom: none; }
.toc-entry:hover { text-decoration: none; }
.toc-entry:hover .toc-title { color: var(--accent); }

.toc-num {
  flex: 0 0 1.6rem;
  font-size: 0.8rem;
  color: var(--dim);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.toc-title { flex: 1 1 auto; font-size: 1.05rem; }
.toc-count {
  flex: 0 0 auto;
  font-size: 0.75rem;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
}

/* ---- Chapter ---- */

.chapter-header {
  margin-bottom: 3rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}
.chapter-part {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--dim);
  margin-bottom: 1rem;
}
.chapter-number {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 0.4rem;
}
.chapter-title {
  font-size: 2rem;
  font-weight: 400;
  color: var(--fg);
  letter-spacing: 0.02em;
  line-height: 1.2;
  margin-bottom: 0.6rem;
}
.chapter-meta { font-size: 0.75rem; color: var(--dim); }

.prose { font-size: 1.06rem; line-height: 1.85; }
.prose p { margin-bottom: 1.35rem; }
.prose em { color: var(--accent); font-style: italic; }

/* A scene break, not a rule. */
.prose hr.scene {
  border: none;
  margin: 2.5rem 0;
  text-align: center;
  overflow: visible;
}
.prose hr.scene::after {
  content: '\00a7';
  color: var(--dim);
  font-size: 0.85rem;
  letter-spacing: 0.5em;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}
.pager a { color: var(--dim); }
.pager a:hover { color: var(--accent); text-decoration: none; }
.pager-next { margin-left: auto; text-align: right; }

/* ---- Annotation layer ---- */

/* Only shown once a reviewer has unlocked with a key. */
.annotating .prose p {
  cursor: text;
  border-radius: 3px;
  transition: background 120ms ease;
  padding: 0 0.4rem;
  margin-left: -0.4rem;
  margin-right: -0.4rem;
}
.annotating .prose p:hover { background: rgba(167, 139, 250, 0.07); }

.prose p.has-note {
  border-left: 2px solid var(--accent);
  padding-left: 0.6rem;
  margin-left: -0.8rem;
}

.note-bar {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.78rem;
  color: var(--dim);
  font-family: system-ui, sans-serif;
}
.note-bar button {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
}
.note-bar button:hover { text-decoration: underline; }
.note-bar .note-count { color: var(--muted); font-variant-numeric: tabular-nums; }

.note-editor {
  margin: 0 0 1.35rem;
  padding: 0.85rem 1rem;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-family: system-ui, sans-serif;
}
.note-editor textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  font: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--fg);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.6rem;
}
.note-editor textarea:focus { outline: none; border-color: var(--accent); }
.note-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
  font-size: 0.8rem;
}
.note-actions button {
  font: inherit;
  cursor: pointer;
  border-radius: 4px;
  padding: 0.35rem 0.8rem;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--muted);
}
.note-actions button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #16121f;
  font-weight: 600;
}
.note-actions button:hover { border-color: var(--accent); }
.note-actions .note-status { color: var(--dim); margin-left: auto; }

.note-saved {
  margin: 0 0 1.35rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  border-radius: 0 4px 4px 0;
  font-family: system-ui, sans-serif;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  white-space: pre-wrap;
}
.note-saved .note-head {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  margin-bottom: 0.35rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--dim);
  white-space: normal;
}
.note-saved .note-head button {
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
  background: none;
  border: none;
  color: var(--dim);
  cursor: pointer;
  padding: 0;
}
.note-saved .note-head button:hover { color: var(--accent); }
.note-saved .note-head .spacer { margin-left: auto; }

@media (max-width: 480px) {
  .chapter-title { font-size: 1.5rem; }
  .toc-count { display: none; }
  .note-bar { left: 1rem; right: 1rem; justify-content: center; }
}
