/* Reuses the owner's photographic cat cutout from JMH/JDM4U. */
.scrollcat { display: none !important; }

.ls-reading-cat {
  --reading-progress: 0;
  position: fixed;
  z-index: 65;
  right: max(12px, env(safe-area-inset-right));
  top: 50%;
  width: 86px;
  height: min(52svh, 390px);
  transform: translateY(-50%);
  pointer-events: none;
}
.ls-reading-cat__track {
  position: absolute;
  left: 43px;
  top: 0;
  bottom: 0;
  width: 2px;
  overflow: hidden;
  border-radius: 2px;
  background: rgba(246, 241, 231, .76);
  box-shadow: 0 0 0 1px rgba(22, 25, 22, .12);
}
.ls-reading-cat__fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #9b671b;
  transform: scaleY(var(--reading-progress));
  transform-origin: top;
}
.ls-reading-cat__button {
  position: absolute;
  top: calc(var(--reading-progress) * 100%);
  left: 0;
  width: 86px;
  height: 90px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  transform: translateY(-50%);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}
.ls-reading-cat__button img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: drop-shadow(0 3px 3px rgba(0, 0, 0, .28));
}
.ls-reading-cat__button:focus-visible {
  outline: 3px solid #9b671b;
  outline-offset: 4px;
  background: rgba(255, 253, 248, .88);
}
.ls-reading-cat__remaining {
  position: absolute;
  top: calc(var(--reading-progress) * 100% + 43px);
  right: 8px;
  min-width: 66px;
  padding: 5px 8px;
  border: 1px solid rgba(22, 25, 22, .18);
  border-radius: 999px;
  background: #fffdf8;
  color: #161916;
  text-align: center;
  font: 10px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  white-space: nowrap;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .10);
}
.ls-reading-cat__remaining b { font-weight: 800; }
.nav-open .ls-reading-cat,
body:has(.lightbox.open) .ls-reading-cat { visibility: hidden; }

@media (max-width: 760px) {
  .ls-reading-cat {
    top: auto;
    bottom: calc(10px + env(safe-area-inset-bottom));
    right: calc(12px + env(safe-area-inset-right));
    width: 164px;
    height: 58px;
    border: 1px solid rgba(22, 25, 22, .18);
    border-radius: 18px;
    background: rgba(255, 253, 248, .97);
    box-shadow: 0 3px 14px rgba(0, 0, 0, .14);
    transform: none;
  }
  .ls-reading-cat__button {
    top: -15px;
    left: 4px;
    width: 76px;
    height: 76px;
    transform: none;
  }
  .ls-reading-cat__remaining {
    top: 12px;
    right: 10px;
    min-width: 66px;
    border: 0;
    padding: 2px 0;
    background: transparent;
    box-shadow: none;
    font-size: 11px;
  }
  .ls-reading-cat__track {
    top: 39px;
    bottom: auto;
    left: 88px;
    width: 62px;
    height: 3px;
    background: #e3d8c3;
    box-shadow: none;
  }
  .ls-reading-cat__fill {
    transform: scaleX(var(--reading-progress));
    transform-origin: left;
  }
  /* Keep the final footer links above the fixed control and iPhone home bar. */
  .footer { padding-bottom: calc(100px + env(safe-area-inset-bottom)); }
}

@media (prefers-reduced-motion: reduce) {
  .ls-reading-cat,
  .ls-reading-cat * { animation: none !important; transition: none !important; }
}
