/* E-book (views/epub.js): pick articles, make an EPUB for a Kobo. The tabs, rows with a tick box, a
   bar at the bottom with the count and "Create e-book", and the sheet that makes the book. Kindle
   mode's overrides are at the end. */
.ep-intro { margin: 14px 2px 0; line-height: 1.5; }
.ep-tabs { position: sticky; top: calc(var(--safe-t) + 51px); z-index: 25; margin: 0 -16px; padding: 10px 16px; background: var(--glass); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); }
.ep-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 2px 2px; }
.ep-all { flex: none; }

/* a row: the tick box, then the kicker, the title and its date / reading time (the whole row toggles) */
.ep-row { display: flex; gap: 14px; align-items: flex-start; width: 100%; padding: 13px 2px; border-bottom: 1px solid var(--line); text-align: left; color: inherit; }
.ep-row:active { background: var(--surface-2); }
.ep-row > .grow { display: block; }
.ep-row .k { display: block; font-size: 10.5px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--brand); }
.ep-row .h { display: block; font: 700 16.5px/1.3 var(--serif); margin-top: 3px; text-wrap: pretty; }
.ep-row .m { display: block; font-size: 12px; font-weight: 600; color: var(--text-3); margin-top: 5px; }
.ep-box { flex: none; width: 24px; height: 24px; margin-top: 1px; border-radius: 7px; border: 2px solid var(--line-2); display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s; }
.ep-box svg { width: 16px; height: 16px; stroke-width: 3; }
.ep-row.on .ep-box { background: var(--brand); border-color: var(--brand); color: #111; }
[data-theme="light"] .ep-row.on .ep-box { color: #fff; }
.ep-day { margin-top: 22px; }

/* the bar at the bottom: "3 selected" (Clear) and Create e-book */
body.epub-mode #app { padding-bottom: calc(100px + var(--safe-b)); }
.ep-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 10px 16px calc(10px + var(--safe-b)); background: var(--glass); -webkit-backdrop-filter: saturate(1.5) blur(20px); backdrop-filter: saturate(1.5) blur(20px); border-top: 1px solid var(--line); transition: transform .25s; }
.ep-bar .inner { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.ep-count { font-weight: 800; font-size: 15px; }
.ep-clear { padding: 0; margin-top: 2px; font-size: 13px; }
.ep-clear[hidden] { display: none; }
.ep-make { flex: none; }
.ep-spin { animation: spin 1s linear infinite; }
body.kb-open .ep-bar { transform: translateY(120%); }

/* the sheet: options, progress, the finished book */
.ep-sheet .seg button { white-space: normal; height: auto; min-height: 40px; line-height: 1.2; padding: 4px 6px; }
.ep-step { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-weight: 700; font-size: 15px; }
.ep-step svg { width: 20px; height: 20px; color: var(--brand); flex: none; }
.ep-step .bar i, .ep-sheet .bar i { transition: width .3s; }
.ep-file { display: flex; align-items: center; gap: 12px; margin-top: 10px; padding: 12px 14px; border-radius: 16px; background: var(--surface-2); }
.ep-file .ic { width: 44px; height: 44px; border-radius: 13px; background: var(--brand-grad); color: #fff; display: grid; place-items: center; flex: none; }
.ep-file .ic svg { width: 22px; height: 22px; }
.ep-file .ttl { font-weight: 800; font-size: 14.5px; overflow-wrap: anywhere; }
.ep-note { margin-top: 10px; color: var(--text-2); line-height: 1.45; }
.ep-how { margin-top: 14px; line-height: 1.55; }
.ep-how b { color: var(--text); }

@media (min-width: 1000px) {
  .ep-tabs { margin: 0 calc(-1 * var(--nx-gut)); padding: 10px var(--nx-gut); }
  .ep-tabs > .seg { max-width: 480px; margin: 0 auto; }
  .ep-intro, .ep-list { max-width: 760px; margin-left: auto; margin-right: auto; }
  .ep-bar { left: 50%; right: auto; bottom: max(16px, var(--safe-b)); transform: translateX(-50%); width: 620px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 22px; box-shadow: var(--shadow); }
  body.kb-open .ep-bar { transform: translate(-50%, 160%); }
}

/* ---------- Kindle mode: ink on paper, no colour (css/kindle.css has the rest) ---------- */
html[data-kindle] .ep-tabs { background: var(--k-paper); }
html[data-kindle] .ep-row { border-bottom-color: var(--k-rule); }
html[data-kindle] .ep-row .k { color: var(--k-ink-2); }
html[data-kindle] .ep-row .m { color: var(--k-ink-2); }
html[data-kindle] .ep-box { border: 1.5px solid var(--k-ink); border-radius: 4px; background: var(--k-paper); color: transparent; }
html[data-kindle] .ep-row.on .ep-box { background: var(--k-invert-bg); border-color: var(--k-invert-bg); color: var(--k-invert-fg); }
/* pressed: the row turns to ink, as the app's other rows do (kindle.css), its tick box with it */
html[data-kindle] .ep-row:active { background: var(--k-invert-bg); color: var(--k-invert-fg); }
html[data-kindle] .ep-row:active :is(.k, .m, .h) { color: inherit; }
html[data-kindle] .ep-row:active .ep-box { border-color: var(--k-invert-fg); }
html[data-kindle] .ep-day { color: var(--k-ink); }
html[data-kindle] .ep-day::after { background: var(--k-ink); }
html[data-kindle] .ep-bar { background: var(--k-paper); border-top: 1px solid var(--k-rule-2); box-shadow: none; }
html[data-kindle] .ep-clear { color: var(--k-ink); text-decoration: underline; text-underline-offset: 3px; }
/* the busy loader turns in steps, like the app's spinners (it is k-motion: kindle.css leaves it moving) */
html[data-kindle] .ep-spin { animation: spin 1s steps(8, end) infinite; }
html[data-kindle] .ep-step svg { color: var(--k-ink); }
html[data-kindle] .ep-file { background: var(--k-paper); border: 1px solid var(--k-rule-2); border-radius: 10px; }
html[data-kindle] .ep-file .ic { background: var(--k-invert-bg); color: var(--k-invert-fg); border-radius: 8px; }
html[data-kindle] :is(.ep-note, .ep-how) { color: var(--k-ink-2); }
html[data-kindle] .ep-how b { color: var(--k-ink); }
@media (min-width: 1000px) { html[data-kindle] .ep-bar { border: 1px solid var(--k-ink); border-radius: 10px; } }
