/* ═══════════════════════════════════════════════════════════════
   book-v5.css: THE BOOK DESIGN (Publisher v5, owner approved).

   One stylesheet draws a chapter in the editor (/publish), in the
   editor's preview, in the admin review and in the reader
   (/read/:slug), so what the writer sees is what readers get.
   Modelled on the owner's "The Pledge of the Spirit"
   (publications/pledge-of-the-spirit/book.css).

   Stored chapter HTML carries only semantic tags and four classes
   (bk-dropcap, bk-center, grv, bk-fig; see lib/publishing.js). The
   kicker ("Chapter 3"), title, fading rule and the part page come
   from the chapter's own fields, rendered by /js/book-v5.js.

   Themes: night (default, deep blue) and paper (gold-white with
   deep-blue ink). Blue #060c2e and gold #f5a623 and their tints only.
   ═══════════════════════════════════════════════════════════════ */
.bk {
    --bk-ink: #f0f2ff;
    --bk-ink2: #b8c4e8;
    --bk-head: #fff8e8;
    --bk-head2: #ffe2a8;
    --bk-acc: #f5a623;
    --bk-mute: #7a8ec0;
    --bk-edge: rgba(122, 142, 192, 0.18);
    --bk-bg: transparent;
    --bk-display: 'Sora', sans-serif;
    --bk-body: 'Plus Jakarta Sans', sans-serif;
    --bk-size: 17px;
    container: bk / inline-size;
    background: var(--bk-bg);
    color: var(--bk-ink);
    font: 400 var(--bk-size) / 1.82 var(--bk-body);
    -webkit-font-smoothing: antialiased;
    overflow-wrap: break-word;
    text-align: left;
}
.bk.paper {
    --bk-ink: #142057;
    --bk-ink2: #2c3a7a;
    --bk-head: #060c2e;
    --bk-head2: #0f1d5a;
    --bk-acc: #b9780c;
    --bk-mute: #5a6aa0;
    --bk-edge: rgba(6, 12, 46, 0.12);
    --bk-bg: #fffaf0;
}
.bk *,
.bk *::before,
.bk *::after {
    box-sizing: border-box;
}
.bk-in {
    padding: 34px 22px 60px;
}
@container bk (min-width: 640px) {
    .bk-in {
        padding: 64px 48px 90px;
    }
}
.bk-in > *,
.bk-body > * {
    max-width: 34em;
    margin-left: auto;
    margin-right: auto;
}

/* opening of the book (above its first page in the reader) */
.bk-open {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    margin-bottom: 2.4em !important;
    padding-bottom: 1.6em;
    border-bottom: 1px solid var(--bk-edge);
}
.bk-open img {
    width: 92px;
    aspect-ratio: 2 / 3;
    object-fit: cover;
    border-radius: 10px;
    flex: none;
    box-shadow: 0 10px 30px rgba(2, 6, 30, 0.45);
}
.bk-open .t {
    font: 800 1.45em/1.15 var(--bk-display);
    color: var(--bk-head);
    margin: 0;
}
.bk-open .s {
    margin: 6px 0 0;
    font: 500 0.92em/1.4 var(--bk-display);
    color: var(--bk-head2);
}
.bk-open .a {
    margin: 10px 0 0;
    font: 700 0.72em/1 var(--bk-display);
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--bk-acc);
}

/* chapter head: kicker, title, fading rule */
.bk-head {
    margin-bottom: 1.7em;
}
.bk-kicker {
    margin: 0;
    font: 700 11px/1 var(--bk-display);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--bk-acc);
}
.bk-title {
    margin: 12px 0 0;
    font: 800 30px/1.14 var(--bk-display);
    letter-spacing: -0.012em;
    color: var(--bk-head);
    outline: none;
}
@container bk (min-width: 640px) {
    .bk-title {
        font-size: 38px;
    }
}
.bk-rule {
    width: 168px;
    height: 2px;
    margin-top: 20px;
    background: linear-gradient(90deg, var(--bk-acc), rgba(245, 166, 35, 0));
}

/* the text */
.bk-body {
    outline: none;
}
.bk-body p {
    margin: 0 auto 1.05em;
}
.bk-body h2 {
    margin: 1.7em auto 0.5em;
    font: 800 1.42em/1.22 var(--bk-display);
    color: var(--bk-head);
    letter-spacing: -0.01em;
}
.bk-body h3 {
    margin: 1.8em auto 0.5em;
    font: 700 1.12em/1.32 var(--bk-display);
    color: var(--bk-head2);
}
.bk-body h4 {
    margin: 1.5em auto 0.4em;
    font: 700 1em/1.35 var(--bk-display);
    color: var(--bk-head2);
}
.bk-body strong,
.bk-body b {
    font-weight: 700;
    color: var(--bk-head);
}
.bk-body em,
.bk-body i {
    font-style: italic;
    color: var(--bk-head2);
}
.bk-body a {
    color: var(--bk-acc);
    text-decoration: none;
    border-bottom: 1px solid rgba(245, 166, 35, 0.5);
}
.bk-body ul,
.bk-body ol {
    padding-left: 1.3em;
    margin-bottom: 1.05em;
}
.bk-body li {
    margin-bottom: 0.35em;
}
.bk-body li > p {
    margin: 0;
}
.bk-body li::marker {
    color: var(--bk-acc);
    font-weight: 700;
}
.bk-body .bk-center {
    text-align: center;
}
.bk-body p.bk-dropcap::first-letter {
    float: left;
    margin: 0.08em 0.12em 0 0;
    font: 800 3.45em/0.8 var(--bk-display);
    color: var(--bk-acc);
}
.bk-body hr {
    border: 0;
    height: 1px;
    max-width: 14em;
    margin: 2.2em auto;
    background: linear-gradient(90deg, rgba(245, 166, 35, 0), var(--bk-acc), rgba(245, 166, 35, 0));
}
.bk-body blockquote:not(.grv) {
    margin: 1.5em auto;
    padding: 2px 0 2px 18px;
    border-left: 2px solid var(--bk-acc);
    font-style: italic;
    color: var(--bk-ink2);
}
.bk-body blockquote:not(.grv) p:last-child {
    margin-bottom: 0;
}

/* the GRV verse plate: centred, between gold rules that fade at the edges */
.bk-body blockquote.grv {
    position: relative;
    margin: 1.9em auto;
    padding: 20px 10px 18px;
    text-align: center;
}
.bk-body blockquote.grv::before,
.bk-body blockquote.grv::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, rgba(245, 166, 35, 0), var(--bk-acc), rgba(245, 166, 35, 0));
}
.bk-body blockquote.grv::before {
    top: 0;
}
.bk-body blockquote.grv::after {
    bottom: 0;
}
.bk-body blockquote.grv p {
    margin: 0;
    font: italic 500 1.03em/1.72 var(--bk-body);
    color: var(--bk-head);
}
.bk-body blockquote.grv sup {
    font: 700 0.6em var(--bk-display);
    font-style: normal;
    color: var(--bk-acc);
    margin: 0 0.22em 0 0.4em;
}
.bk-body blockquote.grv p sup:first-child {
    margin-left: 0;
}
.bk-body blockquote.grv cite {
    display: block;
    margin-top: 12px;
    font: 800 11px/1.3 var(--bk-display);
    letter-spacing: 0.16em;
    text-transform: uppercase;
    font-style: normal;
    color: var(--bk-acc);
}
.bk-body blockquote.grv cite a {
    color: inherit;
    border-bottom: 1px solid rgba(245, 166, 35, 0.5);
}

/* figures */
.bk-body figure.bk-fig {
    margin: 1.8em auto;
}
.bk-body figure.bk-fig img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 16px;
}
.bk-body figure.bk-fig figcaption {
    margin-top: 9px;
    text-align: center;
    font: 500 13px/1.5 var(--bk-body);
    color: var(--bk-mute);
    outline: none;
}
.bk-body img {
    max-width: 100%;
    height: auto;
}

/* a "Part One · …" line in a chapter imported before part pages existed */
.bk-body p.bk-legacy-part {
    margin-bottom: 1.4em;
    font: 700 11px/1.4 var(--bk-display);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--bk-acc);
}
.bk-body p.bk-legacy-part strong {
    color: inherit;
    font-weight: inherit;
}

/* part page */
.bk-part {
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 30px 0;
}
.bk-part .bk-kicker {
    letter-spacing: 0.34em;
}
.bk-part .bk-title {
    font-size: 38px;
    margin-top: 14px;
}
@container bk (min-width: 640px) {
    .bk-part .bk-title {
        font-size: 48px;
    }
}
.bk-part .bk-rule {
    width: 220px;
    margin: 24px auto 0;
    background: linear-gradient(90deg, rgba(245, 166, 35, 0), var(--bk-acc), rgba(245, 166, 35, 0));
}
.bk-part .bk-epi {
    margin: 26px auto 0;
    max-width: 26em;
    font: italic 500 15px/1.7 var(--bk-body);
    color: var(--bk-ink2);
    outline: none;
}
.bk-end {
    margin-top: 2.6em !important;
    text-align: center;
    font: 700 10.5px var(--bk-display);
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--bk-mute);
}
.bk-end::before {
    content: '\2726';
    display: block;
    margin-bottom: 10px;
    color: var(--bk-acc);
    font-size: 14px;
    letter-spacing: 0;
}

/* ── editor marks (only inside the Publisher) ── */
.bk.ed .ProseMirror {
    outline: none;
    min-height: 40vh;
}
.bk.ed .ProseMirror p.is-editor-empty:first-child::before {
    content: attr(data-placeholder);
    float: left;
    height: 0;
    pointer-events: none;
    color: var(--bk-mute);
}
.bk.ed .bk-title:empty::before,
.bk.ed .bk-epi:empty::before {
    content: attr(data-ph);
    color: var(--bk-mute);
}
.bk.ed .bk-body blockquote.grv,
.bk.ed .bk-body figure.bk-fig img {
    cursor: pointer;
}
.bk.ed .bk-body blockquote.grv {
    border-radius: 14px;
    transition: background 0.15s;
}
.bk.ed .bk-body blockquote.grv:hover {
    background: rgba(245, 166, 35, 0.05);
}
.bk.ed .bk-body .ProseMirror-selectednode,
.bk.ed .bk-body blockquote.grv.ProseMirror-selectednode,
.bk.ed .bk-body figure.bk-fig.is-sel {
    background: rgba(22, 39, 122, 0.35);
    box-shadow: 0 0 0 1px rgba(245, 166, 35, 0.55);
    border-radius: 14px;
    outline: none;
}
.bk.paper.ed .bk-body .ProseMirror-selectednode {
    background: rgba(245, 166, 35, 0.08);
}
.bk.ed .bk-body figure.bk-fig figcaption:empty::before {
    content: 'Add a caption';
    color: var(--bk-mute);
}
.bk.ed ::selection {
    background: rgba(245, 166, 35, 0.32);
}
