/* I Can Tell… — ereader styles */
:root {
  --reader-size: 19px;
  --maxw: 40rem;

  --bg: #f6f5f1;
  --bg-elev: #ffffff;
  --ink: #1d1c1a;
  --ink-soft: #5d5a54;
  --line: #e3e0d8;
  --accent: #8a1f2b;        /* oxblood — neutral-ish, not red or blue */
  --accent-ink: #ffffff;
  --blue: #2b5fa8;
  --red: #b23a3a;
}
:root[data-theme='sepia'] {
  --bg: #efe6d3; --bg-elev: #f6efdf; --ink: #3a2f1e; --ink-soft: #6b5d44;
  --line: #ddcfb2; --accent: #7a4a1f; --accent-ink: #fff;
}
:root[data-theme='dark'] {
  --bg: #16161a; --bg-elev: #1e1e24; --ink: #e7e5e0; --ink-soft: #a3a09a;
  --line: #32323b; --accent: #c9a04a; --accent-ink: #16161a;
  --blue: #6fa0e8; --red: #e87f7f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:root[data-font='sans'] .ch-body { font-family: 'Inter', system-ui, sans-serif; }

a { color: inherit; }
.muted { color: var(--ink-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block; padding: .7rem 1.2rem; border-radius: 999px;
  font-weight: 600; text-decoration: none; font-size: .95rem;
  border: 1px solid var(--line); transition: transform .08s ease, background .15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--ink); }
.iconbtn {
  background: transparent; border: 0; color: var(--ink); cursor: pointer;
  font-size: 1.15rem; padding: .4rem .6rem; border-radius: 8px; font-weight: 600;
}
.iconbtn:hover { background: var(--line); }

/* ---------- Cover / landing ---------- */
.cover { max-width: 46rem; margin: 0 auto; padding: 6vh 1.4rem 4rem; }
.cover-hero { text-align: center; padding: 2rem 0 1rem; }
.cover-kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .72rem;
  color: var(--ink-soft); margin: 0 0 1.2rem; }
.cover-title { font-family: 'Lora', Georgia, serif; font-size: clamp(2.6rem, 8vw, 4.2rem);
  margin: 0; line-height: 1.04; }
.cover-sub { font-family: 'Lora', serif; font-style: italic; color: var(--ink-soft);
  font-size: 1.15rem; max-width: 32rem; margin: 1rem auto 0; }
.cover-tag { font-size: 1.05rem; margin: 1.4rem auto 0; color: var(--ink); }
.cover-actions { display: flex; gap: .7rem; justify-content: center; flex-wrap: wrap; margin: 2rem 0 1rem; }
.cover-by { color: var(--ink-soft); font-size: .9rem; margin-top: .6rem; }
.cover-by-alias { color: var(--ink-soft); font-style: italic; font-size: .85em; }
.cover-blurb { max-width: 34rem; margin: 2.5rem auto; font-size: 1.05rem; color: var(--ink-soft);
  text-align: center; line-height: 1.7; }

/* ---------- About the Author ---------- */
.about { max-width: 40rem; margin: 4rem auto 0; padding-top: 2.5rem; border-top: 1px solid var(--line); }
.about h2 { font-family: 'Lora', serif; font-size: 1.3rem; text-align: center; margin: 0 0 1.6rem; }
.about-card { display: flex; gap: 1.5rem; align-items: flex-start; }
.about-photo { flex: 0 0 auto; width: 7.5rem; height: 7.5rem; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--line); box-shadow: 0 6px 24px rgba(0,0,0,.12); }
.about-text { font-size: 1rem; line-height: 1.7; color: var(--ink-soft); }
.about-name { font-family: 'Lora', serif; font-size: 1.15rem; color: var(--ink);
  margin: 0 0 .5rem; font-weight: 600; }
@media (max-width: 32rem) {
  .about-card { flex-direction: column; align-items: center; text-align: center; }
}

/* ---------- TOC ---------- */
.toc { max-width: 36rem; margin: 3rem auto 0; }
.toc h2, .drawer-head h2 { font-family: 'Lora', serif; font-size: 1.3rem; }
.toc-list, .drawer-list { list-style: none; padding: 0; margin: 0; counter-reset: ch; }
.toc-list li, .drawer-list li { border-top: 1px solid var(--line); }
.toc-list a, .drawer-list a {
  display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: .2rem .8rem;
  padding: .9rem .2rem; text-decoration: none;
}
.toc-list a:hover, .drawer-list a:hover { background: var(--bg-elev); }
.toc-kicker { grid-column: 1; font-size: .72rem; text-transform: uppercase;
  letter-spacing: .1em; color: var(--ink-soft); }
.toc-title { grid-column: 1; font-family: 'Lora', serif; font-size: 1.1rem; }
.toc-mins { grid-column: 2; grid-row: 1 / span 2; color: var(--ink-soft); font-size: .8rem; align-self: center; }
.drawer-list .current { background: var(--bg-elev); }
.drawer-list .current .toc-title { color: var(--accent); font-weight: 600; }

/* ---------- Reader (SPA app shell) ---------- */
.reader { position: fixed; inset: 0; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  flex: 0 0 auto; z-index: 20; display: flex; align-items: center;
  justify-content: space-between; padding: .5rem .8rem;
  background: var(--bg); border-bottom: 1px solid var(--line);
}
.topbar-home { font-family: 'Lora', serif; font-size: 1rem; text-decoration: none; color: var(--ink-soft);
  max-width: 70vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.topbar-home.is-chapter .hdr-main { color: var(--ink); font-weight: 600; }
.hdr-main { transition: opacity .14s ease; }
.hdr-tell { color: var(--ink-soft); font-weight: 400; font-size: .82em; font-style: italic;
  transition: opacity .12s ease; }
.hdr-tell::before { content: ' · '; font-style: normal; }
.hdr-tell[hidden] { display: none; }

/* Stage holds the sliding chapter panels */
.stage { position: relative; flex: 1 1 auto; overflow: hidden; }
.page {
  position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  will-change: transform, opacity; transform: translateY(0); opacity: 1;
  transition: transform .42s cubic-bezier(.22, .61, .36, 1), opacity .42s ease;
}
.page .chapter { max-width: var(--maxw); margin: 0 auto; padding: 2.2rem 1.3rem 4rem; }
/* Entering panels start off-stage; exiting panels glide away */
.page.enter-up   { transform: translateY(100%);  opacity: .35; }
.page.enter-down { transform: translateY(-100%); opacity: .35; }
.page.exit-up    { transform: translateY(-28%);  opacity: 0; }
.page.exit-down  { transform: translateY(28%);   opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .page { transition: none; }
}

.ch-kicker { text-transform: uppercase; letter-spacing: .14em; font-size: .74rem;
  color: var(--accent); margin: 0 0 .4rem; font-weight: 600; }
.ch-title { font-family: 'Lora', serif; font-size: clamp(1.9rem, 5vw, 2.6rem);
  line-height: 1.1; margin: 0 0 1.8rem; }

.ch-body { font-family: 'Lora', Georgia, serif; font-size: var(--reader-size); line-height: 1.72; }
.ch-body p { margin: 0 0 1.15em; }
.ch-body h2 { font-family: 'Lora', serif; font-size: 1.4rem; margin: 2.4rem 0 .8rem; }
.ch-body h3 { font-size: 1.05rem; letter-spacing: .02em; margin: 2rem 0 .6rem; color: var(--ink-soft); }
.ch-body strong { font-weight: 600; }
.ch-body em { font-style: italic; }
.ch-body hr { border: 0; text-align: center; margin: 2.4rem 0; }
.ch-body hr::before { content: '✦ ✦ ✦'; color: var(--ink-soft); letter-spacing: .6em; font-size: .8rem; }

/* Specimen cards (blockquotes carry the Mirror structure) */
.ch-body blockquote {
  margin: 1.2rem 0; padding: 1rem 1.1rem; border-left: 4px solid var(--ink-soft);
  background: var(--bg-elev); border-radius: 0 10px 10px 0; font-size: .96em;
}
.ch-body blockquote p { margin: 0 0 .5em; }
.ch-body blockquote p:last-child { margin-bottom: 0; }
/* Tint the Blue/Red specimens by their lead-in bold text */
.ch-body blockquote:has(strong:first-child) { border-left-color: var(--ink-soft); }

.chap-nav { display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  margin-top: 3.5rem; padding-top: 1.5rem; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* Bottom progress */
.readbar { flex: 0 0 auto; z-index: 15;
  background: var(--bg);
  border-top: 1px solid var(--line); padding: .4rem .9rem .6rem; }
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .15s; }
.readbar-meta { display: flex; justify-content: space-between; font-size: .74rem;
  color: var(--ink-soft); margin-top: .3rem; }

/* Drawers + prefs */
.drawer, .prefs { position: fixed; top: 0; bottom: 0; z-index: 40; width: min(88vw, 22rem);
  background: var(--bg); box-shadow: 0 0 40px rgba(0,0,0,.25); overflow-y: auto; padding: 1rem 1.1rem 3rem; }
.drawer { left: 0; }
.prefs { right: 0; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .6rem; }
.prefs-row { display: flex; justify-content: space-between; align-items: center; padding: 1rem 0;
  border-bottom: 1px solid var(--line); }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { background: var(--bg-elev); border: 0; padding: .5rem .8rem; cursor: pointer;
  color: var(--ink); font-weight: 600; }
.seg button.active { background: var(--accent); color: var(--accent-ink); }
.scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); }

/* ---------- Comments ---------- */
.comments { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--line); }
.comments h2 { font-family: 'Lora', serif; font-size: 1.4rem; margin: 0 0 .3rem; }
.comments-sub { color: var(--ink-soft); font-size: .92rem; margin: 0 0 1.4rem; }
.comment-form { display: flex; flex-direction: column; gap: .6rem; margin-bottom: 2rem; }
.comment-name, .comment-body {
  font: inherit; color: var(--ink); background: var(--bg-elev);
  border: 1px solid var(--line); border-radius: 10px; padding: .65rem .8rem; width: 100%;
}
.comment-body { resize: vertical; min-height: 4.5rem; line-height: 1.5; }
.comment-name:focus, .comment-body:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.comment-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.comment-actions { display: flex; align-items: center; justify-content: flex-end; gap: 1rem; }
.comment-status { color: var(--ink-soft); font-size: .85rem; margin-right: auto; }
.btn[disabled] { opacity: .55; pointer-events: none; }

.comment-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.comment-empty { color: var(--ink-soft); font-style: italic; }
.comment { border-bottom: 1px solid var(--line); padding-bottom: 1.1rem; }
.comment-head { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .25rem; }
.comment-author { font-weight: 600; }
.comment-when { color: var(--ink-soft); font-size: .78rem; }
.comment-text { margin: 0; white-space: pre-wrap; word-wrap: break-word; line-height: 1.55; }
@keyframes commentIn { from { background: color-mix(in srgb, var(--accent) 12%, transparent); } to { background: transparent; } }
.comment-new { animation: commentIn 1.4s ease; }

/* Year/Month section headers */
.comment-month {
  font-family: 'Lora', serif; font-size: .8rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--ink-soft); border-bottom: 0; padding: .4rem 0 .1rem; margin-top: .4rem;
}
.comment-month:first-child { margin-top: 0; }

/* Reply affordances + nesting */
.comment-foot { margin-top: .4rem; }
.comment-reply-btn {
  background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
  font-size: .82rem; font-weight: 600; color: var(--accent);
}
.comment-reply-btn:hover { text-decoration: underline; }
.comment-replies {
  list-style: none; margin: .9rem 0 0; padding: 0 0 0 1rem;
  border-left: 2px solid var(--line); display: flex; flex-direction: column; gap: .9rem;
}
.comment-reply { border-bottom: 0; padding-bottom: 0; }
.reply-form { margin: .8rem 0 .2rem; }
.reply-form .comment-body { min-height: 3.2rem; }

.site-foot { text-align: center; color: var(--ink-soft); font-size: .82rem;
  padding: 2.5rem 1rem; border-top: 1px solid var(--line); }
.reader ~ .site-foot { display: none; } /* hide global footer inside reader */
