/* Reading tracker widget. Tokens from _shared/embed.css. */

.rd {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.4em;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0 4%;
  font-size: clamp(10px, min(3.8vw, 7vh), 19px);
}

.rd-title {
  overflow: hidden;
  font-size: 0.85em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rd-head {
  display: flex;
  align-items: baseline;
  gap: 0.35em;
  min-width: 0;
}

.rd-big {
  flex: none;
  font-size: 2.2em;
  line-height: 1;
}

.rd-of {
  overflow: hidden;
  font-size: 0.95em;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Current book: the title is the headline, the page count beside it wraps under. */
.rd--pages .rd-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1em;
}

.rd--pages .rd-big {
  max-width: 100%;
  overflow: hidden;
  font-size: 1.35em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

:root[data-style="paper"] .rd--pages .rd-big {
  font-style: italic;
}

.rd-track {
  height: 0.55em;
  overflow: hidden;
  border-radius: 999px;
  background: var(--track);
}

.rd-fill {
  width: calc(var(--p, 0) * 100%);
  height: 100%;
  border-radius: inherit;
  background: var(--fill);
  transition: width 0.4s ease;
}

.rd-detail {
  font-size: 0.8em;
  font-weight: 600;
}

.rd.is-done .rd-detail {
  color: var(--accent);
}

.rd-controls {
  display: flex;
  align-items: center;
  gap: 0.4em;
}

.rd-controls .px-btn {
  font-size: 0.85em;
}

.rd-page {
  width: 4.6em;
  min-height: 2em;
  padding: 0.2em 0.4em;
  border: 1px solid var(--card-line);
  border-radius: 0.5em;
  background: var(--card-bg);
  color: var(--fg);
  font: inherit;
  font-size: 0.85em;
  text-align: center;
}

.rd-page:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.rd-note {
  font-size: 0.65em;
}

@media (max-height: 120px) {
  .rd-detail {
    display: none;
  }
}
