/* Final public Books calendar refinements. */

/* The original collection stays hidden while Calendar is active. */
body.books-calendar-open #grid {
  display: none !important;
}

/* Give covers breathing room instead of letting them sit on the cell edge. */
.books-calendar-day-covers.is-single {
  inset: 36px 8px 14px !important;
}

.books-calendar-day-covers.is-single .books-calendar-cover {
  height: calc(100% - 12px) !important;
  max-height: 140px !important;
  align-self: center;
}

.books-calendar-day-covers.is-stack {
  bottom: 34px !important;
}

/* The preview already states the finish date above the title. */
.books-calendar-preview dl,
.books-calendar-book-sheet dl {
  grid-template-columns: 72px minmax(0, 1fr) !important;
}

.books-calendar-preview dd,
.books-calendar-book-sheet dd {
  overflow: visible !important;
  text-overflow: clip !important;
  white-space: normal !important;
  overflow-wrap: anywhere;
}

.books-calendar-preview-author,
.books-calendar-book-sheet .books-calendar-preview-author {
  text-transform: none;
}

/* More distinct, color-blind-friendly listening bands. */
.books-calendar-activity-legend i[data-level="zero"],
.books-calendar-activity-strip[data-level="zero"] {
  background: #d7dce5 !important;
}

.books-calendar-activity-legend i[data-level="low"],
.books-calendar-activity-strip[data-level="low"] {
  background: #6ee7b7 !important;
}

.books-calendar-activity-legend i[data-level="medium"],
.books-calendar-activity-strip[data-level="medium"] {
  background: #38bdf8 !important;
}

.books-calendar-activity-legend i[data-level="high"],
.books-calendar-activity-strip[data-level="high"] {
  background: #8b5cf6 !important;
}

.books-calendar-activity-legend i[data-level="very-high"],
.books-calendar-activity-strip[data-level="very-high"] {
  background: #f59e0b !important;
}

.books-calendar-mobile-activity-day[data-level="zero"] {
  background: #d7dce5 !important;
  color: #394150 !important;
}

.books-calendar-mobile-activity-day[data-level="low"] {
  background: #6ee7b7 !important;
  color: #123c31 !important;
}

.books-calendar-mobile-activity-day[data-level="medium"] {
  background: #38bdf8 !important;
  color: #082f49 !important;
}

.books-calendar-mobile-activity-day[data-level="high"] {
  background: #8b5cf6 !important;
  color: #ffffff !important;
}

.books-calendar-mobile-activity-day[data-level="very-high"] {
  background: #f59e0b !important;
  color: #422006 !important;
}

/* Selected-month collection below the desktop calendar. */
.books-calendar-month-books {
  width: min(1600px, calc(100% - clamp(24px, 6vw, 96px)));
  margin: 34px auto 0;
  padding: clamp(16px, 2vw, 24px);
  border: 1px solid rgba(226, 230, 238, 0.98);
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 15px 42px rgba(15, 23, 42, 0.08);
  color: var(--books-calendar-ink, #0e121b);
  color-scheme: light;
}

.books-calendar-month-books-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 15px;
}

.books-calendar-month-books-heading p {
  margin: 0 0 3px;
  color: var(--books-calendar-accent-dark, #263ebd);
  font-size: 0.68rem;
  font-weight: 850;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.books-calendar-month-books-heading h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.5rem);
  line-height: 1.18;
  letter-spacing: -0.02em;
}

.books-calendar-month-books-heading > span {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 1px solid rgba(64, 92, 245, 0.2);
  border-radius: 999px;
  background: var(--books-calendar-accent-soft, #eef1ff);
  color: var(--books-calendar-accent-dark, #263ebd);
  font-size: 0.7rem;
  font-weight: 800;
}

.books-calendar-month-books-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 11px;
}

.books-calendar-month-book {
  display: grid;
  min-width: 0;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  gap: 11px;
  align-items: center;
  padding: 9px;
  border: 1px solid var(--books-calendar-border, #e2e6ee);
  border-radius: 14px;
  background: #ffffff;
  color: inherit;
  text-decoration: none;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.books-calendar-month-book:hover,
.books-calendar-month-book:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(64, 92, 245, 0.36);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.1);
}

.books-calendar-month-book img {
  display: block;
  width: 64px;
  height: 96px;
  object-fit: cover;
  border: 1px solid #d9dde6;
  border-radius: 7px;
  background: #eef0f5;
  box-shadow: 0 5px 13px rgba(15, 23, 42, 0.13);
}

.books-calendar-month-book-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 4px;
}

.books-calendar-month-book-copy strong,
.books-calendar-month-book-copy span,
.books-calendar-month-book-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.books-calendar-month-book-copy strong {
  font-size: 0.87rem;
  line-height: 1.2;
}

.books-calendar-month-book-copy span {
  color: #555d6b;
  font-size: 0.73rem;
  font-weight: 700;
}

.books-calendar-month-book-copy small {
  color: var(--books-calendar-muted, #626a78);
  font-size: 0.67rem;
}

.books-calendar-month-book-arrow {
  color: var(--books-calendar-accent-dark, #263ebd);
  font-size: 0.78rem;
  font-weight: 850;
}

.books-calendar-month-books-empty {
  margin: 0;
  padding: 20px;
  border: 1px dashed var(--books-calendar-border, #e2e6ee);
  border-radius: 14px;
  color: var(--books-calendar-muted, #626a78);
  font-size: 0.82rem;
  text-align: center;
}

.books-calendar-month-books-empty[hidden] {
  display: none;
}

@media (max-width: 1250px) and (min-width: 761px) {
  .books-calendar-month-books-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 940px) and (min-width: 761px) {
  .books-calendar-month-books-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .books-calendar-month-books {
    display: none;
  }

  .books-calendar-preview dl,
  .books-calendar-book-sheet dl {
    grid-template-columns: 76px minmax(0, 1fr) !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .books-calendar-month-book {
    transition: none !important;
  }
}
