/* MeMori — le Letture nello stile «Ritagli» (28/10/2026, prova in tools/prova-letture): il numero dei libri in
 * lettura in un bollino; ogni libro un grande riquadro di carta con la copertina piatta (dritta) e l'ombra
 * d'inchiostro, la barra senape col segnalibro corallo (si tocca o si trascina), la pagina in una pillola,
 * «+10 · +20 · +50 pagine», «Segna» senape; i numeri in bollini, «Il tuo ritmo» in barrette, il diario in
 * una pillola, le citazioni come ritagli col dorso del colore del libro (--c) e la pagina in un bollino.
 * In fondo «Le tue citazioni» in colonne, con la ricerca, il filtro per libro e «Una a caso». Vale solo
 * dentro #reading-view (barra, diario e citazioni si usano anche nella pagina del libro, libro.css).
 * Caratteri e colori: ritagli.css. Animazioni: motion.css (D1, D3, D12) e motion.js («Letture»). */

#reading-view {
  position: relative;
  font-family: var(--rt-body);
  color: var(--rt-ink);
}

#reading-view > :not(.le-blobs) {
  position: relative;
  z-index: 1;
}

#reading-view a {
  color: inherit;
  text-decoration: none;
}

#reading-view [hidden] {
  display: none;
}

.le-blobs {
  --le-rise: 200px;
  position: absolute;
  inset: calc(-1 * var(--le-rise)) 0 0 0;
  z-index: 0;
  overflow: clip;
  pointer-events: none;
}

.le-blob {
  position: absolute;
  will-change: translate;
}

.le-blob path,
.le-blob circle {
  fill: currentColor;
}

.le-blob-1 {
  right: -150px;
  top: calc(var(--le-rise) - 150px);
  width: 460px;
  color: var(--rt-blush);
}

.le-blob-2 {
  left: -80px;
  top: calc(var(--le-rise) + 900px);
  width: 240px;
  color: var(--rt-sage);
}

/* --- Testa ---------------------------------------------------------------------------------- */
.le-head {
  display: flex;
  align-items: flex-end;
  gap: 1rem;
  margin-bottom: 0.4rem;
}

#reading-view h1 {
  margin: 0;
  font: 800 clamp(2.3rem, 5vw, 3.6rem) / 0.9 var(--rt-display);
  letter-spacing: -0.045em;
  text-transform: none;
}

.le-count {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 56px;
  height: 56px;
  margin-bottom: 0.2rem;
  padding: 0 0.6rem;
  border-radius: 55% 45% 50% 50% / 50% 55% 45% 50%;
  background: var(--rt-coral);
  color: #161616;
  font: 800 1.25rem var(--rt-display);
  box-shadow: 3px 3px 0 var(--rt-ink);
  rotate: -6deg;
}

.le-lede {
  margin: 0 0 1.6rem;
  color: var(--muted);
}

.le-lede b {
  color: var(--rt-ink);
}

/* --- Un libro in lettura -------------------------------------------------------------------- */
.le-book {
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr;
  gap: 0.4rem 2rem;
  margin-bottom: 2rem;
  padding: 1.6rem;
  border-radius: 34px 28px 36px 30px;
  background: var(--rt-paper);
}

.le-cv {
  grid-row: 1 / span 3;
  align-self: start;
  container-type: inline-size;
}

#reading-view .le-cv .book-cover {
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  box-shadow: 8px 8px 0 var(--rt-ink);
}

.le-top,
.le-progress,
.le-more {
  grid-column: 2;
  min-width: 0;
}

.le-top h2 {
  margin: 0;
  font: 800 2rem/1 var(--rt-display);
  letter-spacing: -0.03em;
  text-transform: none;
  overflow-wrap: anywhere;
}

.le-top h2 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--rt-accent);
  text-underline-offset: 4px;
}

.le-by {
  margin: 0.3rem 0 0.7rem;
  color: var(--muted);
}

/* La barra: senape fino a dove sei, il segnalibro corallo; sopra la pagina in una pillola. */
#reading-view .page-form {
  display: flex;
  flex-direction: column;
}

#reading-view .page-slider {
  order: 2;
  height: 18px;
  margin: 0.8rem 0 0.7rem;
  padding: 0;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rt-accent) var(--share), var(--rt-bg) var(--share));
  box-shadow: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#reading-view .page-slider::-webkit-slider-runnable-track {
  height: 100%;
  border: 0;
  background: none;
}

#reading-view .page-slider::-moz-range-track {
  height: 100%;
  border: 0;
  background: none;
}

#reading-view .page-slider::-moz-range-progress {
  background: none;
}

#reading-view .page-slider::-webkit-slider-thumb {
  width: 22px;
  height: 34px;
  margin-top: -10px;
  border: 0;
  border-radius: 0;
  background: var(--rt-coral);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
  -webkit-appearance: none;
  appearance: none;
}

#reading-view .page-slider::-moz-range-thumb {
  width: 22px;
  height: 34px;
  border: 0;
  border-radius: 0;
  background: var(--rt-coral);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%);
}

#reading-view .page-slider:focus-visible {
  outline: 3px solid var(--rt-accent);
  outline-offset: 4px;
  border-radius: 999px;
}

#reading-view .progress {
  order: 2;
  height: 16px;
  margin: 0.3rem 0;
  border: 2px dashed var(--rt-ink);
  border-radius: 999px;
  background: none;
}

#reading-view .page-row {
  order: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem 1rem;
}

#reading-view .progress-label {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.35rem 0.85rem;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  background: var(--rt-bg);
  color: var(--rt-ink);
  font: 600 0.9rem var(--rt-body);
  letter-spacing: 0;
  text-transform: none;
}

#reading-view .page-number {
  width: 4.5ch;
  padding: 0;
  border: 0;
  background: none;
  color: var(--rt-ink);
  font: 800 1.35rem var(--rt-display);
  text-align: right;
  -moz-appearance: textfield;
}

#reading-view .page-number:focus-visible {
  outline: 2px solid var(--rt-accent);
  outline-offset: 2px;
}

#reading-view .page-percent {
  color: var(--muted);
  font-weight: 600;
}

#reading-view .page-form .btn {
  margin-left: auto;
  padding: 0.7rem 1.3rem;
  border: 0;
  border-radius: 22px 28px 24px 26px;
  background: var(--rt-accent);
  color: var(--rt-accent-ink);
  font: 800 1rem var(--rt-display);
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 4px 4px 0 var(--rt-ink);
}

#reading-view .page-form .btn:disabled {
  opacity: 0.45;
  box-shadow: none;
}

/* «+10 · +20 · +50 pagine»: pillole tratteggiate. */
.page-quick {
  order: 3;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.page-quick button {
  padding: 0.3rem 0.75rem;
  border: 2px dashed var(--rt-ink);
  border-radius: 999px;
  background: none;
  color: var(--rt-ink);
  font: 700 0.8rem var(--rt-body);
  cursor: pointer;
}

.page-quick button:hover {
  border-style: solid;
  background: var(--rt-bg);
}

.page-quick button:focus-visible {
  outline: 3px solid var(--rt-accent);
  outline-offset: 2px;
}

/* Ultima pagina: la striscia salvia. */
.le-done {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.8rem 1.2rem;
  margin: 1rem 0 0;
  padding: 0.9rem 1.1rem;
  border-radius: 22px;
  background: #c3cbb0;
  color: #161616;
  font-weight: 700;
}

.le-done button {
  padding: 0.55rem 1.1rem;
  border: 0;
  border-radius: 999px;
  background: #161616;
  color: #fffaf1;
  font: 800 0.9rem var(--rt-body);
  cursor: pointer;
}

.le-done button:focus-visible {
  outline: 3px solid #161616;
  outline-offset: 2px;
}

/* I numeri della lettura in bollini: il valore sopra, la spiegazione sotto. */
.le-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  margin: 1.2rem 0 0;
}

.le-facts div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: flex-end;
  min-width: 0;
  padding: 0.65rem 0.85rem;
  border-radius: 18px 22px 20px 16px;
  background: var(--rt-bg);
}

.le-facts dd {
  margin: 0;
  font: 800 1.15rem/1.1 var(--rt-display);
  overflow-wrap: anywhere;
}

.le-facts dt {
  color: var(--muted);
  font-size: 0.72rem;
}

/* Il tuo ritmo: le barrette dei giorni, oggi in senape. */
.le-rhythm {
  margin-top: 1.2rem;
}

#reading-view .le-more h3 {
  margin: 0 0 0.5rem;
  font: 800 1rem var(--rt-display);
  letter-spacing: 0;
  text-transform: none;
}

.le-bars {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  height: 70px;
  padding-bottom: 2px;
  border-bottom: 2px solid var(--rt-ink);
}

.le-bars i {
  flex: 1;
  height: var(--h);
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  background: #c3cbb0;
}

.le-bars i.is-today {
  background: var(--rt-accent);
}

.le-bars i:hover {
  background: var(--rt-coral);
}

.le-barlab {
  display: flex;
  justify-content: space-between;
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.7rem;
}

/* Il diario: chiuso in una pillola. */
#reading-view .reading-diary {
  margin-top: 1rem;
}

#reading-view .reading-diary summary {
  display: inline-flex;
  padding: 0.35rem 0.85rem;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  font: 800 0.85rem var(--rt-display);
  letter-spacing: 0;
  text-transform: none;
  list-style: none;
}

#reading-view .reading-diary summary::-webkit-details-marker {
  display: none;
}

#reading-view .reading-diary summary::before {
  content: "";
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  background: currentColor;
  mask: url("icons/ph-book-open.svg") center / contain no-repeat;
  margin-right: 0.4rem;
}

#reading-view .reading-diary ol {
  display: grid;
  gap: 0.3rem;
  margin-top: 0.6rem;
}

#reading-view .reading-diary li {
  align-items: center;
  padding: 0.35rem 0.7rem;
  border: 0;
  border-radius: 12px;
  background: var(--rt-bg);
  font-size: 0.85rem;
}

/* --- Citazioni: ritagli col dorso del colore del libro ------------------------------------- */
.le-quotes {
  margin-top: 1.4rem;
}

.le-quotes-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.le-addq {
  padding: 0.4rem 0.9rem;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  background: none;
  color: var(--rt-ink);
  font: 700 0.82rem var(--rt-body);
  cursor: pointer;
}

.le-addq:hover {
  background: var(--rt-bg);
}

.le-addq:focus-visible,
.le-edit:focus-visible {
  outline: 3px solid var(--rt-accent);
  outline-offset: 2px;
}

.le-qrow {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
  margin-top: 0.5rem;
}

.le-q {
  position: relative;
  margin: 0;
  padding: 0.9rem 1rem 0.8rem 1.4rem;
  border-radius: 6px 20px 18px 6px;
  background: var(--rt-bg);
}

.le-q::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 8px;
  border-radius: 6px 0 0 6px;
  background: var(--c);
}

.le-q blockquote {
  margin: 0;
  font: 600 1rem/1.35 var(--rt-display);
  overflow-wrap: anywhere;
}

.le-q blockquote::before {
  content: "“";
  margin-right: 0.1rem;
  color: var(--rt-coral);
  font-size: 1.4rem;
  line-height: 0;
}

.le-photo {
  display: block;
  width: 100%;
  max-height: 220px;
  margin-bottom: 0.5rem;
  border-radius: 6px;
  object-fit: contain;
  object-position: left;
}

.le-q figcaption {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.5rem;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.le-pg {
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  background: var(--rt-accent);
  color: var(--rt-accent-ink);
  font-weight: 800;
}

.le-note {
  font-style: italic;
}

.le-edit {
  margin-left: auto;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 600 0.78rem var(--rt-body);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.le-of {
  margin: 0.45rem 0 0;
  font-size: 0.78rem;
  font-weight: 700;
}

.le-of span {
  color: var(--muted);
  font-weight: 500;
}

.le-of a:hover {
  text-decoration: underline;
  text-decoration-color: var(--rt-accent);
  text-underline-offset: 3px;
}

.le-q.is-lucky {
  box-shadow: 0 0 0 3px var(--rt-coral), 5px 5px 0 var(--rt-ink);
}

/* --- Le tue citazioni ----------------------------------------------------------------------- */
.le-allq {
  margin-top: 2.6rem;
  padding: 1.4rem;
  border-radius: 30px 24px 34px 26px;
  background: var(--rt-paper);
}

.le-allq h2 {
  margin: 0 0 0.9rem;
  font: 800 1.6rem/1 var(--rt-display);
  letter-spacing: -0.01em;
  text-transform: none;
}

.le-allq h2::after {
  content: "";
  display: block;
  width: 40px;
  height: 6px;
  margin-top: 0.4rem;
  border-radius: 60% 40% 70% 30% / 50% 60% 40% 50%;
  background: var(--rt-accent);
}

.le-qtools {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.8rem;
}

.le-qsearch {
  flex: 1 1 220px;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.9rem;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  background: var(--rt-bg);
}

.le-qsearch:focus-within {
  outline: 3px solid var(--rt-accent);
  outline-offset: 2px;
}

.le-qsearch input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--rt-ink);
  font: 500 0.9rem var(--rt-body);
}

.le-qsearch input:focus {
  outline: none;
}

.le-dice {
  padding: 0.45rem 0.95rem;
  border: 0;
  border-radius: 999px;
  background: var(--rt-accent);
  color: var(--rt-accent-ink);
  font: 800 0.85rem var(--rt-body);
  box-shadow: 3px 3px 0 var(--rt-ink);
  cursor: pointer;
}

.le-dice:focus-visible {
  outline: 3px solid var(--rt-ink);
  outline-offset: 3px;
}

.le-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.le-pills button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border: 2px solid var(--rt-ink);
  border-radius: 999px;
  background: none;
  color: var(--rt-ink);
  font: 600 0.78rem var(--rt-body);
  cursor: pointer;
}

.le-pills button i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--c);
}

.le-pills button[aria-pressed="true"] {
  background: var(--rt-blush);
}

.le-pills button:focus-visible {
  outline: 3px solid var(--rt-accent);
  outline-offset: 2px;
}

.le-masonry {
  columns: 3 240px;
  column-gap: 0.9rem;
}

.le-masonry .le-q {
  break-inside: avoid;
  margin-bottom: 0.9rem;
}

.le-none {
  margin: 0;
  color: var(--muted);
}

/* --- Telefono -------------------------------------------------------------------------------- */
@media (max-width: 760px) {
  .le-book {
    grid-template-columns: 92px minmax(0, 1fr);
    grid-template-rows: auto;
    gap: 1rem;
    padding: 1.1rem;
  }

  .le-cv {
    grid-row: auto;
  }

  #reading-view .le-cv .book-cover {
    box-shadow: 5px 5px 0 var(--rt-ink);
  }

  .le-top h2 {
    font-size: 1.35rem;
  }

  .le-progress,
  .le-more {
    grid-column: 1 / -1;
  }

  #reading-view .page-form .btn {
    margin-left: 0;
  }

  .le-facts {
    gap: 0.4rem;
  }

  .le-facts dd {
    font-size: 0.95rem;
  }

  .le-qrow {
    grid-template-columns: minmax(0, 1fr);
  }

  .le-masonry {
    columns: 1;
  }
}
