/* Bibel-Reader – eigenständig und als Sidebar (embed) nutzbar */
:root {
  --bg: #faf7f1;
  --bg-elev: #ffffff;
  --fg: #2b2620;
  --fg-muted: #6f675d;
  --line: #e6dfd3;
  --accent: #8a5a2b;
  --accent-soft: #f2e6d6;
  --hl: #fff2b8;
  --hl-border: #e6c25a;
  --radius: 10px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --font-text: "Noto Serif", "Source Serif 4", Georgia, "Times New Roman", serif;
  --text-size: 1.05rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --bg-elev: #25221e;
    --fg: #e9e2d6;
    --fg-muted: #a89e90;
    --line: #3a352e;
    --accent: #d9a86c;
    --accent-soft: #3a2f22;
    --hl: #4a3f1c;
    --hl-border: #b3902f;
  }
}
html[data-theme="dark"] {
  --bg: #1c1a17; --bg-elev: #25221e; --fg: #e9e2d6; --fg-muted: #a89e90; --line: #3a352e;
  --accent: #d9a86c; --accent-soft: #3a2f22; --hl: #4a3f1c; --hl-border: #b3902f;
}
html[data-theme="light"] {
  --bg: #faf7f1; --bg-elev: #ffffff; --fg: #2b2620; --fg-muted: #6f675d; --line: #e6dfd3;
  --accent: #8a5a2b; --accent-soft: #f2e6d6; --hl: #fff2b8; --hl-border: #e6c25a;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: .6rem;
  padding: .55rem .9rem;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--fg); }
.brand:hover { text-decoration: none; color: var(--accent); }
.picker { display: flex; gap: .35rem; }
.picker select, .search input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: .4rem .55rem;
}
.picker select { max-width: 11rem; }
#chapterSelect { width: 4.6rem; }
.search { display: flex; flex: 1 1 14rem; min-width: 12rem; }
.search input { flex: 1; border-radius: 8px 0 0 8px; min-width: 0; }
.search button {
  border: 1px solid var(--line); border-left: 0; border-radius: 0 8px 8px 0;
  background: var(--accent-soft); color: var(--accent); padding: 0 .7rem; cursor: pointer;
  display: inline-flex; align-items: center;
}
.tools { display: flex; gap: .25rem; }
.iconbtn {
  border: 1px solid var(--line); background: var(--bg); border-radius: 8px;
  padding: .3rem .5rem; cursor: pointer; color: var(--fg-muted); font-size: .85rem;
  display: inline-flex; align-items: center; gap: .3rem;
}
.iconbtn:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }

/* ---------- Inhalt ---------- */
.main { flex: 1; outline: none; }
.content { max-width: 46rem; margin: 0 auto; padding: 1.2rem 1.2rem 5rem; }

.hint { color: var(--fg-muted); text-align: center; padding: 2rem 0; }

.section-title {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--fg-muted); margin: 1.4rem 0 .5rem; font-weight: 600;
}
.bookgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: .4rem; }
.bookgrid a {
  display: flex; justify-content: space-between; align-items: baseline; gap: .4rem;
  padding: .5rem .7rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px;
  color: var(--fg);
}
.bookgrid a:hover { border-color: var(--accent); text-decoration: none; color: var(--accent); }
.bookgrid a small { color: var(--fg-muted); font-variant-numeric: tabular-nums; }

.chapgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(3rem, 1fr)); gap: .35rem; }
.chapgrid a {
  text-align: center; padding: .55rem 0; background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 8px; color: var(--fg); font-variant-numeric: tabular-nums;
}
.chapgrid a:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }

h1.book-title { font-family: var(--font-text); font-weight: 600; font-size: 1.7rem; margin: .4rem 0 1rem; }
h1.book-title small { display: block; font-family: var(--font-ui); font-size: .85rem; color: var(--fg-muted); font-weight: 400; }

/* Kapiteltext */
.chapter { font-family: var(--font-text); font-size: var(--text-size); line-height: 1.7; }
.chapter + .chapter { margin-top: 2.2rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.chapter h2 {
  font-size: 1.6rem; font-weight: 600; margin: .2rem 0 .9rem; letter-spacing: -.01em;
}
.chapter h2 a { color: inherit; }
.chapter .sup { font-style: italic; color: var(--fg-muted); font-size: .92em; margin: 0 0 .8rem; }
.chapter .sect { font-family: var(--font-ui); font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); margin: 1.4rem 0 .5rem; font-weight: 600; }
.chapter p.prose { margin: 0 0 .9rem; text-align: left; hyphens: auto; }
.chapter .poem { margin: 0 0 .5rem; padding-left: 1.6rem; }
.chapter .poem .line { display: block; text-indent: -1.6rem; padding-left: 0; }
.chapter .poem .line + .line { padding-left: 1.2rem; text-indent: -1.6rem; }

.v { scroll-margin-top: 5.5rem; border-radius: 4px; transition: background .25s; }
.vn {
  font-family: var(--font-ui); font-size: .7em; font-weight: 700; color: var(--accent);
  vertical-align: super; line-height: 0; margin-right: .15em; cursor: pointer; user-select: none;
}
.vn:hover { text-decoration: underline; }
.v.hl { background: var(--hl); box-shadow: 0 0 0 3px var(--hl); }
.poem .v.hl { display: inline-block; }
.v .br { display: block; height: .35em; }

.fn { cursor: help; color: var(--accent); font-family: var(--font-ui); font-size: .75em; vertical-align: super; line-height: 0; padding: 0 .1em; }
.fn-note {
  display: block; font-family: var(--font-ui); font-size: .8rem; color: var(--fg-muted);
  background: var(--accent-soft); border-left: 3px solid var(--accent); padding: .3rem .6rem; margin: .3rem 0 .5rem; border-radius: 0 6px 6px 0;
}
.omitted { color: var(--fg-muted); }

/* Kapitel-Navigation */
.chapnav {
  position: sticky; bottom: 0; display: flex; justify-content: space-between; gap: .5rem;
  padding: .5rem .9rem; background: var(--bg-elev); border-top: 1px solid var(--line);
}
.navbtn { padding: .35rem .7rem; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); background: var(--bg); }
.navbtn:hover { border-color: var(--accent); color: var(--accent); text-decoration: none; }
.navbtn[aria-disabled="true"] { opacity: .35; pointer-events: none; }

/* Suche */
.results-head { color: var(--fg-muted); margin: .4rem 0 1rem; display: flex; justify-content: space-between; flex-wrap: wrap; gap: .5rem; }
.result { padding: .6rem .8rem; background: var(--bg-elev); border: 1px solid var(--line); border-radius: 8px; margin-bottom: .5rem; }
.result a.ref { font-weight: 600; }
.result .txt { font-family: var(--font-text); margin-top: .2rem; }
.result mark { background: var(--hl); color: inherit; padding: 0 .1em; border-radius: 3px; }
.result-book { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--fg-muted); margin: 1.2rem 0 .4rem; font-weight: 600; }
.progress { height: 3px; background: var(--accent-soft); border-radius: 2px; overflow: hidden; margin: .8rem 0; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- Embed-Modus (Sidebar) ---------- */
body.embed { font-size: 14px; }
body.embed .topbar { padding: .4rem .6rem; gap: .4rem; }
body.embed .brand span { display: none; }
body.embed .picker select { max-width: 8.5rem; padding: .3rem .4rem; }
body.embed .search { flex-basis: 100%; order: 5; }
body.embed .content { padding: .9rem .9rem 4rem; }
body.embed .chapter { font-size: calc(var(--text-size) * .93); }
body.embed h1.book-title { font-size: 1.3rem; }

@media (max-width: 560px) {
  .search { flex-basis: 100%; order: 5; }
  .content { padding: 1rem .9rem 5rem; }
}
