/* Mix reader: optional tools, with the chapter art kept in focus.
   Loaded after kitsune-reader.css. All colours follow reader theme tokens. */
.kr .kr-bar, .kr .kr-hud {
  background: var(--kr-surface);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.kr .kr-progress { height: 2px; }
.kr .kr-progress i { box-shadow: none; }
.kr .kr-thumbs-toggle {
  gap: .45rem;
  min-width: 5.25rem;
  padding-inline: .5rem;
  border: 1px solid var(--kr-line-strong);
  border-radius: var(--radius-pill);
}
.kr .kr-thumbs-toggle[aria-expanded="true"] {
  background: var(--kr-hover);
  border-color: var(--kr-accent);
}
.kr .kr-thumbs-toggle > .kr-ico { color: var(--kr-fg-3); }
.kr-thumbs {
  padding: .5rem .5rem .875rem;
  border-bottom: 1px solid var(--kr-line);
  margin-bottom: .25rem;
}
.kr-thumbs[hidden], .kr-caption[hidden], .kr-thumb-preview img[hidden] { display: none; }
.kr-thumbs-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .625rem; }
.kr-thumbs-head h2 { margin: 0; color: var(--kr-fg); font-size: 1rem; font-weight: 600; line-height: 1.5; }
.kr-thumbs-head p { margin: .125rem 0 0; color: var(--kr-fg-3); font-size: .8125rem; line-height: 1.5; }
.kr-thumbs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.25rem, 1fr));
  gap: .5rem;
  max-height: min(45vh, 20rem);
  max-height: min(45dvh, 20rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: .1875rem;
}
.kr-thumb {
  display: flex; flex-direction: column; gap: .25rem; align-items: stretch;
  padding: .25rem;
  border: 1px solid var(--kr-line-strong);
  border-radius: .5rem;
  color: var(--kr-fg-2);
  background: var(--kr-raised);
  font: inherit; cursor: pointer;
}
.kr-thumb:hover { background: var(--kr-hover); color: var(--kr-fg); }
.kr-thumb[aria-current="page"] { border-color: var(--kr-accent); color: var(--kr-accent-text); box-shadow: 0 0 0 1px var(--kr-accent); }
.kr-thumb-preview { display: block; aspect-ratio: 2 / 3; overflow: hidden; border-radius: .25rem; background: var(--kr-ph); }
.kr-thumb-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.kr-thumb-label { padding-block: .125rem; font-size: .8125rem; font-weight: 500; line-height: 1.5; }
.kr-caption {
  width: min(100%, var(--kr-w));
  margin: 0;
  padding: .875rem clamp(1rem, 3vw, 1.75rem) 1rem;
  border-bottom: 1px solid var(--kr-line);
  background: var(--kr-surface);
  color: var(--kr-fg-2);
  font-size: .9375rem;
  line-height: 1.8;
  overflow-wrap: anywhere;
  cursor: text;
  user-select: text;
}
/* Reserve a full visible HUD row even when the chrome is temporarily hidden.
   Subtract the same space from the image so the caption stays above the HUD. */
.kr[data-mode="paged"][data-captions="on"] { --kr-caption-clearance: calc(6rem + env(safe-area-inset-bottom)); }
.kr[data-mode="paged"][data-captions="on"] .kr-pages { padding-bottom: var(--kr-caption-clearance); }
.kr[data-mode="paged"][data-captions="on"] .kr-page.is-current {
  height: calc(100vh - var(--kr-top) - var(--kr-bar-h) - 8rem - var(--kr-caption-clearance));
  height: calc(100dvh - var(--kr-top) - var(--kr-bar-h) - 8rem - var(--kr-caption-clearance));
  min-height: 12rem;
}
.kr[data-mode="paged"] .kr-caption { width: min(100%, 44rem); border-bottom: 0; }
@media (min-width: 48rem) {
  .kr .kr-hud { width: min(34rem, calc(100% - 2rem)); }
  .kr-thumbs { padding: .625rem .75rem 1rem; }
  .kr-thumbs-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; }
  .kr[data-mode="paged"][data-captions="on"] .kr-page.is-current {
    height: calc(100vh - var(--kr-top) - var(--kr-bar-h) - 6rem - var(--kr-caption-clearance));
    height: calc(100dvh - var(--kr-top) - var(--kr-bar-h) - 6rem - var(--kr-caption-clearance));
  }
}
@media print { .kr-thumbs { display: none !important; } }
