/* Books atlas refinements — July 2026 */

:root {
  --insight-1: #405cf5;
  --insight-2: #7c5ce7;
  --insight-3: #0f9f9a;
  --insight-4: #e58a3a;
  --insight-5: #d5578a;
  --insight-6: #98a1b3;
}

.books-insight-series-0 { background: var(--insight-1); }
.books-insight-series-1 { background: var(--insight-2); }
.books-insight-series-2 { background: var(--insight-3); }
.books-insight-series-3 { background: var(--insight-4); }
.books-insight-series-4 { background: var(--insight-5); }
.books-insight-series-5 { background: var(--insight-6); }

/* World remains the focal point: no secondary growth chart or duplicate cover gallery. */
.books-atlas-growth,
.books-country-books { display: none !important; }

.books-country-insights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin: 0 0 12px;
  padding: 11px 0 12px;
  border-top: 1px solid var(--atlas-border);
  border-bottom: 1px solid var(--atlas-border);
}

.books-country-insights > div {
  min-width: 0;
  padding: 8px 9px;
  border-radius: 10px;
  background: rgba(244, 246, 255, 0.82);
}

.books-country-insights span {
  display: block;
  color: var(--atlas-muted);
  font-size: 0.64rem;
  font-weight: 700;
}

.books-country-insights strong {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--atlas-ink);
  font-size: 0.82rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.books-timeline-insights {
  margin-bottom: 20px;
  padding: clamp(14px, 2vw, 20px);
  border: 1px solid var(--atlas-border);
  border-radius: 20px;
  background: rgba(248, 250, 255, 0.76);
}

.books-insight-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 14px;
}

.books-insight-section-heading--compact { margin-bottom: 10px; }
.books-insight-section-heading--distribution { margin-top: 18px; }

.books-insight-section-heading h3,
.books-base-timeline-heading h3,
.books-donut-card-heading h4 {
  margin: 0;
  color: var(--atlas-ink);
  line-height: 1.25;
}

.books-insight-section-heading h3,
.books-base-timeline-heading h3 { font-size: 1.04rem; }
.books-donut-card-heading h4 { font-size: 0.92rem; }

.books-insight-section-heading p:not(.books-insight-kicker),
.books-donut-card-heading p {
  max-width: 68ch;
  margin: 5px 0 0;
  color: var(--atlas-muted);
  font-size: 0.75rem;
  line-height: 1.45;
}

.books-insight-kicker {
  margin: 0 0 3px;
  color: var(--atlas-accent-dark);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.books-donut-grid {
  display: grid;
  gap: 12px;
}

.books-donut-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.books-donut-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.books-donut-card {
  min-width: 0;
  padding: 13px;
  border: 1px solid rgba(226, 230, 238, 0.96);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.books-donut-layout {
  display: grid;
  grid-template-columns: minmax(104px, 0.72fr) minmax(0, 1.28fr);
  gap: 13px;
  align-items: center;
  margin-top: 12px;
}

.books-donut {
  display: grid;
  width: min(132px, 100%);
  aspect-ratio: 1;
  place-items: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--donut-fill);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
}

.books-donut-center {
  display: grid;
  width: 58%;
  aspect-ratio: 1;
  place-content: center;
  border: 1px solid rgba(226, 230, 238, 0.9);
  border-radius: 50%;
  background: #fff;
  text-align: center;
}

.books-donut-center strong {
  color: var(--atlas-ink);
  font-size: 1.02rem;
  line-height: 1;
}

.books-donut-center span {
  margin-top: 3px;
  color: var(--atlas-muted);
  font-size: 0.62rem;
}

.books-donut-legend {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.books-donut-legend li {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto auto;
  gap: 5px;
  align-items: center;
  min-width: 0;
  color: var(--atlas-muted);
  font-size: 0.67rem;
}

.books-donut-legend i,
.books-age-profile-legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 3px;
}

.books-donut-legend span {
  overflow: hidden;
  color: var(--atlas-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.books-donut-legend strong { color: var(--atlas-ink); }
.books-donut-legend small { min-width: 25px; text-align: right; }
.books-donut-empty { margin: 30px 0; color: var(--atlas-muted); font-size: 0.76rem; text-align: center; }

.books-age-profile-panel {
  padding: 14px;
  border: 1px solid rgba(226, 230, 238, 0.96);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.books-age-profile-track {
  display: flex;
  width: 100%;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8ebf2;
}

.books-age-profile-track span {
  min-width: 2px;
  height: 100%;
  border-right: 2px solid rgba(255, 255, 255, 0.8);
}

.books-age-profile-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-top: 10px;
  color: var(--atlas-muted);
  font-size: 0.68rem;
}

.books-age-profile-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.books-age-profile-legend strong { color: var(--atlas-ink); }

.books-reading-calendar-panel,
.books-period-detail {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--atlas-border);
}

.books-reading-calendar {
  overflow-x: auto;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.books-reading-calendar-header,
.books-reading-calendar-row {
  display: grid;
  min-width: 650px;
  grid-template-columns: 58px repeat(12, minmax(34px, 1fr));
  gap: 5px;
  align-items: center;
}

.books-reading-calendar-header { margin-bottom: 5px; }
.books-reading-calendar-row + .books-reading-calendar-row { margin-top: 5px; }

.books-reading-calendar-header b {
  color: var(--atlas-muted);
  font-size: 0.62rem;
  font-weight: 700;
  text-align: center;
}

.books-reading-calendar-row > button {
  min-height: 32px;
  border: 1px solid var(--atlas-border);
  border-radius: 9px;
  background: #fff;
  color: var(--atlas-ink);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 800;
  cursor: pointer;
}

.books-reading-calendar-row[data-active="true"] > button {
  border-color: var(--atlas-accent);
  background: var(--atlas-accent);
  color: #fff;
}

.books-reading-calendar-cell {
  display: grid;
  min-height: 32px;
  place-items: center;
  border: 1px solid rgba(64, 92, 245, 0.08);
  border-radius: 8px;
  background: #edf0f6;
}

.books-reading-calendar-cell[data-level="1"] { background: #dce2ff; }
.books-reading-calendar-cell[data-level="2"] { background: #bdc9ff; }
.books-reading-calendar-cell[data-level="3"] { background: #93a5ff; }
.books-reading-calendar-cell[data-level="4"] { background: #687ff8; color: #fff; }
.books-reading-calendar-cell[data-level="5"] { background: var(--atlas-accent); color: #fff; }

.books-reading-calendar-cell i {
  font-style: normal;
  font-size: 0.62rem;
  font-weight: 800;
}

.books-period-heatstrip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 7px;
}

.books-period-bucket {
  display: grid;
  min-height: 70px;
  place-content: center;
  padding: 8px;
  border: 1px solid rgba(64, 92, 245, 0.09);
  border-radius: 12px;
  background: #edf0f6;
  text-align: center;
}

.books-period-bucket[data-level="1"] { background: #e1e6ff; }
.books-period-bucket[data-level="2"] { background: #c7d1ff; }
.books-period-bucket[data-level="3"] { background: #a5b4ff; }
.books-period-bucket[data-level="4"] { background: #788df9; color: #fff; }
.books-period-bucket[data-level="5"] { background: var(--atlas-accent); color: #fff; }
.books-period-bucket strong { font-size: 0.96rem; }
.books-period-bucket span { margin-top: 4px; font-size: 0.64rem; font-weight: 700; }

.books-period-samples {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.books-period-samples a {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.books-period-samples img {
  display: block;
  width: 100%;
  max-width: 104px;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid var(--atlas-border);
  border-radius: 8px;
  background: #eef0f5;
  box-shadow: 0 5px 12px rgba(15, 23, 42, 0.1);
}

.books-period-samples span {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 5px;
  color: var(--atlas-ink);
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.2;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.books-period-samples small {
  display: block;
  margin-top: 3px;
  color: var(--atlas-muted);
  font-size: 0.62rem;
}

.books-base-timeline-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 4px;
}

.books-base-timeline-heading span {
  color: var(--atlas-muted);
  font-size: 0.7rem;
}

@media (max-width: 1150px) {
  .books-donut-grid--three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .books-donut-grid--three .books-donut-card:last-child { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .books-timeline-insights { padding: 12px; border-radius: 16px; }
  .books-donut-grid--three,
  .books-donut-grid--two { grid-template-columns: minmax(0, 1fr); }
  .books-donut-grid--three .books-donut-card:last-child { grid-column: auto; }
  .books-donut-layout { grid-template-columns: 112px minmax(0, 1fr); }
  .books-donut { width: 112px; }
  .books-base-timeline-heading { align-items: flex-start; flex-direction: column; }
  .books-period-samples { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 480px) {
  .books-donut-layout { grid-template-columns: 94px minmax(0, 1fr); gap: 10px; }
  .books-donut { width: 94px; }
  .books-donut-center strong { font-size: 0.88rem; }
  .books-period-samples { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .books-country-insights { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .books-donut,
  .books-reading-calendar-cell,
  .books-period-bucket { transition: none !important; }
}
