/* BreathingBooks — dawn-mist palette (from yourcrossings), extended for the reader. */
:root {
  --bg: #182229;
  --ink: #f0ece2;
  --muted: #9aa8ae;
  --accent: #d9a86a;      /* warm stone */
  --mist: #7fa8b8;        /* dawn mist blue */
  --callout-bg: #20303a;
  --callout-border: #3a4e5a;
  --serif: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.65;
}
a { color: var(--mist); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- layout ---------- */
.wrap { max-width: 44rem; margin: 0 auto; padding: 0 1.25rem; }

/* ---------- top nav ---------- */
.topnav {
  display: flex; align-items: baseline; gap: 1rem;
  padding: .9rem 0; border-bottom: 1px solid var(--callout-border);
  font-size: .9rem; flex-wrap: wrap;
}
.topnav .brand { color: var(--ink); font-size: 1.05rem; letter-spacing: .04em; }
.topnav .brand:hover { text-decoration: none; color: var(--mist); }
.topnav .kicker { color: var(--mist); letter-spacing: .12em; text-transform: uppercase; font-size: .75rem; }
.topnav .spacer { flex: 1; }
.topnav .muted { color: var(--muted); }

/* ---------- landing ---------- */
.hero { padding: 3rem 0 2rem; }
.hero h1 { font-weight: normal; font-size: 2.4rem; margin: 0 0 .6rem; }
.hero .sub { color: var(--muted); font-style: italic; font-size: 1.15rem; margin: 0; }

.shelf { padding: 1rem 0 4rem; display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.book-card {
  display: block; background: var(--callout-bg);
  border: 1px solid var(--callout-border); border-radius: 8px;
  padding: 1.1rem 1.2rem; color: var(--ink);
}
.book-card:hover { text-decoration: none; border-color: var(--mist); }
.book-card .cover-kicker { color: var(--mist); letter-spacing: .12em; text-transform: uppercase; font-size: .7rem; margin: 0 0 .5rem; }
.book-card h2 { font-weight: normal; font-size: 1.2rem; margin: 0 0 .3rem; }
.book-card .year { color: var(--muted); font-size: .85rem; margin: 0 0 .6rem; }
.book-card .desc { color: var(--muted); font-size: .92rem; margin: 0 0 .8rem; }
.badge {
  display: inline-block; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  border-radius: 3px; padding: .15rem .55rem; border: 1px solid var(--callout-border); color: var(--muted);
}
.badge.active { color: var(--accent); border-color: var(--accent); }
.badge.in-preparation { color: var(--mist); border-color: var(--mist); }
.book-card:not(.available) { opacity: .62; cursor: default; }
.book-card:not(.available):hover { border-color: var(--callout-border); }

/* ---------- book landing ---------- */
.book-head { padding: 2.5rem 0 1rem; text-align: center; }
.book-head .cover {
  width: 130px; height: 190px; margin: 0 auto 1rem;
  border: 1px solid var(--callout-border); border-radius: 4px;
  background: linear-gradient(160deg, #22343f 0%, #182229 70%), var(--callout-bg);
  display: flex; align-items: center; justify-content: center;
}
.book-head .cover svg, .book-head .cover img { width: 100%; height: 100%; border-radius: 4px; }
.book-head h1 { font-weight: normal; font-size: 2rem; margin: .4rem 0 .2rem; }
.book-head .byline { color: var(--muted); font-style: italic; margin: 0 0 1rem; }
.book-head .desc { color: var(--muted); max-width: 36rem; margin: 0 auto 1.5rem; }
.btn {
  display: inline-block; border: 1px solid var(--mist); color: var(--mist);
  border-radius: 4px; padding: .5rem 1.2rem; font-size: .95rem; cursor: pointer;
  background: transparent; font-family: inherit;
}
.btn:hover { background: rgba(127,168,184,.12); text-decoration: none; }
.btn.primary { border-color: var(--accent); color: var(--accent); }
.btn[disabled] { opacity: .45; cursor: default; }
.resume-row { margin-bottom: 1.5rem; }

.toc { padding: 1rem 0 4rem; }
.toc h2 { font-weight: normal; font-size: 1.2rem; color: var(--mist); letter-spacing: .1em; text-transform: uppercase; }
.toc ol { list-style: none; padding: 0; margin: 0; }
.toc li { border-top: 1px solid var(--callout-border); }
.toc li:last-child { border-bottom: 1px solid var(--callout-border); }
.toc a { display: flex; gap: .8rem; padding: .65rem .2rem; color: var(--ink); align-items: baseline; }
.toc a:hover { text-decoration: none; color: var(--accent); }
.toc .n { color: var(--mist); font-size: .85rem; min-width: 1.6rem; }
.toc .done { color: var(--accent); font-size: .85rem; margin-left: auto; }

.translations { margin: 1.5rem 0 2.5rem; color: var(--muted); font-size: .9rem; }
.translations select {
  background: var(--callout-bg); color: var(--ink); border: 1px solid var(--callout-border);
  border-radius: 4px; padding: .35rem .6rem; font-family: inherit; font-size: .9rem;
}
.notice { background: var(--callout-bg); border: 1px solid var(--callout-border); border-radius: 4px; padding: .7rem 1rem; color: var(--muted); font-size: .9rem; margin: 1rem 0; }

/* ---------- chapter page ---------- */
.chap-header { padding: 2.2rem 0 1.4rem; border-bottom: 1px solid var(--callout-border); margin-bottom: 2rem; }
.chap-header .book { color: var(--mist); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.chap-header h1 { font-weight: normal; font-size: 1.9rem; margin: .4rem 0 .15rem; }
.chap-header .num { color: var(--muted); font-style: italic; margin: 0 0 1.2rem; }
.chap-tools { display: flex; gap: .8rem; align-items: center; flex-wrap: wrap; font-size: .85rem; }
.chap-tools select {
  background: var(--callout-bg); color: var(--ink); border: 1px solid var(--callout-border);
  border-radius: 4px; padding: .3rem .55rem; font-family: inherit; font-size: .85rem;
}
.chap-tools select[disabled] { color: var(--muted); opacity: .6; }

/* ---------- chapter 1 audio bar ---------- */
.audio-bar {
  display: flex; align-items: center; gap: .7rem; width: 100%; max-width: 640px;
  padding: .55rem .8rem; margin-top: .3rem;
  background: var(--callout-bg); border: 1px solid var(--callout-border);
  border-left: 3px solid var(--mist); border-radius: 4px;
}
.audio-bar[hidden] { display: none; }
.ab-play {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 1px solid var(--mist); background: transparent; color: var(--mist);
  font-size: .72rem; cursor: pointer; line-height: 1;
}
.ab-play:hover { background: rgba(127,168,184,.15); }
.ab-progress {
  flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,0.18);
  cursor: pointer; position: relative; overflow: hidden;
}
.ab-fill { height: 100%; width: 0%; background: #d8b64a; border-radius: 4px; }
.ab-time { flex: none; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.reading { font-size: 1.06rem; }
.reading p { margin: 0 0 1.15rem; text-indent: 1.4em; }
.reading p.first { text-indent: 0; }
.reading p.heading { text-indent: 0; color: var(--accent); font-variant: small-caps; letter-spacing: .04em; margin-top: 1.6rem; }
.reading .letter,
.reading figure.manuscript {
  text-indent: 0; margin: 1.4rem 0; padding: 1rem 1.2rem;
  border-left: 3px solid var(--accent); background: var(--callout-bg);
  font-size: .98rem; color: var(--ink);
}
.reading figure.manuscript {
  border-left: none; border: 1px solid var(--callout-border);
  background: #26343c; font-style: italic; margin-left: 1.5rem; margin-right: .5rem;
}
.reading figure.manuscript figcaption {
  font-style: normal; font-size: .72rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); margin-bottom: .5rem;
}
.reading figure.manuscript::before { display: none; }
.reading .letter::before {
  content: "❧"; display: block; color: var(--accent); margin-bottom: .4rem; font-size: .9rem;
}
/* commentary insertions */
.insertion {
  text-indent: 0; margin: 1.4rem 0; padding: .9rem 1.1rem;
  border: 1px dashed var(--mist); border-radius: 6px;
  background: rgba(127,168,184,.07); font-size: .93rem;
}
.insertion .insertion-quote { margin: 0 0 .5rem; color: var(--ink); }
.insertion .insertion-attr { margin: 0; font-size: .8rem; color: var(--muted); }
.more-insertions { margin: 2rem 0; padding-top: 1rem; border-top: 1px solid var(--callout-border); }
.more-insertions h2 {
  font-weight: normal; font-size: 1rem; color: var(--mist);
  letter-spacing: .1em; text-transform: uppercase; margin: 0 0 .6rem;
}
.more-insertions ul { list-style: none; margin: 0; padding: 0; }
.more-insertions li { padding: .35rem 0; color: var(--muted); font-size: .9rem; border-top: 1px dotted var(--callout-border); }
.more-insertions li:first-child { border-top: none; }
/* video insertion cards — embedded-lite: thumbnail link card, click opens YouTube */
.video-insertion { padding: .8rem 1rem; }
.video-insertion .video-link {
  display: flex; align-items: center; gap: .7rem; text-decoration: none;
  color: var(--ink); border: 1px solid var(--mist); border-radius: 4px;
  background: rgba(127,168,184,.06); overflow: hidden;
}
.video-insertion .video-link:hover { background: rgba(127,168,184,.14); }
.video-insertion .video-thumb { width: 96px; height: 54px; object-fit: cover; flex: none; display: block; }
.video-insertion .video-glyph {
  flex: none; width: 18px; height: 18px; margin-left: .7rem; border-radius: 3px;
  background: #f00 center/18px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23fff' d='M9 7l8 5-8 5z'/%3E%3C/svg%3E"),
    linear-gradient(#f00, #e00);
}
.video-insertion .video-title { padding: .5rem .7rem .5rem 0; font-size: .88rem; line-height: 1.3; }
.video-insertion .video-link::after {
  content: "▶"; flex: none; margin-right: .6rem; font-size: .7rem; color: var(--muted);
}
.reading .scene-break { text-align: center; color: var(--mist); text-indent: 0; margin: 2rem 0; letter-spacing: .5em; }
.reading .scene-break::before { content: "⁂"; letter-spacing: 0; }

/* ---------- bottom nav ---------- */
.bottomnav {
  margin: 3rem 0 4rem; padding-top: 1.2rem; border-top: 1px solid var(--callout-border);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}
.bottomnav .index { color: var(--muted); }
.completerow { margin-top: 1.4rem; text-align: center; }
.completerow .done-msg { color: var(--accent); font-style: italic; }

/* ---------- about / footer ---------- */
.about { padding: 2.5rem 0 4rem; }
.about h1 { font-weight: normal; }
.about p { color: var(--muted); }
footer { border-top: 1px solid var(--callout-border); color: var(--muted); font-size: .82rem; padding: 1.2rem 0 2rem; }
footer .wrap { display: flex; gap: 1.2rem; flex-wrap: wrap; }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .shelf { grid-template-columns: 1fr; }
  .hero h1 { font-size: 1.8rem; }
  .reading { font-size: 1.02rem; }
  .topnav .spacer { display: none; }
}

/* navsub: About link under brand */
.navsub { font-size: .78rem; color: var(--muted); }
.navsub:hover { color: var(--accent); }
/* Settings dropdown */
.settings { position: relative; }
.navlink-btn { background: none; border: none; color: var(--muted); font-size: .9rem; cursor: pointer; padding: .3rem .5rem; }
.navlink-btn:hover { color: var(--accent); }
.settings-menu { position: absolute; right: 0; top: 120%; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: .8rem 1rem; box-shadow: 0 4px 14px rgba(0,0,0,.08); z-index: 10; min-width: 240px; }
.settings-menu label { display: block; font-size: .85rem; color: var(--ink); margin: .3rem 0; }
.settings-menu label:first-child { font-weight: 600; color: var(--muted); margin-bottom: .5rem; }

/* TM mark */
sup.tm { font-size: .55em; color: var(--muted); margin-left: 1px; }

/* settings dropdown body (book pages) */
.settings-menu { position: relative; }
.settings-menu summary { cursor: pointer; list-style: none; }
.settings-menu summary::-webkit-details-marker { display: none; }
.settings-body { position: absolute; right: 0; top: calc(100% + 6px); background: var(--card, #fff); border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 10px 14px; min-width: 240px; box-shadow: 0 4px 14px rgba(0,0,0,.12); z-index: 30; }
.settings-body label { display: block; margin: 6px 0; font-size: .92rem; }
.settings-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; opacity: .7; margin: 0 0 4px; }

.settings-link { font-size: .9rem; opacity: .75; }


/* --- chapter list background: winning hound poster, bleached --- */
.toc-wrap { position: relative; overflow: hidden; border-radius: 12px; }
.toc-inner { position: relative; z-index: 1; }
.toc-inner h2, .toc-inner ol { background: rgba(255,255,255,0.35); border-radius: 8px; padding-left: 12px; }
.toc-inner li a { position: relative; }

/* --- veracity2-style settings dropdown (standard for all projects) --- */
.settings-btn {
  background: var(--card, #fff); color: var(--foreground, #111);
  border: 1px solid var(--border, #ddd); border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font-size: 0.9rem;
}
.settings-dropdown {
  display: none; position: absolute; z-index: 200;
  right: 0; top: calc(100% + 4px);
  background: var(--card, #fff); border: 1px solid var(--border, #ddd);
  border-radius: 8px; padding: 12px; min-width: 200px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.settings-dropdown.open { display: block; }
.settings-dropdown label {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.85rem; cursor: pointer; padding: 4px 0;
}
.settings-dd-wrap { position: relative; display: inline-block; }

/* --- chapter audio bar --- */
#audio-bar { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto 18px; padding: 10px 14px; background: var(--card, rgba(255,255,255,.06)); border: 1px solid var(--border, rgba(255,255,255,.15)); border-radius: 10px; }
#ab-play { min-width: 44px; }
#ab-track { flex: 1; height: 6px; background: var(--border, rgba(255,255,255,.2)); border-radius: 3px; cursor: pointer; position: relative; }
#ab-progress { height: 100%; width: 0%; background: var(--accent, #c9a227); border-radius: 3px; }
#ab-time { font-size: .8rem; white-space: nowrap; }

/* --- chapter squares (crossings style) --- */
.chapter-squares { display: flex; flex-wrap: wrap; gap: .45rem; margin: .4rem 0 1rem; }
.chapter-squares button {
  width: 2.1rem; height: 2.1rem;
  border-radius: 4px;
  border: 1px solid var(--callout-border, rgba(255,255,255,.25));
  background: transparent;
  color: var(--muted, #999);
  font-family: sans-serif; font-size: .8rem;
  cursor: pointer; padding: 0;
}
.chapter-squares button:hover { border-color: var(--mist, #ccc); color: var(--mist, #ccc); }
.chapter-squares button.current { border-color: var(--accent, #c9a227); color: var(--accent, #c9a227); cursor: default; }

/* ===== LivingBooks new-shelf additions (assemble_site.py) ===== */
.hero h1 { font-weight: normal; font-size: 2rem; margin: 0 0 .5rem; }
.shelf-tools { display: flex; gap: 1rem; align-items: center; margin: 0 0 1rem; }
.shelf-tools input[type=search] {
  flex: 1; max-width: 22rem; padding: .5rem .7rem; border-radius: 4px;
  border: 1px solid var(--callout-border); background: var(--callout-bg); color: var(--ink);
  font-family: var(--serif); font-size: .95rem;
}
.shelf-tools #shelf-count { color: var(--muted); font-size: .85rem; }
.book-card[hidden], #shelf-none[hidden], .btn[hidden], #bb-audio-note[hidden], #bb-audio[hidden] { display: none; }
.book-card .badge.audio { color: var(--mist); border-color: var(--mist); margin-left: .4rem; }
.shelf-empty { color: var(--muted); font-style: italic; padding: 1rem 0 3rem; grid-column: 1 / -1; }
.meta-line { color: var(--muted); font-size: .85rem; margin: .6rem 0 0; }
.credit { color: var(--muted); font-size: .8rem; max-width: 36rem; margin: .8rem auto 0; }
.toc a .done { margin-left: auto; }
.navsub { margin-left: 1rem; }
.btn { display: inline-block; text-decoration: none; }

/* chapter audio bar (own ids; independent of the Classics bar) */
#bb-audio {
  display: flex; align-items: center; gap: .7rem; width: 100%; max-width: 640px;
  padding: .55rem .8rem; margin-top: .6rem;
  background: var(--callout-bg); border: 1px solid var(--callout-border);
  border-left: 3px solid var(--mist); border-radius: 4px;
}
#bb-play {
  flex: none; width: 2.1rem; height: 2.1rem; border-radius: 50%;
  border: 1px solid var(--mist); background: transparent; color: var(--mist);
  font-size: .72rem; cursor: pointer; line-height: 1;
}
#bb-play:hover { background: rgba(127,168,184,.15); }
#bb-track { flex: 1; height: 8px; border-radius: 4px; background: rgba(255,255,255,.18); cursor: pointer; position: relative; overflow: hidden; }
#bb-fill { height: 100%; width: 0%; background: #d8b64a; border-radius: 4px; }
#bb-time { flex: none; font-size: .72rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#bb-audio-note { color: var(--muted); font-size: .8rem; font-style: italic; margin: .6rem 0 0; }

/* reader settings (t710u) */
.bb-settings{display:flex;flex-wrap:wrap;gap:.5em 1.5em;align-items:center;margin:.6em 0;font-size:.9em}
.bb-settings label{display:flex;gap:.4em;align-items:center}
.bb-lang-note{flex-basis:100%;margin:0;font-style:italic;opacity:.8}
.bb-biblical{margin:2em 0;padding:1em 1.2em;border-left:3px solid currentColor;opacity:.95}
.bb-biblical h2{font-size:1.1em;margin:0 0 .5em}
.bb-biblical .attribution{font-size:.85em;opacity:.8}
