/* The Book */

body { --bk-mono: ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, 'Liberation Mono', 'DejaVu Sans Mono', monospace; }

.bk-main { max-width: 760px; }

/* ------------------------------------------------------------ toolbar */

.bk-bar {
  position: sticky;
  top: 10px;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 12px;
  padding: 10px 12px 10px 18px;
  margin: 0 0 14px;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 20px;
  /* the second shadow fills the rounded top corners, so page edges don't peek through */
  box-shadow: 0 4px 0 var(--ink), 0 -14px 0 4px var(--bg);
}
/* hide pages sliding through the gap above the stuck bar */
.bk-bar::before {
  content: '';
  position: absolute;
  left: -14px;
  right: -14px;
  top: -14px;
  height: 12px;
  background: var(--bg);
}

.bk-where {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  flex-wrap: wrap;
}
.bk-word { font: 600 1.05rem/1 var(--font-display); color: var(--muted); }
.bk-num {
  font: 700 1.3rem/1.15 var(--font-display);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  border: 0;
  background: none;
  padding: 2px 6px;
  margin: 0 -2px 0 -6px;
  border-radius: 10px;
  cursor: pointer;
}
.bk-num:hover { background: var(--soft); }
.bk-num:focus-visible, .bk-icon:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bk-digits {
  font: 600 .78rem/1 var(--font-display);
  color: var(--muted);
  background: var(--soft);
  border-radius: 99px;
  padding: 5px 9px 6px;
  white-space: nowrap;
  cursor: pointer;
}
.bk-icon {
  width: 32px;
  height: 32px;
  flex: none;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--soft);
  cursor: pointer;
}
.bk-icon:hover { background: var(--line); }

.bk-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.bk-tools .btn { gap: 6px; }

.bk-ico {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.bk-ico .bk-dot { stroke-width: 3.6; }

.bk-found {
  flex-basis: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding-top: 10px;
  border-top: 2px dashed var(--line);
  font-weight: 700;
}
.bk-found-q {
  display: inline-block;
  vertical-align: bottom;
  max-width: 24ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre;
  font: 600 .92em/1.5 var(--bk-mono);
  background: var(--accent);
  border-radius: 6px;
  padding: 0 6px;
}

.bk-found-t { min-width: 0; }
.bk-found-n { font: 700 1rem/1 var(--font-display); font-variant-numeric: tabular-nums; }
.bk-found-note { font-weight: 600; color: var(--muted); font-size: .88rem; }
.bk-found-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-left: auto; }
.bk-found-tools .btn { gap: 6px; }

.bk-fine { font-size: .8rem; line-height: 1.45; max-width: 54ch; margin: 0 auto 22px; }

/* ------------------------------------------------------------ pages */

.bk-book {
  --fs: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
  overflow-anchor: none;
  position: relative;
}

.bk-paper {
  position: relative;
  max-width: 100%;
  padding: 18px 30px 14px;
  background: #fffaf0;
  border: 2px solid var(--ink);
  border-radius: 6px 14px 14px 6px;
  box-shadow: 0 4px 0 var(--ink);
}
/* a little shade along the spine */
.bk-paper::before {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 16px;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, rgba(29, 27, 22, .07), transparent);
  pointer-events: none;
}
.bk-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin: 0 0 12px;
  padding: 0 0 8px;
  border-bottom: 1.5px solid var(--line);
  font: italic 500 .85rem/1.2 var(--font-quote);
  color: var(--muted);
  white-space: nowrap;
}
.bk-text {
  margin: 0;
  width: 40ch;
  font: 400 var(--fs)/1.42 var(--bk-mono);
  font-variant-ligatures: none;
  font-kerning: none;
  letter-spacing: 0;
  white-space: pre;
  overflow: hidden;
  color: var(--ink);
}
.bk-foot {
  margin: 12px 0 0;
  text-align: center;
  font: 600 .85rem/1 var(--font-quote);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.bk-hit {
  color: var(--ink);
  background: var(--accent);
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--accent);
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  animation: bk-glow 1.1s ease 2;
}
.bk-also {
  color: var(--ink);
  background: rgba(255, 210, 63, .38);
  border-radius: 3px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
@keyframes bk-glow { 50% { background: #ffa51f; box-shadow: 0 0 0 3px #ffa51f; } }

.bk-probe { position: absolute !important; left: 0; top: 0; visibility: hidden; pointer-events: none; }

/* ------------------------------------------------------------ modals */

.bk-full {
  font: 500 .9rem/1.5 var(--bk-mono);
  word-break: break-all;
  overflow-wrap: anywhere;
  max-height: 46vh;
  overflow: auto;
  background: var(--soft);
  border-radius: 14px;
  padding: 12px 14px;
  margin: 0 0 16px;
}
.bk-row { display: flex; flex-wrap: wrap; gap: 10px; }

.bk-numin, .bk-q { resize: vertical; min-height: 0; }
.bk-numin { font-family: var(--bk-mono); word-break: break-all; }
.bk-q { font: 500 1rem/1.45 var(--bk-mono); }
.bk-count { margin: -6px 2px 0; text-align: right; color: var(--muted); font-size: .85rem; font-weight: 700; }
.bk-count.over { color: var(--bad); }

.bk-check {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
}
.bk-check:hover { border-color: var(--ink); }
.bk-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 24px;
  height: 24px;
  margin: 0;
  border: 2px solid var(--ink);
  border-radius: 7px;
  background: var(--card);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.bk-check input:checked { background: var(--accent); }
.bk-check input:checked::after {
  content: '';
  width: 6px;
  height: 11px;
  margin-top: -3px;
  border: solid var(--ink);
  border-width: 0 3px 3px 0;
  transform: rotate(45deg);
}
.bk-check input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.bk-check b { display: block; font: 600 1rem/1.3 var(--font-display); }
.bk-check small { display: block; color: var(--muted); font-size: .85rem; line-height: 1.4; margin-top: 2px; }

.bk-jumps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 18px; }
.bk-jumps .muted { flex-basis: 100%; font-size: .92rem; }
.bk-jumps sup { font-size: .7em; line-height: 0; }
.bk-modal-fine { font-size: .78rem; text-align: left; margin: 14px 0 0 !important; }

/* ------------------------------------------------------------ small screens */

@media (max-width: 560px) {
  .bk-bar { top: 8px; padding: 8px 10px 10px 14px; border-radius: 16px; gap: 8px; }
  .bk-tools { width: 100%; gap: 6px; flex-wrap: nowrap; }
  .bk-tools .btn { flex: 1 1 0; padding-left: 6px; padding-right: 6px; min-width: 0; }
  .bk-lbl { display: none; }
  .bk-found-tools { width: 100%; margin-left: 0; }
  .bk-num { font-size: 1.2rem; }
  .bk-paper { padding: 12px 12px 10px; border-radius: 4px 10px 10px 4px; }
  .bk-paper::before { width: 10px; }
  .bk-head { margin-bottom: 8px; padding-bottom: 6px; font-size: .78rem; }
  .bk-foot { margin-top: 8px; font-size: .78rem; }
  .bk-book { gap: 20px; }
}

/* ------------------------------------------------------------ dark mode (see the end of assets/css/style.css) */
html[data-dark] .bk-paper { background: var(--card); }
html[data-dark] :is(.bk-found-q, .bk-hit) { color: #1d1b16; }
